annotate runtime/syntax/scheme.vim @ 1619:b9740fb41986

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 20:39:31 +0000
parents 125e80798a85
children 7bc41231fbc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Scheme (R5RS)
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 36
diff changeset
3 " Last Change: 2007 Jun 16
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
4 " Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
5 " Original author: Dirk van Deun <dirk@igwe.vub.ac.be>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " This script incorrectly recognizes some junk input as numerals:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " parsing the complete system of Scheme numerals using the pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " language is practically impossible: I did a lax approximation.
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
10
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
11 " MzScheme extensions can be activated with setting is_mzscheme variable
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " Suggestions and bug reports are solicited by the author.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " Initializing:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " Fascist highlighting: everything that doesn't fit the rules is an error...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
29 syn match schemeError oneline ![^ \t()\[\]";]*!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn match schemeError oneline ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " Quoted and backquoted stuff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
34 syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn region schemeQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn region schemeQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syn region schemeStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn region schemeStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
42 " Popular Scheme extension:
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
43 " using [] as well as ()
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
44 syn region schemeStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
45 syn region schemeStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
47 syn region schemeUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
48 syn region schemeUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
49
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
50 syn region schemeUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
51 syn region schemeUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn region schemeUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn region schemeUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
56 syn region schemeUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
57 syn region schemeUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
58
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
59 syn region schemeUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
60 syn region schemeUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
61
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " R5RS Scheme Functions and Syntax:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn keyword schemeSyntax lambda and or if cond case define let let* letrec
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 syn keyword schemeSyntax begin do delay set! else =>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syn keyword schemeSyntax quote quasiquote unquote unquote-splicing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 syn keyword schemeFunc cddaar cddadr cdddar cddddr null? list? list length
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 syn keyword schemeFunc append reverse list-ref memq memv member assq assv assoc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn keyword schemeFunc symbol? symbol->string string->symbol number? complex?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn keyword schemeFunc real? rational? integer? exact? inexact? = < > <= >=
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 syn keyword schemeFunc zero? positive? negative? odd? even? max min + * - / abs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 syn keyword schemeFunc quotient remainder modulo gcd lcm numerator denominator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 syn keyword schemeFunc floor ceiling truncate round rationalize exp log sin cos
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn keyword schemeFunc tan asin acos atan sqrt expt make-rectangular make-polar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn keyword schemeFunc real-part imag-part magnitude angle exact->inexact
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 syn keyword schemeFunc inexact->exact number->string string->number char=?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn keyword schemeFunc char-ci=? char<? char-ci<? char>? char-ci>? char<=?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn keyword schemeFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn keyword schemeFunc char-numeric? char-whitespace? char-upper-case?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 syn keyword schemeFunc char-lower-case?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn keyword schemeFunc char->integer integer->char char-upcase char-downcase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 syn keyword schemeFunc string? make-string string string-length string-ref
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 syn keyword schemeFunc string-set! string=? string-ci=? string<? string-ci<?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 syn keyword schemeFunc string>? string-ci>? string<=? string-ci<=? string>=?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 syn keyword schemeFunc string-ci>=? substring string-append vector? make-vector
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn keyword schemeFunc vector vector-length vector-ref vector-set! procedure?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn keyword schemeFunc apply map for-each call-with-current-continuation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syn keyword schemeFunc call-with-input-file call-with-output-file input-port?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 syn keyword schemeFunc output-port? current-input-port current-output-port
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 syn keyword schemeFunc open-input-file open-output-file close-input-port
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syn keyword schemeFunc close-output-port eof-object? read read-char peek-char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 syn keyword schemeFunc write display newline write-char call/cc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 syn keyword schemeFunc list-tail string->list list->string string-copy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 syn keyword schemeFunc string-fill! vector->list list->vector vector-fill!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 syn keyword schemeFunc force with-input-from-file with-output-to-file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 syn keyword schemeFunc char-ready? load transcript-on transcript-off eval
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 syn keyword schemeFunc dynamic-wind port? values call-with-values
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 syn keyword schemeFunc scheme-report-environment null-environment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 syn keyword schemeFunc interaction-environment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 " ... so that a single + or -, inside a quoted context, would not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " interpreted as a number (outside such contexts, it's a schemeFunc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
116 syn match schemeDelimiter oneline !\.[ \t\[\]()";]!me=e-1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 syn match schemeDelimiter oneline !\.$!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 " ... and a single dot is not a number but a delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 " This keeps all other stuff unhighlighted, except *stuff* and <stuff>:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
122 syn match schemeOther oneline ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*,
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
123 syn match schemeError oneline ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 syn match schemeOther oneline "\.\.\."
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
126 syn match schemeError oneline !\.\.\.[^ \t\[\]()";]\+!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 " ... a special identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
129 syn match schemeConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[ \t\[\]()";],me=e-1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 syn match schemeConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*$,
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
131 syn match schemeError oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
133 syn match schemeConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 syn match schemeConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$,
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
135 syn match schemeError oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 " Non-quoted lists, and strings:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
142 syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
143 syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
144
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
145 " Simple literals:
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
146 syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 " Comments:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 syn match schemeComment ";.*$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
152
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
153 " Writing out the complete description of Scheme numerals without
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
154 " using variables is a day's work for a trained secretary...
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
155
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
156 syn match schemeOther oneline ![+-][ \t\[\]()";]!me=e-1
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
157 syn match schemeOther oneline ![+-]$!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
158 "
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
159 " This is a useful lax approximation:
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
160 syn match schemeNumber oneline "[-#+0-9.][-#+/0-9a-f@i.boxesfdl]*"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
161 syn match schemeError oneline ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
162
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
163 syn match schemeBoolean oneline "#[tf]"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
164 syn match schemeError oneline !#[tf][^ \t\[\]()";]\+!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
165
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
166 syn match schemeChar oneline "#\\"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
167 syn match schemeChar oneline "#\\."
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
168 syn match schemeError oneline !#\\.[^ \t\[\]()";]\+!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
169 syn match schemeChar oneline "#\\space"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
170 syn match schemeError oneline !#\\space[^ \t\[\]()";]\+!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
171 syn match schemeChar oneline "#\\newline"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
172 syn match schemeError oneline !#\\newline[^ \t\[\]()";]\+!
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
173
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
174 if exists("b:is_mzscheme") || exists("is_mzscheme")
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
175 " MzScheme extensions
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
176 " multiline comment
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
177 syn region schemeComment start="#|" end="|#"
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
178
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
179 " #%xxx are the special MzScheme identifiers
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
180 syn match schemeOther oneline "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
181 " anything limited by |'s is identifier
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
182 syn match schemeOther oneline "|[^|]\+|"
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
183
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
184 syn match schemeChar oneline "#\\\%(return\|tab\)"
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
185
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
186 " Modules require stmt
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
187 syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
188 " modules provide stmt
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
189 syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
190 " Other from MzScheme
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
191 syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
192 syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
193 syn keyword schemeExtSyntax datum->syntax-object
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
194 syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
195 syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
196 syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
197 syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
198
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
199 syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
200 syn keyword schemeExtFunc use-standard-linker use-standard-compiler
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
201 syn keyword schemeExtFunc find-executable-path append-object-suffix append-extension-suffix
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
202 syn keyword schemeExtFunc current-library-collection-paths current-extension-compiler-flags make-parameter
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
203 syn keyword schemeExtFunc current-directory build-path normalize-path current-extension-linker-flags
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
204 syn keyword schemeExtFunc file-exists? directory-exists? delete-directory/files delete-directory delete-file
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
205 syn keyword schemeExtFunc system compile-file system-library-subpath getenv putenv current-standard-link-libraries
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
206 syn keyword schemeExtFunc remove* file-size find-files fold-files directory-list shell-execute split-path
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
207 syn keyword schemeExtFunc current-error-port process/ports process printf fprintf open-input-string open-output-string
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
208 syn keyword schemeExtFunc get-output-string
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
209 " exceptions
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
210 syn keyword schemeExtFunc exn exn:application:arity exn:application:continuation exn:application:fprintf:mismatch
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
211 syn keyword schemeExtFunc exn:application:mismatch exn:application:type exn:application:mismatch exn:break exn:i/o:filesystem exn:i/o:port
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
212 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
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
213 syn keyword schemeExtFunc exn:read:non-char exn:special-comment exn:syntax exn:thread exn:user exn:variable exn:application:mismatch
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
214 syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch?
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
215 syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed?
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
216 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?
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
217 syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch?
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
218 " Command-line parsing
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
219 syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
220
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
221 " syntax quoting, unquoting and quasiquotation
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
222 syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
223 syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
224 syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
225 syn region schemeUnquote matchgroup=Delimiter start="#,@(" end=")" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
226 syn region schemeUnquote matchgroup=Delimiter start="#,\[" end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
227 syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
228 syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
229 syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
230 endif
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
231
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
232
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
233 if exists("b:is_chicken") || exists("is_chicken")
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
234 " multiline comment
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
235 syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
236
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
237 syn match schemeOther oneline "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
238 syn match schemeExtSyntax oneline "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
239
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
240 syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec
36
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
241 syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
242 syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
243 syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
244 syn keyword schemeExtSyntax pointer tag-pointer tagged-pointer? define-foreign-type
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
245 syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv
125e80798a85 updated for version 7.0021
vimboss
parents: 26
diff changeset
246 syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
247 syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
248
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
249 " here-string
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
250 syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
251
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
252 if filereadable(expand("<sfile>:p:h")."/cpp.vim")
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
253 unlet! b:current_syntax
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
254 syn include @ChickenC <sfile>:p:h/cpp.vim
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
255 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
256 syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
257 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse "+ end=+")\@=+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
258 syn region ChickenC matchgroup=schemeComment start=+foreign-parse\s*#<<\z(.*\)$+hs=s+13 end=+^\z1$+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
259 syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse/spec "+ end=+")\@=+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
260 syn region ChickenC matchgroup=schemeComment start=+foreign-parse/spec\s*#<<\z(.*\)$+hs=s+18 end=+^\z1$+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
261 syn region ChickenC matchgroup=schemeComment start=+#>+ end=+<#+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
262 syn region ChickenC matchgroup=schemeComment start=+#>?+ end=+<#+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
263 syn region ChickenC matchgroup=schemeComment start=+#>!+ end=+<#+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
264 syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
265 syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
266 endif
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
267
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 36
diff changeset
268 " suggested by Alex Queiroz
b9740fb41986 updated for version 7.2a
vimboss
parents: 36
diff changeset
269 syn match schemeExtSyntax oneline "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
b9740fb41986 updated for version 7.2a
vimboss
parents: 36
diff changeset
270 syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
271 endif
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
272
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 " Synchronization and the wrapping up...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 syn sync match matchPlace grouphere NONE "^[^ \t]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 " ... i.e. synchronize on a line that starts at the left margin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 if version >= 508 || !exists("did_scheme_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 let did_scheme_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 HiLink schemeSyntax Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 HiLink schemeFunc Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 HiLink schemeString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 HiLink schemeChar Character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 HiLink schemeNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 HiLink schemeBoolean Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 HiLink schemeDelimiter Delimiter
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
298 HiLink schemeConstant Constant
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 HiLink schemeComment Comment
17
9be87deaeb52 updated for version 7.0009
vimboss
parents: 7
diff changeset
301 HiLink schemeMultilineComment Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 HiLink schemeError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303
26
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
304 HiLink schemeExtSyntax Type
404aac550f35 updated for version 7.0017
vimboss
parents: 17
diff changeset
305 HiLink schemeExtFunc PreProc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 let b:current_syntax = "scheme"