Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Lex_Flex.pm
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 'lex.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7
8 #kate xml version 1.01
9 #kate version 2.4
10 #kate author Jan Villat (jan.villat@net2000.ch)
11 #generated: Sun Feb  3 22:02:05 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::Lex_Flex;
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       'Alert' => 'Alert',
27       'Backslash Code' => 'String',
28       'Comment' => 'Comment',
29       'Content-Type Delimiter' => 'BaseN',
30       'Definition' => 'DataType',
31       'Directive' => 'Keyword',
32       'Normal Text' => 'Normal',
33       'RegExpr' => 'String',
34    });
35    $self->contextdata({
36       'Action' => {
37          callback => \&parseAction,
38          attribute => 'Normal Text',
39          lineending => '#pop',
40          fallthrough => 'Action C',
41       },
42       'Action C' => {
43          callback => \&parseActionC,
44          attribute => 'Normal Text',
45          lineending => '#pop',
46       },
47       'Comment' => {
48          callback => \&parseComment,
49          attribute => 'Comment',
50       },
51       'Definition RegExpr' => {
52          callback => \&parseDefinitionRegExpr,
53          attribute => 'RegExpr',
54          lineending => '#pop',
55       },
56       'Definitions' => {
57          callback => \&parseDefinitions,
58          attribute => 'Normal Text',
59       },
60       'Detect C' => {
61          callback => \&parseDetectC,
62          attribute => 'Normal Text',
63       },
64       'Indented C' => {
65          callback => \&parseIndentedC,
66          attribute => 'Normal Text',
67          lineending => '#pop',
68       },
69       'Lex C Bloc' => {
70          callback => \&parseLexCBloc,
71          attribute => 'Normal Text',
72       },
73       'Lex Rule C Bloc' => {
74          callback => \&parseLexRuleCBloc,
75          attribute => 'Normal Text',
76       },
77       'Normal C Bloc' => {
78          callback => \&parseNormalCBloc,
79          attribute => 'Normal Text',
80       },
81       'Percent Command' => {
82          callback => \&parsePercentCommand,
83          attribute => 'Directive',
84          lineending => '#pop',
85       },
86       'Pre Start' => {
87          callback => \&parsePreStart,
88          attribute => 'Normal Text',
89       },
90       'RegExpr (' => {
91          callback => \&parseRegExprBo,
92          attribute => 'RegExpr',
93       },
94       'RegExpr Base' => {
95          callback => \&parseRegExprBase,
96          attribute => 'RegExpr',
97       },
98       'RegExpr Q' => {
99          callback => \&parseRegExprQ,
100          attribute => 'RegExpr',
101       },
102       'RegExpr [' => {
103          callback => \&parseRegExprSo,
104          attribute => 'RegExpr',
105       },
106       'RegExpr {' => {
107          callback => \&parseRegExprCo,
108          attribute => 'RegExpr',
109       },
110       'Rule RegExpr' => {
111          callback => \&parseRuleRegExpr,
112          attribute => 'RegExpr',
113          lineending => '#pop',
114       },
115       'Rules' => {
116          callback => \&parseRules,
117          attribute => 'Normal Text',
118          fallthrough => 'Rule RegExpr',
119       },
120       'Start Conditions Scope' => {
121          callback => \&parseStartConditionsScope,
122          attribute => 'Normal Text',
123          fallthrough => 'Rule RegExpr',
124       },
125       'User Code' => {
126          callback => \&parseUserCode,
127          attribute => 'Normal Text',
128       },
129    });
130    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
131    $self->basecontext('Pre Start');
132    $self->keywordscase(1);
133    $self->initialize;
134    bless ($self, $class);
135    return $self;
136 }
137
138 sub language {
139    return 'Lex/Flex';
140 }
141
142 sub parseAction {
143    my ($self, $text) = @_;
144    # String => '\|\s*$'
145    # attribute => 'Directive'
146    # context => '#stay'
147    # type => 'RegExpr'
148    if ($self->testRegExpr($text, '\\|\\s*$', 0, 0, 0, undef, 0, '#stay', 'Directive')) {
149       return 1
150    }
151    # attribute => 'Content-Type Delimiter'
152    # beginRegion => 'lexCbloc'
153    # char => '%'
154    # char1 => '{'
155    # context => 'Lex Rule C Bloc'
156    # type => 'Detect2Chars'
157    if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, 'Lex Rule C Bloc', 'Content-Type Delimiter')) {
158       return 1
159    }
160    return 0;
161 };
162
163 sub parseActionC {
164    my ($self, $text) = @_;
165    # attribute => 'Normal Text'
166    # beginRegion => 'bloc'
167    # char => '{'
168    # context => 'Normal C Bloc'
169    # type => 'DetectChar'
170    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
171       return 1
172    }
173    # attribute => 'Alert'
174    # char => '}'
175    # context => '#stay'
176    # type => 'DetectChar'
177    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
178       return 1
179    }
180    # context => '##C++'
181    # type => 'IncludeRules'
182    if ($self->includePlugin('C++', $text)) {
183       return 1
184    }
185    return 0;
186 };
187
188 sub parseComment {
189    my ($self, $text) = @_;
190    # attribute => 'Comment'
191    # char => '*'
192    # char1 => '/'
193    # context => '#pop'
194    # type => 'Detect2Chars'
195    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
196       return 1
197    }
198    return 0;
199 };
200
201 sub parseDefinitionRegExpr {
202    my ($self, $text) = @_;
203    # context => 'RegExpr Base'
204    # type => 'IncludeRules'
205    if ($self->includeRules('RegExpr Base', $text)) {
206       return 1
207    }
208    # String => '\S'
209    # attribute => 'RegExpr'
210    # context => '#stay'
211    # type => 'RegExpr'
212    if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
213       return 1
214    }
215    # String => '.*'
216    # attribute => 'Alert'
217    # context => '#stay'
218    # type => 'RegExpr'
219    if ($self->testRegExpr($text, '.*', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
220       return 1
221    }
222    return 0;
223 };
224
225 sub parseDefinitions {
226    my ($self, $text) = @_;
227    # context => 'Detect C'
228    # type => 'IncludeRules'
229    if ($self->includeRules('Detect C', $text)) {
230       return 1
231    }
232    # attribute => 'Content-Type Delimiter'
233    # beginRegion => 'rules'
234    # char => '%'
235    # char1 => '%'
236    # context => 'Rules'
237    # endRegion => 'definitions'
238    # type => 'Detect2Chars'
239    if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Rules', 'Content-Type Delimiter')) {
240       return 1
241    }
242    # attribute => 'Directive'
243    # char => '%'
244    # context => 'Percent Command'
245    # type => 'DetectChar'
246    if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Percent Command', 'Directive')) {
247       return 1
248    }
249    # attribute => 'Comment'
250    # char => '/'
251    # char1 => '*'
252    # column => '0'
253    # context => 'Comment'
254    # type => 'Detect2Chars'
255    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, 0, 0, 'Comment', 'Comment')) {
256       return 1
257    }
258    # String => '[A-Za-z_]\w*\s+'
259    # attribute => 'Definition'
260    # column => '0'
261    # context => 'Definition RegExpr'
262    # type => 'RegExpr'
263    if ($self->testRegExpr($text, '[A-Za-z_]\\w*\\s+', 0, 0, 0, 0, 0, 'Definition RegExpr', 'Definition')) {
264       return 1
265    }
266    return 0;
267 };
268
269 sub parseDetectC {
270    my ($self, $text) = @_;
271    # String => '^\s'
272    # attribute => 'Normal Text'
273    # context => 'Indented C'
274    # type => 'RegExpr'
275    if ($self->testRegExpr($text, '^\\s', 0, 0, 0, undef, 0, 'Indented C', 'Normal Text')) {
276       return 1
277    }
278    # attribute => 'Content-Type Delimiter'
279    # beginRegion => 'lexCbloc'
280    # char => '%'
281    # char1 => '{'
282    # column => '0'
283    # context => 'Lex C Bloc'
284    # type => 'Detect2Chars'
285    if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'Lex C Bloc', 'Content-Type Delimiter')) {
286       return 1
287    }
288    return 0;
289 };
290
291 sub parseIndentedC {
292    my ($self, $text) = @_;
293    # context => '##C++'
294    # type => 'IncludeRules'
295    if ($self->includePlugin('C++', $text)) {
296       return 1
297    }
298    return 0;
299 };
300
301 sub parseLexCBloc {
302    my ($self, $text) = @_;
303    # attribute => 'Content-Type Delimiter'
304    # char => '%'
305    # char1 => '}'
306    # column => '0'
307    # context => '#pop'
308    # endRegion => 'lexCbloc'
309    # type => 'Detect2Chars'
310    if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, 0, 0, '#pop', 'Content-Type Delimiter')) {
311       return 1
312    }
313    # context => '##C++'
314    # type => 'IncludeRules'
315    if ($self->includePlugin('C++', $text)) {
316       return 1
317    }
318    return 0;
319 };
320
321 sub parseLexRuleCBloc {
322    my ($self, $text) = @_;
323    # attribute => 'Content-Type Delimiter'
324    # char => '%'
325    # char1 => '}'
326    # context => '#pop'
327    # endRegion => 'lexCbloc'
328    # type => 'Detect2Chars'
329    if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) {
330       return 1
331    }
332    # context => '##C++'
333    # type => 'IncludeRules'
334    if ($self->includePlugin('C++', $text)) {
335       return 1
336    }
337    return 0;
338 };
339
340 sub parseNormalCBloc {
341    my ($self, $text) = @_;
342    # attribute => 'Normal Text'
343    # beginRegion => 'bloc'
344    # char => '{'
345    # context => 'Normal C Bloc'
346    # type => 'DetectChar'
347    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
348       return 1
349    }
350    # attribute => 'Normal Text'
351    # char => '}'
352    # context => '#pop'
353    # endRegion => 'bloc'
354    # type => 'DetectChar'
355    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
356       return 1
357    }
358    # context => '##C++'
359    # type => 'IncludeRules'
360    if ($self->includePlugin('C++', $text)) {
361       return 1
362    }
363    return 0;
364 };
365
366 sub parsePercentCommand {
367    my ($self, $text) = @_;
368    return 0;
369 };
370
371 sub parsePreStart {
372    my ($self, $text) = @_;
373    # String => '.'
374    # attribute => 'Normal Text'
375    # beginRegion => 'definitions'
376    # context => 'Definitions'
377    # lookAhead => 'true'
378    # type => 'RegExpr'
379    if ($self->testRegExpr($text, '.', 0, 0, 1, undef, 0, 'Definitions', 'Normal Text')) {
380       return 1
381    }
382    return 0;
383 };
384
385 sub parseRegExprBo {
386    my ($self, $text) = @_;
387    # context => 'RegExpr Base'
388    # type => 'IncludeRules'
389    if ($self->includeRules('RegExpr Base', $text)) {
390       return 1
391    }
392    # attribute => 'RegExpr'
393    # char => ')'
394    # context => '#pop'
395    # type => 'DetectChar'
396    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
397       return 1
398    }
399    # String => '.'
400    # attribute => 'RegExpr'
401    # context => '#stay'
402    # type => 'RegExpr'
403    if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
404       return 1
405    }
406    return 0;
407 };
408
409 sub parseRegExprBase {
410    my ($self, $text) = @_;
411    # String => '\\.'
412    # attribute => 'Backslash Code'
413    # context => '#stay'
414    # type => 'RegExpr'
415    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
416       return 1
417    }
418    # attribute => 'RegExpr'
419    # char => '('
420    # context => 'RegExpr ('
421    # type => 'DetectChar'
422    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'RegExpr (', 'RegExpr')) {
423       return 1
424    }
425    # attribute => 'RegExpr'
426    # char => '['
427    # context => 'RegExpr ['
428    # type => 'DetectChar'
429    if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'RegExpr [', 'RegExpr')) {
430       return 1
431    }
432    # attribute => 'RegExpr'
433    # char => '{'
434    # context => 'RegExpr {'
435    # type => 'DetectChar'
436    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RegExpr {', 'RegExpr')) {
437       return 1
438    }
439    # attribute => 'RegExpr'
440    # char => '"'
441    # context => 'RegExpr Q'
442    # type => 'DetectChar'
443    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'RegExpr Q', 'RegExpr')) {
444       return 1
445    }
446    return 0;
447 };
448
449 sub parseRegExprQ {
450    my ($self, $text) = @_;
451    # String => '\\.'
452    # attribute => 'Backslash Code'
453    # context => '#stay'
454    # type => 'RegExpr'
455    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
456       return 1
457    }
458    # attribute => 'RegExpr'
459    # char => '"'
460    # context => '#pop'
461    # type => 'DetectChar'
462    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
463       return 1
464    }
465    # String => '.'
466    # attribute => 'RegExpr'
467    # context => '#stay'
468    # type => 'RegExpr'
469    if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
470       return 1
471    }
472    return 0;
473 };
474
475 sub parseRegExprSo {
476    my ($self, $text) = @_;
477    # String => '\\.'
478    # attribute => 'Backslash Code'
479    # context => '#stay'
480    # type => 'RegExpr'
481    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
482       return 1
483    }
484    # attribute => 'RegExpr'
485    # char => ']'
486    # context => '#pop'
487    # type => 'DetectChar'
488    if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
489       return 1
490    }
491    # String => '.'
492    # attribute => 'RegExpr'
493    # context => '#stay'
494    # type => 'RegExpr'
495    if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
496       return 1
497    }
498    return 0;
499 };
500
501 sub parseRegExprCo {
502    my ($self, $text) = @_;
503    # String => '\\.'
504    # attribute => 'Backslash Code'
505    # context => '#stay'
506    # type => 'RegExpr'
507    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
508       return 1
509    }
510    # attribute => 'RegExpr'
511    # char => '}'
512    # context => '#pop'
513    # type => 'DetectChar'
514    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
515       return 1
516    }
517    # String => '.'
518    # attribute => 'RegExpr'
519    # context => '#stay'
520    # type => 'RegExpr'
521    if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
522       return 1
523    }
524    return 0;
525 };
526
527 sub parseRuleRegExpr {
528    my ($self, $text) = @_;
529    # String => '\{$'
530    # attribute => 'Content-Type Delimiter'
531    # beginRegion => 'SCscope'
532    # context => 'Start Conditions Scope'
533    # type => 'RegExpr'
534    if ($self->testRegExpr($text, '\\{$', 0, 0, 0, undef, 0, 'Start Conditions Scope', 'Content-Type Delimiter')) {
535       return 1
536    }
537    # context => 'RegExpr Base'
538    # type => 'IncludeRules'
539    if ($self->includeRules('RegExpr Base', $text)) {
540       return 1
541    }
542    # String => '\S'
543    # attribute => 'RegExpr'
544    # context => '#stay'
545    # type => 'RegExpr'
546    if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
547       return 1
548    }
549    # String => '\s+'
550    # attribute => 'Normal Text'
551    # context => 'Action'
552    # type => 'RegExpr'
553    if ($self->testRegExpr($text, '\\s+', 0, 0, 0, undef, 0, 'Action', 'Normal Text')) {
554       return 1
555    }
556    return 0;
557 };
558
559 sub parseRules {
560    my ($self, $text) = @_;
561    # context => 'Detect C'
562    # type => 'IncludeRules'
563    if ($self->includeRules('Detect C', $text)) {
564       return 1
565    }
566    # attribute => 'Content-Type Delimiter'
567    # beginRegion => 'code'
568    # char => '%'
569    # char1 => '%'
570    # context => 'User Code'
571    # endRegion => 'rules'
572    # type => 'Detect2Chars'
573    if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'User Code', 'Content-Type Delimiter')) {
574       return 1
575    }
576    return 0;
577 };
578
579 sub parseStartConditionsScope {
580    my ($self, $text) = @_;
581    # String => '\s*\}'
582    # attribute => 'Content-Type Delimiter'
583    # context => '#pop'
584    # endRegion => 'SCscope'
585    # type => 'RegExpr'
586    if ($self->testRegExpr($text, '\\s*\\}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) {
587       return 1
588    }
589    # String => '\s*'
590    # attribute => 'Normal Text'
591    # context => 'Rule RegExpr'
592    # type => 'RegExpr'
593    if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, 'Rule RegExpr', 'Normal Text')) {
594       return 1
595    }
596    return 0;
597 };
598
599 sub parseUserCode {
600    my ($self, $text) = @_;
601    # context => '##C++'
602    # type => 'IncludeRules'
603    if ($self->includePlugin('C++', $text)) {
604       return 1
605    }
606    return 0;
607 };
608
609
610 1;
611
612 __END__
613
614 =head1 NAME
615
616 Syntax::Highlight::Engine::Kate::Lex_Flex - a Plugin for Lex/Flex syntax highlighting
617
618 =head1 SYNOPSIS
619
620  require Syntax::Highlight::Engine::Kate::Lex_Flex;
621  my $sh = new Syntax::Highlight::Engine::Kate::Lex_Flex([
622  ]);
623
624 =head1 DESCRIPTION
625
626 Syntax::Highlight::Engine::Kate::Lex_Flex is a  plugin module that provides syntax highlighting
627 for Lex/Flex to the Syntax::Haghlight::Engine::Kate highlighting engine.
628
629 This code is generated from the syntax definition files used
630 by the Kate project.
631 It works quite fine, but can use refinement and optimization.
632
633 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
634
635 =cut
636
637 =head1 AUTHOR
638
639 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
640
641 =cut
642
643 =head1 BUGS
644
645 Unknown. If you find any, please contact the author
646
647 =cut
648