7
|
1 " Vim syntax file
|
|
2 "
|
|
3 " Language: Logtalk
|
|
4 " Maintainer: Paulo Moura <pmoura@logtalk.org>
|
2034
|
5 " Last Change: Oct 31, 2008
|
7
|
6
|
|
7
|
|
8 " Quit when a syntax file was already loaded:
|
|
9
|
|
10 if version < 600
|
|
11 syntax clear
|
|
12 elseif exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
|
16
|
|
17 " Logtalk is case sensitive:
|
|
18
|
|
19 syn case match
|
|
20
|
|
21
|
|
22 " Logtalk variables
|
|
23
|
|
24 syn match logtalkVariable "\<\(\u\|_\)\(\w\)*\>"
|
|
25
|
|
26
|
|
27 " Logtalk clause functor
|
|
28
|
|
29 syn match logtalkOperator ":-"
|
|
30
|
|
31
|
|
32 " Logtalk quoted atoms and strings
|
|
33
|
|
34 syn region logtalkString start=+"+ skip=+\\"+ end=+"+
|
1668
|
35 syn region logtalkAtom start=+'+ skip=+\\'+ end=+'+ contains=logtalkEscapeSequence
|
|
36
|
|
37 syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+\|[0-7]\+\)\\\)"
|
7
|
38
|
|
39
|
|
40 " Logtalk message sending operators
|
|
41
|
|
42 syn match logtalkOperator "::"
|
1668
|
43 syn match logtalkOperator ":"
|
7
|
44 syn match logtalkOperator "\^\^"
|
|
45
|
|
46
|
|
47 " Logtalk external call
|
|
48
|
|
49 syn region logtalkExtCall matchgroup=logtalkExtCallTag start="{" matchgroup=logtalkExtCallTag end="}" contains=ALL
|
|
50
|
|
51
|
|
52 " Logtalk opening entity directives
|
|
53
|
2034
|
54 syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- object(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom,logtalkEntityRel,logtalkLineComment
|
|
55 syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- protocol(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkEntityRel,logtalkLineComment
|
|
56 syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- category(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkEntityRel,logtalkLineComment
|
7
|
57
|
|
58
|
|
59 " Logtalk closing entity directives
|
|
60
|
308
|
61 syn match logtalkCloseEntityDir ":- end_object\."
|
|
62 syn match logtalkCloseEntityDir ":- end_protocol\."
|
|
63 syn match logtalkCloseEntityDir ":- end_category\."
|
7
|
64
|
|
65
|
|
66 " Logtalk entity relations
|
|
67
|
1668
|
68 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="instantiates(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
|
69 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="specializes(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
|
70 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="extends(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
|
71 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="imports(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
|
72 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="implements(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
|
73 syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="complements(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained
|
7
|
74
|
|
75
|
|
76 " Logtalk directives
|
|
77
|
214
|
78 syn region logtalkDir matchgroup=logtalkDirTag start=":- alias(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
1668
|
79 syn region logtalkDir matchgroup=logtalkDirTag start=":- calls(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
80 syn region logtalkDir matchgroup=logtalkDirTag start=":- encoding(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
7
|
81 syn region logtalkDir matchgroup=logtalkDirTag start=":- initialization(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
82 syn region logtalkDir matchgroup=logtalkDirTag start=":- info(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
214
|
83 syn region logtalkDir matchgroup=logtalkDirTag start=":- mode(" matchgroup=logtalkDirTag end=")\." contains=logtalkOperator, logtalkAtom
|
7
|
84 syn region logtalkDir matchgroup=logtalkDirTag start=":- dynamic(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
85 syn match logtalkDirTag ":- dynamic\."
|
|
86 syn region logtalkDir matchgroup=logtalkDirTag start=":- discontiguous(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
214
|
87 syn region logtalkDir matchgroup=logtalkDirTag start=":- multifile(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
7
|
88 syn region logtalkDir matchgroup=logtalkDirTag start=":- public(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
89 syn region logtalkDir matchgroup=logtalkDirTag start=":- protected(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
90 syn region logtalkDir matchgroup=logtalkDirTag start=":- private(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
1668
|
91 syn region logtalkDir matchgroup=logtalkDirTag start=":- meta_predicate(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
7
|
92 syn region logtalkDir matchgroup=logtalkDirTag start=":- op(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
1668
|
93 syn region logtalkDir matchgroup=logtalkDirTag start=":- synchronized(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
94 syn match logtalkDirTag ":- synchronized\."
|
7
|
95 syn region logtalkDir matchgroup=logtalkDirTag start=":- uses(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
1668
|
96 syn match logtalkDirTag ":- threaded\."
|
7
|
97
|
|
98
|
714
|
99 " Module directives
|
|
100
|
|
101 syn region logtalkDir matchgroup=logtalkDirTag start=":- module(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
102 syn region logtalkDir matchgroup=logtalkDirTag start=":- export(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
103 syn region logtalkDir matchgroup=logtalkDirTag start=":- use_module(" matchgroup=logtalkDirTag end=")\." contains=ALL
|
|
104
|
|
105
|
7
|
106 " Logtalk built-in predicates
|
|
107
|
294
|
108 syn match logtalkBuiltIn "\<\(abolish\|c\(reate\|urrent\)\)_\(object\|protocol\|category\)\ze("
|
7
|
109
|
10
|
110 syn match logtalkBuiltIn "\<\(object\|protocol\|category\)_property\ze("
|
7
|
111
|
1668
|
112 syn match logtalkBuiltIn "\<complements_object\ze("
|
|
113 syn match logtalkBuiltIn "\<extends_\(object\|protocol\|category\)\ze("
|
10
|
114 syn match logtalkBuiltIn "\<imp\(orts_category\|lements_protocol\)\ze("
|
1668
|
115 syn match logtalkBuiltIn "\<\(instantiat\|specializ\)es_class\ze("
|
7
|
116
|
10
|
117 syn match logtalkBuiltIn "\<\(abolish\|define\)_events\ze("
|
7
|
118 syn match logtalkBuiltIn "\<current_event\ze("
|
|
119
|
1668
|
120 syn match logtalkBuiltIn "\<\(curren\|se\)t_logtalk_flag\ze("
|
7
|
121
|
214
|
122 syn match logtalkBuiltIn "\<logtalk_\(compile\|l\(ibrary_path\|oad\)\)\ze("
|
7
|
123
|
214
|
124 syn match logtalkBuiltIn "\<\(for\|retract\)all\ze("
|
7
|
125
|
1668
|
126 syn match logtalkBuiltIn "\<threaded\(_\(call\|once\|ignore\|exit\|peek\|wait\|notify\)\)\?\ze("
|
|
127
|
7
|
128
|
|
129 " Logtalk built-in methods
|
|
130
|
|
131 syn match logtalkBuiltInMethod "\<parameter\ze("
|
10
|
132 syn match logtalkBuiltInMethod "\<se\(lf\|nder\)\ze("
|
7
|
133 syn match logtalkBuiltInMethod "\<this\ze("
|
|
134
|
|
135 syn match logtalkBuiltInMethod "\<current_predicate\ze("
|
|
136 syn match logtalkBuiltInMethod "\<predicate_property\ze("
|
|
137
|
294
|
138 syn match logtalkBuiltInMethod "\<a\(bolish\|ssert\(a\|z\)\)\ze("
|
7
|
139 syn match logtalkBuiltInMethod "\<clause\ze("
|
294
|
140 syn match logtalkBuiltInMethod "\<retract\(all\)\?\ze("
|
7
|
141
|
10
|
142 syn match logtalkBuiltInMethod "\<\(bag\|set\)of\ze("
|
|
143 syn match logtalkBuiltInMethod "\<f\(ind\|or\)all\ze("
|
7
|
144
|
|
145 syn match logtalkBuiltInMethod "\<before\ze("
|
|
146 syn match logtalkBuiltInMethod "\<after\ze("
|
|
147
|
214
|
148 syn match logtalkBuiltInMethod "\<expand_term\ze("
|
1668
|
149 syn match logtalkBuiltInMethod "\<\(goal\|term\)_expansion\ze("
|
7
|
150 syn match logtalkBuiltInMethod "\<phrase\ze("
|
|
151
|
|
152
|
|
153 " Mode operators
|
|
154
|
|
155 syn match logtalkOperator "?"
|
|
156 syn match logtalkOperator "@"
|
|
157
|
|
158
|
|
159 " Control constructs
|
|
160
|
|
161 syn match logtalkKeyword "\<true\>"
|
|
162 syn match logtalkKeyword "\<fail\>"
|
10
|
163 syn match logtalkKeyword "\<ca\(ll\|tch\)\ze("
|
7
|
164 syn match logtalkOperator "!"
|
10
|
165 " syn match logtalkOperator ","
|
7
|
166 syn match logtalkOperator ";"
|
|
167 syn match logtalkOperator "-->"
|
|
168 syn match logtalkOperator "->"
|
|
169 syn match logtalkKeyword "\<throw\ze("
|
|
170
|
|
171
|
|
172 " Term unification
|
|
173
|
|
174 syn match logtalkOperator "="
|
|
175 syn match logtalkKeyword "\<unify_with_occurs_check\ze("
|
|
176 syn match logtalkOperator "\\="
|
|
177
|
|
178
|
|
179 " Term testing
|
|
180
|
|
181 syn match logtalkKeyword "\<var\ze("
|
294
|
182 syn match logtalkKeyword "\<atom\(ic\)\?\ze("
|
7
|
183 syn match logtalkKeyword "\<integer\ze("
|
|
184 syn match logtalkKeyword "\<float\ze("
|
|
185 syn match logtalkKeyword "\<compound\ze("
|
10
|
186 syn match logtalkKeyword "\<n\(onvar\|umber\)\ze("
|
7
|
187
|
|
188
|
|
189 " Term comparison
|
|
190
|
|
191 syn match logtalkOperator "@=<"
|
|
192 syn match logtalkOperator "=="
|
|
193 syn match logtalkOperator "\\=="
|
|
194 syn match logtalkOperator "@<"
|
|
195 syn match logtalkOperator "@>"
|
|
196 syn match logtalkOperator "@>="
|
|
197
|
|
198
|
|
199 " Term creation and decomposition
|
|
200
|
|
201 syn match logtalkKeyword "\<functor\ze("
|
|
202 syn match logtalkKeyword "\<arg\ze("
|
|
203 syn match logtalkOperator "=\.\."
|
|
204 syn match logtalkKeyword "\<copy_term\ze("
|
|
205
|
|
206
|
|
207 " Arithemtic evaluation
|
|
208
|
214
|
209 syn match logtalkOperator "\<is\>"
|
7
|
210
|
|
211
|
|
212 " Arithemtic comparison
|
|
213
|
|
214 syn match logtalkOperator "=:="
|
|
215 syn match logtalkOperator "=\\="
|
|
216 syn match logtalkOperator "<"
|
|
217 syn match logtalkOperator "=<"
|
|
218 syn match logtalkOperator ">"
|
|
219 syn match logtalkOperator ">="
|
|
220
|
|
221
|
|
222 " Stream selection and control
|
|
223
|
1668
|
224 syn match logtalkKeyword "\<\(curren\|se\)t_\(in\|out\)put\ze("
|
7
|
225 syn match logtalkKeyword "\<open\ze("
|
|
226 syn match logtalkKeyword "\<close\ze("
|
|
227 syn match logtalkKeyword "\<flush_output\ze("
|
|
228 syn match logtalkKeyword "\<flush_output\>"
|
|
229 syn match logtalkKeyword "\<stream_property\ze("
|
|
230 syn match logtalkKeyword "\<at_end_of_stream\ze("
|
|
231 syn match logtalkKeyword "\<at_end_of_stream\>"
|
|
232 syn match logtalkKeyword "\<set_stream_position\ze("
|
|
233
|
|
234
|
10
|
235 " Character and byte input/output
|
7
|
236
|
294
|
237 syn match logtalkKeyword "\<\(get\|p\(eek\|ut\)\)_\(c\(har\|ode\)\|byte\)\ze("
|
7
|
238 syn match logtalkKeyword "\<nl\ze("
|
|
239 syn match logtalkKeyword "\<nl\>"
|
|
240
|
|
241
|
|
242 " Term input/output
|
|
243
|
294
|
244 syn match logtalkKeyword "\<read\(_term\)\?\ze("
|
|
245 syn match logtalkKeyword "\<write\(q\|_\(canonical\|term\)\)\?\ze("
|
|
246 syn match logtalkKeyword "\<\(current_\)\?op\ze("
|
1668
|
247 syn match logtalkKeyword "\<\(current_\)\?char_conversion\ze("
|
7
|
248
|
|
249
|
|
250 " Logic and control
|
|
251
|
|
252 syn match logtalkOperator "\\+"
|
|
253 syn match logtalkKeyword "\<once\ze("
|
|
254 syn match logtalkKeyword "\<repeat\>"
|
|
255
|
|
256
|
|
257 " Atomic term processing
|
|
258
|
294
|
259 syn match logtalkKeyword "\<atom_\(length\|c\(hars\|o\(ncat\|des\)\)\)\ze("
|
7
|
260 syn match logtalkKeyword "\<sub_atom\ze("
|
|
261 syn match logtalkKeyword "\<char_code\ze("
|
1668
|
262 syn match logtalkKeyword "\<number_c\(har\|ode\)s\ze("
|
7
|
263
|
|
264
|
|
265 " Implementation defined hooks functions
|
|
266
|
1668
|
267 syn match logtalkKeyword "\<\(curren\|se\)t_prolog_flag\ze("
|
7
|
268 syn match logtalkKeyword "\<halt\ze("
|
|
269 syn match logtalkKeyword "\<halt\>"
|
|
270
|
|
271
|
|
272 " Evaluable functors
|
|
273
|
|
274 syn match logtalkOperator "+"
|
|
275 syn match logtalkOperator "-"
|
|
276 syn match logtalkOperator "\*"
|
|
277 syn match logtalkOperator "//"
|
|
278 syn match logtalkOperator "/"
|
294
|
279 syn match logtalkKeyword "\<r\(ound\|em\)\ze("
|
7
|
280 syn match logtalkKeyword "\<rem\>"
|
|
281 syn match logtalkKeyword "\<mod\ze("
|
|
282 syn match logtalkKeyword "\<mod\>"
|
|
283 syn match logtalkKeyword "\<abs\ze("
|
|
284 syn match logtalkKeyword "\<sign\ze("
|
294
|
285 syn match logtalkKeyword "\<flo\(or\|at\(_\(integer\|fractional\)_part\)\?\)\ze("
|
7
|
286 syn match logtalkKeyword "\<truncate\ze("
|
|
287 syn match logtalkKeyword "\<ceiling\ze("
|
|
288
|
|
289
|
|
290 " Other arithemtic functors
|
|
291
|
|
292 syn match logtalkOperator "\*\*"
|
10
|
293 syn match logtalkKeyword "\<s\(in\|qrt\)\ze("
|
7
|
294 syn match logtalkKeyword "\<cos\ze("
|
|
295 syn match logtalkKeyword "\<atan\ze("
|
|
296 syn match logtalkKeyword "\<exp\ze("
|
|
297 syn match logtalkKeyword "\<log\ze("
|
|
298
|
|
299
|
|
300 " Bitwise functors
|
|
301
|
|
302 syn match logtalkOperator ">>"
|
|
303 syn match logtalkOperator "<<"
|
|
304 syn match logtalkOperator "/\\"
|
|
305 syn match logtalkOperator "\\/"
|
|
306 syn match logtalkOperator "\\"
|
|
307
|
|
308
|
294
|
309 " Logtalk list operator
|
|
310
|
|
311 syn match logtalkOperator "|"
|
|
312
|
|
313
|
1668
|
314 " Logtalk numbers
|
294
|
315
|
|
316 syn match logtalkNumber "\<\d\+\>"
|
|
317 syn match logtalkNumber "\<\d\+\.\d\+\>"
|
|
318 syn match logtalkNumber "\<\d\+[eE][-+]\=\d\+\>"
|
|
319 syn match logtalkNumber "\<\d\+\.\d\+[eE][-+]\=\d\+\>"
|
1668
|
320 syn match logtalkNumber "\<0'.\|0''\|0'\"\>"
|
294
|
321 syn match logtalkNumber "\<0b[0-1]\+\>"
|
308
|
322 syn match logtalkNumber "\<0o\o\+\>"
|
294
|
323 syn match logtalkNumber "\<0x\x\+\>"
|
|
324
|
|
325
|
7
|
326 " Logtalk end-of-clause
|
|
327
|
|
328 syn match logtalkOperator "\."
|
|
329
|
|
330
|
|
331 " Logtalk comments
|
|
332
|
308
|
333 syn region logtalkBlockComment start="/\*" end="\*/" fold
|
7
|
334 syn match logtalkLineComment "%.*"
|
|
335
|
|
336
|
308
|
337 " Logtalk entity folding
|
|
338
|
|
339 syn region logtalkEntity transparent fold keepend start=":- object(" end=":- end_object\." contains=ALL
|
|
340 syn region logtalkEntity transparent fold keepend start=":- protocol(" end=":- end_protocol\." contains=ALL
|
|
341 syn region logtalkEntity transparent fold keepend start=":- category(" end=":- end_category\." contains=ALL
|
|
342
|
|
343
|
214
|
344 syn sync ccomment logtalkBlockComment maxlines=50
|
7
|
345
|
|
346
|
|
347 " Define the default highlighting.
|
|
348 " For version 5.7 and earlier: only when not done already
|
|
349 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
350
|
|
351 if version >= 508 || !exists("did_logtalk_syn_inits")
|
|
352 if version < 508
|
|
353 let did_logtalk_syn_inits = 1
|
|
354 command -nargs=+ HiLink hi link <args>
|
|
355 else
|
|
356 command -nargs=+ HiLink hi def link <args>
|
|
357 endif
|
1668
|
358
|
7
|
359 HiLink logtalkBlockComment Comment
|
|
360 HiLink logtalkLineComment Comment
|
|
361
|
|
362 HiLink logtalkOpenEntityDir Normal
|
|
363 HiLink logtalkOpenEntityDirTag PreProc
|
|
364
|
|
365 HiLink logtalkEntity Normal
|
|
366
|
|
367 HiLink logtalkEntityRel Normal
|
|
368 HiLink logtalkEntityRelTag PreProc
|
|
369
|
|
370 HiLink logtalkCloseEntityDir PreProc
|
|
371
|
|
372 HiLink logtalkDir Normal
|
|
373 HiLink logtalkDirTag PreProc
|
|
374
|
|
375 HiLink logtalkAtom String
|
|
376 HiLink logtalkString String
|
1668
|
377 HiLink logtalkEscapeSequence SpecialChar
|
7
|
378
|
|
379 HiLink logtalkNumber Number
|
|
380
|
|
381 HiLink logtalkKeyword Keyword
|
|
382
|
|
383 HiLink logtalkBuiltIn Keyword
|
|
384 HiLink logtalkBuiltInMethod Keyword
|
|
385
|
|
386 HiLink logtalkOperator Operator
|
|
387
|
|
388 HiLink logtalkExtCall Normal
|
|
389 HiLink logtalkExtCallTag Operator
|
|
390
|
|
391 HiLink logtalkVariable Identifier
|
|
392
|
|
393 delcommand HiLink
|
|
394
|
|
395 endif
|
|
396
|
|
397
|
|
398 let b:current_syntax = "logtalk"
|