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 'cpp.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #generated: Sun Feb 3 22:02:04 2008, localtime
12 package Syntax::Highlight::Engine::Kate::Cplusplus;
14 our $VERSION = '0.06';
18 use base('Syntax::Highlight::Engine::Kate::Template');
22 my $class = ref($proto) || $proto;
23 my $self = $class->SUPER::new(@_);
26 'Comment' => 'Comment',
27 'Data Type' => 'DataType',
28 'Decimal' => 'DecVal',
29 'Extensions' => 'Keyword',
32 'Keyword' => 'Keyword',
33 'Normal Text' => 'Normal',
35 'Prep. Lib' => 'Others',
36 'Preprocessor' => 'Others',
37 'Region Marker' => 'RegionMarker',
39 'String Char' => 'Char',
42 $self->listAdd('extensions',
53 'Q_DECLARE_INTERFACE',
54 'Q_DECLARE_OPERATORS_FOR_FLAGS',
67 'Q_GLOBAL_STATIC_WITH_ARGS',
91 $self->listAdd('keywords',
157 $self->listAdd('types',
188 callback => \&parseCommentar1,
189 attribute => 'Comment',
190 lineending => '#pop',
193 callback => \&parseCommentar2,
194 attribute => 'Comment',
196 'Commentar/Preprocessor' => {
197 callback => \&parseCommentarPreprocessor,
198 attribute => 'Comment',
201 callback => \&parseDefine,
202 attribute => 'Preprocessor',
203 lineending => '#pop',
206 callback => \&parseNormal,
207 attribute => 'Normal Text',
210 callback => \&parseOutscoped,
211 attribute => 'Comment',
213 'Outscoped intern' => {
214 callback => \&parseOutscopedintern,
215 attribute => 'Comment',
218 callback => \&parsePreprocessor,
219 attribute => 'Preprocessor',
220 lineending => '#pop',
223 callback => \&parseRegionMarker,
224 attribute => 'Region Marker',
225 lineending => '#pop',
228 callback => \&parseString,
229 attribute => 'String',
230 lineending => '#pop',
233 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
234 $self->basecontext('Normal');
235 $self->keywordscase(0);
237 bless ($self, $class);
245 sub parseCommentar1 {
246 my ($self, $text) = @_;
247 # type => 'DetectSpaces'
248 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
251 # context => '##Alerts'
252 # type => 'IncludeRules'
253 if ($self->includePlugin('Alerts', $text)) {
256 # type => 'DetectIdentifier'
257 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
263 sub parseCommentar2 {
264 my ($self, $text) = @_;
265 # type => 'DetectSpaces'
266 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
269 # attribute => 'Comment'
273 # endRegion => 'Comment'
274 # type => 'Detect2Chars'
275 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
278 # context => '##Alerts'
279 # type => 'IncludeRules'
280 if ($self->includePlugin('Alerts', $text)) {
283 # type => 'DetectIdentifier'
284 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
290 sub parseCommentarPreprocessor {
291 my ($self, $text) = @_;
292 # type => 'DetectSpaces'
293 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
296 # attribute => 'Comment'
300 # type => 'Detect2Chars'
301 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
304 # type => 'DetectIdentifier'
305 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
312 my ($self, $text) = @_;
313 # attribute => 'Preprocessor'
315 # type => 'LineContinue'
316 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) {
323 my ($self, $text) = @_;
324 # type => 'DetectSpaces'
325 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
328 # String => '#\s*if\s+0'
329 # attribute => 'Preprocessor'
330 # beginRegion => 'Outscoped'
331 # context => 'Outscoped'
332 # firstNonSpace => 'true'
334 if ($self->testRegExpr($text, '#\\s*if\\s+0', 0, 0, 0, undef, 1, 'Outscoped', 'Preprocessor')) {
337 # attribute => 'Preprocessor'
339 # context => 'Preprocessor'
340 # firstNonSpace => 'true'
341 # type => 'DetectChar'
342 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Preprocessor', 'Preprocessor')) {
345 # String => '//BEGIN'
346 # attribute => 'Region Marker'
347 # beginRegion => 'Region1'
348 # context => 'Region Marker'
349 # firstNonSpace => 'true'
350 # type => 'StringDetect'
351 if ($self->testStringDetect($text, '//BEGIN', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
355 # attribute => 'Region Marker'
356 # context => 'Region Marker'
357 # endRegion => 'Region1'
358 # firstNonSpace => 'true'
359 # type => 'StringDetect'
360 if ($self->testStringDetect($text, '//END', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
363 # String => 'keywords'
364 # attribute => 'Keyword'
367 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
370 # String => 'extensions'
371 # attribute => 'Extensions'
374 if ($self->testKeyword($text, 'extensions', 0, undef, 0, '#stay', 'Extensions')) {
378 # attribute => 'Data Type'
381 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
384 # attribute => 'Char'
387 if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
390 # attribute => 'String'
392 # context => 'String'
393 # type => 'DetectChar'
394 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
397 # type => 'DetectIdentifier'
398 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
401 # attribute => 'Float'
403 # items => 'ARRAY(0x1255cd0)'
405 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
407 # attribute => 'Float'
410 if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) {
414 # attribute => 'Octal'
417 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
423 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
426 # attribute => 'Decimal'
428 # items => 'ARRAY(0x132c920)'
430 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
432 # attribute => 'Decimal'
434 # insensitive => 'TRUE'
435 # type => 'StringDetect'
436 if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
440 # attribute => 'Decimal'
442 # insensitive => 'TRUE'
443 # type => 'StringDetect'
444 if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
448 # attribute => 'Decimal'
450 # insensitive => 'TRUE'
451 # type => 'StringDetect'
452 if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
456 # attribute => 'Decimal'
458 # insensitive => 'TRUE'
459 # type => 'StringDetect'
460 if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
464 # attribute => 'Decimal'
466 # insensitive => 'TRUE'
467 # type => 'StringDetect'
468 if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
472 # attribute => 'Decimal'
474 # insensitive => 'TRUE'
475 # type => 'StringDetect'
476 if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
480 # attribute => 'Decimal'
482 # insensitive => 'TRUE'
483 # type => 'StringDetect'
484 if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
488 # attribute => 'Decimal'
490 # insensitive => 'TRUE'
491 # type => 'StringDetect'
492 if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
496 # context => '##Doxygen'
497 # type => 'IncludeRules'
498 if ($self->includePlugin('Doxygen', $text)) {
501 # attribute => 'Comment'
504 # context => 'Commentar 1'
505 # type => 'Detect2Chars'
506 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
509 # attribute => 'Comment'
510 # beginRegion => 'Comment'
513 # context => 'Commentar 2'
514 # type => 'Detect2Chars'
515 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
518 # attribute => 'Symbol'
519 # beginRegion => 'Brace1'
522 # type => 'DetectChar'
523 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
526 # attribute => 'Symbol'
529 # endRegion => 'Brace1'
530 # type => 'DetectChar'
531 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
534 # String => ':!%&()+,-/.*<=>?[]{|}~^;'
535 # attribute => 'Symbol'
538 if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]{|}~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
545 my ($self, $text) = @_;
546 # type => 'DetectSpaces'
547 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
550 # context => '##Alerts'
551 # type => 'IncludeRules'
552 if ($self->includePlugin('Alerts', $text)) {
555 # type => 'DetectIdentifier'
556 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
559 # attribute => 'String'
561 # context => 'String'
562 # type => 'DetectChar'
563 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
566 # context => '##Doxygen'
567 # type => 'IncludeRules'
568 if ($self->includePlugin('Doxygen', $text)) {
571 # attribute => 'Comment'
574 # context => 'Commentar 1'
575 # type => 'Detect2Chars'
576 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
579 # attribute => 'Comment'
580 # beginRegion => 'Comment'
583 # context => 'Commentar 2'
584 # type => 'Detect2Chars'
585 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
589 # attribute => 'Comment'
590 # beginRegion => 'Outscoped'
591 # context => 'Outscoped intern'
592 # firstNonSpace => 'true'
594 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
597 # String => '#\s*(endif|else|elif)'
598 # attribute => 'Preprocessor'
600 # endRegion => 'Outscoped'
601 # firstNonSpace => 'true'
603 if ($self->testRegExpr($text, '#\\s*(endif|else|elif)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) {
609 sub parseOutscopedintern {
610 my ($self, $text) = @_;
611 # type => 'DetectSpaces'
612 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
615 # context => '##Alerts'
616 # type => 'IncludeRules'
617 if ($self->includePlugin('Alerts', $text)) {
620 # type => 'DetectIdentifier'
621 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
624 # attribute => 'String'
626 # context => 'String'
627 # type => 'DetectChar'
628 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
631 # context => '##Doxygen'
632 # type => 'IncludeRules'
633 if ($self->includePlugin('Doxygen', $text)) {
636 # attribute => 'Comment'
639 # context => 'Commentar 1'
640 # type => 'Detect2Chars'
641 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
644 # attribute => 'Comment'
645 # beginRegion => 'Comment'
648 # context => 'Commentar 2'
649 # type => 'Detect2Chars'
650 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
654 # attribute => 'Comment'
655 # beginRegion => 'Outscoped'
656 # context => 'Outscoped intern'
657 # firstNonSpace => 'true'
659 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
662 # String => '#\s*endif'
663 # attribute => 'Comment'
665 # endRegion => 'Outscoped'
666 # firstNonSpace => 'true'
668 if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
674 sub parsePreprocessor {
675 my ($self, $text) = @_;
676 # attribute => 'Preprocessor'
678 # type => 'LineContinue'
679 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) {
682 # String => 'define.*((?=\\))'
683 # attribute => 'Preprocessor'
684 # context => 'Define'
686 if ($self->testRegExpr($text, 'define.*((?=\\\\))', 0, 0, 0, undef, 0, 'Define', 'Preprocessor')) {
689 # String => 'define.*'
690 # attribute => 'Preprocessor'
693 if ($self->testRegExpr($text, 'define.*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) {
696 # attribute => 'Prep. Lib'
700 # type => 'RangeDetect'
701 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
704 # attribute => 'Prep. Lib'
708 # type => 'RangeDetect'
709 if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
712 # context => '##Doxygen'
713 # type => 'IncludeRules'
714 if ($self->includePlugin('Doxygen', $text)) {
717 # attribute => 'Comment'
720 # context => 'Commentar 1'
721 # type => 'Detect2Chars'
722 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
725 # attribute => 'Comment'
728 # context => 'Commentar/Preprocessor'
729 # type => 'Detect2Chars'
730 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar/Preprocessor', 'Comment')) {
736 sub parseRegionMarker {
737 my ($self, $text) = @_;
742 my ($self, $text) = @_;
743 # attribute => 'String'
745 # type => 'LineContinue'
746 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
749 # attribute => 'String Char'
751 # type => 'HlCStringChar'
752 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
755 # attribute => 'String'
758 # type => 'DetectChar'
759 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
772 Syntax::Highlight::Engine::Kate::Cplusplus - a Plugin for C++ syntax highlighting
776 require Syntax::Highlight::Engine::Kate::Cplusplus;
777 my $sh = new Syntax::Highlight::Engine::Kate::Cplusplus([
782 Syntax::Highlight::Engine::Kate::Cplusplus is a plugin module that provides syntax highlighting
783 for C++ to the Syntax::Haghlight::Engine::Kate highlighting engine.
785 This code is generated from the syntax definition files used
787 It works quite fine, but can use refinement and optimization.
789 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
795 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
801 Unknown. If you find any, please contact the author