Mercurial > vim
comparison runtime/syntax/tcl.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | 96cd8222a819 |
children | 80e5f9584b02 |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: TCL/TK | 2 " Language: Tcl/Tk |
3 " Maintainer: Brett Cannon <brett@python.org> | 3 " Maintainer: Taylor Venable <taylor@metasyntax.net> |
4 " (previously Brett Cannon <brett@python.org>) | |
4 " (previously Dean Copsey <copsey@cs.ucdavis.edu>) | 5 " (previously Dean Copsey <copsey@cs.ucdavis.edu>) |
5 " (previously Matt Neumann <mattneu@purpleturtle.com>) | 6 " (previously Matt Neumann <mattneu@purpleturtle.com>) |
6 " (previously Allan Kelly <allan@fruitloaf.co.uk>) | 7 " (previously Allan Kelly <allan@fruitloaf.co.uk>) |
7 " Original: Robin Becker <robin@jessikat.demon.co.uk> | 8 " Original: Robin Becker <robin@jessikat.demon.co.uk> |
8 " Last Change: 2006 Nov 17 | 9 " Last Change: 2009/04/06 02:38:36 |
10 " Version: 1.13 | |
11 " URL: http://real.metasyntax.net:2357/cvs/cvsweb.cgi/Config/vim/syntax/tcl.vim | |
9 " | 12 " |
10 " Keywords TODO: format clock click anchor | 13 " Keywords TODO: click anchor |
11 | 14 |
12 " For version 5.x: Clear all syntax items | 15 " For version 5.x: Clear all syntax items |
13 " For version 6.x: Quit when a syntax file was already loaded | 16 " For version 6.x: Quit when a syntax file was already loaded |
14 if version < 600 | 17 if version < 600 |
15 syntax clear | 18 syntax clear |
16 elseif exists("b:current_syntax") | 19 elseif exists("b:current_syntax") |
17 finish | 20 finish |
18 endif | 21 endif |
19 | 22 |
20 " A bunch of useful keywords | 23 " Basic Tcl commands: http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm |
21 syn keyword tclStatement tell socket subst open eof pwd glob list exec pid | 24 syn keyword tclCommand after append apply array bgerror binary catch cd chan clock |
22 syn keyword tclStatement auto_load_index time unknown eval lrange fblocked | 25 syn keyword tclCommand close concat dde dict encoding eof error eval exec exit |
23 syn keyword tclStatement lsearch auto_import gets lappend proc variable llength | 26 syn keyword tclCommand expr fblocked fconfigure fcopy file fileevent filename flush |
24 syn keyword tclStatement auto_execok return linsert error catch clock info | 27 syn keyword tclCommand format gets glob global history incr info interp join |
25 syn keyword tclStatement split array fconfigure concat join lreplace source | 28 syn keyword tclCommand lappend lassign lindex linsert list llength load lrange lrepeat |
26 syn keyword tclStatement fcopy global auto_qualify update close cd auto_load | 29 syn keyword tclCommand lreplace lreverse lsearch lset lsort memory namespace open package |
27 syn keyword tclStatement file append format read package set binary namespace | 30 syn keyword tclCommand pid proc puts pwd read regexp registry regsub rename return |
28 syn keyword tclStatement scan trace seek flush after vwait uplevel lset rename | 31 syn keyword tclCommand scan seek set socket source split string subst tell time |
29 syn keyword tclStatement fileevent regexp upvar unset encoding expr load regsub | 32 syn keyword tclCommand trace unknown unload unset update uplevel upvar variable vwait |
30 syn keyword tclStatement interp exit puts incr lindex lsort tclLog string | 33 |
34 " The 'Tcl Standard Library' commands: http://www.tcl.tk/man/tcl8.5/TclCmd/library.htm | |
35 syn keyword tclCommand auto_execok auto_import auto_load auto_mkindex auto_mkindex_old | |
36 syn keyword tclCommand auto_qualify auto_reset parray tcl_endOfWord tcl_findLibrary | |
37 syn keyword tclCommand tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter | |
38 syn keyword tclCommand tcl_wordBreakBefore | |
39 | |
40 " Commands that were added in Tcl 8.6 | |
41 | |
42 syn keyword tclCommand my oo::copy oo::define oo::objdefine self | |
43 syn keyword tclCommand coroutine tailcall throw yield | |
44 | |
45 " Global variables used by Tcl: http://www.tcl.tk/man/tcl8.5/TclCmd/tclvars.htm | |
46 syn keyword tclVars env errorCode errorInfo tcl_library tcl_patchLevel tcl_pkgPath | |
47 syn keyword tclVars tcl_platform tcl_precision tcl_rcFileName tcl_traceCompile | |
48 syn keyword tclVars tcl_traceExec tcl_wordchars tcl_nonwordchars tcl_version argc argv | |
49 syn keyword tclVars argv0 tcl_interactive geometry | |
50 | |
51 " Strings which expr accepts as boolean values, aside from zero / non-zero. | |
52 syn keyword tclBoolean true false on off yes no | |
53 | |
31 syn keyword tclLabel case default | 54 syn keyword tclLabel case default |
32 syn keyword tclConditional if then else elseif switch | 55 syn keyword tclConditional if then else elseif switch |
56 syn keyword tclConditional try finally | |
33 syn keyword tclRepeat while for foreach break continue | 57 syn keyword tclRepeat while for foreach break continue |
34 syn keyword tcltkSwitch contained insert create polygon fill outline tag | 58 syn keyword tcltkSwitch contained insert create polygon fill outline tag |
35 | 59 |
36 " WIDGETS | 60 " WIDGETS |
37 " commands associated with widgets | 61 " commands associated with widgets |
61 syn keyword tcltkWidgetSwitch contained activerelief elementborderwidth | 85 syn keyword tcltkWidgetSwitch contained activerelief elementborderwidth |
62 " image | 86 " image |
63 syn keyword tcltkWidgetSwitch contained delete names types create | 87 syn keyword tcltkWidgetSwitch contained delete names types create |
64 " variable reference | 88 " variable reference |
65 " ::optional::namespaces | 89 " ::optional::namespaces |
66 syn match tclVarRef "$\(\(::\)\?\([[:alnum:]_.]*::\)*\)\a[a-zA-Z0-9_.]*" | 90 syn match tclVarRef "$\(\(::\)\?\([[:alnum:]_]*::\)*\)\a[[:alnum:]_]*" |
67 " ${...} may contain any character except '}' | 91 " ${...} may contain any character except '}' |
68 syn match tclVarRef "${[^}]*}" | 92 syn match tclVarRef "${[^}]*}" |
93 | |
94 " The syntactic unquote-splicing replacement for [expand]. | |
95 syn match tclExpand '\s{\*}' | |
96 syn match tclExpand '^{\*}' | |
97 | |
69 " menu, mane add | 98 " menu, mane add |
70 syn keyword tcltkWidgetSwitch contained active end last none cascade checkbutton command radiobutton separator | 99 syn keyword tcltkWidgetSwitch contained active end last none cascade checkbutton command radiobutton separator |
71 syn keyword tcltkWidgetSwitch contained activebackground actveforeground accelerator background bitmap columnbreak | 100 syn keyword tcltkWidgetSwitch contained activebackground actveforeground accelerator background bitmap columnbreak |
72 syn keyword tcltkWidgetSwitch contained font foreground hidemargin image indicatoron label menu offvalue onvalue | 101 syn keyword tcltkWidgetSwitch contained font foreground hidemargin image indicatoron label menu offvalue onvalue |
73 syn keyword tcltkWidgetSwitch contained selectcolor selectimage state underline value variable | 102 syn keyword tcltkWidgetSwitch contained selectcolor selectimage state underline value variable |
128 syn keyword tcltkNamespaceSwitch contained parent qualifiers tail which command variable | 157 syn keyword tcltkNamespaceSwitch contained parent qualifiers tail which command variable |
129 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<namespace\>" matchgroup=NONE skip="^\s*$" end="{\|}\|]\|\"\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkNamespaceSwitch | 158 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<namespace\>" matchgroup=NONE skip="^\s*$" end="{\|}\|]\|\"\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkNamespaceSwitch |
130 | 159 |
131 " EXPR | 160 " EXPR |
132 " commands associated with expr | 161 " commands associated with expr |
133 syn keyword tcltkMaths contained acos cos hypot sinh | 162 syn keyword tcltkMaths contained abs acos asin atan atan2 bool ceil cos cosh double entier |
134 syn keyword tcltkMaths contained asin cosh log sqrt | 163 syn keyword tcltkMaths contained exp floor fmod hypot int isqrt log log10 max min pow rand |
135 syn keyword tcltkMaths contained atan exp log10 tan | 164 syn keyword tcltkMaths contained round sin sinh sqrt srand tan tanh wide |
136 syn keyword tcltkMaths contained atan2 floor pow tanh | 165 |
137 syn keyword tcltkMaths contained ceil fmod sin | |
138 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<expr\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf | 166 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<expr\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf |
139 | 167 |
140 " format | 168 " format |
141 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<format\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf | 169 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<format\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf |
142 | 170 |
163 " match from command name to ] or EOL | 191 " match from command name to ] or EOL |
164 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<lsort\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkLsortSwitch,tclNumber,tclVarRef,tclString,tcltkCommand | 192 syn region tcltkCommand matchgroup=tcltkCommandColor start="\<lsort\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkLsortSwitch,tclNumber,tclVarRef,tclString,tcltkCommand |
165 | 193 |
166 syn keyword tclTodo contained TODO | 194 syn keyword tclTodo contained TODO |
167 | 195 |
168 | 196 " Sequences which are backslash-escaped: http://www.tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M16 |
169 " String and Character contstants | 197 " Octal, hexadecimal, unicode codepoints, and the classics. |
170 " Highlight special characters (those which have a backslash) differently | 198 " Tcl takes as many valid characters in a row as it can, so \xAZ in a string is newline followed by 'Z'. |
171 syn match tclSpecial contained "\\\d\d\d\=\|\\." | 199 syn match tclSpecial contained '\\\([0-7]\{1,3}\|x\x\{1,2}\|u\x\{1,4}\|[abfnrtv]\)' |
200 syn match tclSpecial contained '\\[\[\]\{\}\"\$]' | |
201 | |
202 " Command appearing inside another command or inside a string. | |
203 syn region tclEmbeddedStatement start='\[' end='\]' contained contains=tclCommand,tclNumber,tclLineContinue,tclString,tclVarRef,tclEmbeddedStatement | |
172 " A string needs the skip argument as it may legitimately contain \". | 204 " A string needs the skip argument as it may legitimately contain \". |
173 " Match at start of line | 205 " Match at start of line |
174 syn region tclString start=+^"+ end=+"+ contains=tclSpecial skip=+\\\\\|\\"+ | 206 syn region tclString start=+^"+ end=+"+ contains=tclSpecial skip=+\\\\\|\\"+ |
175 "Match all other legal strings. | 207 "Match all other legal strings. |
176 syn region tclString start=+[^\\]"+ms=s+1 end=+"+ contains=tclSpecial skip=+\\\\\|\\"+ | 208 syn region tclString start=+[^\\]"+ms=s+1 end=+"+ contains=tclSpecial,tclVarRef,tclEmbeddedStatement skip=+\\\\\|\\"+ |
177 | 209 |
178 syn match tclLineContinue "\\\s*$" | 210 " Line continuation is backslash immediately followed by newline. |
211 syn match tclLineContinue '\\$' | |
212 | |
213 if exists('g:tcl_warn_continuation') | |
214 syn match tclNotLineContinue '\\\s\+$' | |
215 endif | |
179 | 216 |
180 "integer number, or floating point number without a dot and with "f". | 217 "integer number, or floating point number without a dot and with "f". |
181 syn case ignore | 218 syn case ignore |
182 syn match tclNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" | 219 syn match tclNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" |
183 "floating point number, with dot, optional exponent | 220 "floating point number, with dot, optional exponent |
206 else | 243 else |
207 command -nargs=+ HiLink hi def link <args> | 244 command -nargs=+ HiLink hi def link <args> |
208 endif | 245 endif |
209 | 246 |
210 HiLink tcltkSwitch Special | 247 HiLink tcltkSwitch Special |
248 HiLink tclExpand Special | |
211 HiLink tclLabel Label | 249 HiLink tclLabel Label |
212 HiLink tclConditional Conditional | 250 HiLink tclConditional Conditional |
213 HiLink tclRepeat Repeat | 251 HiLink tclRepeat Repeat |
214 HiLink tclNumber Number | 252 HiLink tclNumber Number |
215 HiLink tclError Error | 253 HiLink tclError Error |
216 HiLink tclStatement Statement | 254 HiLink tclCommand Statement |
217 "HiLink tclStatementColor Statement | |
218 HiLink tclString String | 255 HiLink tclString String |
219 HiLink tclComment Comment | 256 HiLink tclComment Comment |
220 HiLink tclSpecial Special | 257 HiLink tclSpecial Special |
221 HiLink tclTodo Todo | 258 HiLink tclTodo Todo |
222 " Below here are the commands and their options. | 259 " Below here are the commands and their options. |
223 HiLink tcltkCommandColor Statement | 260 HiLink tcltkCommandColor Statement |
224 HiLink tcltkWidgetColor Structure | 261 HiLink tcltkWidgetColor Structure |
225 HiLink tclLineContinue WarningMsg | 262 HiLink tclLineContinue WarningMsg |
263 if exists('g:tcl_warn_continuation') | |
264 HiLink tclNotLineContinue ErrorMsg | |
265 endif | |
226 HiLink tcltkStringSwitch Special | 266 HiLink tcltkStringSwitch Special |
227 HiLink tcltkArraySwitch Special | 267 HiLink tcltkArraySwitch Special |
228 HiLink tcltkLsortSwitch Special | 268 HiLink tcltkLsortSwitch Special |
229 HiLink tcltkPackSwitch Special | 269 HiLink tcltkPackSwitch Special |
230 HiLink tcltkPackConfSwitch Special | 270 HiLink tcltkPackConfSwitch Special |
231 HiLink tcltkMaths Special | 271 HiLink tcltkMaths Special |
232 HiLink tcltkNamespaceSwitch Special | 272 HiLink tcltkNamespaceSwitch Special |
233 HiLink tcltkWidgetSwitch Special | 273 HiLink tcltkWidgetSwitch Special |
234 HiLink tcltkPackConfColor Identifier | 274 HiLink tcltkPackConfColor Identifier |
235 "HiLink tcltkLsort Statement | |
236 HiLink tclVarRef Identifier | 275 HiLink tclVarRef Identifier |
237 | 276 |
238 delcommand HiLink | 277 delcommand HiLink |
239 endif | 278 endif |
240 | 279 |
241 let b:current_syntax = "tcl" | 280 let b:current_syntax = "tcl" |
242 | 281 |
243 " vim: ts=8 | 282 " vim: ts=8 noet |