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 'mason.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:05 2008, localtime
12 package Syntax::Highlight::Engine::Kate::Mason;
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',
32 'Keyword' => 'Keyword',
33 'Mason Method' => 'Keyword',
34 'Mason Tag' => 'Keyword',
36 'Pattern' => 'Others',
38 'String Char' => 'Char',
42 $self->listAdd('keywords',
106 callback => \&parseCommentar1,
107 attribute => 'Comment',
108 lineending => '#pop',
111 callback => \&parseCommentar2,
112 attribute => 'Comment',
115 callback => \&parseDocumentation,
116 attribute => 'Comment',
119 callback => \&parseEmbeddedPerl,
120 attribute => 'normal',
123 callback => \&parseHTML,
127 callback => \&parseMethodCall,
128 attribute => 'Mason Method',
131 callback => \&parsePattern,
132 attribute => 'Pattern',
135 callback => \&parsePattern2,
136 attribute => 'Pattern',
139 callback => \&parsePattern3,
140 attribute => 'Pattern',
143 callback => \&parsePerlOneLiner,
144 attribute => 'String',
145 lineending => '#pop',
148 callback => \&parseSomething,
149 attribute => 'String Char',
152 callback => \&parseString,
153 attribute => 'String',
156 callback => \&parseString2,
157 attribute => 'String',
160 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
161 $self->basecontext('HTML');
162 $self->keywordscase(0);
164 bless ($self, $class);
172 sub parseCommentar1 {
173 my ($self, $text) = @_;
177 sub parseCommentar2 {
178 my ($self, $text) = @_;
179 # attribute => 'Comment'
183 # type => 'Detect2Chars'
184 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
190 sub parseDocumentation {
191 my ($self, $text) = @_;
192 # String => '</%doc>'
193 # attribute => 'Comment'
195 # insensitive => 'FALSE'
196 # type => 'StringDetect'
197 if ($self->testStringDetect($text, '</%doc>', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
203 sub parseEmbeddedPerl {
204 my ($self, $text) = @_;
205 # attribute => 'Mason Tag'
209 # type => 'Detect2Chars'
210 if ($self->testDetect2Chars($text, '%', '>', 0, 0, 0, undef, 0, '#pop', 'Mason Tag')) {
213 # String => '</%perl>'
214 # attribute => 'Mason Tag'
216 # insensitive => 'FALSE'
217 # type => 'StringDetect'
218 if ($self->testStringDetect($text, '</%perl>', 0, 0, 0, undef, 0, '#pop', 'Mason Tag')) {
221 # String => '</%method>'
222 # attribute => 'Mason Tag'
224 # insensitive => 'FALSE'
225 # type => 'StringDetect'
226 if ($self->testStringDetect($text, '</%method>', 0, 0, 0, undef, 0, '#pop', 'Mason Tag')) {
229 # String => 'keywords'
230 # attribute => 'Keyword'
233 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
236 # attribute => 'Octal'
239 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
245 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
248 # attribute => 'Decimal'
251 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
254 # attribute => 'Char'
257 if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
261 # attribute => 'Keyword'
264 if ($self->testRegExpr($text, '^#!.*', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
267 # attribute => 'String'
269 # context => 'String'
270 # type => 'DetectChar'
271 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
274 # attribute => 'String'
276 # context => 'String2'
277 # type => 'DetectChar'
278 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String2', 'String')) {
281 # attribute => 'String Char'
283 # context => 'String'
284 # type => 'DetectChar'
285 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'String', 'String Char')) {
288 # attribute => 'Comment'
291 # context => 'Commentar 1'
292 # type => 'Detect2Chars'
293 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
296 # attribute => 'Comment'
299 # context => 'Commentar 2'
300 # type => 'Detect2Chars'
301 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
304 # attribute => 'Pattern'
307 # context => 'Pattern2'
308 # type => 'Detect2Chars'
309 if ($self->testDetect2Chars($text, 's', '/', 0, 0, 0, undef, 0, 'Pattern2', 'Pattern')) {
312 # attribute => 'Pattern'
314 # context => 'Pattern'
315 # type => 'DetectChar'
316 if ($self->testDetectChar($text, '/', 0, 0, 0, undef, 0, 'Pattern', 'Pattern')) {
319 # String => '!%&()+,-<=>?[]^{|}~'
320 # attribute => 'Symbol'
323 if ($self->testAnyChar($text, '!%&()+,-<=>?[]^{|}~', 0, 0, undef, 0, '#stay', 'Symbol')) {
326 # String => '\$[0-9]+'
327 # attribute => 'Decimal'
330 if ($self->testRegExpr($text, '\\$[0-9]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
333 # String => '\$\#?[a-zA-Z_]+[a-zA-Z0-9_]*'
334 # attribute => 'Data Type'
337 if ($self->testRegExpr($text, '\\$\\#?[a-zA-Z_]+[a-zA-Z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
341 # attribute => 'Pattern'
344 if ($self->testRegExpr($text, '\\s+\\:', 0, 0, 0, undef, 0, '#stay', 'Pattern')) {
347 # attribute => 'Comment'
349 # context => 'Commentar 1'
350 # type => 'DetectChar'
351 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
358 my ($self, $text) = @_;
359 # String => '<\%method[^>]*>'
360 # attribute => 'Mason Tag'
361 # context => 'EmbeddedPerl'
363 if ($self->testRegExpr($text, '<\\%method[^>]*>', 0, 0, 0, undef, 0, 'EmbeddedPerl', 'Mason Tag')) {
366 # String => '<%method>'
367 # attribute => 'Mason Tag'
368 # context => 'EmbeddedPerl'
369 # insensitive => 'FALSE'
370 # type => 'StringDetect'
371 if ($self->testStringDetect($text, '<%method>', 0, 0, 0, undef, 0, 'EmbeddedPerl', 'Mason Tag')) {
375 # attribute => 'Comment'
376 # context => 'Documentation'
377 # insensitive => 'FALSE'
378 # type => 'StringDetect'
379 if ($self->testStringDetect($text, '<%doc>', 0, 0, 0, undef, 0, 'Documentation', 'Comment')) {
382 # String => '<%perl>'
383 # attribute => 'Mason Tag'
384 # context => 'EmbeddedPerl'
385 # insensitive => 'FALSE'
386 # type => 'StringDetect'
387 if ($self->testStringDetect($text, '<%perl>', 0, 0, 0, undef, 0, 'EmbeddedPerl', 'Mason Tag')) {
390 # attribute => 'Mason Tag'
393 # context => 'EmbeddedPerl'
394 # type => 'Detect2Chars'
395 if ($self->testDetect2Chars($text, '<', '%', 0, 0, 0, undef, 0, 'EmbeddedPerl', 'Mason Tag')) {
398 # attribute => 'Mason Method'
401 # context => 'MethodCall'
402 # type => 'Detect2Chars'
403 if ($self->testDetect2Chars($text, '<', '&', 0, 0, 0, undef, 0, 'MethodCall', 'Mason Method')) {
407 # attribute => 'Mason Tag'
408 # context => 'PerlOneLiner'
410 if ($self->testRegExpr($text, '^%', 0, 0, 0, undef, 0, 'PerlOneLiner', 'Mason Tag')) {
416 sub parseMethodCall {
417 my ($self, $text) = @_;
418 # attribute => 'Mason Method'
422 # type => 'Detect2Chars'
423 if ($self->testDetect2Chars($text, '&', '>', 0, 0, 0, undef, 0, '#pop', 'Mason Method')) {
430 my ($self, $text) = @_;
431 # String => '\\[\/\[\]dDwWsSnrtfb0\$@]?'
432 # attribute => 'String Char'
435 if ($self->testRegExpr($text, '\\\\[\\/\\[\\]dDwWsSnrtfb0\\$@]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
438 # String => '\^[\/\[\]]?'
439 # attribute => 'String Char'
442 if ($self->testRegExpr($text, '\\^[\\/\\[\\]]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
445 # attribute => 'Pattern'
448 # type => 'DetectChar'
449 if ($self->testDetectChar($text, '/', 0, 0, 0, undef, 0, '#pop', 'Pattern')) {
456 my ($self, $text) = @_;
457 # String => '\\[\/\[\]dDwWsSnrtfb0\$@]?'
458 # attribute => 'String Char'
461 if ($self->testRegExpr($text, '\\\\[\\/\\[\\]dDwWsSnrtfb0\\$@]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
464 # String => '\^[\/\[\]]?'
465 # attribute => 'String Char'
468 if ($self->testRegExpr($text, '\\^[\\/\\[\\]]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
472 # attribute => 'Pattern'
473 # context => 'Pattern3'
475 if ($self->testRegExpr($text, '\\/', 0, 0, 0, undef, 0, 'Pattern3', 'Pattern')) {
482 my ($self, $text) = @_;
483 # String => '\\[\/\[\]dDwWsSnrtfb0\$@]?'
484 # attribute => 'String Char'
487 if ($self->testRegExpr($text, '\\\\[\\/\\[\\]dDwWsSnrtfb0\\$@]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
490 # String => '\^[\/\[\]]?'
491 # attribute => 'String Char'
494 if ($self->testRegExpr($text, '\\^[\\/\\[\\]]?', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
498 # attribute => 'Pattern'
499 # context => '#pop#pop'
501 if ($self->testRegExpr($text, '\\/g?', 0, 0, 0, undef, 0, '#pop#pop', 'Pattern')) {
507 sub parsePerlOneLiner {
508 my ($self, $text) = @_;
509 # String => 'keywords'
510 # attribute => 'Keyword'
513 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
516 # attribute => 'Octal'
519 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
525 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
528 # attribute => 'Decimal'
531 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
534 # attribute => 'Char'
537 if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
541 # attribute => 'Keyword'
544 if ($self->testRegExpr($text, '^#!.*', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
547 # String => '"[^"]*"'
548 # attribute => 'String'
551 if ($self->testRegExpr($text, '"[^"]*"', 0, 0, 0, undef, 0, '#stay', 'String')) {
554 # String => ''[^']*''
555 # attribute => 'String'
558 if ($self->testRegExpr($text, '\'[^\']*\'', 0, 0, 0, undef, 0, '#stay', 'String')) {
561 # attribute => 'String Char'
563 # context => 'Something'
564 # type => 'DetectChar'
565 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'Something', 'String Char')) {
568 # attribute => 'Comment'
571 # context => 'Commentar 1'
572 # type => 'Detect2Chars'
573 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
576 # attribute => 'Comment'
579 # context => 'Commentar 2'
580 # type => 'Detect2Chars'
581 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
584 # attribute => 'Pattern'
587 # context => 'Pattern2'
588 # type => 'Detect2Chars'
589 if ($self->testDetect2Chars($text, 's', '/', 0, 0, 0, undef, 0, 'Pattern2', 'Pattern')) {
592 # String => '!%&()+,-<=>?[]^{|}~'
593 # attribute => 'Symbol'
596 if ($self->testAnyChar($text, '!%&()+,-<=>?[]^{|}~', 0, 0, undef, 0, '#stay', 'Symbol')) {
599 # String => '\$[0-9]+'
600 # attribute => 'Decimal'
603 if ($self->testRegExpr($text, '\\$[0-9]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
606 # String => '\$\#?[a-zA-Z_]+[a-zA-Z0-9_]*'
607 # attribute => 'Data Type'
610 if ($self->testRegExpr($text, '\\$\\#?[a-zA-Z_]+[a-zA-Z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
614 # attribute => 'Pattern'
617 if ($self->testRegExpr($text, '\\s+\\:', 0, 0, 0, undef, 0, '#stay', 'Pattern')) {
621 # attribute => 'Comment'
624 if ($self->testRegExpr($text, '\\#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
631 my ($self, $text) = @_;
632 # attribute => 'String Char'
635 # type => 'DetectChar'
636 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'String Char')) {
643 my ($self, $text) = @_;
644 # attribute => 'String'
646 # type => 'LineContinue'
647 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
650 # attribute => 'String Char'
652 # type => 'HlCStringChar'
653 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
656 # attribute => 'String'
659 # type => 'DetectChar'
660 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
663 # String => '\$[0-9]+'
664 # attribute => 'Decimal'
667 if ($self->testRegExpr($text, '\\$[0-9]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
670 # String => '\$[a-zA-Z_]*[a-zA-Z0-9_]*'
671 # attribute => 'Data Type'
674 if ($self->testRegExpr($text, '\\$[a-zA-Z_]*[a-zA-Z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
681 my ($self, $text) = @_;
682 # attribute => 'String'
684 # type => 'LineContinue'
685 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
688 # attribute => 'String Char'
692 # type => 'Detect2Chars'
693 if ($self->testDetect2Chars($text, '\\', '\'', 0, 0, 0, undef, 0, '#stay', 'String Char')) {
696 # attribute => 'String'
699 # type => 'DetectChar'
700 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
713 Syntax::Highlight::Engine::Kate::Mason - a Plugin for Mason syntax highlighting
717 require Syntax::Highlight::Engine::Kate::Mason;
718 my $sh = new Syntax::Highlight::Engine::Kate::Mason([
723 Syntax::Highlight::Engine::Kate::Mason is a plugin module that provides syntax highlighting
724 for Mason to the Syntax::Haghlight::Engine::Kate highlighting engine.
726 This code is generated from the syntax definition files used
728 It works quite fine, but can use refinement and optimization.
730 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
736 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
742 Unknown. If you find any, please contact the author