comparison runtime/syntax/scheme.vim @ 48:67300faee616 v7-3-618

v7-3-618
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 01 Aug 2012 18:08:28 +0900
parents c16898406ff2
children
comparison
equal deleted inserted replaced
47:6c0584ec21b1 48:67300faee616
1 " Vim syntax file 1 " Vim syntax file
2 " Language: Scheme (R5RS + some R6RS extras) 2 " Language: Scheme (R5RS + some R6RS extras)
3 " Last Change: 2009 Nov 27 3 " Last Change: 2012 May 13
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
9 " language is practically impossible: I did a lax approximation. 9 " language is practically impossible: I did a lax approximation.
10 10
11 " MzScheme extensions can be activated with setting is_mzscheme variable 11 " MzScheme extensions can be activated with setting is_mzscheme variable
12 12
13 " Suggestions and bug reports are solicited by the author. 13 " Suggestions and bug reports are solicited by the author.
14 14
15 " Initializing: 15 " Initializing:
19 if version < 600 19 if version < 600
20 syntax clear 20 syntax clear
21 elseif exists("b:current_syntax") 21 elseif exists("b:current_syntax")
22 finish 22 finish
23 endif 23 endif
24
25 let s:cpo_save = &cpo
26 set cpo&vim
24 27
25 syn case ignore 28 syn case ignore
26 29
27 " Fascist highlighting: everything that doesn't fit the rules is an error... 30 " Fascist highlighting: everything that doesn't fit the rules is an error...
28 31
115 syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable 118 syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable
116 syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set! 119 syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set!
117 syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update! 120 syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update!
118 syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys 121 syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys
119 syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function 122 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 123 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 124 syn keyword schemeFunc find for-all exists filter partition fold-left fold-right
122 syn keyword schemeFunc remp remove remv remq memp assp cons* 125 syn keyword schemeFunc remp remove remv remq memp assp cons*
123 126
124 " ... so that a single + or -, inside a quoted context, would not be 127 " ... so that a single + or -, inside a quoted context, would not be
125 " interpreted as a number (outside such contexts, it's a schemeFunc) 128 " interpreted as a number (outside such contexts, it's a schemeFunc)
152 155
153 syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL 156 syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL
154 syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL 157 syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL
155 158
156 " Simple literals: 159 " Simple literals:
157 syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+ 160 syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+ contains=@Spell
158 161
159 " Comments: 162 " Comments:
160 163
161 syn match schemeComment ";.*$" 164 syn match schemeComment ";.*$" contains=@Spell
162 165
163 166
164 " Writing out the complete description of Scheme numerals without 167 " Writing out the complete description of Scheme numerals without
165 " using variables is a day's work for a trained secretary... 168 " using variables is a day's work for a trained secretary...
166 169
187 190
188 191
189 if exists("b:is_mzscheme") || exists("is_mzscheme") 192 if exists("b:is_mzscheme") || exists("is_mzscheme")
190 " MzScheme extensions 193 " MzScheme extensions
191 " multiline comment 194 " multiline comment
192 syn region schemeComment start="#|" end="|#" 195 syn region schemeComment start="#|" end="|#" contains=@Spell
193 196
194 " #%xxx are the special MzScheme identifiers 197 " #%xxx are the special MzScheme identifiers
195 syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" 198 syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
196 " anything limited by |'s is identifier 199 " anything limited by |'s is identifier
197 syn match schemeOther "|[^|]\+|" 200 syn match schemeOther "|[^|]\+|"
205 " Other from MzScheme 208 " Other from MzScheme
206 syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case 209 syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case
207 syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum 210 syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum
208 syn keyword schemeExtSyntax datum->syntax-object 211 syn keyword schemeExtSyntax datum->syntax-object
209 syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0 212 syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0
210 syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature 213 syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature
211 syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export 214 syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export
212 syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax 215 syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax
213 216
214 syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker 217 syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker
215 syn keyword schemeExtFunc use-standard-linker use-standard-compiler 218 syn keyword schemeExtFunc use-standard-linker use-standard-compiler
229 syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch? 232 syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch?
230 syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed? 233 syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed?
231 syn keyword schemeExtFunc exn:i/o:tcp? exn:i/o:udp? exn:misc? exn:misc:application? exn:misc:unsupported? exn:module? exn:read? exn:read:non-char? 234 syn keyword schemeExtFunc exn:i/o:tcp? exn:i/o:udp? exn:misc? exn:misc:application? exn:misc:unsupported? exn:module? exn:read? exn:read:non-char?
232 syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch? 235 syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch?
233 " Command-line parsing 236 " Command-line parsing
234 syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each 237 syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each
235 238
236 " syntax quoting, unquoting and quasiquotation 239 " syntax quoting, unquoting and quasiquotation
237 syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL 240 syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL
238 syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL 241 syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL
239 syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL 242 syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL
245 endif 248 endif
246 249
247 250
248 if exists("b:is_chicken") || exists("is_chicken") 251 if exists("b:is_chicken") || exists("is_chicken")
249 " multiline comment 252 " multiline comment
250 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment 253 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=@Spell,schemeMultilineComment
251 254
252 syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" 255 syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
253 syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" 256 syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
254 257
255 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec 258 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec
260 syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv 263 syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv
261 syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax 264 syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax
262 syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno 265 syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno
263 266
264 " here-string 267 " here-string
265 syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ 268 syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ contains=@Spell
266 269
267 if filereadable(expand("<sfile>:p:h")."/cpp.vim") 270 if filereadable(expand("<sfile>:p:h")."/cpp.vim")
268 unlet! b:current_syntax 271 unlet! b:current_syntax
269 syn include @ChickenC <sfile>:p:h/cpp.vim 272 syn include @ChickenC <sfile>:p:h/cpp.vim
270 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC 273 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC
271 syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC 274 syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC
280 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC 283 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC
281 endif 284 endif
282 285
283 " suggested by Alex Queiroz 286 " suggested by Alex Queiroz
284 syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" 287 syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
285 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ 288 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ contains=@Spell
286 endif 289 endif
287 290
288 " Synchronization and the wrapping up... 291 " Synchronization and the wrapping up...
289 292
290 syn sync match matchPlace grouphere NONE "^[^ \t]" 293 syn sync match matchPlace grouphere NONE "^[^ \t]"
320 HiLink schemeExtFunc PreProc 323 HiLink schemeExtFunc PreProc
321 delcommand HiLink 324 delcommand HiLink
322 endif 325 endif
323 326
324 let b:current_syntax = "scheme" 327 let b:current_syntax = "scheme"
328
329 let &cpo = s:cpo_save
330 unlet s:cpo_save