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 'ilerpg.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.03 |
9 | #kate version 2.1 |
10 | #generated: Sun Feb 3 22:02:05 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::ILERPG; |
13 | |
14 | our $VERSION = '0.06'; |
15 | |
16 | use strict; |
17 | use warnings; |
18 | use base('Syntax::Highlight::Engine::Kate::Template'); |
19 | |
20 | sub new { |
21 | my $proto = shift; |
22 | my $class = ref($proto) || $proto; |
23 | my $self = $class->SUPER::new(@_); |
24 | $self->attributes({ |
25 | 'Base-N' => 'BaseN', |
26 | 'Biff' => 'Keyword', |
27 | 'BoldComment' => 'Alert', |
28 | 'Char' => 'Char', |
29 | 'Comment' => 'Comment', |
30 | 'Constant' => 'DataType', |
31 | 'Decimal' => 'DecVal', |
32 | 'Directive' => 'Others', |
33 | 'DivideComment' => 'Alert', |
34 | 'Fill' => 'Reserved', |
35 | 'Float' => 'Float', |
36 | 'Hex' => 'BaseN', |
37 | 'Keyword' => 'Keyword', |
38 | 'Normal Text' => 'Normal', |
39 | 'Octal' => 'BaseN', |
40 | 'RegExpr' => 'BaseN', |
41 | 'Symbol' => 'Normal', |
42 | }); |
43 | $self->listAdd('biffs', |
44 | 'ABS', |
45 | 'ADDR', |
46 | 'CHAR', |
47 | 'DEC', |
48 | 'DECH', |
49 | 'DECPOS', |
50 | 'EDITC', |
51 | 'EDITFLT', |
52 | 'EDITW', |
53 | 'ELEM', |
54 | 'EOF', |
55 | 'EQUAL', |
56 | 'ERROR', |
57 | 'FLOAT', |
58 | 'FOUND', |
59 | 'INT', |
60 | 'INTH', |
61 | 'LEN', |
62 | 'NULLIND', |
63 | 'OPEN', |
64 | 'PADDR', |
65 | 'PARMS', |
66 | 'REPLACE', |
67 | 'SCAN', |
68 | 'SIZE', |
69 | 'STATUS', |
70 | 'STR', |
71 | 'SUBST', |
72 | 'TRIM', |
73 | 'TRIML', |
74 | 'TRIMR', |
75 | 'UNS', |
76 | 'UNSH', |
77 | ); |
78 | $self->listAdd('opcodes', |
79 | '*BLANKS', |
80 | 'ACQ', |
81 | 'ADD', |
82 | 'ADDDUR', |
83 | 'ALLOC', |
84 | 'AND', |
85 | 'ANDEQ', |
86 | 'ANDGE', |
87 | 'ANDGT', |
88 | 'ANDLE', |
89 | 'ANDLT', |
90 | 'ANDNE', |
91 | 'BEGSR', |
92 | 'BITOFF', |
93 | 'BITON', |
94 | 'CAB', |
95 | 'CABEQ', |
96 | 'CABGE', |
97 | 'CABGT', |
98 | 'CABLE', |
99 | 'CABLT', |
100 | 'CABNE', |
101 | 'CALL', |
102 | 'CALLB', |
103 | 'CALLP', |
104 | 'CAS', |
105 | 'CASEQ', |
106 | 'CASGE', |
107 | 'CASGT', |
108 | 'CASLE', |
109 | 'CASLT', |
110 | 'CASNE', |
111 | 'CAT', |
112 | 'CHAIN', |
113 | 'CHECK', |
114 | 'CHECKR', |
115 | 'CLEAR', |
116 | 'CLOSE', |
117 | 'COMMIT', |
118 | 'COMP', |
119 | 'DEALLOC', |
120 | 'DEFINE', |
121 | 'DELETE', |
122 | 'DIV', |
123 | 'DO', |
124 | 'DOU', |
125 | 'DOUEQ', |
126 | 'DOUGE', |
127 | 'DOUGT', |
128 | 'DOULE', |
129 | 'DOULT', |
130 | 'DOUNE', |
131 | 'DOW', |
132 | 'DOWEQ', |
133 | 'DOWGE', |
134 | 'DOWGT', |
135 | 'DOWLE', |
136 | 'DOWLT', |
137 | 'DOWNE', |
138 | 'DSPLY', |
139 | 'DUMP', |
140 | 'ELSE', |
141 | 'END', |
142 | 'ENDCS', |
143 | 'ENDDO', |
144 | 'ENDIF', |
145 | 'ENDSL', |
146 | 'ENDSR', |
147 | 'EVAL', |
148 | 'EXCEPT', |
149 | 'EXFMT', |
150 | 'EXSR', |
151 | 'EXTRCT', |
152 | 'FEOD', |
153 | 'FORCE', |
154 | 'GOTO', |
155 | 'IF', |
156 | 'IFEQ', |
157 | 'IFGE', |
158 | 'IFGT', |
159 | 'IFLE', |
160 | 'IFLT', |
161 | 'IFNE', |
162 | 'IN', |
163 | 'ITER', |
164 | 'KFLD', |
165 | 'KLIST', |
166 | 'LEAVE', |
167 | 'LOOKUP', |
168 | 'MHHZO', |
169 | 'MHLZO', |
170 | 'MLHZO', |
171 | 'MLLZO', |
172 | 'MOVE', |
173 | 'MOVEA', |
174 | 'MOVEL', |
175 | 'MULT', |
176 | 'MVR', |
177 | 'NEXT', |
178 | 'OCCUR', |
179 | 'OPEN', |
180 | 'OR', |
181 | 'OREQ', |
182 | 'ORGE', |
183 | 'ORGT', |
184 | 'ORLE', |
185 | 'ORLT', |
186 | 'ORNE', |
187 | 'OTHER', |
188 | 'OUT', |
189 | 'PARM', |
190 | 'PLIST', |
191 | 'POST', |
192 | 'READ', |
193 | 'READC', |
194 | 'READE', |
195 | 'READP', |
196 | 'READPE', |
197 | 'REALLOC', |
198 | 'REL', |
199 | 'RESET', |
200 | 'RETURN', |
201 | 'ROLBK', |
202 | 'SCAN', |
203 | 'SELECT', |
204 | 'SETGT', |
205 | 'SETLL', |
206 | 'SETOFF', |
207 | 'SETON', |
208 | 'SHTDN', |
209 | 'SORTA', |
210 | 'SQRT', |
211 | 'SUB', |
212 | 'SUBDUR', |
213 | 'SUBST', |
214 | 'TAG', |
215 | 'TEST', |
216 | 'TESTB', |
217 | 'TESTN', |
218 | 'TESTZ', |
219 | 'TIME', |
220 | 'UNLOCK', |
221 | 'UPDATE', |
222 | 'WHEN', |
223 | 'WHENEQ', |
224 | 'WHENGE', |
225 | 'WHENGT', |
226 | 'WHENLE', |
227 | 'WHENLT', |
228 | 'WHENNR', |
229 | 'WRITE', |
230 | 'XFOOT', |
231 | 'XLATE', |
232 | 'Z-ADD', |
233 | 'Z-SUB', |
234 | ); |
235 | $self->contextdata({ |
236 | 'Default' => { |
237 | callback => \&parseDefault, |
238 | attribute => 'Normal Text', |
239 | }, |
240 | 'context1' => { |
241 | callback => \&parsecontext1, |
242 | attribute => 'Normal Text', |
243 | lineending => '#pop', |
244 | }, |
245 | 'context3' => { |
246 | callback => \&parsecontext3, |
247 | attribute => 'Comment', |
248 | lineending => '#pop', |
249 | }, |
250 | 'context4' => { |
251 | callback => \&parsecontext4, |
252 | attribute => 'Constant', |
253 | }, |
254 | 'context5' => { |
255 | callback => \&parsecontext5, |
256 | attribute => 'Constant', |
257 | }, |
258 | 'context6' => { |
259 | callback => \&parsecontext6, |
260 | attribute => 'Keyword', |
261 | lineending => '#pop#pop', |
262 | }, |
263 | 'context7' => { |
264 | callback => \&parsecontext7, |
265 | attribute => 'BoldComment', |
266 | lineending => 'Default', |
267 | }, |
268 | 'context8' => { |
269 | callback => \&parsecontext8, |
270 | attribute => 'Biff', |
271 | lineending => '#pop#pop#pop', |
272 | }, |
273 | }); |
274 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
275 | $self->basecontext('Default'); |
276 | $self->keywordscase(0); |
277 | $self->initialize; |
278 | bless ($self, $class); |
279 | return $self; |
280 | } |
281 | |
282 | sub language { |
283 | return 'ILERPG'; |
284 | } |
285 | |
286 | sub parseDefault { |
287 | my ($self, $text) = @_; |
288 | # String => '[POIHFDC ]?\*' |
289 | # attribute => 'Comment' |
290 | # context => 'context3' |
291 | # type => 'RegExpr' |
292 | if ($self->testRegExpr($text, '[POIHFDC ]?\\*', 0, 0, 0, undef, 0, 'context3', 'Comment')) { |
293 | return 1 |
294 | } |
295 | # String => 'POIHFDC' |
296 | # attribute => 'Keyword' |
297 | # context => 'context1' |
298 | # type => 'AnyChar' |
299 | if ($self->testAnyChar($text, 'POIHFDC', 0, 0, undef, 0, 'context1', 'Keyword')) { |
300 | return 1 |
301 | } |
302 | return 0; |
303 | }; |
304 | |
305 | sub parsecontext1 { |
306 | my ($self, $text) = @_; |
307 | # String => 'opcodes' |
308 | # attribute => 'Keyword' |
309 | # context => '#stay' |
310 | # type => 'keyword' |
311 | if ($self->testKeyword($text, 'opcodes', 0, undef, 0, '#stay', 'Keyword')) { |
312 | return 1 |
313 | } |
314 | # attribute => 'Biff' |
315 | # char => '%' |
316 | # context => 'context7' |
317 | # type => 'DetectChar' |
318 | if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'context7', 'Biff')) { |
319 | return 1 |
320 | } |
321 | # attribute => 'Constant' |
322 | # char => ''' |
323 | # context => 'context3' |
324 | # type => 'DetectChar' |
325 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'context3', 'Constant')) { |
326 | return 1 |
327 | } |
328 | # attribute => 'Float' |
329 | # context => '#stay' |
330 | # type => 'Float' |
331 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
332 | return 1 |
333 | } |
334 | # String => '[Xx]'[0-9a-fA-F]{2,}'' |
335 | # attribute => 'Hex' |
336 | # context => '#stay' |
337 | # type => 'RegExpr' |
338 | if ($self->testRegExpr($text, '[Xx]\'[0-9a-fA-F]{2,}\'', 0, 0, 0, undef, 0, '#stay', 'Hex')) { |
339 | return 1 |
340 | } |
341 | # attribute => 'Decimal' |
342 | # context => '#stay' |
343 | # items => 'ARRAY(0x1190f00)' |
344 | # type => 'Int' |
345 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
346 | # String => 'ULL' |
347 | # attribute => 'Decimal' |
348 | # context => '#stay' |
349 | # insensitive => 'TRUE' |
350 | # type => 'StringDetect' |
351 | if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
352 | return 1 |
353 | } |
354 | # String => 'LUL' |
355 | # attribute => 'Decimal' |
356 | # context => '#stay' |
357 | # insensitive => 'TRUE' |
358 | # type => 'StringDetect' |
359 | if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
360 | return 1 |
361 | } |
362 | # String => 'LLU' |
363 | # attribute => 'Decimal' |
364 | # context => '#stay' |
365 | # insensitive => 'TRUE' |
366 | # type => 'StringDetect' |
367 | if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
368 | return 1 |
369 | } |
370 | # String => 'UL' |
371 | # attribute => 'Decimal' |
372 | # context => '#stay' |
373 | # insensitive => 'TRUE' |
374 | # type => 'StringDetect' |
375 | if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
376 | return 1 |
377 | } |
378 | # String => 'LU' |
379 | # attribute => 'Decimal' |
380 | # context => '#stay' |
381 | # insensitive => 'TRUE' |
382 | # type => 'StringDetect' |
383 | if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
384 | return 1 |
385 | } |
386 | # String => 'LL' |
387 | # attribute => 'Decimal' |
388 | # context => '#stay' |
389 | # insensitive => 'TRUE' |
390 | # type => 'StringDetect' |
391 | if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
392 | return 1 |
393 | } |
394 | # String => 'U' |
395 | # attribute => 'Decimal' |
396 | # context => '#stay' |
397 | # insensitive => 'TRUE' |
398 | # type => 'StringDetect' |
399 | if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
400 | return 1 |
401 | } |
402 | # String => 'L' |
403 | # attribute => 'Decimal' |
404 | # context => '#stay' |
405 | # insensitive => 'TRUE' |
406 | # type => 'StringDetect' |
407 | if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
408 | return 1 |
409 | } |
410 | } |
411 | return 0; |
412 | }; |
413 | |
414 | sub parsecontext3 { |
415 | my ($self, $text) = @_; |
416 | # String => '\(*(FIXME|TODO)\)*' |
417 | # attribute => 'BoldComment' |
418 | # context => '#stay' |
419 | # type => 'RegExpr' |
420 | if ($self->testRegExpr($text, '\\(*(FIXME|TODO)\\)*', 0, 0, 0, undef, 0, '#stay', 'BoldComment')) { |
421 | return 1 |
422 | } |
423 | # String => '\(*(NOTE:)\)*' |
424 | # attribute => 'BoldComment' |
425 | # context => '#stay' |
426 | # type => 'RegExpr' |
427 | if ($self->testRegExpr($text, '\\(*(NOTE:)\\)*', 0, 0, 0, undef, 0, '#stay', 'BoldComment')) { |
428 | return 1 |
429 | } |
430 | # attribute => 'BoldComment' |
431 | # char => '!' |
432 | # context => 'context6' |
433 | # type => 'DetectChar' |
434 | if ($self->testDetectChar($text, '!', 0, 0, 0, undef, 0, 'context6', 'BoldComment')) { |
435 | return 1 |
436 | } |
437 | # String => '-|=' |
438 | # attribute => 'DivideComment' |
439 | # context => '#stay' |
440 | # type => 'RegExpr' |
441 | if ($self->testRegExpr($text, '-|=', 0, 0, 0, undef, 0, '#stay', 'DivideComment')) { |
442 | return 1 |
443 | } |
444 | return 0; |
445 | }; |
446 | |
447 | sub parsecontext4 { |
448 | my ($self, $text) = @_; |
449 | # attribute => 'Constant' |
450 | # char => ''' |
451 | # context => '#pop' |
452 | # type => 'DetectChar' |
453 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Constant')) { |
454 | return 1 |
455 | } |
456 | return 0; |
457 | }; |
458 | |
459 | sub parsecontext5 { |
460 | my ($self, $text) = @_; |
461 | # String => 'FHDICO' |
462 | # attribute => 'Normal Text' |
463 | # context => '#stay' |
464 | # type => 'AnyChar' |
465 | if ($self->testAnyChar($text, 'FHDICO', 0, 0, undef, 0, '#stay', 'Normal Text')) { |
466 | return 1 |
467 | } |
468 | # attribute => 'Constant' |
469 | # char => ' ' |
470 | # context => '#pop' |
471 | # type => 'DetectChar' |
472 | if ($self->testDetectChar($text, ' ', 0, 0, 0, undef, 0, '#pop', 'Constant')) { |
473 | return 1 |
474 | } |
475 | return 0; |
476 | }; |
477 | |
478 | sub parsecontext6 { |
479 | my ($self, $text) = @_; |
480 | return 0; |
481 | }; |
482 | |
483 | sub parsecontext7 { |
484 | my ($self, $text) = @_; |
485 | # attribute => 'BoldComment' |
486 | # char => '!' |
487 | # context => 'context3' |
488 | # type => 'DetectChar' |
489 | if ($self->testDetectChar($text, '!', 0, 0, 0, undef, 0, 'context3', 'BoldComment')) { |
490 | return 1 |
491 | } |
492 | return 0; |
493 | }; |
494 | |
495 | sub parsecontext8 { |
496 | my ($self, $text) = @_; |
497 | # String => 'biffs' |
498 | # attribute => 'Biff' |
499 | # context => '#pop#pop' |
500 | # type => 'keyword' |
501 | if ($self->testKeyword($text, 'biffs', 0, undef, 0, '#pop#pop', 'Biff')) { |
502 | return 1 |
503 | } |
504 | # attribute => 'Biff' |
505 | # char => ' ' |
506 | # context => '#pop#pop' |
507 | # type => 'DetectChar' |
508 | if ($self->testDetectChar($text, ' ', 0, 0, 0, undef, 0, '#pop#pop', 'Biff')) { |
509 | return 1 |
510 | } |
511 | return 0; |
512 | }; |
513 | |
514 | |
515 | 1; |
516 | |
517 | __END__ |
518 | |
519 | =head1 NAME |
520 | |
521 | Syntax::Highlight::Engine::Kate::ILERPG - a Plugin for ILERPG syntax highlighting |
522 | |
523 | =head1 SYNOPSIS |
524 | |
525 | require Syntax::Highlight::Engine::Kate::ILERPG; |
526 | my $sh = new Syntax::Highlight::Engine::Kate::ILERPG([ |
527 | ]); |
528 | |
529 | =head1 DESCRIPTION |
530 | |
531 | Syntax::Highlight::Engine::Kate::ILERPG is a plugin module that provides syntax highlighting |
532 | for ILERPG to the Syntax::Haghlight::Engine::Kate highlighting engine. |
533 | |
534 | This code is generated from the syntax definition files used |
535 | by the Kate project. |
536 | It works quite fine, but can use refinement and optimization. |
537 | |
538 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
539 | |
540 | =cut |
541 | |
542 | =head1 AUTHOR |
543 | |
544 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
545 | |
546 | =cut |
547 | |
548 | =head1 BUGS |
549 | |
550 | Unknown. If you find any, please contact the author |
551 | |
552 | =cut |
553 | |