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