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 'yacc.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:06 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Yacc_Bison;
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 'Data Type' => 'DataType',
31 'Definition' => 'Normal',
32 'Directive' => 'Keyword',
33 'Normal Text' => 'Normal',
36 'String Char' => 'Char',
40 callback => \&parseCDeclarations,
41 attribute => 'Normal Text',
44 callback => \&parseChar,
45 attribute => 'String Char',
49 callback => \&parseComment,
50 attribute => 'Comment',
53 callback => \&parseCommentSlash,
54 attribute => 'Comment',
57 callback => \&parseCommentStar,
58 attribute => 'Comment',
61 callback => \&parseDeclarations,
62 attribute => 'Normal Text',
65 callback => \&parseDol,
66 attribute => 'Normal Text',
67 fallthrough => 'DolEnd',
70 callback => \&parseDolEnd,
71 attribute => 'Normal Text',
74 callback => \&parseNormalCBloc,
75 attribute => 'Normal Text',
78 callback => \&parsePCtype,
79 attribute => 'Data Type',
80 lineending => '#pop#pop#pop',
82 'Percent Command' => {
83 callback => \&parsePercentCommand,
84 attribute => 'Directive',
87 'Percent Command In' => {
88 callback => \&parsePercentCommandIn,
89 attribute => 'NormalText',
90 lineending => '#pop#pop',
93 callback => \&parsePreStart,
94 attribute => 'Normal Text',
97 callback => \&parseRuleIn,
98 attribute => 'Definition',
101 callback => \&parseRules,
105 callback => \&parseString,
106 attribute => 'String',
107 lineending => '#pop',
110 callback => \&parseStringOrChar,
111 attribute => 'NormalText',
114 callback => \&parseUnionIn,
115 attribute => 'Normal Text',
118 callback => \&parseUnionInIn,
119 attribute => 'Normal Text',
122 callback => \&parseUnionStart,
123 attribute => 'Normal Text',
126 callback => \&parseUserCode,
127 attribute => 'Normal Text',
130 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
131 $self->basecontext('Pre Start');
132 $self->keywordscase(1);
134 bless ($self, $class);
142 sub parseCDeclarations {
143 my ($self, $text) = @_;
144 # context => 'Comment'
145 # type => 'IncludeRules'
146 if ($self->includeRules('Comment', $text)) {
149 # attribute => 'Content-Type Delimiter'
154 # endRegion => 'cdeclarations'
155 # type => 'Detect2Chars'
156 if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, 0, 0, '#pop', 'Content-Type Delimiter')) {
160 # type => 'IncludeRules'
161 if ($self->includePlugin('C++', $text)) {
168 my ($self, $text) = @_;
170 # attribute => 'Backslash Code'
173 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
176 # attribute => 'String Char'
179 # type => 'DetectChar'
180 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String Char')) {
187 my ($self, $text) = @_;
188 # attribute => 'Comment'
191 # context => 'CommentStar'
192 # type => 'Detect2Chars'
193 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'CommentStar', 'Comment')) {
196 # attribute => 'Comment'
199 # context => 'CommentSlash'
200 # type => 'Detect2Chars'
201 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'CommentSlash', 'Comment')) {
207 sub parseCommentSlash {
208 my ($self, $text) = @_;
210 # attribute => 'Comment'
213 if ($self->testRegExpr($text, '[^\\\\]$', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
219 sub parseCommentStar {
220 my ($self, $text) = @_;
221 # attribute => 'Comment'
225 # type => 'Detect2Chars'
226 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
232 sub parseDeclarations {
233 my ($self, $text) = @_;
234 # context => 'Comment'
235 # type => 'IncludeRules'
236 if ($self->includeRules('Comment', $text)) {
240 # attribute => 'Directive'
241 # context => 'Union Start'
242 # type => 'StringDetect'
243 if ($self->testStringDetect($text, '%union', 0, 0, 0, undef, 0, 'Union Start', 'Directive')) {
246 # attribute => 'Content-Type Delimiter'
247 # beginRegion => 'rules'
251 # endRegion => 'declarations'
252 # type => 'Detect2Chars'
253 if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Rules', 'Content-Type Delimiter')) {
256 # attribute => 'Content-Type Delimiter'
257 # beginRegion => 'cdeclarations'
261 # context => 'C Declarations'
262 # type => 'Detect2Chars'
263 if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'C Declarations', 'Content-Type Delimiter')) {
266 # attribute => 'Directive'
268 # context => 'Percent Command'
269 # type => 'DetectChar'
270 if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Percent Command', 'Directive')) {
277 my ($self, $text) = @_;
278 # String => '<[^>]+>'
279 # attribute => 'Data Type'
280 # context => 'DolEnd'
282 if ($self->testRegExpr($text, '<[^>]+>', 0, 0, 0, undef, 0, 'DolEnd', 'Data Type')) {
289 my ($self, $text) = @_;
291 # attribute => 'Directive'
292 # context => '#pop#pop'
294 if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#pop#pop', 'Directive')) {
297 # attribute => 'Directive'
299 # context => '#pop#pop'
300 # type => 'DetectChar'
301 if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#pop#pop', 'Directive')) {
307 sub parseNormalCBloc {
308 my ($self, $text) = @_;
309 # attribute => 'Normal Text'
310 # beginRegion => 'bloc'
312 # context => 'Normal C Bloc'
313 # type => 'DetectChar'
314 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
317 # attribute => 'Normal Text'
320 # endRegion => 'bloc'
321 # type => 'DetectChar'
322 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
326 # type => 'IncludeRules'
327 if ($self->includePlugin('C++', $text)) {
330 # attribute => 'Directive'
333 # type => 'DetectChar'
334 if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, 'Dol', 'Directive')) {
341 my ($self, $text) = @_;
342 # attribute => 'Data Type'
345 # type => 'DetectChar'
346 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Data Type')) {
352 sub parsePercentCommand {
353 my ($self, $text) = @_;
354 # context => 'Comment'
355 # type => 'IncludeRules'
356 if ($self->includeRules('Comment', $text)) {
360 # attribute => 'Normal Text'
361 # context => 'Percent Command In'
362 # lookAhead => 'true'
364 if ($self->testRegExpr($text, '\\W', 0, 0, 1, undef, 0, 'Percent Command In', 'Normal Text')) {
370 sub parsePercentCommandIn {
371 my ($self, $text) = @_;
372 # context => 'StringOrChar'
373 # type => 'IncludeRules'
374 if ($self->includeRules('StringOrChar', $text)) {
377 # attribute => 'Data Type'
379 # context => 'PC type'
380 # type => 'DetectChar'
381 if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, 'PC type', 'Data Type')) {
388 my ($self, $text) = @_;
389 # context => 'Comment'
390 # type => 'IncludeRules'
391 if ($self->includeRules('Comment', $text)) {
394 # type => 'DetectSpaces'
395 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
398 # attribute => 'Content-Type Delimiter'
399 # beginRegion => 'cdeclarations'
403 # context => 'C Declarations'
404 # type => 'Detect2Chars'
405 if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'C Declarations', 'Content-Type Delimiter')) {
409 # attribute => 'Normal Text'
410 # beginRegion => 'declarations'
411 # context => 'Declarations'
412 # lookAhead => 'true'
414 if ($self->testRegExpr($text, '.', 0, 0, 1, undef, 0, 'Declarations', 'Normal Text')) {
421 my ($self, $text) = @_;
422 # context => 'Comment'
423 # type => 'IncludeRules'
424 if ($self->includeRules('Comment', $text)) {
427 # attribute => 'Normal Text'
430 # endRegion => 'rule'
431 # type => 'DetectChar'
432 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
435 # attribute => 'Normal Text'
436 # beginRegion => 'bloc'
438 # context => 'Normal C Bloc'
439 # type => 'DetectChar'
440 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
443 # attribute => 'Normal Text'
446 # type => 'DetectChar'
447 if ($self->testDetectChar($text, '|', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
450 # context => 'StringOrChar'
451 # type => 'IncludeRules'
452 if ($self->includeRules('StringOrChar', $text)) {
459 my ($self, $text) = @_;
460 # context => 'Comment'
461 # type => 'IncludeRules'
462 if ($self->includeRules('Comment', $text)) {
465 # attribute => 'Content-Type Delimiter'
466 # beginRegion => 'code'
469 # context => 'User Code'
470 # endRegion => 'rules'
471 # type => 'Detect2Chars'
472 if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'User Code', 'Content-Type Delimiter')) {
475 # attribute => 'Normal Text'
476 # beginRegion => 'rule'
478 # context => 'Rule In'
479 # type => 'DetectChar'
480 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule In', 'Normal Text')) {
487 my ($self, $text) = @_;
489 # attribute => 'Backslash Code'
492 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
495 # attribute => 'String'
498 # type => 'DetectChar'
499 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
505 sub parseStringOrChar {
506 my ($self, $text) = @_;
507 # attribute => 'String Char'
510 # type => 'DetectChar'
511 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Char', 'String Char')) {
514 # attribute => 'String'
516 # context => 'String'
517 # type => 'DetectChar'
518 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
525 my ($self, $text) = @_;
526 # attribute => 'Normal Text'
528 # context => 'Union InIn'
529 # type => 'DetectChar'
530 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union InIn', 'Normal Text')) {
533 # attribute => 'Normal Text'
535 # context => '#pop#pop'
536 # endRegion => 'union'
537 # type => 'DetectChar'
538 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Normal Text')) {
542 # type => 'IncludeRules'
543 if ($self->includePlugin('C++', $text)) {
550 my ($self, $text) = @_;
551 # attribute => 'Normal Text'
553 # context => 'Union InIn'
554 # type => 'DetectChar'
555 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union InIn', 'Normal Text')) {
558 # attribute => 'Normal Text'
561 # type => 'DetectChar'
562 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
566 # type => 'IncludeRules'
567 if ($self->includePlugin('C++', $text)) {
573 sub parseUnionStart {
574 my ($self, $text) = @_;
575 # context => 'Comment'
576 # type => 'IncludeRules'
577 if ($self->includeRules('Comment', $text)) {
580 # type => 'DetectSpaces'
581 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
584 # attribute => 'Normal Text'
585 # beginRegion => 'union'
587 # context => 'Union In'
588 # type => 'DetectChar'
589 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union In', 'Normal Text')) {
593 # attribute => 'Alert'
596 if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#pop', 'Alert')) {
603 my ($self, $text) = @_;
605 # type => 'IncludeRules'
606 if ($self->includePlugin('C++', $text)) {
619 Syntax::Highlight::Engine::Kate::Yacc_Bison - a Plugin for Yacc/Bison syntax highlighting
623 require Syntax::Highlight::Engine::Kate::Yacc_Bison;
624 my $sh = new Syntax::Highlight::Engine::Kate::Yacc_Bison([
629 Syntax::Highlight::Engine::Kate::Yacc_Bison is a plugin module that provides syntax highlighting
630 for Yacc/Bison to the Syntax::Haghlight::Engine::Kate highlighting engine.
632 This code is generated from the syntax definition files used
634 It works quite fine, but can use refinement and optimization.
636 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
642 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
648 Unknown. If you find any, please contact the author