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 'javascript-php.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Anders Lund (anders@alweb.dk), Joseph Wenninger (jowenn@kde.org), Whitehawk Stormchaser (zerokode@gmx.net)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
13 package Syntax::Highlight::Engine::Kate::JavaScript_PHP;
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 'Comment' => 'Comment',
28 'Data Type' => 'DataType',
29 'Decimal' => 'DecVal',
30 'Events' => 'Keyword',
32 'Function' => 'Function',
33 'Keyword' => 'Keyword',
35 'Normal Text' => 'Normal',
36 'Objects' => 'Keyword',
37 'Pattern Character Class' => 'BaseN',
38 'Pattern Internal Operator' => 'Float',
39 'Region Marker' => 'RegionMarker',
40 'Regular Expression' => 'Others',
42 'String Char' => 'Char',
45 $self->listAdd('events',
60 $self->listAdd('functions',
73 $self->listAdd('keywords',
101 $self->listAdd('math',
127 $self->listAdd('methods',
186 'disableExternalCapture',
190 'enableExternalCapture',
222 'getUTCMilliseconds',
337 'setUTCMilliseconds',
393 $self->listAdd('objects',
432 '(Internal regex catch)' => {
433 callback => \&parseBoInternalregexcatchBc,
434 attribute => 'Normal Text',
435 fallthrough => '#pop',
437 '(charclass caret first check)' => {
438 callback => \&parseBocharclasscaretfirstcheckBc,
439 attribute => 'Pattern Internal Operator',
440 lineending => '#pop',
441 fallthrough => 'Regular Expression Character Class',
443 '(regex caret first check)' => {
444 callback => \&parseBoregexcaretfirstcheckBc,
445 attribute => 'Pattern Internal Operator',
446 lineending => '#pop',
447 fallthrough => 'Regular Expression',
450 callback => \&parseComment,
451 attribute => 'Comment',
452 lineending => '#pop',
455 callback => \&parseFindPHP,
457 'Multi/inline Comment' => {
458 callback => \&parseMultiinlineComment,
459 attribute => 'Comment',
462 callback => \&parseNormal,
463 attribute => 'Normal Text',
465 'Regular Expression' => {
466 callback => \&parseRegularExpression,
467 attribute => 'Regular Expression',
469 'Regular Expression Character Class' => {
470 callback => \&parseRegularExpressionCharacterClass,
471 attribute => 'Pattern Character Class',
474 callback => \&parseString,
475 attribute => 'String',
476 lineending => '#pop',
479 callback => \&parseString1,
480 attribute => 'String Char',
481 lineending => '#pop',
484 callback => \&parseregion_marker,
485 attribute => 'Region Marker',
486 lineending => '#pop',
489 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
490 $self->basecontext('Normal');
491 $self->keywordscase(0);
493 bless ($self, $class);
498 return 'JavaScript/PHP';
501 sub parseBoInternalregexcatchBc {
502 my ($self, $text) = @_;
503 # context => 'FindPHP'
504 # type => 'IncludeRules'
505 if ($self->includeRules('FindPHP', $text)) {
509 # attribute => 'Normal Text'
512 if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
515 # String => '//(?=;)'
516 # attribute => 'Regular Expression'
519 if ($self->testRegExpr($text, '//(?=;)', 0, 0, 0, undef, 0, '#pop', 'Regular Expression')) {
522 # attribute => 'Comment'
525 # context => 'Comment'
526 # type => 'Detect2Chars'
527 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
530 # attribute => 'Comment'
533 # context => 'Multi/inline Comment'
534 # type => 'Detect2Chars'
535 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Multi/inline Comment', 'Comment')) {
538 # attribute => 'Regular Expression'
540 # context => '(regex caret first check)'
541 # type => 'DetectChar'
542 if ($self->testDetectChar($text, '/', 0, 0, 0, undef, 0, '(regex caret first check)', 'Regular Expression')) {
548 sub parseBocharclasscaretfirstcheckBc {
549 my ($self, $text) = @_;
550 # context => 'FindPHP'
551 # type => 'IncludeRules'
552 if ($self->includeRules('FindPHP', $text)) {
555 # attribute => 'Pattern Internal Operator'
557 # context => 'Regular Expression Character Class'
558 # type => 'DetectChar'
559 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, 'Regular Expression Character Class', 'Pattern Internal Operator')) {
565 sub parseBoregexcaretfirstcheckBc {
566 my ($self, $text) = @_;
567 # context => 'FindPHP'
568 # type => 'IncludeRules'
569 if ($self->includeRules('FindPHP', $text)) {
572 # attribute => 'Pattern Internal Operator'
574 # context => 'Regular Expression'
575 # type => 'DetectChar'
576 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, 'Regular Expression', 'Pattern Internal Operator')) {
583 my ($self, $text) = @_;
584 # context => 'FindPHP'
585 # type => 'IncludeRules'
586 if ($self->includeRules('FindPHP', $text)) {
589 # type => 'DetectSpaces'
590 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
593 # context => '##Alerts'
594 # type => 'IncludeRules'
595 if ($self->includePlugin('Alerts', $text)) {
598 # type => 'DetectIdentifier'
599 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
606 my ($self, $text) = @_;
607 # String => '<\?(?:=|php)?'
608 # context => '##PHP/PHP'
609 # lookAhead => 'true'
611 if ($self->testRegExpr($text, '<\\?(?:=|php)?', 0, 0, 1, undef, 0, '##PHP/PHP', undef)) {
617 sub parseMultiinlineComment {
618 my ($self, $text) = @_;
619 # context => 'FindPHP'
620 # type => 'IncludeRules'
621 if ($self->includeRules('FindPHP', $text)) {
624 # context => '##Alerts'
625 # type => 'IncludeRules'
626 if ($self->includePlugin('Alerts', $text)) {
629 # attribute => 'Comment'
633 # endRegion => 'Comment'
634 # type => 'Detect2Chars'
635 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
642 my ($self, $text) = @_;
643 # context => 'FindPHP'
644 # type => 'IncludeRules'
645 if ($self->includeRules('FindPHP', $text)) {
648 # type => 'DetectSpaces'
649 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
652 # String => '//BEGIN'
653 # attribute => 'Region Marker'
654 # beginRegion => 'Region1'
655 # context => 'region_marker'
656 # type => 'StringDetect'
657 if ($self->testStringDetect($text, '//BEGIN', 0, 0, 0, undef, 0, 'region_marker', 'Region Marker')) {
661 # attribute => 'Region Marker'
662 # context => 'region_marker'
663 # endRegion => 'Region1'
665 if ($self->testRegExpr($text, '//END', 0, 0, 0, undef, 0, 'region_marker', 'Region Marker')) {
668 # String => 'keywords'
669 # attribute => 'Keyword'
672 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
675 # String => 'functions'
676 # attribute => 'Function'
679 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
682 # String => 'objects'
683 # attribute => 'Objects'
686 if ($self->testKeyword($text, 'objects', 0, undef, 0, '#stay', 'Objects')) {
690 # attribute => 'Math'
693 if ($self->testKeyword($text, 'math', 0, undef, 0, '#stay', 'Math')) {
697 # attribute => 'Events'
700 if ($self->testKeyword($text, 'events', 0, undef, 0, '#stay', 'Events')) {
703 # String => 'methods'
704 # attribute => 'Data Type'
707 if ($self->testKeyword($text, 'methods', 0, undef, 0, '#stay', 'Data Type')) {
710 # type => 'DetectIdentifier'
711 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
714 # attribute => 'Float'
717 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
720 # attribute => 'Decimal'
723 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
726 # attribute => 'String'
728 # context => 'String'
729 # type => 'DetectChar'
730 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
733 # attribute => 'String'
735 # context => 'String 1'
736 # type => 'DetectChar'
737 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String 1', 'String')) {
740 # attribute => 'Comment'
743 # context => 'Comment'
744 # type => 'Detect2Chars'
745 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
748 # attribute => 'Comment'
749 # beginRegion => 'Comment'
752 # context => 'Multi/inline Comment'
753 # type => 'Detect2Chars'
754 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Multi/inline Comment', 'Comment')) {
758 # attribute => 'Normal Text'
759 # context => '(Internal regex catch)'
761 if ($self->testRegExpr($text, '[=?:]', 0, 0, 0, undef, 0, '(Internal regex catch)', 'Normal Text')) {
765 # attribute => 'Normal Text'
766 # context => '(Internal regex catch)'
768 if ($self->testRegExpr($text, '\\(', 0, 0, 0, undef, 0, '(Internal regex catch)', 'Normal Text')) {
771 # attribute => 'Symbol'
772 # beginRegion => 'Brace1'
775 # type => 'DetectChar'
776 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
779 # attribute => 'Symbol'
782 # endRegion => 'Brace1'
783 # type => 'DetectChar'
784 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
787 # String => ':!%&+,-/.*<=>?[]|~^;'
788 # attribute => 'Symbol'
791 if ($self->testAnyChar($text, ':!%&+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
797 sub parseRegularExpression {
798 my ($self, $text) = @_;
799 # context => 'FindPHP'
800 # type => 'IncludeRules'
801 if ($self->includeRules('FindPHP', $text)) {
804 # String => '/[ig]{0,2}'
805 # attribute => 'Regular Expression'
806 # context => '#pop#pop#pop'
808 if ($self->testRegExpr($text, '/[ig]{0,2}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Regular Expression')) {
811 # String => '\{[\d, ]+\}'
812 # attribute => 'Pattern Internal Operator'
815 if ($self->testRegExpr($text, '\\{[\\d, ]+\\}', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
819 # attribute => 'Pattern Internal Operator'
822 if ($self->testRegExpr($text, '\\\\[bB]', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
825 # String => '\\[nrtvfDdSsWw]'
826 # attribute => 'Pattern Character Class'
829 if ($self->testRegExpr($text, '\\\\[nrtvfDdSsWw]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
832 # attribute => 'Pattern Character Class'
834 # context => '(charclass caret first check)'
835 # type => 'DetectChar'
836 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, '(charclass caret first check)', 'Pattern Character Class')) {
840 # attribute => 'Pattern Internal Operator'
843 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
846 # String => '\$(?=/)'
847 # attribute => 'Pattern Internal Operator'
850 if ($self->testRegExpr($text, '\\$(?=/)', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
854 # attribute => 'Pattern Internal Operator'
857 if ($self->testAnyChar($text, '?+*()|', 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
863 sub parseRegularExpressionCharacterClass {
864 my ($self, $text) = @_;
865 # context => 'FindPHP'
866 # type => 'IncludeRules'
867 if ($self->includeRules('FindPHP', $text)) {
870 # String => '\\[\[\]]'
871 # attribute => 'Pattern Character Class'
874 if ($self->testRegExpr($text, '\\\\[\\[\\]]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
877 # attribute => 'Pattern Character Class'
879 # context => '#pop#pop'
880 # type => 'DetectChar'
881 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop', 'Pattern Character Class')) {
888 my ($self, $text) = @_;
889 # context => 'FindPHP'
890 # type => 'IncludeRules'
891 if ($self->includeRules('FindPHP', $text)) {
894 # type => 'DetectIdentifier'
895 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
898 # attribute => 'String Char'
900 # type => 'HlCStringChar'
901 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
904 # attribute => 'String'
907 # type => 'DetectChar'
908 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
915 my ($self, $text) = @_;
916 # context => 'FindPHP'
917 # type => 'IncludeRules'
918 if ($self->includeRules('FindPHP', $text)) {
921 # type => 'DetectIdentifier'
922 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
925 # attribute => 'String'
927 # context => 'String'
928 # type => 'DetectChar'
929 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
932 # attribute => 'String Char'
935 # type => 'DetectChar'
936 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String Char')) {
942 sub parseregion_marker {
943 my ($self, $text) = @_;
944 # context => 'FindPHP'
945 # type => 'IncludeRules'
946 if ($self->includeRules('FindPHP', $text)) {
949 # type => 'DetectIdentifier'
950 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
953 # type => 'DetectSpaces'
954 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
967 Syntax::Highlight::Engine::Kate::JavaScript_PHP - a Plugin for JavaScript/PHP syntax highlighting
971 require Syntax::Highlight::Engine::Kate::JavaScript_PHP;
972 my $sh = new Syntax::Highlight::Engine::Kate::JavaScript_PHP([
977 Syntax::Highlight::Engine::Kate::JavaScript_PHP is a plugin module that provides syntax highlighting
978 for JavaScript/PHP to the Syntax::Haghlight::Engine::Kate highlighting engine.
980 This code is generated from the syntax definition files used
982 It works quite fine, but can use refinement and optimization.
984 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
990 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
996 Unknown. If you find any, please contact the author