7
|
1 " Vim syntax file
|
|
2 " Language: Monk (See-Beyond Technologies)
|
|
3 " Maintainer: Mike Litherland <litherm@ccf.org>
|
|
4 " Last Change: March 6, 2002
|
|
5
|
|
6 " This syntax file is good enough for my needs, but others
|
|
7 " may desire more features. Suggestions and bug reports
|
|
8 " are solicited by the author (above).
|
|
9
|
|
10 " Originally based on the Scheme syntax file by:
|
|
11
|
|
12 " Maintainer: Dirk van Deun <dvandeun@poboxes.com>
|
|
13 " Last Change: April 30, 1998
|
|
14
|
|
15 " In fact it's almost identical. :)
|
|
16
|
|
17 " The original author's notes:
|
|
18 " This script incorrectly recognizes some junk input as numerals:
|
|
19 " parsing the complete system of Scheme numerals using the pattern
|
|
20 " language is practically impossible: I did a lax approximation.
|
|
21
|
|
22 " Initializing:
|
|
23
|
|
24 " For version 5.x: Clear all syntax items
|
|
25 " For version 6.x: Quit when a syntax file was already loaded
|
|
26 if version < 600
|
|
27 syntax clear
|
|
28 elseif exists("b:current_syntax")
|
|
29 finish
|
|
30 endif
|
|
31
|
|
32 syn case ignore
|
|
33
|
|
34 " Fascist highlighting: everything that doesn't fit the rules is an error...
|
|
35
|
|
36 syn match monkError oneline ![^ \t()";]*!
|
|
37 syn match monkError oneline ")"
|
|
38
|
|
39 " Quoted and backquoted stuff
|
|
40
|
|
41 syn region monkQuoted matchgroup=Delimiter start="['`]" end=![ \t()";]!me=e-1 contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
42
|
|
43 syn region monkQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
44 syn region monkQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
45
|
|
46 syn region monkStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
47 syn region monkStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
48
|
|
49 syn region monkUnquote matchgroup=Delimiter start="," end=![ \t()";]!me=e-1 contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
50 syn region monkUnquote matchgroup=Delimiter start=",@" end=![ \t()";]!me=e-1 contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
51
|
|
52 syn region monkUnquote matchgroup=Delimiter start=",(" end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
53 syn region monkUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
54
|
|
55 syn region monkUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
56 syn region monkUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,monkStruc,monkSyntax,monkFunc
|
|
57
|
|
58 " R5RS Scheme Functions and Syntax:
|
|
59
|
|
60 if version < 600
|
|
61 set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
|
|
62 else
|
|
63 setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
|
|
64 endif
|
|
65
|
|
66 syn keyword monkSyntax lambda and or if cond case define let let* letrec
|
|
67 syn keyword monkSyntax begin do delay set! else =>
|
|
68 syn keyword monkSyntax quote quasiquote unquote unquote-splicing
|
|
69 syn keyword monkSyntax define-syntax let-syntax letrec-syntax syntax-rules
|
|
70
|
|
71 syn keyword monkFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car!
|
|
72 syn keyword monkFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr
|
|
73 syn keyword monkFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr
|
|
74 syn keyword monkFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr
|
|
75 syn keyword monkFunc cddaar cddadr cdddar cddddr null? list? list length
|
|
76 syn keyword monkFunc append reverse list-ref memq memv member assq assv assoc
|
|
77 syn keyword monkFunc symbol? symbol->string string->symbol number? complex?
|
|
78 syn keyword monkFunc real? rational? integer? exact? inexact? = < > <= >=
|
|
79 syn keyword monkFunc zero? positive? negative? odd? even? max min + * - / abs
|
|
80 syn keyword monkFunc quotient remainder modulo gcd lcm numerator denominator
|
|
81 syn keyword monkFunc floor ceiling truncate round rationalize exp log sin cos
|
|
82 syn keyword monkFunc tan asin acos atan sqrt expt make-rectangular make-polar
|
|
83 syn keyword monkFunc real-part imag-part magnitude angle exact->inexact
|
|
84 syn keyword monkFunc inexact->exact number->string string->number char=?
|
|
85 syn keyword monkFunc char-ci=? char<? char-ci<? char>? char-ci>? char<=?
|
|
86 syn keyword monkFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char?
|
|
87 syn keyword monkFunc char-numeric? char-whitespace? char-upper-case?
|
|
88 syn keyword monkFunc char-lower-case?
|
|
89 syn keyword monkFunc char->integer integer->char char-upcase char-downcase
|
|
90 syn keyword monkFunc string? make-string string string-length string-ref
|
|
91 syn keyword monkFunc string-set! string=? string-ci=? string<? string-ci<?
|
|
92 syn keyword monkFunc string>? string-ci>? string<=? string-ci<=? string>=?
|
|
93 syn keyword monkFunc string-ci>=? substring string-append vector? make-vector
|
|
94 syn keyword monkFunc vector vector-length vector-ref vector-set! procedure?
|
|
95 syn keyword monkFunc apply map for-each call-with-current-continuation
|
|
96 syn keyword monkFunc call-with-input-file call-with-output-file input-port?
|
|
97 syn keyword monkFunc output-port? current-input-port current-output-port
|
|
98 syn keyword monkFunc open-input-file open-output-file close-input-port
|
|
99 syn keyword monkFunc close-output-port eof-object? read read-char peek-char
|
|
100 syn keyword monkFunc write display newline write-char call/cc
|
|
101 syn keyword monkFunc list-tail string->list list->string string-copy
|
|
102 syn keyword monkFunc string-fill! vector->list list->vector vector-fill!
|
|
103 syn keyword monkFunc force with-input-from-file with-output-to-file
|
|
104 syn keyword monkFunc char-ready? load transcript-on transcript-off eval
|
|
105 syn keyword monkFunc dynamic-wind port? values call-with-values
|
|
106 syn keyword monkFunc monk-report-environment null-environment
|
|
107 syn keyword monkFunc interaction-environment
|
|
108
|
|
109 " Keywords specific to STC's implementation
|
|
110
|
|
111 syn keyword monkFunc $event-clear $event-parse $event->string $make-event-map
|
|
112 syn keyword monkFunc $resolve-event-definition change-pattern copy copy-strip
|
|
113 syn keyword monkFunc count-data-children count-map-children count-rep data-map
|
|
114 syn keyword monkFunc duplicate duplicate-strip file-check file-lookup get
|
|
115 syn keyword monkFunc insert list-lookup node-has-data? not-verify path?
|
|
116 syn keyword monkFunc path-defined-as-repeating? path-nodeclear path-nodedepth
|
|
117 syn keyword monkFunc path-nodename path-nodeparentname path->string path-valid?
|
|
118 syn keyword monkFunc regex string->path timestamp uniqueid verify
|
|
119
|
|
120 " Keywords from the Monk function library (from e*Gate 4.1 programmers ref)
|
|
121 syn keyword monkFunc allcap? capitalize char-punctuation? char-substitute
|
|
122 syn keyword monkFunc char-to-char conv count-used-children degc->degf
|
|
123 syn keyword monkFunc diff-two-dates display-error empty-string? fail_id
|
|
124 syn keyword monkFunc fail_id_if fail_translation fail_translation_if
|
|
125 syn keyword monkFunc find-get-after find-get-before get-timestamp julian-date?
|
|
126 syn keyword monkFunc julian->standard leap-year? map-string not-empty-string?
|
|
127 syn keyword monkFunc standard-date? standard->julian string-begins-with?
|
|
128 syn keyword monkFunc string-contains? string-ends-with? string-search-from-left
|
|
129 syn keyword monkFunc string-search-from-right string->ssn strip-punct
|
|
130 syn keyword monkFunc strip-string substring=? symbol-table-get symbol-table-put
|
|
131 syn keyword monkFunc trim-string-left trim-string-right valid-decimal?
|
|
132 syn keyword monkFunc valid-integer? verify-type
|
|
133
|
|
134 " Writing out the complete description of Scheme numerals without
|
|
135 " using variables is a day's work for a trained secretary...
|
|
136 " This is a useful lax approximation:
|
|
137
|
|
138 syn match monkNumber oneline "[-#+0-9.][-#+/0-9a-f@i.boxesfdl]*"
|
|
139 syn match monkError oneline ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t()";][^ \t()";]*!
|
|
140
|
|
141 syn match monkOther oneline ![+-][ \t()";]!me=e-1
|
|
142 syn match monkOther oneline ![+-]$!
|
|
143 " ... so that a single + or -, inside a quoted context, would not be
|
|
144 " interpreted as a number (outside such contexts, it's a monkFunc)
|
|
145
|
|
146 syn match monkDelimiter oneline !\.[ \t()";]!me=e-1
|
|
147 syn match monkDelimiter oneline !\.$!
|
|
148 " ... and a single dot is not a number but a delimiter
|
|
149
|
|
150 " Simple literals:
|
|
151
|
|
152 syn match monkBoolean oneline "#[tf]"
|
|
153 syn match monkError oneline !#[tf][^ \t()";]\+!
|
|
154
|
|
155 syn match monkChar oneline "#\\"
|
|
156 syn match monkChar oneline "#\\."
|
|
157 syn match monkError oneline !#\\.[^ \t()";]\+!
|
|
158 syn match monkChar oneline "#\\space"
|
|
159 syn match monkError oneline !#\\space[^ \t()";]\+!
|
|
160 syn match monkChar oneline "#\\newline"
|
|
161 syn match monkError oneline !#\\newline[^ \t()";]\+!
|
|
162
|
|
163 " This keeps all other stuff unhighlighted, except *stuff* and <stuff>:
|
|
164
|
|
165 syn match monkOther oneline ,[a-z!$%&*/:<=>?^_~][-a-z!$%&*/:<=>?^_~0-9+.@]*,
|
|
166 syn match monkError oneline ,[a-z!$%&*/:<=>?^_~][-a-z!$%&*/:<=>?^_~0-9+.@]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t()";]\+[^ \t()";]*,
|
|
167
|
|
168 syn match monkOther oneline "\.\.\."
|
|
169 syn match monkError oneline !\.\.\.[^ \t()";]\+!
|
|
170 " ... a special identifier
|
|
171
|
|
172 syn match monkConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[ \t()";],me=e-1
|
|
173 syn match monkConstant oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*$,
|
|
174 syn match monkError oneline ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t()";]\+[^ \t()";]*,
|
|
175
|
|
176 syn match monkConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t()";],me=e-1
|
|
177 syn match monkConstant oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$,
|
|
178 syn match monkError oneline ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t()";]\+[^ \t()";]*,
|
|
179
|
|
180 " Monk input and output structures
|
|
181 syn match monkSyntax oneline "\(\~input\|\[I\]->\)[^ \t]*"
|
|
182 syn match monkFunc oneline "\(\~output\|\[O\]->\)[^ \t]*"
|
|
183
|
|
184 " Non-quoted lists, and strings:
|
|
185
|
|
186 syn region monkStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL
|
|
187 syn region monkStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL
|
|
188
|
|
189 syn region monkString start=+"+ skip=+\\[\\"]+ end=+"+
|
|
190
|
|
191 " Comments:
|
|
192
|
|
193 syn match monkComment ";.*$"
|
|
194
|
|
195 " Synchronization and the wrapping up...
|
|
196
|
|
197 syn sync match matchPlace grouphere NONE "^[^ \t]"
|
|
198 " ... i.e. synchronize on a line that starts at the left margin
|
|
199
|
|
200 " Define the default highlighting.
|
|
201 " For version 5.7 and earlier: only when not done already
|
|
202 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
203 if version >= 508 || !exists("did_monk_syntax_inits")
|
|
204 if version < 508
|
|
205 let did_monk_syntax_inits = 1
|
|
206 command -nargs=+ HiLink hi link <args>
|
|
207 else
|
|
208 command -nargs=+ HiLink hi def link <args>
|
|
209 endif
|
|
210
|
|
211 HiLink monkSyntax Statement
|
|
212 HiLink monkFunc Function
|
|
213
|
|
214 HiLink monkString String
|
|
215 HiLink monkChar Character
|
|
216 HiLink monkNumber Number
|
|
217 HiLink monkBoolean Boolean
|
|
218
|
|
219 HiLink monkDelimiter Delimiter
|
|
220 HiLink monkConstant Constant
|
|
221
|
|
222 HiLink monkComment Comment
|
|
223 HiLink monkError Error
|
|
224
|
|
225 delcommand HiLink
|
|
226 endif
|
|
227
|
|
228 let b:current_syntax = "monk"
|