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