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 'd.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Simon J Mackenzie (project.katedxml@smackoz.fastmail.fm)
11 #generated: Sun Feb 3 22:02:04 2008, localtime
13 package Syntax::Highlight::Engine::Kate::D;
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(@_);
26 'Assert' => 'Variable',
29 'Comment' => 'Comment',
31 'Escape String' => 'String',
34 'Integer' => 'DecVal',
35 'Keyword' => 'Keyword',
36 'Linkage' => 'IString',
37 'Linkage Type' => 'Others',
38 'Module' => 'Keyword',
39 'Module Name' => 'Reserved',
40 'Normal Text' => 'Normal',
42 'Phobos Library' => 'BString',
43 'Pragma' => 'Keyword',
46 'Unit Test' => 'RegionMarker',
47 'Version' => 'Keyword',
48 'Version Type' => 'DataType',
51 $self->listAdd('assert',
54 $self->listAdd('debug',
57 $self->listAdd('keywords',
119 $self->listAdd('linkage',
122 $self->listAdd('ltypes',
128 $self->listAdd('modules',
132 $self->listAdd('phobos',
136 $self->listAdd('pragma',
139 $self->listAdd('ptypes',
142 $self->listAdd('types',
168 $self->listAdd('unittest',
171 $self->listAdd('version',
174 $self->listAdd('vtypes',
189 callback => \&parseChar,
193 callback => \&parseCommentBlockA,
194 attribute => 'Comment',
197 callback => \&parseCommentBlockB,
198 attribute => 'Comment',
201 callback => \&parseCommentLine,
202 attribute => 'Comment',
203 lineending => '#pop',
206 callback => \&parseHex,
210 callback => \&parseLinkage,
211 attribute => 'Linkage',
212 lineending => '#pop',
215 callback => \&parseModuleName,
216 attribute => 'Module Name',
219 callback => \&parsePragmas,
220 attribute => 'Pragma',
221 lineending => '#pop',
224 callback => \&parseString,
225 attribute => 'String',
228 callback => \&parseVersion,
229 attribute => 'Version',
230 lineending => '#pop',
233 callback => \&parseWysiwyg,
234 attribute => 'Wysiwyg',
237 callback => \&parsenormal,
238 attribute => 'Normal Text',
241 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
242 $self->basecontext('normal');
243 $self->keywordscase(1);
245 bless ($self, $class);
254 my ($self, $text) = @_;
255 # attribute => 'Char'
259 # type => 'Detect2Chars'
260 if ($self->testDetect2Chars($text, '\\', '\'', 0, 0, 0, undef, 0, '#stay', 'Char')) {
263 # attribute => 'Char'
267 # type => 'Detect2Chars'
268 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'Char')) {
271 # attribute => 'Char'
274 # type => 'DetectChar'
275 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Char')) {
281 sub parseCommentBlockA {
282 my ($self, $text) = @_;
283 # attribute => 'Comment'
287 # endRegion => 'CommentA'
288 # type => 'Detect2Chars'
289 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
295 sub parseCommentBlockB {
296 my ($self, $text) = @_;
297 # attribute => 'Comment'
301 # endRegion => 'CommentB'
302 # type => 'Detect2Chars'
303 if ($self->testDetect2Chars($text, '+', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
309 sub parseCommentLine {
310 my ($self, $text) = @_;
315 my ($self, $text) = @_;
319 # type => 'DetectChar'
320 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Hex')) {
327 my ($self, $text) = @_;
329 # attribute => 'Type'
332 if ($self->testKeyword($text, 'types', 0, undef, 0, '#pop', 'Type')) {
335 # attribute => 'Normal Text'
338 # type => 'DetectChar'
339 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
343 # attribute => 'Linkage Type'
346 if ($self->testKeyword($text, 'ltypes', 0, undef, 0, '#stay', 'Linkage Type')) {
349 # attribute => 'Normal Text'
352 # type => 'DetectChar'
353 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
356 # attribute => 'Normal Text'
359 # type => 'DetectChar'
360 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
366 sub parseModuleName {
367 my ($self, $text) = @_;
368 # attribute => 'Normal Text'
371 # type => 'DetectChar'
372 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
375 # attribute => 'Normal Text'
378 # type => 'DetectChar'
379 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
382 # attribute => 'Comment'
385 # context => 'CommentLine'
386 # type => 'Detect2Chars'
387 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'CommentLine', 'Comment')) {
390 # attribute => 'Comment'
391 # beginRegion => 'CommentA'
394 # context => 'CommentBlockA'
395 # type => 'Detect2Chars'
396 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'CommentBlockA', 'Comment')) {
399 # attribute => 'Comment'
400 # beginRegion => 'CommentB'
403 # context => 'CommentBlockB'
404 # type => 'Detect2Chars'
405 if ($self->testDetect2Chars($text, '/', '+', 0, 0, 0, undef, 0, 'CommentBlockB', 'Comment')) {
412 my ($self, $text) = @_;
413 # attribute => 'Normal Text'
416 # type => 'DetectChar'
417 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
421 # attribute => 'Version Type'
424 if ($self->testKeyword($text, 'ptypes', 0, undef, 0, '#stay', 'Version Type')) {
428 # attribute => 'Version Type'
431 if ($self->testKeyword($text, 'vtypes', 0, undef, 0, '#stay', 'Version Type')) {
434 # String => '[_a-z][\w]*'
435 # attribute => 'Keyword'
437 # insensitive => 'true'
439 if ($self->testRegExpr($text, '[_a-z][\\w]*', 1, 0, 0, undef, 0, '#pop', 'Keyword')) {
442 # attribute => 'Normal Text'
445 # type => 'DetectChar'
446 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
449 # attribute => 'Normal Text'
452 # type => 'DetectChar'
453 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
460 my ($self, $text) = @_;
461 # attribute => 'String'
464 # type => 'DetectChar'
465 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
472 my ($self, $text) = @_;
473 # attribute => 'Normal Text'
476 # type => 'DetectChar'
477 if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
480 # attribute => 'Normal Text'
483 # type => 'DetectChar'
484 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
488 # attribute => 'Version Type'
491 if ($self->testKeyword($text, 'vtypes', 0, undef, 0, '#stay', 'Version Type')) {
495 # attribute => 'Normal Text'
497 # insensitive => 'true'
499 if ($self->testRegExpr($text, '\\w', 1, 0, 0, undef, 0, '#pop', 'Normal Text')) {
502 # attribute => 'Normal Text'
505 # type => 'DetectChar'
506 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
513 my ($self, $text) = @_;
514 # attribute => 'Wysiwyg'
517 # type => 'DetectChar'
518 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Wysiwyg')) {
521 # attribute => 'Wysiwyg'
524 # type => 'DetectChar'
525 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'Wysiwyg')) {
532 my ($self, $text) = @_;
533 # String => 'keywords'
534 # attribute => 'Keyword'
537 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
540 # String => 'modules'
541 # attribute => 'Module'
542 # context => 'ModuleName'
544 if ($self->testKeyword($text, 'modules', 0, undef, 0, 'ModuleName', 'Module')) {
548 # attribute => 'Type'
551 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Type')) {
555 # attribute => 'Phobos Library'
558 if ($self->testKeyword($text, 'phobos', 0, undef, 0, '#stay', 'Phobos Library')) {
561 # String => 'linkage'
562 # attribute => 'Linkage'
563 # context => 'Linkage'
565 if ($self->testKeyword($text, 'linkage', 0, undef, 0, 'Linkage', 'Linkage')) {
569 # attribute => 'Debug'
572 if ($self->testKeyword($text, 'debug', 0, undef, 0, '#stay', 'Debug')) {
576 # attribute => 'Assert'
579 if ($self->testKeyword($text, 'assert', 0, undef, 0, '#stay', 'Assert')) {
583 # attribute => 'Pragma'
584 # context => 'Pragmas'
586 if ($self->testKeyword($text, 'pragma', 0, undef, 0, 'Pragmas', 'Pragma')) {
589 # String => 'version'
590 # attribute => 'Version'
591 # context => 'Version'
593 if ($self->testKeyword($text, 'version', 0, undef, 0, 'Version', 'Version')) {
596 # String => 'unittest'
597 # attribute => 'Unit Test'
600 if ($self->testKeyword($text, 'unittest', 0, undef, 0, '#stay', 'Unit Test')) {
603 # attribute => 'Wysiwyg'
606 # context => 'Wysiwyg'
607 # type => 'Detect2Chars'
608 if ($self->testDetect2Chars($text, 'r', '"', 0, 0, 0, undef, 0, 'Wysiwyg', 'Wysiwyg')) {
615 # type => 'Detect2Chars'
616 if ($self->testDetect2Chars($text, 'x', '"', 0, 0, 0, undef, 0, 'Hex', 'Hex')) {
619 # String => '[_a-z][\w]*'
620 # attribute => 'Normal Text'
622 # insensitive => 'true'
624 if ($self->testRegExpr($text, '[_a-z][\\w]*', 1, 0, 0, undef, 0, '#pop', 'Normal Text')) {
627 # String => '\#[ ]*line'
628 # attribute => 'Pragma'
631 if ($self->testRegExpr($text, '\\#[ ]*line', 0, 0, 0, undef, 0, '#pop', 'Pragma')) {
634 # String => '\\[n|t|"]'
635 # attribute => 'Escape String'
638 if ($self->testRegExpr($text, '\\\\[n|t|"]', 0, 0, 0, undef, 0, '#pop', 'Escape String')) {
641 # String => '(\\r\\n)'
642 # attribute => 'Escape String'
645 if ($self->testRegExpr($text, '(\\\\r\\\\n)', 0, 0, 0, undef, 0, '#pop', 'Escape String')) {
648 # String => '\\0[0-7]+'
649 # attribute => 'Escape String'
652 if ($self->testRegExpr($text, '\\\\0[0-7]+', 0, 0, 0, undef, 0, '#pop', 'Escape String')) {
655 # String => '\\u[\d]+'
656 # attribute => 'Escape String'
658 # insensitive => 'true'
660 if ($self->testRegExpr($text, '\\\\u[\\d]+', 1, 0, 0, undef, 0, '#pop', 'Escape String')) {
663 # String => '\\x[\da-fA-F]+'
664 # attribute => 'Escape String'
667 if ($self->testRegExpr($text, '\\\\x[\\da-fA-F]+', 0, 0, 0, undef, 0, '#pop', 'Escape String')) {
670 # String => '0b[01]+[_01]*[ ]*\.\.[ ]*0b[01]+[_01]*(UL|LU|U|L)?'
671 # attribute => 'Binary'
673 # insensitive => 'true'
675 if ($self->testRegExpr($text, '0b[01]+[_01]*[ ]*\\.\\.[ ]*0b[01]+[_01]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Binary')) {
678 # String => '0[0-7]+[_0-7]*[ ]*\.\.[ ]*0[0-7]+[_0-7]*(UL|LU|U|L)?'
679 # attribute => 'Octal'
681 # insensitive => 'true'
683 if ($self->testRegExpr($text, '0[0-7]+[_0-7]*[ ]*\\.\\.[ ]*0[0-7]+[_0-7]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Octal')) {
686 # String => '0x[\da-f]+[_\da-f]*[ ]*\.\.[ ]*0x[\da-f]+[_\da-f]*(UL|LU|U|L)?'
689 # insensitive => 'true'
691 if ($self->testRegExpr($text, '0x[\\da-f]+[_\\da-f]*[ ]*\\.\\.[ ]*0x[\\da-f]+[_\\da-f]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Hex')) {
694 # String => '[\d]+[_\d]*(UL|LU|U|L)?[ ]*\.\.[ ]*[\d]+[_\d]*(UL|LU|U|L)?'
695 # attribute => 'Integer'
697 # insensitive => 'true'
699 if ($self->testRegExpr($text, '[\\d]+[_\\d]*(UL|LU|U|L)?[ ]*\\.\\.[ ]*[\\d]+[_\\d]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Integer')) {
702 # String => '[\d]*[_\d]*\.[_\d]*(e-|e|e\+)?[\d]+[_\d]*(F|L|I|FI|LI|)?'
703 # attribute => 'Float'
705 # insensitive => 'true'
707 if ($self->testRegExpr($text, '[\\d]*[_\\d]*\\.[_\\d]*(e-|e|e\\+)?[\\d]+[_\\d]*(F|L|I|FI|LI|)?', 1, 0, 0, undef, 0, '#pop', 'Float')) {
710 # String => '[\d]*[_\d]*\.?[_\d]*(e-|e|e\+)[\d]+[_\d]*(F|L|I|FI|LI|)?'
711 # attribute => 'Float'
713 # insensitive => 'true'
715 if ($self->testRegExpr($text, '[\\d]*[_\\d]*\\.?[_\\d]*(e-|e|e\\+)[\\d]+[_\\d]*(F|L|I|FI|LI|)?', 1, 0, 0, undef, 0, '#pop', 'Float')) {
718 # String => '0x[\da-f]+[_\da-f]*\.[_\da-f]*(p-|p|p\+)?[\da-f]+[_\da-f]*(F|L|I|FI|LI)?'
719 # attribute => 'Float'
721 # insensitive => 'true'
723 if ($self->testRegExpr($text, '0x[\\da-f]+[_\\da-f]*\\.[_\\da-f]*(p-|p|p\\+)?[\\da-f]+[_\\da-f]*(F|L|I|FI|LI)?', 1, 0, 0, undef, 0, '#pop', 'Float')) {
726 # String => '0x[\da-f]+[_\da-f]*\.?[_\da-f]*(p-|p|p\+)[\da-f]+[_\da-f]*(F|L|I|FI|LI)?'
727 # attribute => 'Float'
729 # insensitive => 'true'
731 if ($self->testRegExpr($text, '0x[\\da-f]+[_\\da-f]*\\.?[_\\da-f]*(p-|p|p\\+)[\\da-f]+[_\\da-f]*(F|L|I|FI|LI)?', 1, 0, 0, undef, 0, '#pop', 'Float')) {
734 # String => '0B[01]+[_01]*(UL|LU|U|L)?'
735 # attribute => 'Binary'
737 # insensitive => 'true'
739 if ($self->testRegExpr($text, '0B[01]+[_01]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Binary')) {
742 # String => '0[0-7]+[_0-7]*(UL|LU|U|L)?'
743 # attribute => 'Octal'
745 # insensitive => 'true'
747 if ($self->testRegExpr($text, '0[0-7]+[_0-7]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Octal')) {
750 # String => '0x[\da-f]+[_\da-f]*(UL|LU|U|L)?'
753 # insensitive => 'true'
755 if ($self->testRegExpr($text, '0x[\\da-f]+[_\\da-f]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Hex')) {
758 # String => '[\d]+[_\d]*(UL|LU|U|L)?'
759 # attribute => 'Integer'
761 # insensitive => 'true'
763 if ($self->testRegExpr($text, '[\\d]+[_\\d]*(UL|LU|U|L)?', 1, 0, 0, undef, 0, '#pop', 'Integer')) {
766 # attribute => 'Char'
769 # type => 'DetectChar'
770 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Char', 'Char')) {
773 # attribute => 'String'
775 # context => 'String'
776 # type => 'DetectChar'
777 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
780 # attribute => 'Wysiwyg'
782 # context => 'Wysiwyg'
783 # type => 'DetectChar'
784 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'Wysiwyg', 'Wysiwyg')) {
787 # attribute => 'Comment'
790 # context => 'CommentLine'
791 # type => 'Detect2Chars'
792 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'CommentLine', 'Comment')) {
795 # attribute => 'Comment'
796 # beginRegion => 'CommentA'
799 # context => 'CommentBlockA'
800 # type => 'Detect2Chars'
801 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'CommentBlockA', 'Comment')) {
804 # attribute => 'Comment'
805 # beginRegion => 'CommentB'
808 # context => 'CommentBlockB'
809 # type => 'Detect2Chars'
810 if ($self->testDetect2Chars($text, '/', '+', 0, 0, 0, undef, 0, 'CommentBlockB', 'Comment')) {
813 # attribute => 'Normal Text'
814 # beginRegion => 'BraceA'
817 # type => 'DetectChar'
818 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
821 # attribute => 'Normal Text'
824 # endRegion => 'BraceA'
825 # type => 'DetectChar'
826 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
839 Syntax::Highlight::Engine::Kate::D - a Plugin for D syntax highlighting
843 require Syntax::Highlight::Engine::Kate::D;
844 my $sh = new Syntax::Highlight::Engine::Kate::D([
849 Syntax::Highlight::Engine::Kate::D is a plugin module that provides syntax highlighting
850 for D to the Syntax::Haghlight::Engine::Kate highlighting engine.
852 This code is generated from the syntax definition files used
854 It works quite fine, but can use refinement and optimization.
856 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
862 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
868 Unknown. If you find any, please contact the author