3 " Maintainer: Lutz Eymers <ixtab@polzin.com>
4 " URL: http://www.isp.de/data/tf.vim
5 " Email: send syntax_vim.tgz
6 " Last Change: 2001 May 10
8 " Options lite_minlines = x to sync at least x lines backwards
10 " Remove any old syntax stuff hanging around
12 " For version 5.x: Clear all syntax items
13 " For version 6.x: Quit when a syntax file was already loaded
16 elseif exists("b:current_syntax")
22 if !exists("main_syntax")
23 let main_syntax = 'tf'
26 " Special global variables
27 syn keyword tfVar HOME LANG MAIL SHELL TERM TFHELP TFLIBDIR TFLIBRARY TZ contained
28 syn keyword tfVar background backslash contained
29 syn keyword tfVar bamf bg_output borg clearfull cleardone clock connect contained
30 syn keyword tfVar emulation end_color gag gethostbyname gpri hook hilite contained
31 syn keyword tfVar hiliteattr histsize hpri insert isize istrip kecho contained
32 syn keyword tfVar kprefix login lp lpquote maildelay matching max_iter contained
33 syn keyword tfVar max_recur mecho more mprefix oldslash promt_sec contained
34 syn keyword tfVar prompt_usec proxy_host proxy_port ptime qecho qprefix contained
35 syn keyword tfVar quite quitdone redef refreshtime scroll shpause snarf sockmload contained
36 syn keyword tfVar start_color tabsize telopt sub time_format visual contained
37 syn keyword tfVar watch_dog watchname wordpunct wrap wraplog wrapsize contained
38 syn keyword tfVar wrapspace contained
41 syn keyword tfWorld world_name world_character world_password world_host contained
42 syn keyword tfWorld world_port world_mfile world_type contained
45 syn match tfNumber "-\=\<\d\+\>"
48 syn match tfFloat "\(-\=\<\d+\|-\=\)\.\d\+\>"
51 syn match tfOperator "[-+=?:&|!]"
52 syn match tfOperator "/[^*~@]"he=e-1
53 syn match tfOperator ":="
54 syn match tfOperator "[^/%]\*"hs=s+1
55 syn match tfOperator "$\+[([{]"he=e-1,me=e-1
56 syn match tfOperator "\^\[\+"he=s+1 contains=tfSpecialCharEsc
59 syn match tfRelation "&&"
60 syn match tfRelation "||"
61 syn match tfRelation "[<>/!=]="
62 syn match tfRelation "[<>]"
63 syn match tfRelation "[!=]\~"
64 syn match tfRelation "[=!]/"
68 syn match tfReadonly "[#*]" contained
69 syn match tfReadonly "\<-\=L\=\d\{-}\>" contained
70 syn match tfReadonly "\<P\(\d\+\|R\|L\)\>" contained
71 syn match tfReadonly "\<R\>" contained
74 syn match tfIdentifier "%\+[a-zA-Z_#*-0-9]\w*" contains=tfVar,tfReadonly
75 syn match tfIdentifier "%\+[{]"he=e-1,me=e-1
76 syn match tfIdentifier "\$\+{[a-zA-Z_#*-0-9]\w*}" contains=tfWorld
79 syn keyword tfFunctions ascii char columns echo filename ftime fwrite getopts
80 syn keyword tfFunctions getpid idle kbdel kbgoto kbhead kblen kbmatch kbpoint
81 syn keyword tfFunctions kbtail kbwordleft kbwordright keycode lines mod
82 syn keyword tfFunctions moresize pad rand read regmatch send strcat strchr
83 syn keyword tfFunctions strcmp strlen strncmp strrchr strrep strstr substr
84 syn keyword tfFunctions systype time tolower toupper
86 syn keyword tfStatement addworld bamf beep bind break cat changes connect contained
87 syn keyword tfStatement dc def dokey echo edit escape eval export expr fg for contained
88 syn keyword tfStatement gag getfile grab help hilite histsize hook if input contained
89 syn keyword tfStatement kill lcd let list listsockets listworlds load contained
90 syn keyword tfStatement localecho log nohilite not partial paste ps purge contained
91 syn keyword tfStatement purgeworld putfile quit quote recall recordline save contained
92 syn keyword tfStatement saveworld send sh shift sub substitute contained
93 syn keyword tfStatement suspend telnet test time toggle trig trigger unbind contained
94 syn keyword tfStatement undef undefn undeft unhook untrig unworld contained
95 syn keyword tfStatement version watchdog watchname while world contained
98 syn keyword tfHook ACTIVITY BACKGROUND BAMF CONFAIL CONFLICT CONNECT DISCONNECT
99 syn keyword tfHook KILL LOAD LOADFAIL LOG LOGIN MAIL MORE PENDING PENDING
100 syn keyword tfHook PROCESS PROMPT PROXY REDEF RESIZE RESUME SEND SHADOW SHELL
101 syn keyword tfHook SIGHUP SIGTERM SIGUSR1 SIGUSR2 WORLD
104 syn keyword tfConditional if endif then else elseif contained
107 syn keyword tfRepeat while do done repeat for contained
110 syn keyword tfStatement break quit contained
113 syn keyword tfInclude require load save loaded contained
116 syn keyword tfDefine bind unbind def undef undefn undefn purge hook unhook trig untrig contained
117 syn keyword tfDefine set unset setenv contained
120 syn keyword tfTodo TODO Todo todo contained
123 syn match tfSpecialChar "\\[abcfnrtyv\\]" contained
124 syn match tfSpecialChar "\\\d\{3}" contained contains=tfOctalError
125 syn match tfSpecialChar "\\x[0-9a-fA-F]\{2}" contained
126 syn match tfSpecialCharEsc "\[\+" contained
128 syn match tfOctalError "[89]" contained
131 syn region tfComment start="^;" end="$" contains=tfTodo
134 syn region tfString oneline matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=tfIdentifier,tfSpecialChar,tfEscape
135 syn region tfString matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=tfIdentifier,tfSpecialChar,tfEscape
137 syn match tfParentError "[)}\]]"
140 syn region tfParent matchgroup=Delimiter start="(" end=")" contains=ALLBUT,tfReadonly
141 syn region tfParent matchgroup=Delimiter start="\[" end="\]" contains=ALL
142 syn region tfParent matchgroup=Delimiter start="{" end="}" contains=ALL
144 syn match tfEndCommand "%%\{-};"
145 syn match tfJoinLines "\\$"
149 syn match tfType "/[a-zA-Z_~@][a-zA-Z0-9_]*" contains=tfConditional,tfRepeat,tfStatement,tfInclude,tfDefine,tfStatement
152 syn match tfQuotes "/quote .\{-}'" contains=ALLBUT,tfString
154 syn match tfEscape "(/escape .*)"
157 if exists("tf_minlines")
158 exec "syn sync minlines=" . tf_minlines
160 syn sync minlines=100
163 " Define the default highlighting.
164 " For version 5.7 and earlier: only when not done already
165 " For version 5.8 and later: only when an item doesn't have highlighting yet
166 if version >= 508 || !exists("did_tf_syn_inits")
168 let did_tf_syn_inits = 1
169 command -nargs=+ HiLink hi link <args>
171 command -nargs=+ HiLink hi def link <args>
174 HiLink tfComment Comment
175 HiLink tfString String
176 HiLink tfNumber Number
178 HiLink tfIdentifier Identifier
179 HiLink tfVar Identifier
180 HiLink tfWorld Identifier
181 HiLink tfReadonly Identifier
182 HiLink tfHook Identifier
183 HiLink tfFunctions Function
184 HiLink tfRepeat Repeat
185 HiLink tfConditional Conditional
187 HiLink tfStatement Statement
189 HiLink tfInclude Include
190 HiLink tfDefine Define
191 HiLink tfSpecialChar SpecialChar
192 HiLink tfSpecialCharEsc SpecialChar
193 HiLink tfParentError Error
195 HiLink tfEndCommand Delimiter
196 HiLink tfJoinLines Delimiter
197 HiLink tfOperator Operator
198 HiLink tfRelation Operator
203 let b:current_syntax = "tf"
205 if main_syntax == 'tf'