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 'xml.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Wilbert Berendsen (wilbert@kde.nl)
11 #generated: Sun Feb 3 22:02:06 2008, localtime
13 package Syntax::Highlight::Engine::Kate::XML;
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 'Attribute' => 'Others',
28 'Comment' => 'Comment',
29 'Doctype' => 'DataType',
30 'Element' => 'Keyword',
31 'EntityRef' => 'DecVal',
33 'Normal Text' => 'Normal',
34 'PEntityRef' => 'DecVal',
35 'Processing Instruction' => 'Keyword',
40 callback => \&parseAttribute,
41 attribute => 'Normal Text',
44 callback => \&parseCDATA,
45 attribute => 'Normal Text',
48 callback => \&parseComment,
49 attribute => 'Comment',
52 callback => \&parseDoctype,
53 attribute => 'Normal Text',
55 'Doctype Internal Subset' => {
56 callback => \&parseDoctypeInternalSubset,
57 attribute => 'Normal Text',
59 'Doctype Markupdecl' => {
60 callback => \&parseDoctypeMarkupdecl,
61 attribute => 'Normal Text',
63 'Doctype Markupdecl DQ' => {
64 callback => \&parseDoctypeMarkupdeclDQ,
67 'Doctype Markupdecl SQ' => {
68 callback => \&parseDoctypeMarkupdeclSQ,
72 callback => \&parseElContent,
73 attribute => 'Normal Text',
76 callback => \&parseElEnd,
77 attribute => 'Normal Text',
80 callback => \&parseElement,
81 attribute => 'Normal Text',
84 callback => \&parseFindEntityRefs,
85 attribute => 'Normal Text',
87 'FindPEntityRefs' => {
88 callback => \&parseFindPEntityRefs,
89 attribute => 'Normal Text',
92 callback => \&parseFindXML,
93 attribute => 'Normal Text',
96 callback => \&parsePI,
97 attribute => 'Normal Text',
100 callback => \&parseStart,
101 attribute => 'Normal Text',
104 callback => \&parseValue,
105 attribute => 'Normal Text',
108 callback => \&parseValueDQ,
109 attribute => 'Value',
112 callback => \&parseValueSQ,
113 attribute => 'Value',
116 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
117 $self->basecontext('Start');
118 $self->keywordscase(1);
120 bless ($self, $class);
129 my ($self, $text) = @_;
130 # attribute => 'Attribute'
133 # type => 'DetectChar'
134 if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) {
138 # attribute => 'Error'
141 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
148 my ($self, $text) = @_;
149 # type => 'DetectSpaces'
150 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
153 # type => 'DetectIdentifier'
154 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
158 # attribute => 'CDATA'
160 # endRegion => 'cdata'
161 # type => 'StringDetect'
162 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) {
166 # attribute => 'EntityRef'
168 # type => 'StringDetect'
169 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) {
176 my ($self, $text) = @_;
177 # type => 'DetectSpaces'
178 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
182 # attribute => 'Comment'
184 # endRegion => 'comment'
185 # type => 'StringDetect'
186 if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
189 # String => '-(-(?!->))+'
190 # attribute => 'Error'
193 if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) {
196 # context => '##Alerts'
197 # type => 'IncludeRules'
198 if ($self->includePlugin('Alerts', $text)) {
201 # type => 'DetectIdentifier'
202 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
209 my ($self, $text) = @_;
210 # attribute => 'Doctype'
213 # endRegion => 'doctype'
214 # type => 'DetectChar'
215 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) {
218 # attribute => 'Doctype'
219 # beginRegion => 'int_subset'
221 # context => 'Doctype Internal Subset'
222 # type => 'DetectChar'
223 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) {
229 sub parseDoctypeInternalSubset {
230 my ($self, $text) = @_;
231 # attribute => 'Doctype'
234 # endRegion => 'int_subset'
235 # type => 'DetectChar'
236 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) {
239 # String => '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b'
240 # attribute => 'Doctype'
241 # context => 'Doctype Markupdecl'
243 if ($self->testRegExpr($text, '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\\b', 0, 0, 0, undef, 0, 'Doctype Markupdecl', 'Doctype')) {
247 # attribute => 'Comment'
248 # beginRegion => 'comment'
249 # context => 'Comment'
250 # type => 'StringDetect'
251 if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
254 # String => '<\?[\w:_-]*'
255 # attribute => 'Processing Instruction'
256 # beginRegion => 'pi'
259 if ($self->testRegExpr($text, '<\\?[\\w:_-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) {
262 # context => 'FindPEntityRefs'
263 # type => 'IncludeRules'
264 if ($self->includeRules('FindPEntityRefs', $text)) {
270 sub parseDoctypeMarkupdecl {
271 my ($self, $text) = @_;
272 # attribute => 'Doctype'
275 # type => 'DetectChar'
276 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) {
279 # attribute => 'Value'
281 # context => 'Doctype Markupdecl DQ'
282 # type => 'DetectChar'
283 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Doctype Markupdecl DQ', 'Value')) {
286 # attribute => 'Value'
288 # context => 'Doctype Markupdecl SQ'
289 # type => 'DetectChar'
290 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Doctype Markupdecl SQ', 'Value')) {
296 sub parseDoctypeMarkupdeclDQ {
297 my ($self, $text) = @_;
298 # attribute => 'Value'
301 # type => 'DetectChar'
302 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Value')) {
305 # context => 'FindPEntityRefs'
306 # type => 'IncludeRules'
307 if ($self->includeRules('FindPEntityRefs', $text)) {
313 sub parseDoctypeMarkupdeclSQ {
314 my ($self, $text) = @_;
315 # attribute => 'Value'
318 # type => 'DetectChar'
319 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Value')) {
322 # context => 'FindPEntityRefs'
323 # type => 'IncludeRules'
324 if ($self->includeRules('FindPEntityRefs', $text)) {
331 my ($self, $text) = @_;
332 # String => '</[A-Za-z_:][\w.:_-]*'
333 # attribute => 'Element'
334 # context => 'El End'
336 if ($self->testRegExpr($text, '</[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'El End', 'Element')) {
339 # context => 'FindXML'
340 # type => 'IncludeRules'
341 if ($self->includeRules('FindXML', $text)) {
348 my ($self, $text) = @_;
349 # attribute => 'Element'
351 # context => '#pop#pop#pop'
352 # endRegion => 'element'
353 # type => 'DetectChar'
354 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Element')) {
358 # attribute => 'Error'
361 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
368 my ($self, $text) = @_;
369 # attribute => 'Element'
373 # endRegion => 'element'
374 # type => 'Detect2Chars'
375 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) {
378 # attribute => 'Element'
380 # context => 'El Content'
381 # type => 'DetectChar'
382 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'El Content', 'Element')) {
385 # String => '^[A-Za-z_:][\w.:_-]*'
386 # attribute => 'Attribute'
387 # context => 'Attribute'
389 if ($self->testRegExpr($text, '^[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'Attribute', 'Attribute')) {
392 # String => '\s+[A-Za-z_:][\w.:_-]*'
393 # attribute => 'Attribute'
394 # context => 'Attribute'
396 if ($self->testRegExpr($text, '\\s+[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'Attribute', 'Attribute')) {
400 # attribute => 'Error'
403 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
409 sub parseFindEntityRefs {
410 my ($self, $text) = @_;
411 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);'
412 # attribute => 'EntityRef'
415 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) {
419 # attribute => 'Error'
422 if ($self->testAnyChar($text, '&<', 0, 0, undef, 0, '#stay', 'Error')) {
428 sub parseFindPEntityRefs {
429 my ($self, $text) = @_;
430 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);'
431 # attribute => 'EntityRef'
434 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) {
437 # String => '%[A-Za-z_:][\w.:_-]*;'
438 # attribute => 'PEntityRef'
441 if ($self->testRegExpr($text, '%[A-Za-z_:][\\w.:_-]*;', 0, 0, 0, undef, 0, '#stay', 'PEntityRef')) {
445 # attribute => 'Error'
448 if ($self->testAnyChar($text, '&%', 0, 0, undef, 0, '#stay', 'Error')) {
455 my ($self, $text) = @_;
456 # type => 'DetectSpaces'
457 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
461 # attribute => 'Comment'
462 # beginRegion => 'comment'
463 # context => 'Comment'
464 # type => 'StringDetect'
465 if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
468 # String => '<![CDATA['
469 # attribute => 'CDATA'
470 # beginRegion => 'cdata'
472 # type => 'StringDetect'
473 if ($self->testStringDetect($text, '<![CDATA[', 0, 0, 0, undef, 0, 'CDATA', 'CDATA')) {
476 # String => '<!DOCTYPE\s+'
477 # attribute => 'Doctype'
478 # beginRegion => 'doctype'
479 # context => 'Doctype'
481 if ($self->testRegExpr($text, '<!DOCTYPE\\s+', 0, 0, 0, undef, 0, 'Doctype', 'Doctype')) {
484 # String => '<\?[\w:_-]*'
485 # attribute => 'Processing Instruction'
486 # beginRegion => 'pi'
489 if ($self->testRegExpr($text, '<\\?[\\w:_-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) {
492 # String => '<[A-Za-z_:][\w.:_-]*'
493 # attribute => 'Element'
494 # beginRegion => 'element'
495 # context => 'Element'
497 if ($self->testRegExpr($text, '<[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'Element', 'Element')) {
500 # context => 'FindEntityRefs'
501 # type => 'IncludeRules'
502 if ($self->includeRules('FindEntityRefs', $text)) {
505 # type => 'DetectIdentifier'
506 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
513 my ($self, $text) = @_;
514 # attribute => 'Processing Instruction'
519 # type => 'Detect2Chars'
520 if ($self->testDetect2Chars($text, '?', '>', 0, 0, 0, undef, 0, '#pop', 'Processing Instruction')) {
527 my ($self, $text) = @_;
528 # context => 'FindXML'
529 # type => 'IncludeRules'
530 if ($self->includeRules('FindXML', $text)) {
537 my ($self, $text) = @_;
538 # attribute => 'Value'
540 # context => 'Value DQ'
541 # type => 'DetectChar'
542 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Value DQ', 'Value')) {
545 # attribute => 'Value'
547 # context => 'Value SQ'
548 # type => 'DetectChar'
549 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Value SQ', 'Value')) {
553 # attribute => 'Error'
556 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
563 my ($self, $text) = @_;
564 # attribute => 'Value'
566 # context => '#pop#pop#pop'
567 # type => 'DetectChar'
568 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Value')) {
571 # context => 'FindEntityRefs'
572 # type => 'IncludeRules'
573 if ($self->includeRules('FindEntityRefs', $text)) {
580 my ($self, $text) = @_;
581 # attribute => 'Value'
583 # context => '#pop#pop#pop'
584 # type => 'DetectChar'
585 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Value')) {
588 # context => 'FindEntityRefs'
589 # type => 'IncludeRules'
590 if ($self->includeRules('FindEntityRefs', $text)) {
603 Syntax::Highlight::Engine::Kate::XML - a Plugin for XML syntax highlighting
607 require Syntax::Highlight::Engine::Kate::XML;
608 my $sh = new Syntax::Highlight::Engine::Kate::XML([
613 Syntax::Highlight::Engine::Kate::XML is a plugin module that provides syntax highlighting
614 for XML to the Syntax::Haghlight::Engine::Kate highlighting engine.
616 This code is generated from the syntax definition files used
618 It works quite fine, but can use refinement and optimization.
620 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
626 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
632 Unknown. If you find any, please contact the author