Mercurial > vim
comparison runtime/syntax/scheme.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | b9740fb41986 |
children | b37888de599c |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Scheme (R5RS) | 2 " Language: Scheme (R5RS + some R6RS extras) |
3 " Last Change: 2007 Jun 16 | 3 " Last Change: 2009 Nov 27 |
4 " Maintainer: Sergey Khorev <sergey.khorev@gmail.com> | 4 " Maintainer: Sergey Khorev <sergey.khorev@gmail.com> |
5 " Original author: Dirk van Deun <dirk@igwe.vub.ac.be> | 5 " Original author: Dirk van Deun <dirk@igwe.vub.ac.be> |
6 | 6 |
7 " This script incorrectly recognizes some junk input as numerals: | 7 " This script incorrectly recognizes some junk input as numerals: |
8 " parsing the complete system of Scheme numerals using the pattern | 8 " parsing the complete system of Scheme numerals using the pattern |
24 | 24 |
25 syn case ignore | 25 syn case ignore |
26 | 26 |
27 " Fascist highlighting: everything that doesn't fit the rules is an error... | 27 " Fascist highlighting: everything that doesn't fit the rules is an error... |
28 | 28 |
29 syn match schemeError oneline ![^ \t()\[\]";]*! | 29 syn match schemeError ![^ \t()\[\]";]*! |
30 syn match schemeError oneline ")" | 30 syn match schemeError ")" |
31 | 31 |
32 " Quoted and backquoted stuff | 32 " Quoted and backquoted stuff |
33 | 33 |
34 syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc | 34 syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
35 | 35 |
69 | 69 |
70 syn keyword schemeSyntax lambda and or if cond case define let let* letrec | 70 syn keyword schemeSyntax lambda and or if cond case define let let* letrec |
71 syn keyword schemeSyntax begin do delay set! else => | 71 syn keyword schemeSyntax begin do delay set! else => |
72 syn keyword schemeSyntax quote quasiquote unquote unquote-splicing | 72 syn keyword schemeSyntax quote quasiquote unquote unquote-splicing |
73 syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules | 73 syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules |
74 " R6RS | |
75 syn keyword schemeSyntax define-record-type fields protocol | |
74 | 76 |
75 syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car! | 77 syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car! |
76 syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr | 78 syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr |
77 syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr | 79 syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr |
78 syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr | 80 syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr |
107 syn keyword schemeFunc force with-input-from-file with-output-to-file | 109 syn keyword schemeFunc force with-input-from-file with-output-to-file |
108 syn keyword schemeFunc char-ready? load transcript-on transcript-off eval | 110 syn keyword schemeFunc char-ready? load transcript-on transcript-off eval |
109 syn keyword schemeFunc dynamic-wind port? values call-with-values | 111 syn keyword schemeFunc dynamic-wind port? values call-with-values |
110 syn keyword schemeFunc scheme-report-environment null-environment | 112 syn keyword schemeFunc scheme-report-environment null-environment |
111 syn keyword schemeFunc interaction-environment | 113 syn keyword schemeFunc interaction-environment |
114 " R6RS | |
115 syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable | |
116 syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set! | |
117 syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update! | |
118 syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys | |
119 syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function | |
120 syn keyword schemeFunc hashtable-mutable? equal-hash string-hash string-ci-hash symbol-hash | |
121 syn keyword schemeFunc find for-all exists filter partition fold-left fold-right | |
122 syn keyword schemeFunc remp remove remv remq memp assp cons* | |
112 | 123 |
113 " ... so that a single + or -, inside a quoted context, would not be | 124 " ... so that a single + or -, inside a quoted context, would not be |
114 " interpreted as a number (outside such contexts, it's a schemeFunc) | 125 " interpreted as a number (outside such contexts, it's a schemeFunc) |
115 | 126 |
116 syn match schemeDelimiter oneline !\.[ \t\[\]()";]!me=e-1 | 127 syn match schemeDelimiter !\.[ \t\[\]()";]!me=e-1 |
117 syn match schemeDelimiter oneline !\.$! | 128 syn match schemeDelimiter !\.$! |
118 " ... and a single dot is not a number but a delimiter | 129 " ... and a single dot is not a number but a delimiter |
119 | 130 |
120 " This keeps all other stuff unhighlighted, except *stuff* and <stuff>: | 131 " This keeps all other stuff unhighlighted, except *stuff* and <stuff>: |
121 | 132 |
122 syn match schemeOther oneline ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*, | 133 syn match schemeOther ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*, |
123 syn match schemeError oneline ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, | 134 syn match schemeError ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
124 | 135 |
125 syn match schemeOther oneline "\.\.\." | 136 syn match schemeOther "\.\.\." |
126 syn match schemeError oneline !\.\.\.[^ \t\[\]()";]\+! | 137 syn match schemeError !\.\.\.[^ \t\[\]()";]\+! |
127 " ... a special identifier | 138 " ... a special identifier |
128 | 139 |
129 syn match schemeConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[ \t\[\]()";],me=e-1 | 140 syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*[ \t\[\]()";],me=e-1 |
130 syn match schemeConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*$, | 141 syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*$, |
131 syn match schemeError oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, | 142 syn match schemeError ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
132 | 143 |
133 syn match schemeConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1 | 144 syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1 |
134 syn match schemeConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$, | 145 syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$, |
135 syn match schemeError oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, | 146 syn match schemeError ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
136 | 147 |
137 " Non-quoted lists, and strings: | 148 " Non-quoted lists, and strings: |
138 | 149 |
139 syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL | 150 syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL |
140 syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL | 151 syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL |
151 | 162 |
152 | 163 |
153 " Writing out the complete description of Scheme numerals without | 164 " Writing out the complete description of Scheme numerals without |
154 " using variables is a day's work for a trained secretary... | 165 " using variables is a day's work for a trained secretary... |
155 | 166 |
156 syn match schemeOther oneline ![+-][ \t\[\]()";]!me=e-1 | 167 syn match schemeOther ![+-][ \t\[\]()";]!me=e-1 |
157 syn match schemeOther oneline ![+-]$! | 168 syn match schemeOther ![+-]$! |
158 " | 169 " |
159 " This is a useful lax approximation: | 170 " This is a useful lax approximation: |
160 syn match schemeNumber oneline "[-#+0-9.][-#+/0-9a-f@i.boxesfdl]*" | 171 syn match schemeNumber "[-#+.]\=[0-9][-#+/0-9a-f@i.boxesfdl]*" |
161 syn match schemeError oneline ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*! | 172 syn match schemeError ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*! |
162 | 173 |
163 syn match schemeBoolean oneline "#[tf]" | 174 syn match schemeBoolean "#[tf]" |
164 syn match schemeError oneline !#[tf][^ \t\[\]()";]\+! | 175 syn match schemeError !#[tf][^ \t\[\]()";]\+! |
165 | 176 |
166 syn match schemeChar oneline "#\\" | 177 syn match schemeCharacter "#\\" |
167 syn match schemeChar oneline "#\\." | 178 syn match schemeCharacter "#\\." |
168 syn match schemeError oneline !#\\.[^ \t\[\]()";]\+! | 179 syn match schemeError !#\\.[^ \t\[\]()";]\+! |
169 syn match schemeChar oneline "#\\space" | 180 syn match schemeCharacter "#\\space" |
170 syn match schemeError oneline !#\\space[^ \t\[\]()";]\+! | 181 syn match schemeError !#\\space[^ \t\[\]()";]\+! |
171 syn match schemeChar oneline "#\\newline" | 182 syn match schemeCharacter "#\\newline" |
172 syn match schemeError oneline !#\\newline[^ \t\[\]()";]\+! | 183 syn match schemeError !#\\newline[^ \t\[\]()";]\+! |
184 | |
185 " R6RS | |
186 syn match schemeCharacter "#\\x[0-9a-fA-F]\+" | |
187 | |
173 | 188 |
174 if exists("b:is_mzscheme") || exists("is_mzscheme") | 189 if exists("b:is_mzscheme") || exists("is_mzscheme") |
175 " MzScheme extensions | 190 " MzScheme extensions |
176 " multiline comment | 191 " multiline comment |
177 syn region schemeComment start="#|" end="|#" | 192 syn region schemeComment start="#|" end="|#" |
178 | 193 |
179 " #%xxx are the special MzScheme identifiers | 194 " #%xxx are the special MzScheme identifiers |
180 syn match schemeOther oneline "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" | 195 syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
181 " anything limited by |'s is identifier | 196 " anything limited by |'s is identifier |
182 syn match schemeOther oneline "|[^|]\+|" | 197 syn match schemeOther "|[^|]\+|" |
183 | 198 |
184 syn match schemeChar oneline "#\\\%(return\|tab\)" | 199 syn match schemeCharacter "#\\\%(return\|tab\)" |
185 | 200 |
186 " Modules require stmt | 201 " Modules require stmt |
187 syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename | 202 syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename |
188 " modules provide stmt | 203 " modules provide stmt |
189 syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except | 204 syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except |
232 | 247 |
233 if exists("b:is_chicken") || exists("is_chicken") | 248 if exists("b:is_chicken") || exists("is_chicken") |
234 " multiline comment | 249 " multiline comment |
235 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment | 250 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment |
236 | 251 |
237 syn match schemeOther oneline "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" | 252 syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
238 syn match schemeExtSyntax oneline "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" | 253 syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
239 | 254 |
240 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec | 255 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec |
241 syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library | 256 syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library |
242 syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension | 257 syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension |
243 syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record | 258 syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record |
264 syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC | 279 syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC |
265 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC | 280 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC |
266 endif | 281 endif |
267 | 282 |
268 " suggested by Alex Queiroz | 283 " suggested by Alex Queiroz |
269 syn match schemeExtSyntax oneline "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" | 284 syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
270 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ | 285 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ |
271 endif | 286 endif |
272 | 287 |
273 " Synchronization and the wrapping up... | 288 " Synchronization and the wrapping up... |
274 | 289 |
288 | 303 |
289 HiLink schemeSyntax Statement | 304 HiLink schemeSyntax Statement |
290 HiLink schemeFunc Function | 305 HiLink schemeFunc Function |
291 | 306 |
292 HiLink schemeString String | 307 HiLink schemeString String |
293 HiLink schemeChar Character | 308 HiLink schemeCharacter Character |
294 HiLink schemeNumber Number | 309 HiLink schemeNumber Number |
295 HiLink schemeBoolean Boolean | 310 HiLink schemeBoolean Boolean |
296 | 311 |
297 HiLink schemeDelimiter Delimiter | 312 HiLink schemeDelimiter Delimiter |
298 HiLink schemeConstant Constant | 313 HiLink schemeConstant Constant |