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