blob: c59e09cd17c3b18cc3cda485fd830b566849ef32 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaar5c736222010-01-06 20:54:52 +01002" Language: Scheme (R5RS + some R6RS extras)
Bram Moolenaar26852122016-05-24 20:02:38 +02003" Last Change: 2016 May 23
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00004" Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
Bram Moolenaar21cf8232004-07-16 20:18:37 +00005" Original author: Dirk van Deun <dirk@igwe.vub.ac.be>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" This script incorrectly recognizes some junk input as numerals:
8" parsing the complete system of Scheme numerals using the pattern
9" language is practically impossible: I did a lax approximation.
Bram Moolenaar5dc62522012-02-13 00:05:22 +010010
Bram Moolenaar21cf8232004-07-16 20:18:37 +000011" MzScheme extensions can be activated with setting is_mzscheme variable
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13" Suggestions and bug reports are solicited by the author.
14
15" Initializing:
16
17" For version 5.x: Clear all syntax items
18" For version 6.x: Quit when a syntax file was already loaded
19if version < 600
20 syntax clear
21elseif exists("b:current_syntax")
22 finish
23endif
24
Bram Moolenaar5dc62522012-02-13 00:05:22 +010025let s:cpo_save = &cpo
26set cpo&vim
27
Bram Moolenaar071d4272004-06-13 20:20:40 +000028syn case ignore
29
30" Fascist highlighting: everything that doesn't fit the rules is an error...
31
Bram Moolenaar5c736222010-01-06 20:54:52 +010032syn match schemeError ![^ \t()\[\]";]*!
33syn match schemeError ")"
Bram Moolenaar071d4272004-06-13 20:20:40 +000034
35" Quoted and backquoted stuff
36
Bram Moolenaar21cf8232004-07-16 20:18:37 +000037syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
39syn region schemeQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
40syn region schemeQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
41
42syn region schemeStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
43syn region schemeStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
44
Bram Moolenaar21cf8232004-07-16 20:18:37 +000045" Popular Scheme extension:
46" using [] as well as ()
47syn region schemeStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
48syn region schemeStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
Bram Moolenaar21cf8232004-07-16 20:18:37 +000050syn region schemeUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
51syn region schemeUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
52
53syn region schemeUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL
54syn region schemeUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
56syn region schemeUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
57syn region schemeUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
58
Bram Moolenaar21cf8232004-07-16 20:18:37 +000059syn region schemeUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL
60syn region schemeUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL
61
62syn region schemeUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
63syn region schemeUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
64
Bram Moolenaar071d4272004-06-13 20:20:40 +000065" R5RS Scheme Functions and Syntax:
66
67if version < 600
68 set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
69else
70 setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
71endif
72
73syn keyword schemeSyntax lambda and or if cond case define let let* letrec
74syn keyword schemeSyntax begin do delay set! else =>
75syn keyword schemeSyntax quote quasiquote unquote unquote-splicing
76syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules
Bram Moolenaar5c736222010-01-06 20:54:52 +010077" R6RS
78syn keyword schemeSyntax define-record-type fields protocol
Bram Moolenaar071d4272004-06-13 20:20:40 +000079
80syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car!
81syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr
82syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr
83syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr
84syn keyword schemeFunc cddaar cddadr cdddar cddddr null? list? list length
85syn keyword schemeFunc append reverse list-ref memq memv member assq assv assoc
86syn keyword schemeFunc symbol? symbol->string string->symbol number? complex?
87syn keyword schemeFunc real? rational? integer? exact? inexact? = < > <= >=
88syn keyword schemeFunc zero? positive? negative? odd? even? max min + * - / abs
89syn keyword schemeFunc quotient remainder modulo gcd lcm numerator denominator
90syn keyword schemeFunc floor ceiling truncate round rationalize exp log sin cos
91syn keyword schemeFunc tan asin acos atan sqrt expt make-rectangular make-polar
92syn keyword schemeFunc real-part imag-part magnitude angle exact->inexact
93syn keyword schemeFunc inexact->exact number->string string->number char=?
94syn keyword schemeFunc char-ci=? char<? char-ci<? char>? char-ci>? char<=?
95syn keyword schemeFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char?
96syn keyword schemeFunc char-numeric? char-whitespace? char-upper-case?
97syn keyword schemeFunc char-lower-case?
98syn keyword schemeFunc char->integer integer->char char-upcase char-downcase
99syn keyword schemeFunc string? make-string string string-length string-ref
100syn keyword schemeFunc string-set! string=? string-ci=? string<? string-ci<?
101syn keyword schemeFunc string>? string-ci>? string<=? string-ci<=? string>=?
102syn keyword schemeFunc string-ci>=? substring string-append vector? make-vector
103syn keyword schemeFunc vector vector-length vector-ref vector-set! procedure?
104syn keyword schemeFunc apply map for-each call-with-current-continuation
105syn keyword schemeFunc call-with-input-file call-with-output-file input-port?
106syn keyword schemeFunc output-port? current-input-port current-output-port
107syn keyword schemeFunc open-input-file open-output-file close-input-port
108syn keyword schemeFunc close-output-port eof-object? read read-char peek-char
109syn keyword schemeFunc write display newline write-char call/cc
110syn keyword schemeFunc list-tail string->list list->string string-copy
111syn keyword schemeFunc string-fill! vector->list list->vector vector-fill!
112syn keyword schemeFunc force with-input-from-file with-output-to-file
113syn keyword schemeFunc char-ready? load transcript-on transcript-off eval
114syn keyword schemeFunc dynamic-wind port? values call-with-values
115syn keyword schemeFunc scheme-report-environment null-environment
116syn keyword schemeFunc interaction-environment
Bram Moolenaar5c736222010-01-06 20:54:52 +0100117" R6RS
118syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable
119syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set!
120syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update!
121syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys
122syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100123syn keyword schemeFunc hashtable-mutable? equal-hash string-hash string-ci-hash symbol-hash
Bram Moolenaar5c736222010-01-06 20:54:52 +0100124syn keyword schemeFunc find for-all exists filter partition fold-left fold-right
125syn keyword schemeFunc remp remove remv remq memp assp cons*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127" ... so that a single + or -, inside a quoted context, would not be
128" interpreted as a number (outside such contexts, it's a schemeFunc)
129
Bram Moolenaar5c736222010-01-06 20:54:52 +0100130syn match schemeDelimiter !\.[ \t\[\]()";]!me=e-1
131syn match schemeDelimiter !\.$!
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132" ... and a single dot is not a number but a delimiter
133
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134" This keeps all other stuff unhighlighted, except *stuff* and <stuff>:
135
Bram Moolenaar5c736222010-01-06 20:54:52 +0100136syn match schemeOther ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*,
137syn match schemeError ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138
Bram Moolenaar5c736222010-01-06 20:54:52 +0100139syn match schemeOther "\.\.\."
140syn match schemeError !\.\.\.[^ \t\[\]()";]\+!
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141" ... a special identifier
142
Bram Moolenaar5c736222010-01-06 20:54:52 +0100143syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*[ \t\[\]()";],me=e-1
144syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*$,
145syn match schemeError ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000146
Bram Moolenaar5c736222010-01-06 20:54:52 +0100147syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1
148syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$,
149syn match schemeError ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000150
151" Non-quoted lists, and strings:
152
153syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL
154syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL
155
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000156syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL
157syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL
158
159" Simple literals:
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200160syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+ contains=@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161
162" Comments:
163
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200164syn match schemeComment ";.*$" contains=@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000166
167" Writing out the complete description of Scheme numerals without
168" using variables is a day's work for a trained secretary...
169
Bram Moolenaar5c736222010-01-06 20:54:52 +0100170syn match schemeOther ![+-][ \t\[\]()";]!me=e-1
171syn match schemeOther ![+-]$!
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000172"
173" This is a useful lax approximation:
Bram Moolenaar5c736222010-01-06 20:54:52 +0100174syn match schemeNumber "[-#+.]\=[0-9][-#+/0-9a-f@i.boxesfdl]*"
175syn match schemeError ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*!
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000176
Bram Moolenaar5c736222010-01-06 20:54:52 +0100177syn match schemeBoolean "#[tf]"
178syn match schemeError !#[tf][^ \t\[\]()";]\+!
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000179
Bram Moolenaar5c736222010-01-06 20:54:52 +0100180syn match schemeCharacter "#\\"
181syn match schemeCharacter "#\\."
182syn match schemeError !#\\.[^ \t\[\]()";]\+!
183syn match schemeCharacter "#\\space"
184syn match schemeError !#\\space[^ \t\[\]()";]\+!
185syn match schemeCharacter "#\\newline"
186syn match schemeError !#\\newline[^ \t\[\]()";]\+!
187
188" R6RS
189syn match schemeCharacter "#\\x[0-9a-fA-F]\+"
190
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000191
192if exists("b:is_mzscheme") || exists("is_mzscheme")
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000193 " MzScheme extensions
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000194 " multiline comment
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200195 syn region schemeComment start="#|" end="|#" contains=@Spell
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000196
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000197 " #%xxx are the special MzScheme identifiers
Bram Moolenaar5c736222010-01-06 20:54:52 +0100198 syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000199 " anything limited by |'s is identifier
Bram Moolenaar5c736222010-01-06 20:54:52 +0100200 syn match schemeOther "|[^|]\+|"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000201
Bram Moolenaar5c736222010-01-06 20:54:52 +0100202 syn match schemeCharacter "#\\\%(return\|tab\)"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000203
204 " Modules require stmt
205 syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename
206 " modules provide stmt
207 syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except
208 " Other from MzScheme
209 syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case
210 syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum
211 syn keyword schemeExtSyntax datum->syntax-object
212 syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100213 syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000214 syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export
215 syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000216
217 syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker
218 syn keyword schemeExtFunc use-standard-linker use-standard-compiler
219 syn keyword schemeExtFunc find-executable-path append-object-suffix append-extension-suffix
220 syn keyword schemeExtFunc current-library-collection-paths current-extension-compiler-flags make-parameter
221 syn keyword schemeExtFunc current-directory build-path normalize-path current-extension-linker-flags
222 syn keyword schemeExtFunc file-exists? directory-exists? delete-directory/files delete-directory delete-file
223 syn keyword schemeExtFunc system compile-file system-library-subpath getenv putenv current-standard-link-libraries
224 syn keyword schemeExtFunc remove* file-size find-files fold-files directory-list shell-execute split-path
225 syn keyword schemeExtFunc current-error-port process/ports process printf fprintf open-input-string open-output-string
226 syn keyword schemeExtFunc get-output-string
227 " exceptions
228 syn keyword schemeExtFunc exn exn:application:arity exn:application:continuation exn:application:fprintf:mismatch
229 syn keyword schemeExtFunc exn:application:mismatch exn:application:type exn:application:mismatch exn:break exn:i/o:filesystem exn:i/o:port
230 syn keyword schemeExtFunc exn:i/o:port:closed exn:i/o:tcp exn:i/o:udp exn:misc exn:misc:application exn:misc:unsupported exn:module exn:read
231 syn keyword schemeExtFunc exn:read:non-char exn:special-comment exn:syntax exn:thread exn:user exn:variable exn:application:mismatch
232 syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch?
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?
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?
235 syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch?
236 " Command-line parsing
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100237 syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000238
239 " syntax quoting, unquoting and quasiquotation
240 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
242 syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL
243 syn region schemeUnquote matchgroup=Delimiter start="#,@(" end=")" contains=ALL
244 syn region schemeUnquote matchgroup=Delimiter start="#,\[" end="\]" contains=ALL
245 syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL
246 syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL
247 syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL
Bram Moolenaar26852122016-05-24 20:02:38 +0200248
249 " Identifiers are very liberal in MzScheme/Racket
250 syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+!
251
252 " Language setting
253 syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>"
254
255 " Various number forms
256 syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>"
257 syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>"
258 syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>"
259 syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000260endif
261
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000262
263if exists("b:is_chicken") || exists("is_chicken")
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000264 " multiline comment
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200265 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=@Spell,schemeMultilineComment
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000266
Bram Moolenaar5c736222010-01-06 20:54:52 +0100267 syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
268 syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000269
270 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000271 syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library
272 syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension
273 syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record
274 syn keyword schemeExtSyntax pointer tag-pointer tagged-pointer? define-foreign-type
275 syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv
276 syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000277 syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno
278
279 " here-string
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200280 syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ contains=@Spell
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100281
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000282 if filereadable(expand("<sfile>:p:h")."/cpp.vim")
283 unlet! b:current_syntax
284 syn include @ChickenC <sfile>:p:h/cpp.vim
285 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC
286 syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC
287 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse "+ end=+")\@=+ contains=@ChickenC
288 syn region ChickenC matchgroup=schemeComment start=+foreign-parse\s*#<<\z(.*\)$+hs=s+13 end=+^\z1$+ contains=@ChickenC
289 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse/spec "+ end=+")\@=+ contains=@ChickenC
290 syn region ChickenC matchgroup=schemeComment start=+foreign-parse/spec\s*#<<\z(.*\)$+hs=s+18 end=+^\z1$+ contains=@ChickenC
291 syn region ChickenC matchgroup=schemeComment start=+#>+ end=+<#+ contains=@ChickenC
292 syn region ChickenC matchgroup=schemeComment start=+#>?+ end=+<#+ contains=@ChickenC
293 syn region ChickenC matchgroup=schemeComment start=+#>!+ end=+<#+ contains=@ChickenC
294 syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC
295 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC
296 endif
297
Bram Moolenaara7241f52008-06-24 20:39:31 +0000298 " suggested by Alex Queiroz
Bram Moolenaar5c736222010-01-06 20:54:52 +0100299 syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200300 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ contains=@Spell
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000301endif
302
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303" Synchronization and the wrapping up...
304
305syn sync match matchPlace grouphere NONE "^[^ \t]"
306" ... i.e. synchronize on a line that starts at the left margin
307
308" Define the default highlighting.
309" For version 5.7 and earlier: only when not done already
310" For version 5.8 and later: only when an item doesn't have highlighting yet
311if version >= 508 || !exists("did_scheme_syntax_inits")
312 if version < 508
313 let did_scheme_syntax_inits = 1
314 command -nargs=+ HiLink hi link <args>
315 else
316 command -nargs=+ HiLink hi def link <args>
317 endif
318
319 HiLink schemeSyntax Statement
320 HiLink schemeFunc Function
321
322 HiLink schemeString String
Bram Moolenaar5c736222010-01-06 20:54:52 +0100323 HiLink schemeCharacter Character
Bram Moolenaar071d4272004-06-13 20:20:40 +0000324 HiLink schemeNumber Number
325 HiLink schemeBoolean Boolean
326
327 HiLink schemeDelimiter Delimiter
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000328 HiLink schemeConstant Constant
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329
330 HiLink schemeComment Comment
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000331 HiLink schemeMultilineComment Comment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000332 HiLink schemeError Error
333
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000334 HiLink schemeExtSyntax Type
335 HiLink schemeExtFunc PreProc
Bram Moolenaar26852122016-05-24 20:02:38 +0200336
337 HiLink schemeLang PreProc
338
Bram Moolenaar071d4272004-06-13 20:20:40 +0000339 delcommand HiLink
340endif
341
342let b:current_syntax = "scheme"
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100343
344let &cpo = s:cpo_save
345unlet s:cpo_save