Commit | Line | Data |
3fea05b9 |
1 | # Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. |
2 | # This program is free software; you can redistribute it and/or |
3 | # modify it under the same terms as Perl itself. |
4 | |
5 | # This file was generated from the 'logtalk.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.40 |
9 | #kate version 2.4 |
10 | #kate author Paulo Moura (pmoura@logtalk.org) |
11 | #generated: Sun Feb 3 22:02:05 2008, localtime |
12 | |
13 | package Syntax::Highlight::Engine::Kate::Logtalk; |
14 | |
15 | our $VERSION = '0.06'; |
16 | |
17 | use strict; |
18 | use warnings; |
19 | use base('Syntax::Highlight::Engine::Kate::Template'); |
20 | |
21 | sub new { |
22 | my $proto = shift; |
23 | my $class = ref($proto) || $proto; |
24 | my $self = $class->SUPER::new(@_); |
25 | $self->attributes({ |
26 | 'Built-in' => 'Keyword', |
27 | 'Comment' => 'Comment', |
28 | 'Directive' => 'Keyword', |
29 | 'Normal' => 'Normal', |
30 | 'Number' => 'DecVal', |
31 | 'Operator' => 'DataType', |
32 | 'String' => 'String', |
33 | 'Variable' => 'Others', |
34 | }); |
35 | $self->contextdata({ |
36 | 'atom' => { |
37 | callback => \&parseatom, |
38 | attribute => 'String', |
39 | }, |
40 | 'directive' => { |
41 | callback => \&parsedirective, |
42 | attribute => 'Directive', |
43 | }, |
44 | 'entityrelations' => { |
45 | callback => \&parseentityrelations, |
46 | attribute => 'Normal', |
47 | }, |
48 | 'multiline comment' => { |
49 | callback => \&parsemultilinecomment, |
50 | attribute => 'Comment', |
51 | }, |
52 | 'normal' => { |
53 | callback => \&parsenormal, |
54 | attribute => 'Normal', |
55 | }, |
56 | 'single line comment' => { |
57 | callback => \&parsesinglelinecomment, |
58 | attribute => 'Comment', |
59 | lineending => '#pop', |
60 | }, |
61 | 'string' => { |
62 | callback => \&parsestring, |
63 | attribute => 'String', |
64 | }, |
65 | }); |
66 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
67 | $self->basecontext('normal'); |
68 | $self->keywordscase(1); |
69 | $self->initialize; |
70 | bless ($self, $class); |
71 | return $self; |
72 | } |
73 | |
74 | sub language { |
75 | return 'Logtalk'; |
76 | } |
77 | |
78 | sub parseatom { |
79 | my ($self, $text) = @_; |
80 | # attribute => 'String' |
81 | # char => ''' |
82 | # context => '#pop' |
83 | # type => 'DetectChar' |
84 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
85 | return 1 |
86 | } |
87 | return 0; |
88 | }; |
89 | |
90 | sub parsedirective { |
91 | my ($self, $text) = @_; |
92 | # String => '\b(category|object|protocol)(?=[(])' |
93 | # attribute => 'Directive' |
94 | # beginRegion => 'Entity' |
95 | # context => 'entityrelations' |
96 | # type => 'RegExpr' |
97 | if ($self->testRegExpr($text, '\\b(category|object|protocol)(?=[(])', 0, 0, 0, undef, 0, 'entityrelations', 'Directive')) { |
98 | return 1 |
99 | } |
100 | # String => '\bend_(category|object|protocol)[.]' |
101 | # attribute => 'Directive' |
102 | # context => '#pop' |
103 | # endRegion => 'Entity' |
104 | # type => 'RegExpr' |
105 | if ($self->testRegExpr($text, '\\bend_(category|object|protocol)[.]', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
106 | return 1 |
107 | } |
108 | # String => '\bp(ublic|r(otected|ivate))(?=[(])' |
109 | # attribute => 'Directive' |
110 | # context => '#pop' |
111 | # type => 'RegExpr' |
112 | if ($self->testRegExpr($text, '\\bp(ublic|r(otected|ivate))(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
113 | return 1 |
114 | } |
115 | # String => '\bencoding(?=[(])' |
116 | # attribute => 'Directive' |
117 | # context => '#pop' |
118 | # type => 'RegExpr' |
119 | if ($self->testRegExpr($text, '\\bencoding(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
120 | return 1 |
121 | } |
122 | # String => '\bin(fo|itialization)(?=[(])' |
123 | # attribute => 'Directive' |
124 | # context => '#pop' |
125 | # type => 'RegExpr' |
126 | if ($self->testRegExpr($text, '\\bin(fo|itialization)(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
127 | return 1 |
128 | } |
129 | # String => '\bdynamic[.]' |
130 | # attribute => 'Directive' |
131 | # context => '#pop' |
132 | # type => 'RegExpr' |
133 | if ($self->testRegExpr($text, '\\bdynamic[.]', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
134 | return 1 |
135 | } |
136 | # String => '\b(alias|d(ynamic|iscontiguous)|m(etapredicate|ode|ultifile))(?=[(])' |
137 | # attribute => 'Directive' |
138 | # context => '#pop' |
139 | # type => 'RegExpr' |
140 | if ($self->testRegExpr($text, '\\b(alias|d(ynamic|iscontiguous)|m(etapredicate|ode|ultifile))(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
141 | return 1 |
142 | } |
143 | # String => '\bop(?=[(])' |
144 | # attribute => 'Directive' |
145 | # context => '#pop' |
146 | # type => 'RegExpr' |
147 | if ($self->testRegExpr($text, '\\bop(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
148 | return 1 |
149 | } |
150 | # String => '\b(calls|uses)(?=[(])' |
151 | # attribute => 'Directive' |
152 | # context => '#pop' |
153 | # type => 'RegExpr' |
154 | if ($self->testRegExpr($text, '\\b(calls|uses)(?=[(])', 0, 0, 0, undef, 0, '#pop', 'Directive')) { |
155 | return 1 |
156 | } |
157 | return 0; |
158 | }; |
159 | |
160 | sub parseentityrelations { |
161 | my ($self, $text) = @_; |
162 | # String => '\b(extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])' |
163 | # attribute => 'Directive' |
164 | # context => '#stay' |
165 | # type => 'RegExpr' |
166 | if ($self->testRegExpr($text, '\\b(extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Directive')) { |
167 | return 1 |
168 | } |
169 | # attribute => 'Normal' |
170 | # char => ')' |
171 | # char1 => '.' |
172 | # context => 'normal' |
173 | # type => 'Detect2Chars' |
174 | if ($self->testDetect2Chars($text, ')', '.', 0, 0, 0, undef, 0, 'normal', 'Normal')) { |
175 | return 1 |
176 | } |
177 | return 0; |
178 | }; |
179 | |
180 | sub parsemultilinecomment { |
181 | my ($self, $text) = @_; |
182 | # attribute => 'Comment' |
183 | # char => '*' |
184 | # char1 => '/' |
185 | # context => '#pop' |
186 | # endRegion => 'Comment' |
187 | # type => 'Detect2Chars' |
188 | if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
189 | return 1 |
190 | } |
191 | return 0; |
192 | }; |
193 | |
194 | sub parsenormal { |
195 | my ($self, $text) = @_; |
196 | # String => '^\s*:-' |
197 | # attribute => 'Normal' |
198 | # context => 'directive' |
199 | # type => 'RegExpr' |
200 | if ($self->testRegExpr($text, '^\\s*:-', 0, 0, 0, undef, 0, 'directive', 'Normal')) { |
201 | return 1 |
202 | } |
203 | # String => '\b(after|before)(?=[(])' |
204 | # attribute => 'Built-in' |
205 | # context => '#stay' |
206 | # type => 'RegExpr' |
207 | if ($self->testRegExpr($text, '\\b(after|before)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
208 | return 1 |
209 | } |
210 | # String => '\b(parameter|this|se(lf|nder))(?=[(])' |
211 | # attribute => 'Built-in' |
212 | # context => '#stay' |
213 | # type => 'RegExpr' |
214 | if ($self->testRegExpr($text, '\\b(parameter|this|se(lf|nder))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
215 | return 1 |
216 | } |
217 | # String => '\b(current_predicate|predicate_property)(?=[(])' |
218 | # attribute => 'Built-in' |
219 | # context => '#stay' |
220 | # type => 'RegExpr' |
221 | if ($self->testRegExpr($text, '\\b(current_predicate|predicate_property)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
222 | return 1 |
223 | } |
224 | # String => '\b(expand_term|phrase)(?=[(])' |
225 | # attribute => 'Built-in' |
226 | # context => '#stay' |
227 | # type => 'RegExpr' |
228 | if ($self->testRegExpr($text, '\\b(expand_term|phrase)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
229 | return 1 |
230 | } |
231 | # String => '\b(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])' |
232 | # attribute => 'Built-in' |
233 | # context => '#stay' |
234 | # type => 'RegExpr' |
235 | if ($self->testRegExpr($text, '\\b(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
236 | return 1 |
237 | } |
238 | # String => '\b(object|protocol|category)_property(?=[(])' |
239 | # attribute => 'Built-in' |
240 | # context => '#stay' |
241 | # type => 'RegExpr' |
242 | if ($self->testRegExpr($text, '\\b(object|protocol|category)_property(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
243 | return 1 |
244 | } |
245 | # String => '\bextends_(object|protocol)(?=[(])' |
246 | # attribute => 'Built-in' |
247 | # context => '#stay' |
248 | # type => 'RegExpr' |
249 | if ($self->testRegExpr($text, '\\bextends_(object|protocol)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
250 | return 1 |
251 | } |
252 | # String => '\bimplements_protocol(?=[(])' |
253 | # attribute => 'Built-in' |
254 | # context => '#stay' |
255 | # type => 'RegExpr' |
256 | if ($self->testRegExpr($text, '\\bimplements_protocol(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
257 | return 1 |
258 | } |
259 | # String => '\b(instantiates|specializes)_class(?=[(])' |
260 | # attribute => 'Built-in' |
261 | # context => '#stay' |
262 | # type => 'RegExpr' |
263 | if ($self->testRegExpr($text, '\\b(instantiates|specializes)_class(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
264 | return 1 |
265 | } |
266 | # String => '\bimports_category(?=[(])' |
267 | # attribute => 'Built-in' |
268 | # context => '#stay' |
269 | # type => 'RegExpr' |
270 | if ($self->testRegExpr($text, '\\bimports_category(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
271 | return 1 |
272 | } |
273 | # String => '\b(current_event|(abolish|define)_events)(?=[(])' |
274 | # attribute => 'Built-in' |
275 | # context => '#stay' |
276 | # type => 'RegExpr' |
277 | if ($self->testRegExpr($text, '\\b(current_event|(abolish|define)_events)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
278 | return 1 |
279 | } |
280 | # String => '\b(current|set)_logtalk_flag(?=[(])' |
281 | # attribute => 'Built-in' |
282 | # context => '#stay' |
283 | # type => 'RegExpr' |
284 | if ($self->testRegExpr($text, '\\b(current|set)_logtalk_flag(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
285 | return 1 |
286 | } |
287 | # String => '\blogtalk_(compile|l(ibrary_path|oad))(?=[(])' |
288 | # attribute => 'Built-in' |
289 | # context => '#stay' |
290 | # type => 'RegExpr' |
291 | if ($self->testRegExpr($text, '\\blogtalk_(compile|l(ibrary_path|oad))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
292 | return 1 |
293 | } |
294 | # String => '\b(clause|retract(all)?)(?=[(])' |
295 | # attribute => 'Built-in' |
296 | # context => '#stay' |
297 | # type => 'RegExpr' |
298 | if ($self->testRegExpr($text, '\\b(clause|retract(all)?)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
299 | return 1 |
300 | } |
301 | # String => '\ba(bolish|ssert(a|z))(?=[(])' |
302 | # attribute => 'Built-in' |
303 | # context => '#stay' |
304 | # type => 'RegExpr' |
305 | if ($self->testRegExpr($text, '\\ba(bolish|ssert(a|z))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
306 | return 1 |
307 | } |
308 | # String => '\b(ca(ll|tch)|throw)(?=[(])' |
309 | # attribute => 'Built-in' |
310 | # context => '#stay' |
311 | # type => 'RegExpr' |
312 | if ($self->testRegExpr($text, '\\b(ca(ll|tch)|throw)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
313 | return 1 |
314 | } |
315 | # String => '\b(fail|true)\b' |
316 | # attribute => 'Built-in' |
317 | # context => '#stay' |
318 | # type => 'RegExpr' |
319 | if ($self->testRegExpr($text, '\\b(fail|true)\\b', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
320 | return 1 |
321 | } |
322 | # String => '\b((bag|set)of|f(ind|or)all)(?=[(])' |
323 | # attribute => 'Built-in' |
324 | # context => '#stay' |
325 | # type => 'RegExpr' |
326 | if ($self->testRegExpr($text, '\\b((bag|set)of|f(ind|or)all)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
327 | return 1 |
328 | } |
329 | # String => '\bunify_with_occurs_check(?=[(])' |
330 | # attribute => 'Built-in' |
331 | # context => '#stay' |
332 | # type => 'RegExpr' |
333 | if ($self->testRegExpr($text, '\\bunify_with_occurs_check(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
334 | return 1 |
335 | } |
336 | # String => '\b(functor|arg|copy_term)(?=[(])' |
337 | # attribute => 'Built-in' |
338 | # context => '#stay' |
339 | # type => 'RegExpr' |
340 | if ($self->testRegExpr($text, '\\b(functor|arg|copy_term)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
341 | return 1 |
342 | } |
343 | # String => '\b(rem|mod|abs|sign)(?=[(])' |
344 | # attribute => 'Built-in' |
345 | # context => '#stay' |
346 | # type => 'RegExpr' |
347 | if ($self->testRegExpr($text, '\\b(rem|mod|abs|sign)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
348 | return 1 |
349 | } |
350 | # String => '\bfloat(_(integer|fractional)_part)?(?=[(])' |
351 | # attribute => 'Built-in' |
352 | # context => '#stay' |
353 | # type => 'RegExpr' |
354 | if ($self->testRegExpr($text, '\\bfloat(_(integer|fractional)_part)?(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
355 | return 1 |
356 | } |
357 | # String => '\b(floor|truncate|round|ceiling)(?=[(])' |
358 | # attribute => 'Built-in' |
359 | # context => '#stay' |
360 | # type => 'RegExpr' |
361 | if ($self->testRegExpr($text, '\\b(floor|truncate|round|ceiling)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
362 | return 1 |
363 | } |
364 | # String => '\b(cos|atan|exp|log|s(in|qrt))(?=[(])' |
365 | # attribute => 'Built-in' |
366 | # context => '#stay' |
367 | # type => 'RegExpr' |
368 | if ($self->testRegExpr($text, '\\b(cos|atan|exp|log|s(in|qrt))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
369 | return 1 |
370 | } |
371 | # String => '\b(var|atom(ic)?|integer|float|compound|n(onvar|umber))(?=[(])' |
372 | # attribute => 'Built-in' |
373 | # context => '#stay' |
374 | # type => 'RegExpr' |
375 | if ($self->testRegExpr($text, '\\b(var|atom(ic)?|integer|float|compound|n(onvar|umber))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
376 | return 1 |
377 | } |
378 | # String => '\b(current|set)_(in|out)put(?=[(])' |
379 | # attribute => 'Built-in' |
380 | # context => '#stay' |
381 | # type => 'RegExpr' |
382 | if ($self->testRegExpr($text, '\\b(current|set)_(in|out)put(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
383 | return 1 |
384 | } |
385 | # String => '\b(open|close)(?=[(])' |
386 | # attribute => 'Built-in' |
387 | # context => '#stay' |
388 | # type => 'RegExpr' |
389 | if ($self->testRegExpr($text, '\\b(open|close)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
390 | return 1 |
391 | } |
392 | # String => '\bflush_output(?=[(])' |
393 | # attribute => 'Built-in' |
394 | # context => '#stay' |
395 | # type => 'RegExpr' |
396 | if ($self->testRegExpr($text, '\\bflush_output(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
397 | return 1 |
398 | } |
399 | # String => '\bflush_output\b' |
400 | # attribute => 'Built-in' |
401 | # context => '#stay' |
402 | # type => 'RegExpr' |
403 | if ($self->testRegExpr($text, '\\bflush_output\\b', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
404 | return 1 |
405 | } |
406 | # String => '\b(stream_property|at_end_of_stream|set_stream_position)(?=[(])' |
407 | # attribute => 'Built-in' |
408 | # context => '#stay' |
409 | # type => 'RegExpr' |
410 | if ($self->testRegExpr($text, '\\b(stream_property|at_end_of_stream|set_stream_position)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
411 | return 1 |
412 | } |
413 | # String => '\b(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])' |
414 | # attribute => 'Built-in' |
415 | # context => '#stay' |
416 | # type => 'RegExpr' |
417 | if ($self->testRegExpr($text, '\\b(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
418 | return 1 |
419 | } |
420 | # String => '\bnl\b' |
421 | # attribute => 'Built-in' |
422 | # context => '#stay' |
423 | # type => 'RegExpr' |
424 | if ($self->testRegExpr($text, '\\bnl\\b', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
425 | return 1 |
426 | } |
427 | # String => '\bread(_term)?(?=[(])' |
428 | # attribute => 'Built-in' |
429 | # context => '#stay' |
430 | # type => 'RegExpr' |
431 | if ($self->testRegExpr($text, '\\bread(_term)?(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
432 | return 1 |
433 | } |
434 | # String => '\bwrite(q|_(canonical|term))?(?=[(])' |
435 | # attribute => 'Built-in' |
436 | # context => '#stay' |
437 | # type => 'RegExpr' |
438 | if ($self->testRegExpr($text, '\\bwrite(q|_(canonical|term))?(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
439 | return 1 |
440 | } |
441 | # String => '\b(current_)?op(?=[(])' |
442 | # attribute => 'Built-in' |
443 | # context => '#stay' |
444 | # type => 'RegExpr' |
445 | if ($self->testRegExpr($text, '\\b(current_)?op(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
446 | return 1 |
447 | } |
448 | # String => '\b(current_)?char_conversion(?=[(])' |
449 | # attribute => 'Built-in' |
450 | # context => '#stay' |
451 | # type => 'RegExpr' |
452 | if ($self->testRegExpr($text, '\\b(current_)?char_conversion(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
453 | return 1 |
454 | } |
455 | # String => '\batom_(length|c(hars|o(ncat|des)))(?=[(])' |
456 | # attribute => 'Built-in' |
457 | # context => '#stay' |
458 | # type => 'RegExpr' |
459 | if ($self->testRegExpr($text, '\\batom_(length|c(hars|o(ncat|des)))(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
460 | return 1 |
461 | } |
462 | # String => '\b(char_code|sub_atom)(?=[(])' |
463 | # attribute => 'Built-in' |
464 | # context => '#stay' |
465 | # type => 'RegExpr' |
466 | if ($self->testRegExpr($text, '\\b(char_code|sub_atom)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
467 | return 1 |
468 | } |
469 | # String => '\bnumber_c(hars|odes)(?=[(])' |
470 | # attribute => 'Built-in' |
471 | # context => '#stay' |
472 | # type => 'RegExpr' |
473 | if ($self->testRegExpr($text, '\\bnumber_c(hars|odes)(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
474 | return 1 |
475 | } |
476 | # String => '\b(set|current)_prolog_flag(?=[(])' |
477 | # attribute => 'Built-in' |
478 | # context => '#stay' |
479 | # type => 'RegExpr' |
480 | if ($self->testRegExpr($text, '\\b(set|current)_prolog_flag(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
481 | return 1 |
482 | } |
483 | # String => '\bhalt\b' |
484 | # attribute => 'Built-in' |
485 | # context => '#stay' |
486 | # type => 'RegExpr' |
487 | if ($self->testRegExpr($text, '\\bhalt\\b', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
488 | return 1 |
489 | } |
490 | # String => '\bhalt(?=[(])' |
491 | # attribute => 'Built-in' |
492 | # context => '#stay' |
493 | # type => 'RegExpr' |
494 | if ($self->testRegExpr($text, '\\bhalt(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
495 | return 1 |
496 | } |
497 | # String => '\b[A-Z_]\w*' |
498 | # attribute => 'Variable' |
499 | # context => '#stay' |
500 | # type => 'RegExpr' |
501 | if ($self->testRegExpr($text, '\\b[A-Z_]\\w*', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
502 | return 1 |
503 | } |
504 | # attribute => 'Comment' |
505 | # char => '%' |
506 | # context => 'single line comment' |
507 | # type => 'DetectChar' |
508 | if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'single line comment', 'Comment')) { |
509 | return 1 |
510 | } |
511 | # attribute => 'Comment' |
512 | # beginRegion => 'Comment' |
513 | # char => '/' |
514 | # char1 => '*' |
515 | # context => 'multiline comment' |
516 | # type => 'Detect2Chars' |
517 | if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'multiline comment', 'Comment')) { |
518 | return 1 |
519 | } |
520 | # attribute => 'String' |
521 | # char => '"' |
522 | # context => 'string' |
523 | # type => 'DetectChar' |
524 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) { |
525 | return 1 |
526 | } |
527 | # attribute => 'String' |
528 | # char => ''' |
529 | # context => 'atom' |
530 | # type => 'DetectChar' |
531 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'atom', 'String')) { |
532 | return 1 |
533 | } |
534 | # String => '0'.' |
535 | # attribute => 'Number' |
536 | # context => '#stay' |
537 | # type => 'RegExpr' |
538 | if ($self->testRegExpr($text, '0\'.', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
539 | return 1 |
540 | } |
541 | # String => '0b[0-1]+' |
542 | # attribute => 'Number' |
543 | # context => '#stay' |
544 | # type => 'RegExpr' |
545 | if ($self->testRegExpr($text, '0b[0-1]+', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
546 | return 1 |
547 | } |
548 | # String => '0o[0-7]+' |
549 | # attribute => 'Number' |
550 | # context => '#stay' |
551 | # type => 'RegExpr' |
552 | if ($self->testRegExpr($text, '0o[0-7]+', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
553 | return 1 |
554 | } |
555 | # String => '0x[0-9a-fA-F]+' |
556 | # attribute => 'Number' |
557 | # context => '#stay' |
558 | # type => 'RegExpr' |
559 | if ($self->testRegExpr($text, '0x[0-9a-fA-F]+', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
560 | return 1 |
561 | } |
562 | # String => '\d+(\.\d+)?([eE]([-+])?\d+)?' |
563 | # attribute => 'Number' |
564 | # context => '#stay' |
565 | # type => 'RegExpr' |
566 | if ($self->testRegExpr($text, '\\d+(\\.\\d+)?([eE]([-+])?\\d+)?', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
567 | return 1 |
568 | } |
569 | # attribute => 'Operator' |
570 | # char => ':' |
571 | # char1 => ':' |
572 | # context => '#stay' |
573 | # type => 'Detect2Chars' |
574 | if ($self->testDetect2Chars($text, ':', ':', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
575 | return 1 |
576 | } |
577 | # attribute => 'Operator' |
578 | # char => '^' |
579 | # char1 => '^' |
580 | # context => '#stay' |
581 | # type => 'Detect2Chars' |
582 | if ($self->testDetect2Chars($text, '^', '^', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
583 | return 1 |
584 | } |
585 | # attribute => 'Operator' |
586 | # beginRegion => 'external' |
587 | # char => '{' |
588 | # context => '#stay' |
589 | # type => 'DetectChar' |
590 | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
591 | return 1 |
592 | } |
593 | # attribute => 'Operator' |
594 | # char => '}' |
595 | # context => '#stay' |
596 | # endRegion => 'external' |
597 | # type => 'DetectChar' |
598 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
599 | return 1 |
600 | } |
601 | # String => '\bonce(?=[(])' |
602 | # attribute => 'Built-in' |
603 | # context => '#stay' |
604 | # type => 'RegExpr' |
605 | if ($self->testRegExpr($text, '\\bonce(?=[(])', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
606 | return 1 |
607 | } |
608 | # String => '\brepeat\b' |
609 | # attribute => 'Built-in' |
610 | # context => '#stay' |
611 | # type => 'RegExpr' |
612 | if ($self->testRegExpr($text, '\\brepeat\\b', 0, 0, 0, undef, 0, '#stay', 'Built-in')) { |
613 | return 1 |
614 | } |
615 | # attribute => 'Operator' |
616 | # char => '>' |
617 | # char1 => '>' |
618 | # context => '#stay' |
619 | # type => 'Detect2Chars' |
620 | if ($self->testDetect2Chars($text, '>', '>', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
621 | return 1 |
622 | } |
623 | # attribute => 'Operator' |
624 | # char => '<' |
625 | # char1 => '<' |
626 | # context => '#stay' |
627 | # type => 'Detect2Chars' |
628 | if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
629 | return 1 |
630 | } |
631 | # attribute => 'Operator' |
632 | # char => '/' |
633 | # char1 => '\' |
634 | # context => '#stay' |
635 | # type => 'Detect2Chars' |
636 | if ($self->testDetect2Chars($text, '/', '\\', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
637 | return 1 |
638 | } |
639 | # attribute => 'Operator' |
640 | # char => '\' |
641 | # char1 => '/' |
642 | # context => '#stay' |
643 | # type => 'Detect2Chars' |
644 | if ($self->testDetect2Chars($text, '\\', '/', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
645 | return 1 |
646 | } |
647 | # attribute => 'Operator' |
648 | # char => '\' |
649 | # char1 => '\' |
650 | # context => '#stay' |
651 | # type => 'Detect2Chars' |
652 | if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
653 | return 1 |
654 | } |
655 | # String => '\bis\b' |
656 | # attribute => 'Operator' |
657 | # context => '#stay' |
658 | # type => 'RegExpr' |
659 | if ($self->testRegExpr($text, '\\bis\\b', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
660 | return 1 |
661 | } |
662 | # String => '=:=' |
663 | # attribute => 'Operator' |
664 | # context => '#stay' |
665 | # type => 'StringDetect' |
666 | if ($self->testStringDetect($text, '=:=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
667 | return 1 |
668 | } |
669 | # String => '=\=' |
670 | # attribute => 'Operator' |
671 | # context => '#stay' |
672 | # type => 'StringDetect' |
673 | if ($self->testStringDetect($text, '=\\=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
674 | return 1 |
675 | } |
676 | # attribute => 'Operator' |
677 | # char => '<' |
678 | # context => '#stay' |
679 | # type => 'DetectChar' |
680 | if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
681 | return 1 |
682 | } |
683 | # attribute => 'Operator' |
684 | # char => '=' |
685 | # char1 => '<' |
686 | # context => '#stay' |
687 | # type => 'Detect2Chars' |
688 | if ($self->testDetect2Chars($text, '=', '<', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
689 | return 1 |
690 | } |
691 | # attribute => 'Operator' |
692 | # char => '>' |
693 | # context => '#stay' |
694 | # type => 'DetectChar' |
695 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
696 | return 1 |
697 | } |
698 | # attribute => 'Operator' |
699 | # char => '>' |
700 | # char1 => '=' |
701 | # context => '#stay' |
702 | # type => 'Detect2Chars' |
703 | if ($self->testDetect2Chars($text, '>', '=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
704 | return 1 |
705 | } |
706 | # String => '=..' |
707 | # attribute => 'Operator' |
708 | # context => '#stay' |
709 | # type => 'StringDetect' |
710 | if ($self->testStringDetect($text, '=..', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
711 | return 1 |
712 | } |
713 | # attribute => 'Operator' |
714 | # char => '=' |
715 | # context => '#stay' |
716 | # type => 'DetectChar' |
717 | if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
718 | return 1 |
719 | } |
720 | # attribute => 'Operator' |
721 | # char => '\' |
722 | # char1 => '=' |
723 | # context => '#stay' |
724 | # type => 'Detect2Chars' |
725 | if ($self->testDetect2Chars($text, '\\', '=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
726 | return 1 |
727 | } |
728 | # attribute => 'Operator' |
729 | # char => '=' |
730 | # char1 => '=' |
731 | # context => '#stay' |
732 | # type => 'Detect2Chars' |
733 | if ($self->testDetect2Chars($text, '=', '=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
734 | return 1 |
735 | } |
736 | # String => '\==' |
737 | # attribute => 'Operator' |
738 | # context => '#stay' |
739 | # type => 'StringDetect' |
740 | if ($self->testStringDetect($text, '\\==', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
741 | return 1 |
742 | } |
743 | # String => '@=<' |
744 | # attribute => 'Operator' |
745 | # context => '#stay' |
746 | # type => 'StringDetect' |
747 | if ($self->testStringDetect($text, '@=<', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
748 | return 1 |
749 | } |
750 | # attribute => 'Operator' |
751 | # char => '@' |
752 | # char1 => '<' |
753 | # context => '#stay' |
754 | # type => 'Detect2Chars' |
755 | if ($self->testDetect2Chars($text, '@', '<', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
756 | return 1 |
757 | } |
758 | # String => '@>=' |
759 | # attribute => 'Operator' |
760 | # context => '#stay' |
761 | # type => 'StringDetect' |
762 | if ($self->testStringDetect($text, '@>=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
763 | return 1 |
764 | } |
765 | # attribute => 'Operator' |
766 | # char => '@' |
767 | # char1 => '>' |
768 | # context => '#stay' |
769 | # type => 'Detect2Chars' |
770 | if ($self->testDetect2Chars($text, '@', '>', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
771 | return 1 |
772 | } |
773 | # attribute => 'Operator' |
774 | # char => '/' |
775 | # char1 => '/' |
776 | # context => '#stay' |
777 | # type => 'Detect2Chars' |
778 | if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
779 | return 1 |
780 | } |
781 | # String => '+-*/' |
782 | # attribute => 'Operator' |
783 | # context => '#stay' |
784 | # type => 'AnyChar' |
785 | if ($self->testAnyChar($text, '+-*/', 0, 0, undef, 0, '#stay', 'Operator')) { |
786 | return 1 |
787 | } |
788 | # String => '\b(mod|rem)\b' |
789 | # attribute => 'Operator' |
790 | # context => '#stay' |
791 | # type => 'RegExpr' |
792 | if ($self->testRegExpr($text, '\\b(mod|rem)\\b', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
793 | return 1 |
794 | } |
795 | # attribute => 'Operator' |
796 | # char => '*' |
797 | # char1 => '*' |
798 | # context => '#stay' |
799 | # type => 'Detect2Chars' |
800 | if ($self->testDetect2Chars($text, '*', '*', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
801 | return 1 |
802 | } |
803 | # String => '-->' |
804 | # attribute => 'Operator' |
805 | # context => '#stay' |
806 | # type => 'StringDetect' |
807 | if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
808 | return 1 |
809 | } |
810 | # String => '!;' |
811 | # attribute => 'Operator' |
812 | # context => '#stay' |
813 | # type => 'AnyChar' |
814 | if ($self->testAnyChar($text, '!;', 0, 0, undef, 0, '#stay', 'Operator')) { |
815 | return 1 |
816 | } |
817 | # attribute => 'Operator' |
818 | # char => '-' |
819 | # char1 => '>' |
820 | # context => '#stay' |
821 | # type => 'Detect2Chars' |
822 | if ($self->testDetect2Chars($text, '-', '>', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
823 | return 1 |
824 | } |
825 | # attribute => 'Operator' |
826 | # char => '\' |
827 | # char1 => '+' |
828 | # context => '#stay' |
829 | # type => 'Detect2Chars' |
830 | if ($self->testDetect2Chars($text, '\\', '+', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
831 | return 1 |
832 | } |
833 | # String => '?@' |
834 | # attribute => 'Operator' |
835 | # context => '#stay' |
836 | # type => 'AnyChar' |
837 | if ($self->testAnyChar($text, '?@', 0, 0, undef, 0, '#stay', 'Operator')) { |
838 | return 1 |
839 | } |
840 | # attribute => 'Normal' |
841 | # char => ':' |
842 | # char1 => '-' |
843 | # context => '#stay' |
844 | # firstNonSpace => 'false' |
845 | # type => 'Detect2Chars' |
846 | if ($self->testDetect2Chars($text, ':', '-', 0, 0, 0, undef, 0, '#stay', 'Normal')) { |
847 | return 1 |
848 | } |
849 | # String => '\b[a-z]\w*' |
850 | # attribute => 'Normal' |
851 | # context => '#stay' |
852 | # type => 'RegExpr' |
853 | if ($self->testRegExpr($text, '\\b[a-z]\\w*', 0, 0, 0, undef, 0, '#stay', 'Normal')) { |
854 | return 1 |
855 | } |
856 | return 0; |
857 | }; |
858 | |
859 | sub parsesinglelinecomment { |
860 | my ($self, $text) = @_; |
861 | return 0; |
862 | }; |
863 | |
864 | sub parsestring { |
865 | my ($self, $text) = @_; |
866 | # attribute => 'String' |
867 | # char => '"' |
868 | # context => '#pop' |
869 | # type => 'DetectChar' |
870 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
871 | return 1 |
872 | } |
873 | return 0; |
874 | }; |
875 | |
876 | |
877 | 1; |
878 | |
879 | __END__ |
880 | |
881 | =head1 NAME |
882 | |
883 | Syntax::Highlight::Engine::Kate::Logtalk - a Plugin for Logtalk syntax highlighting |
884 | |
885 | =head1 SYNOPSIS |
886 | |
887 | require Syntax::Highlight::Engine::Kate::Logtalk; |
888 | my $sh = new Syntax::Highlight::Engine::Kate::Logtalk([ |
889 | ]); |
890 | |
891 | =head1 DESCRIPTION |
892 | |
893 | Syntax::Highlight::Engine::Kate::Logtalk is a plugin module that provides syntax highlighting |
894 | for Logtalk to the Syntax::Haghlight::Engine::Kate highlighting engine. |
895 | |
896 | This code is generated from the syntax definition files used |
897 | by the Kate project. |
898 | It works quite fine, but can use refinement and optimization. |
899 | |
900 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
901 | |
902 | =cut |
903 | |
904 | =head1 AUTHOR |
905 | |
906 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
907 | |
908 | =cut |
909 | |
910 | =head1 BUGS |
911 | |
912 | Unknown. If you find any, please contact the author |
913 | |
914 | =cut |
915 | |