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.
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
10 #kate author Jan Villat (jan.villat@net2000.ch)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Lex_Flex;
15 our $VERSION = '0.06';
19 use base('Syntax::Highlight::Engine::Kate::Template');
23 my $class = ref($proto) || $proto;
24 my $self = $class->SUPER::new(@_);
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',
37 callback => \&parseAction,
38 attribute => 'Normal Text',
40 fallthrough => 'Action C',
43 callback => \&parseActionC,
44 attribute => 'Normal Text',
48 callback => \&parseComment,
49 attribute => 'Comment',
51 'Definition RegExpr' => {
52 callback => \&parseDefinitionRegExpr,
53 attribute => 'RegExpr',
57 callback => \&parseDefinitions,
58 attribute => 'Normal Text',
61 callback => \&parseDetectC,
62 attribute => 'Normal Text',
65 callback => \&parseIndentedC,
66 attribute => 'Normal Text',
70 callback => \&parseLexCBloc,
71 attribute => 'Normal Text',
73 'Lex Rule C Bloc' => {
74 callback => \&parseLexRuleCBloc,
75 attribute => 'Normal Text',
78 callback => \&parseNormalCBloc,
79 attribute => 'Normal Text',
81 'Percent Command' => {
82 callback => \&parsePercentCommand,
83 attribute => 'Directive',
87 callback => \&parsePreStart,
88 attribute => 'Normal Text',
91 callback => \&parseRegExprBo,
92 attribute => 'RegExpr',
95 callback => \&parseRegExprBase,
96 attribute => 'RegExpr',
99 callback => \&parseRegExprQ,
100 attribute => 'RegExpr',
103 callback => \&parseRegExprSo,
104 attribute => 'RegExpr',
107 callback => \&parseRegExprCo,
108 attribute => 'RegExpr',
111 callback => \&parseRuleRegExpr,
112 attribute => 'RegExpr',
113 lineending => '#pop',
116 callback => \&parseRules,
117 attribute => 'Normal Text',
118 fallthrough => 'Rule RegExpr',
120 'Start Conditions Scope' => {
121 callback => \&parseStartConditionsScope,
122 attribute => 'Normal Text',
123 fallthrough => 'Rule RegExpr',
126 callback => \&parseUserCode,
127 attribute => 'Normal Text',
130 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
131 $self->basecontext('Pre Start');
132 $self->keywordscase(1);
134 bless ($self, $class);
143 my ($self, $text) = @_;
145 # attribute => 'Directive'
148 if ($self->testRegExpr($text, '\\|\\s*$', 0, 0, 0, undef, 0, '#stay', 'Directive')) {
151 # attribute => 'Content-Type Delimiter'
152 # beginRegion => 'lexCbloc'
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')) {
164 my ($self, $text) = @_;
165 # attribute => 'Normal Text'
166 # beginRegion => 'bloc'
168 # context => 'Normal C Bloc'
169 # type => 'DetectChar'
170 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
173 # attribute => 'Alert'
176 # type => 'DetectChar'
177 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
181 # type => 'IncludeRules'
182 if ($self->includePlugin('C++', $text)) {
189 my ($self, $text) = @_;
190 # attribute => 'Comment'
194 # type => 'Detect2Chars'
195 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
201 sub parseDefinitionRegExpr {
202 my ($self, $text) = @_;
203 # context => 'RegExpr Base'
204 # type => 'IncludeRules'
205 if ($self->includeRules('RegExpr Base', $text)) {
209 # attribute => 'RegExpr'
212 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
216 # attribute => 'Alert'
219 if ($self->testRegExpr($text, '.*', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
225 sub parseDefinitions {
226 my ($self, $text) = @_;
227 # context => 'Detect C'
228 # type => 'IncludeRules'
229 if ($self->includeRules('Detect C', $text)) {
232 # attribute => 'Content-Type Delimiter'
233 # beginRegion => 'rules'
237 # endRegion => 'definitions'
238 # type => 'Detect2Chars'
239 if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Rules', 'Content-Type Delimiter')) {
242 # attribute => 'Directive'
244 # context => 'Percent Command'
245 # type => 'DetectChar'
246 if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Percent Command', 'Directive')) {
249 # attribute => 'Comment'
253 # context => 'Comment'
254 # type => 'Detect2Chars'
255 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, 0, 0, 'Comment', 'Comment')) {
258 # String => '[A-Za-z_]\w*\s+'
259 # attribute => 'Definition'
261 # context => 'Definition RegExpr'
263 if ($self->testRegExpr($text, '[A-Za-z_]\\w*\\s+', 0, 0, 0, 0, 0, 'Definition RegExpr', 'Definition')) {
270 my ($self, $text) = @_;
272 # attribute => 'Normal Text'
273 # context => 'Indented C'
275 if ($self->testRegExpr($text, '^\\s', 0, 0, 0, undef, 0, 'Indented C', 'Normal Text')) {
278 # attribute => 'Content-Type Delimiter'
279 # beginRegion => 'lexCbloc'
283 # context => 'Lex C Bloc'
284 # type => 'Detect2Chars'
285 if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'Lex C Bloc', 'Content-Type Delimiter')) {
292 my ($self, $text) = @_;
294 # type => 'IncludeRules'
295 if ($self->includePlugin('C++', $text)) {
302 my ($self, $text) = @_;
303 # attribute => 'Content-Type Delimiter'
308 # endRegion => 'lexCbloc'
309 # type => 'Detect2Chars'
310 if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, 0, 0, '#pop', 'Content-Type Delimiter')) {
314 # type => 'IncludeRules'
315 if ($self->includePlugin('C++', $text)) {
321 sub parseLexRuleCBloc {
322 my ($self, $text) = @_;
323 # attribute => 'Content-Type Delimiter'
327 # endRegion => 'lexCbloc'
328 # type => 'Detect2Chars'
329 if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) {
333 # type => 'IncludeRules'
334 if ($self->includePlugin('C++', $text)) {
340 sub parseNormalCBloc {
341 my ($self, $text) = @_;
342 # attribute => 'Normal Text'
343 # beginRegion => 'bloc'
345 # context => 'Normal C Bloc'
346 # type => 'DetectChar'
347 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
350 # attribute => 'Normal Text'
353 # endRegion => 'bloc'
354 # type => 'DetectChar'
355 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
359 # type => 'IncludeRules'
360 if ($self->includePlugin('C++', $text)) {
366 sub parsePercentCommand {
367 my ($self, $text) = @_;
372 my ($self, $text) = @_;
374 # attribute => 'Normal Text'
375 # beginRegion => 'definitions'
376 # context => 'Definitions'
377 # lookAhead => 'true'
379 if ($self->testRegExpr($text, '.', 0, 0, 1, undef, 0, 'Definitions', 'Normal Text')) {
386 my ($self, $text) = @_;
387 # context => 'RegExpr Base'
388 # type => 'IncludeRules'
389 if ($self->includeRules('RegExpr Base', $text)) {
392 # attribute => 'RegExpr'
395 # type => 'DetectChar'
396 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
400 # attribute => 'RegExpr'
403 if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
409 sub parseRegExprBase {
410 my ($self, $text) = @_;
412 # attribute => 'Backslash Code'
415 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
418 # attribute => 'RegExpr'
420 # context => 'RegExpr ('
421 # type => 'DetectChar'
422 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'RegExpr (', 'RegExpr')) {
425 # attribute => 'RegExpr'
427 # context => 'RegExpr ['
428 # type => 'DetectChar'
429 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'RegExpr [', 'RegExpr')) {
432 # attribute => 'RegExpr'
434 # context => 'RegExpr {'
435 # type => 'DetectChar'
436 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RegExpr {', 'RegExpr')) {
439 # attribute => 'RegExpr'
441 # context => 'RegExpr Q'
442 # type => 'DetectChar'
443 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'RegExpr Q', 'RegExpr')) {
450 my ($self, $text) = @_;
452 # attribute => 'Backslash Code'
455 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
458 # attribute => 'RegExpr'
461 # type => 'DetectChar'
462 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
466 # attribute => 'RegExpr'
469 if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
476 my ($self, $text) = @_;
478 # attribute => 'Backslash Code'
481 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
484 # attribute => 'RegExpr'
487 # type => 'DetectChar'
488 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
492 # attribute => 'RegExpr'
495 if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
502 my ($self, $text) = @_;
504 # attribute => 'Backslash Code'
507 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
510 # attribute => 'RegExpr'
513 # type => 'DetectChar'
514 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) {
518 # attribute => 'RegExpr'
521 if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
527 sub parseRuleRegExpr {
528 my ($self, $text) = @_;
530 # attribute => 'Content-Type Delimiter'
531 # beginRegion => 'SCscope'
532 # context => 'Start Conditions Scope'
534 if ($self->testRegExpr($text, '\\{$', 0, 0, 0, undef, 0, 'Start Conditions Scope', 'Content-Type Delimiter')) {
537 # context => 'RegExpr Base'
538 # type => 'IncludeRules'
539 if ($self->includeRules('RegExpr Base', $text)) {
543 # attribute => 'RegExpr'
546 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) {
550 # attribute => 'Normal Text'
551 # context => 'Action'
553 if ($self->testRegExpr($text, '\\s+', 0, 0, 0, undef, 0, 'Action', 'Normal Text')) {
560 my ($self, $text) = @_;
561 # context => 'Detect C'
562 # type => 'IncludeRules'
563 if ($self->includeRules('Detect C', $text)) {
566 # attribute => 'Content-Type Delimiter'
567 # beginRegion => 'code'
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')) {
579 sub parseStartConditionsScope {
580 my ($self, $text) = @_;
582 # attribute => 'Content-Type Delimiter'
584 # endRegion => 'SCscope'
586 if ($self->testRegExpr($text, '\\s*\\}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) {
590 # attribute => 'Normal Text'
591 # context => 'Rule RegExpr'
593 if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, 'Rule RegExpr', 'Normal Text')) {
600 my ($self, $text) = @_;
602 # type => 'IncludeRules'
603 if ($self->includePlugin('C++', $text)) {
616 Syntax::Highlight::Engine::Kate::Lex_Flex - a Plugin for Lex/Flex syntax highlighting
620 require Syntax::Highlight::Engine::Kate::Lex_Flex;
621 my $sh = new Syntax::Highlight::Engine::Kate::Lex_Flex([
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.
629 This code is generated from the syntax definition files used
631 It works quite fine, but can use refinement and optimization.
633 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
639 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
645 Unknown. If you find any, please contact the author