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 'inform.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Giancarlo Niccolai (giancarlo@niccolai.ws)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Inform;
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 'Actions' => 'DataType',
27 'Comment' => 'Comment',
28 'Function' => 'Function',
29 'Keyword' => 'Keyword',
30 'Normal Text' => 'Normal',
32 'OpCode' => 'Reserved',
33 'Operator' => 'Operator',
35 'PredefFunction' => 'Function',
40 $self->listAdd('ClassDeclOps',
45 $self->listAdd('actions',
149 $self->listAdd('functions',
164 'ObjectIsUntouchable',
189 $self->listAdd('inline_pragmas',
195 $self->listAdd('keywords',
228 $self->listAdd('operators',
237 $self->listAdd('pragmas',
270 $self->listAdd('special_vals',
300 callback => \&parseClassDecl,
301 attribute => 'Normal Text',
302 lineending => 'ClassDecl_1',
305 callback => \&parseClassDecl_1,
306 attribute => 'Normal Text',
309 callback => \&parseNormal,
310 attribute => 'Normal Text',
312 'PropDefVal rules' => {
313 callback => \&parsePropDefValrules,
314 attribute => 'Normal Text',
317 callback => \&parseTopLevel,
318 attribute => 'Normal Text',
321 callback => \&parsecomment,
322 attribute => 'Comment',
323 lineending => '#pop',
326 callback => \&parsefuncdef,
327 attribute => 'Normal Text',
330 callback => \&parsehas_decl,
331 attribute => 'Normal Text',
334 callback => \&parseprop_def,
335 attribute => 'Normal Text',
338 callback => \&parseprop_func_def,
339 attribute => 'Normal Text',
342 callback => \&parsestring,
343 attribute => 'String',
346 callback => \&parseword,
348 lineending => '#pop',
351 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
352 $self->basecontext('TopLevel');
353 $self->keywordscase(0);
355 bless ($self, $class);
364 my ($self, $text) = @_;
365 # context => 'PropDefVal rules'
366 # type => 'IncludeRules'
367 if ($self->includeRules('PropDefVal rules', $text)) {
373 sub parseClassDecl_1 {
374 my ($self, $text) = @_;
375 # String => '^[\t ]*has '
376 # attribute => 'Keyword'
377 # context => 'has_decl'
378 # insensitive => 'TRUE'
380 if ($self->testRegExpr($text, '^[\\t ]*has ', 1, 0, 0, undef, 0, 'has_decl', 'Keyword')) {
383 # String => 'ClassDeclOps'
384 # attribute => 'Keyword'
387 if ($self->testKeyword($text, 'ClassDeclOps', 0, undef, 0, '#stay', 'Keyword')) {
390 # String => '[a-zA-Z_]+\w*'
391 # attribute => 'Function'
392 # context => 'prop_def'
394 if ($self->testRegExpr($text, '[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, 'prop_def', 'Function')) {
397 # attribute => 'Pragma'
400 # endRegion => 'reg_class'
401 # type => 'DetectChar'
402 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Pragma')) {
409 my ($self, $text) = @_;
410 # attribute => 'Comment'
412 # context => 'comment'
413 # type => 'DetectChar'
414 if ($self->testDetectChar($text, '!', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
417 # attribute => 'String'
419 # context => 'string'
420 # type => 'DetectChar'
421 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
424 # attribute => 'Word'
427 # type => 'DetectChar'
428 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'word', 'Word')) {
431 # String => 'inline_pragmas'
432 # attribute => 'Pragma'
435 if ($self->testKeyword($text, 'inline_pragmas', 0, undef, 0, '#stay', 'Pragma')) {
439 # attribute => 'Operator'
442 if ($self->testRegExpr($text, '--?>', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
445 # String => 'keywords'
446 # attribute => 'Keyword'
449 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
452 # String => 'actions'
453 # attribute => 'Actions'
456 if ($self->testKeyword($text, 'actions', 0, undef, 0, '#stay', 'Actions')) {
459 # String => 'functions'
460 # attribute => 'PredefFunction'
463 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'PredefFunction')) {
466 # String => 'special_vals'
467 # attribute => 'Values'
470 if ($self->testKeyword($text, 'special_vals', 0, undef, 0, '#stay', 'Values')) {
473 # String => 'operators'
474 # attribute => 'Operator'
477 if ($self->testKeyword($text, 'operators', 0, undef, 0, '#stay', 'Operator')) {
480 # String => '##[a-zA-Z_]+\w*'
481 # attribute => 'Actions'
484 if ($self->testRegExpr($text, '##[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'Actions')) {
487 # String => '@[a-zA-Z_]+\w*'
488 # attribute => 'OpCode'
491 if ($self->testRegExpr($text, '@[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'OpCode')) {
494 # String => '\$[0-9a-fA-F]{1,4}'
495 # attribute => 'Number'
498 if ($self->testRegExpr($text, '\\$[0-9a-fA-F]{1,4}', 0, 0, 0, undef, 0, '#stay', 'Number')) {
501 # String => '[a-zA-Z_]+\w*'
502 # attribute => 'Normal Text'
505 if ($self->testRegExpr($text, '[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
509 # attribute => 'Number'
512 if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#stay', 'Number')) {
515 # attribute => 'Keyword'
516 # beginRegion => 'reg_compound'
519 # type => 'DetectChar'
520 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
523 # attribute => 'Keyword'
526 # endRegion => 'reg_compound'
527 # type => 'DetectChar'
528 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
531 # String => '%&()+-<=>{|}~'
532 # attribute => 'Operator'
535 if ($self->testAnyChar($text, '%&()+-<=>{|}~', 0, 0, undef, 0, '#stay', 'Operator')) {
541 sub parsePropDefValrules {
542 my ($self, $text) = @_;
543 # attribute => 'Comment'
545 # context => 'comment'
546 # type => 'DetectChar'
547 if ($self->testDetectChar($text, '!', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
550 # attribute => 'String'
552 # context => 'string'
553 # type => 'DetectChar'
554 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
557 # attribute => 'Word'
560 # type => 'DetectChar'
561 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'word', 'Word')) {
564 # attribute => 'Function'
565 # beginRegion => 'reg_prop_def_func'
567 # context => 'prop_func_def'
568 # type => 'DetectChar'
569 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'prop_func_def', 'Function')) {
572 # attribute => 'Operator'
575 # type => 'DetectChar'
576 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
579 # String => '\$[0-9a-fA-F]{1,4}'
580 # attribute => 'Number'
583 if ($self->testRegExpr($text, '\\$[0-9a-fA-F]{1,4}', 0, 0, 0, undef, 0, '#stay', 'Number')) {
587 # attribute => 'Number'
590 if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#stay', 'Number')) {
597 my ($self, $text) = @_;
598 # attribute => 'Comment'
600 # context => 'comment'
601 # type => 'DetectChar'
602 if ($self->testDetectChar($text, '!', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
605 # attribute => 'String'
607 # context => 'string'
608 # type => 'DetectChar'
609 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
612 # String => '[[]\s*[a-zA-Z_]+\w*'
613 # attribute => 'Function'
614 # beginRegion => 'reg_function'
615 # context => 'funcdef'
617 if ($self->testRegExpr($text, '[[]\\s*[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, 'funcdef', 'Function')) {
620 # String => ' *object | *class '
621 # attribute => 'Pragma'
622 # beginRegion => 'reg_class'
624 # context => 'ClassDecl'
625 # insensitive => 'TRUE'
627 if ($self->testRegExpr($text, ' *object | *class ', 1, 0, 0, 0, 0, 'ClassDecl', 'Pragma')) {
630 # String => 'pragmas'
631 # attribute => 'Pragma'
634 if ($self->testKeyword($text, 'pragmas', 0, undef, 0, '#stay', 'Pragma')) {
637 # String => 'inline_pragmas'
638 # attribute => 'Pragma'
641 if ($self->testKeyword($text, 'inline_pragmas', 0, undef, 0, '#stay', 'Pragma')) {
645 # attribute => 'Operator'
648 if ($self->testRegExpr($text, '--?>', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
651 # String => '[a-zA-Z_]+\d*'
652 # attribute => 'Normal Text'
655 if ($self->testRegExpr($text, '[a-zA-Z_]+\\d*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
658 # String => '\$[0-9a-fA-F]{1,4}'
659 # attribute => 'Number'
662 if ($self->testRegExpr($text, '\\$[0-9a-fA-F]{1,4}', 0, 0, 0, undef, 0, '#stay', 'Number')) {
666 # attribute => 'Number'
669 if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#stay', 'Number')) {
676 my ($self, $text) = @_;
681 my ($self, $text) = @_;
682 # context => 'Normal'
683 # type => 'IncludeRules'
684 if ($self->includeRules('Normal', $text)) {
687 # attribute => 'Function'
691 # endRegion => 'reg_function'
692 # type => 'Detect2Chars'
693 if ($self->testDetect2Chars($text, ']', ';', 0, 0, 0, undef, 0, '#pop', 'Function')) {
700 my ($self, $text) = @_;
701 # attribute => 'Pragma'
703 # context => '#pop#pop#pop'
704 # endRegion => 'reg_class'
705 # type => 'DetectChar'
706 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Pragma')) {
709 # context => 'PropDefVal rules'
710 # type => 'IncludeRules'
711 if ($self->includeRules('PropDefVal rules', $text)) {
718 my ($self, $text) = @_;
719 # attribute => 'Function'
722 # endRegion => 'reg_prop'
723 # type => 'DetectChar'
724 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Function')) {
727 # attribute => 'Pragma'
729 # context => '#pop#pop#pop'
730 # endRegion => 'reg_class'
731 # type => 'DetectChar'
732 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Pragma')) {
735 # attribute => 'Function'
736 # beginRegion => 'reg_prop_func'
738 # context => 'prop_func_def'
739 # type => 'DetectChar'
740 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'prop_func_def', 'Function')) {
743 # context => 'PropDefVal rules'
744 # type => 'IncludeRules'
745 if ($self->includeRules('PropDefVal rules', $text)) {
751 sub parseprop_func_def {
752 my ($self, $text) = @_;
753 # attribute => 'Function'
756 # endRegion => 'reg_prop_func'
757 # type => 'DetectChar'
758 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Function')) {
761 # context => 'Normal'
762 # type => 'IncludeRules'
763 if ($self->includeRules('Normal', $text)) {
770 my ($self, $text) = @_;
771 # attribute => 'String'
774 # type => 'DetectChar'
775 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
782 my ($self, $text) = @_;
783 # attribute => 'Word'
786 # type => 'DetectChar'
787 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Word')) {
800 Syntax::Highlight::Engine::Kate::Inform - a Plugin for Inform syntax highlighting
804 require Syntax::Highlight::Engine::Kate::Inform;
805 my $sh = new Syntax::Highlight::Engine::Kate::Inform([
810 Syntax::Highlight::Engine::Kate::Inform is a plugin module that provides syntax highlighting
811 for Inform to the Syntax::Haghlight::Engine::Kate highlighting engine.
813 This code is generated from the syntax definition files used
815 It works quite fine, but can use refinement and optimization.
817 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
823 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
829 Unknown. If you find any, please contact the author