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 'xslt.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Peter Lammich (views@gmx.de)
11 #generated: Sun Feb 3 22:02:06 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Xslt;
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 'Attribute' => 'Others',
28 'Attribute Value' => 'BaseN',
29 'Comment' => 'Comment',
30 'Entity Reference' => 'Char',
32 'Normal Text' => 'Normal',
34 'Variable' => 'Variable',
36 'XPath 2.0/ XSLT 2.0 Function' => 'Operator',
37 'XPath Attribute' => 'Float',
38 'XPath Axis' => 'DecVal',
39 'XPath String' => 'BaseN',
40 'XPath/ XSLT Function' => 'Function',
41 'XSLT 2.0 Tag' => 'Reserved',
42 'XSLT Tag' => 'Reserved',
44 $self->listAdd('functions',
81 'unparsed-entity-uri',
83 $self->listAdd('functions_2.0',
86 'adjust-date-to-timezone',
87 'adjust-dateTime-to-timezone',
88 'adjust-time-to-timezone',
91 'codepoints-to-string',
97 'current-grouping-key',
103 'days-from-duration',
119 'hours-from-dateTime',
120 'hours-from-duration',
128 'local-name-from-QName',
133 'minutes-from-dateTime',
134 'minutes-from-duration',
137 'month-from-dateTime',
138 'months-from-duration',
139 'namespace-uri-for-prefix',
140 'namespace-uri-from-QName',
152 'round-half-to-even',
153 'seconds-from-dateTime',
154 'seconds-from-duration',
156 'sequence-node-identical',
159 'string-to-codepoints',
161 'subtract-dateTimes-yielding-dayTimeDuration',
162 'subtract-dateTimes-yielding-yearMonthDuration',
163 'subtract-dates-yielding-dayTimeDuration',
164 'subtract-dates-yielding-yearMonthDuration',
165 'timezone-from-date',
166 'timezone-from-dateTime',
167 'timezone-from-time',
171 'unparsed-entity-public-id',
175 'year-from-dateTime',
176 'years-from-duration',
179 $self->listAdd('keytags',
181 'xsl:apply-templates',
189 'xsl:decimal-format',
198 'xsl:namespace-alias',
203 'xsl:preserve-space',
204 'xsl:processing-instruction',
216 $self->listAdd('keytags_2.0',
217 'xsl:analyze-string',
220 'xsl:for-each-group',
223 'xsl:matching-substring',
226 'xsl:non-matching-substring',
227 'xsl:output-character',
229 'xsl:result-document',
234 callback => \&parseattrValue,
235 attribute => 'Invalid',
238 callback => \&parseattributes,
239 attribute => 'Attribute',
242 callback => \&parsecomment,
243 attribute => 'Comment',
246 callback => \&parsedetectEntRef,
247 attribute => 'Normal Text',
250 callback => \&parsenormalText,
251 attribute => 'Normal Text',
254 callback => \&parsesqstring,
255 attribute => 'Attribute Value',
258 callback => \&parsesqxpath,
259 attribute => 'XPath',
262 callback => \&parsesqxpathstring,
263 attribute => 'XPath String',
266 callback => \&parsestring,
267 attribute => 'Attribute Value',
270 callback => \&parsetagname,
274 callback => \&parsexattrValue,
275 attribute => 'Invalid',
278 callback => \&parsexattributes,
279 attribute => 'Attribute',
282 callback => \&parsexpath,
283 attribute => 'XPath',
286 callback => \&parsexpathstring,
287 attribute => 'XPath String',
290 $self->deliminators('\\s||\\.|\\(|\\)|\\!|\\+|,|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|-|:');
291 $self->basecontext('normalText');
292 $self->keywordscase(0);
294 bless ($self, $class);
303 my ($self, $text) = @_;
304 # attribute => 'Invalid'
307 # context => '#pop#pop#pop'
308 # type => 'Detect2Chars'
309 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Invalid')) {
312 # attribute => 'Invalid'
314 # context => '#pop#pop#pop'
315 # type => 'DetectChar'
316 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Invalid')) {
319 # attribute => 'Attribute Value'
321 # context => 'string'
322 # type => 'DetectChar'
323 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'Attribute Value')) {
326 # attribute => 'Attribute Value'
328 # context => 'sqstring'
329 # type => 'DetectChar'
330 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'sqstring', 'Attribute Value')) {
336 sub parseattributes {
337 my ($self, $text) = @_;
341 # context => '#pop#pop'
342 # type => 'Detect2Chars'
343 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop#pop', 'Tag')) {
348 # context => '#pop#pop'
349 # type => 'DetectChar'
350 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop', 'Tag')) {
353 # String => '\s*=\s*'
354 # attribute => 'Normal Text'
355 # context => 'attrValue'
357 if ($self->testRegExpr($text, '\\s*=\\s*', 0, 0, 0, undef, 0, 'attrValue', 'Normal Text')) {
364 my ($self, $text) = @_;
366 # attribute => 'Comment'
368 # endRegion => 'comment'
369 # type => 'StringDetect'
370 if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
373 # String => '-(-(?!->))+'
374 # attribute => 'Invalid'
377 if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Invalid')) {
380 # String => '(FIXME|TODO|HACK)'
381 # attribute => 'Alert'
384 if ($self->testRegExpr($text, '(FIXME|TODO|HACK)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
390 sub parsedetectEntRef {
391 my ($self, $text) = @_;
392 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);'
393 # attribute => 'Entity Reference'
396 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'Entity Reference')) {
402 sub parsenormalText {
403 my ($self, $text) = @_;
405 # attribute => 'Comment'
406 # beginRegion => 'comment'
407 # context => 'comment'
408 # type => 'StringDetect'
409 if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
414 # context => 'tagname'
415 # type => 'DetectChar'
416 if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, 'tagname', 'Tag')) {
419 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);'
420 # attribute => 'Entity Reference'
423 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'Entity Reference')) {
430 my ($self, $text) = @_;
431 # attribute => 'XPath'
433 # context => 'sqxpath'
434 # type => 'DetectChar'
435 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'sqxpath', 'XPath')) {
438 # attribute => 'Attribute Value'
440 # context => '#pop#pop'
441 # type => 'DetectChar'
442 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop#pop', 'Attribute Value')) {
445 # context => 'detectEntRef'
446 # type => 'IncludeRules'
447 if ($self->includeRules('detectEntRef', $text)) {
454 my ($self, $text) = @_;
455 # String => 'functions'
456 # attribute => 'XPath/ XSLT Function'
459 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'XPath/ XSLT Function')) {
462 # String => 'functions_2.0'
463 # attribute => 'XPath 2.0/ XSLT 2.0 Function'
466 if ($self->testKeyword($text, 'functions_2.0', 0, undef, 0, '#stay', 'XPath 2.0/ XSLT 2.0 Function')) {
469 # String => '(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::'
470 # attribute => 'XPath Axis'
473 if ($self->testRegExpr($text, '(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::', 0, 0, 0, undef, 0, '#stay', 'XPath Axis')) {
476 # attribute => 'XPath'
479 # type => 'DetectChar'
480 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'XPath')) {
483 # attribute => 'XPath String'
485 # context => 'xpathstring'
486 # type => 'DetectChar'
487 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'xpathstring', 'XPath String')) {
490 # attribute => 'XPath'
492 # context => '#pop#pop'
493 # type => 'DetectChar'
494 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop#pop', 'XPath')) {
497 # String => '@[A-Za-z_:][\w.:_-]*'
498 # attribute => 'XPath Attribute'
501 if ($self->testRegExpr($text, '@[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'XPath Attribute')) {
504 # String => '\$[A-Za-z_:][\w.:_-]*'
505 # attribute => 'Variable'
508 if ($self->testRegExpr($text, '\\$[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'Variable')) {
511 # String => '[A-Za-z_:][\w.:_-]*'
512 # attribute => 'XPath'
515 if ($self->testRegExpr($text, '[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'XPath')) {
518 # attribute => 'Invalid'
521 # type => 'DetectChar'
522 if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#stay', 'Invalid')) {
525 # context => 'detectEntRef'
526 # type => 'IncludeRules'
527 if ($self->includeRules('detectEntRef', $text)) {
533 sub parsesqxpathstring {
534 my ($self, $text) = @_;
535 # attribute => 'XPath String'
538 # type => 'DetectChar'
539 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'XPath String')) {
542 # context => 'detectEntRef'
543 # type => 'IncludeRules'
544 if ($self->includeRules('detectEntRef', $text)) {
551 my ($self, $text) = @_;
552 # attribute => 'XPath'
555 # type => 'DetectChar'
556 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'xpath', 'XPath')) {
559 # attribute => 'Attribute Value'
561 # context => '#pop#pop'
562 # type => 'DetectChar'
563 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop#pop', 'Attribute Value')) {
566 # context => 'detectEntRef'
567 # type => 'IncludeRules'
568 if ($self->includeRules('detectEntRef', $text)) {
575 my ($self, $text) = @_;
576 # String => 'keytags'
577 # attribute => 'XSLT Tag'
578 # context => 'xattributes'
580 if ($self->testKeyword($text, 'keytags', 0, undef, 0, 'xattributes', 'XSLT Tag')) {
583 # String => 'keytags_2.0'
584 # attribute => 'XSLT 2.0 Tag'
585 # context => 'xattributes'
587 if ($self->testKeyword($text, 'keytags_2.0', 0, undef, 0, 'xattributes', 'XSLT 2.0 Tag')) {
591 # attribute => 'Attribute'
592 # context => 'attributes'
594 if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, 'attributes', 'Attribute')) {
600 # type => 'DetectChar'
601 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Tag')) {
607 sub parsexattrValue {
608 my ($self, $text) = @_;
609 # attribute => 'Invalid'
612 # context => '#pop#pop#pop'
613 # type => 'Detect2Chars'
614 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Invalid')) {
617 # attribute => 'Invalid'
619 # context => '#pop#pop#pop'
620 # type => 'DetectChar'
621 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Invalid')) {
624 # attribute => 'XPath'
627 # type => 'DetectChar'
628 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'xpath', 'XPath')) {
631 # attribute => 'XPath'
633 # context => 'sqxpath'
634 # type => 'DetectChar'
635 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'sqxpath', 'XPath')) {
641 sub parsexattributes {
642 my ($self, $text) = @_;
646 # context => '#pop#pop'
647 # type => 'Detect2Chars'
648 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop#pop', 'Tag')) {
653 # context => '#pop#pop'
654 # type => 'DetectChar'
655 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop', 'Tag')) {
658 # String => 'select\s*=\s*'
659 # attribute => 'Attribute'
660 # context => 'xattrValue'
662 if ($self->testRegExpr($text, 'select\\s*=\\s*', 0, 0, 0, undef, 0, 'xattrValue', 'Attribute')) {
665 # String => 'test\s*=\s*'
666 # attribute => 'Attribute'
667 # context => 'xattrValue'
669 if ($self->testRegExpr($text, 'test\\s*=\\s*', 0, 0, 0, undef, 0, 'xattrValue', 'Attribute')) {
672 # String => 'match\s*=\s*'
673 # attribute => 'Attribute'
674 # context => 'xattrValue'
676 if ($self->testRegExpr($text, 'match\\s*=\\s*', 0, 0, 0, undef, 0, 'xattrValue', 'Attribute')) {
679 # String => '\s*=\s*'
680 # attribute => 'Attribute'
681 # context => 'attrValue'
683 if ($self->testRegExpr($text, '\\s*=\\s*', 0, 0, 0, undef, 0, 'attrValue', 'Attribute')) {
690 my ($self, $text) = @_;
691 # String => 'functions'
692 # attribute => 'XPath/ XSLT Function'
695 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'XPath/ XSLT Function')) {
698 # String => 'functions_2.0'
699 # attribute => 'XPath 2.0/ XSLT 2.0 Function'
702 if ($self->testKeyword($text, 'functions_2.0', 0, undef, 0, '#stay', 'XPath 2.0/ XSLT 2.0 Function')) {
705 # String => '(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::'
706 # attribute => 'XPath Axis'
709 if ($self->testRegExpr($text, '(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::', 0, 0, 0, undef, 0, '#stay', 'XPath Axis')) {
712 # attribute => 'XPath'
715 # type => 'DetectChar'
716 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'XPath')) {
719 # attribute => 'XPath String'
721 # context => 'sqxpathstring'
722 # type => 'DetectChar'
723 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'sqxpathstring', 'XPath String')) {
726 # attribute => 'XPath'
728 # context => '#pop#pop'
729 # type => 'DetectChar'
730 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop#pop', 'XPath')) {
733 # String => '@[A-Za-z_:][\w.:_-]*'
734 # attribute => 'XPath Attribute'
737 if ($self->testRegExpr($text, '@[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'XPath Attribute')) {
740 # String => '\$[A-Za-z_:][\w.:_-]*'
741 # attribute => 'Variable'
744 if ($self->testRegExpr($text, '\\$[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'Variable')) {
747 # String => '[A-Za-z_:][\w.:_-]*'
748 # attribute => 'XPath'
751 if ($self->testRegExpr($text, '[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'XPath')) {
754 # attribute => 'Invalid'
757 # type => 'DetectChar'
758 if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#stay', 'Invalid')) {
761 # context => 'detectEntRef'
762 # type => 'IncludeRules'
763 if ($self->includeRules('detectEntRef', $text)) {
769 sub parsexpathstring {
770 my ($self, $text) = @_;
771 # attribute => 'XPath String'
774 # type => 'DetectChar'
775 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'XPath String')) {
778 # context => 'detectEntRef'
779 # type => 'IncludeRules'
780 if ($self->includeRules('detectEntRef', $text)) {
793 Syntax::Highlight::Engine::Kate::Xslt - a Plugin for xslt syntax highlighting
797 require Syntax::Highlight::Engine::Kate::Xslt;
798 my $sh = new Syntax::Highlight::Engine::Kate::Xslt([
803 Syntax::Highlight::Engine::Kate::Xslt is a plugin module that provides syntax highlighting
804 for xslt to the Syntax::Haghlight::Engine::Kate highlighting engine.
806 This code is generated from the syntax definition files used
808 It works quite fine, but can use refinement and optimization.
810 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
816 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
822 Unknown. If you find any, please contact the author