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 'css-php.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:04 2008, localtime
13 package Syntax::Highlight::Engine::Kate::CSS_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 'At Rule' => 'DecVal',
28 'Comment' => 'Comment',
30 'Important' => 'Keyword',
32 'Normal Text' => 'Normal',
33 'Property' => 'Keyword',
34 'Region Marker' => 'RegionMarker',
35 'Selector Attr' => 'Char',
36 'Selector Class' => 'Float',
37 'Selector Id' => 'Float',
38 'Selector Pseudo' => 'DecVal',
40 'Unknown Property' => 'Error',
41 'Value' => 'DataType',
43 $self->listAdd('colors',
58 'InactiveCaptionText',
89 $self->listAdd('mediatypes',
101 $self->listAdd('paren',
111 $self->listAdd('properties',
115 'background-attachment',
118 'background-position',
124 'border-bottom-color',
125 'border-bottom-style',
126 'border-bottom-width',
134 'border-right-color',
135 'border-right-style',
136 'border-right-width',
188 'list-style-keyword',
189 'list-style-position',
243 'text-decoration-color',
265 $self->listAdd('pseudoclasses',
290 $self->listAdd('types',
334 'decimal-leading-zero',
446 'table-column-group',
447 'table-footer-group',
448 'table-header-group',
476 callback => \&parseBase,
477 attribute => 'Normal Text',
480 callback => \&parseComment,
481 attribute => 'Comment',
484 callback => \&parseFindComments,
485 attribute => 'Normal Text',
488 callback => \&parseFindPHP,
491 callback => \&parseFindRuleSets,
492 attribute => 'Normal Text',
495 callback => \&parseFindStrings,
496 attribute => 'Normal Text',
499 callback => \&parseFindValues,
500 attribute => 'Normal Text',
503 callback => \&parseImport,
504 attribute => 'Normal Text',
507 callback => \&parseInsideString,
508 attribute => 'String',
511 callback => \&parseMedia,
512 attribute => 'Normal Text',
515 callback => \&parseMedia2,
516 attribute => 'Normal Text',
519 callback => \&parsePropParen,
520 attribute => 'Normal Text',
523 callback => \&parsePropParen2,
524 attribute => 'Normal Text',
527 callback => \&parseRule,
528 attribute => 'Normal Text',
531 callback => \&parseRule2,
532 attribute => 'Normal Text',
535 callback => \&parseRuleSet,
536 attribute => 'Normal Text',
539 callback => \&parseSelAttr,
540 attribute => 'Selector Attr',
543 callback => \&parseSelPseudo,
544 attribute => 'Selector Pseudo',
545 lineending => '#pop',
546 fallthrough => '#pop',
549 callback => \&parseStringDQ,
550 attribute => 'String',
553 callback => \&parseStringSQ,
554 attribute => 'String',
557 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|<|=|>|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|-|\\%');
558 $self->basecontext('Base');
559 $self->keywordscase(0);
561 bless ($self, $class);
570 my ($self, $text) = @_;
571 # context => 'FindPHP'
572 # type => 'IncludeRules'
573 if ($self->includeRules('FindPHP', $text)) {
576 # type => 'LineContinue'
577 if ($self->testLineContinue($text, 0, undef, 0, '#stay', undef)) {
580 # type => 'DetectSpaces'
581 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
584 # context => 'FindRuleSets'
585 # type => 'IncludeRules'
586 if ($self->includeRules('FindRuleSets', $text)) {
593 my ($self, $text) = @_;
594 # context => 'FindPHP'
595 # type => 'IncludeRules'
596 if ($self->includeRules('FindPHP', $text)) {
599 # type => 'DetectSpaces'
600 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
603 # attribute => 'Comment'
607 # endRegion => 'comment'
608 # type => 'Detect2Chars'
609 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
612 # context => '##Alerts'
613 # type => 'IncludeRules'
614 if ($self->includePlugin('Alerts', $text)) {
617 # type => 'DetectIdentifier'
618 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
624 sub parseFindComments {
625 my ($self, $text) = @_;
626 # context => 'FindPHP'
627 # type => 'IncludeRules'
628 if ($self->includeRules('FindPHP', $text)) {
631 # String => '/\*BEGIN.*\*/'
632 # attribute => 'Region Marker'
633 # beginRegion => 'UserDefined'
636 if ($self->testRegExpr($text, '/\\*BEGIN.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
639 # String => '/\*END.*\*/'
640 # attribute => 'Region Marker'
642 # endRegion => 'UserDefined'
644 if ($self->testRegExpr($text, '/\\*END.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
647 # attribute => 'Comment'
648 # beginRegion => 'comment'
651 # context => 'Comment'
652 # type => 'Detect2Chars'
653 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
660 my ($self, $text) = @_;
661 # String => '<\?(?:=|php)?'
662 # context => '##PHP/PHP'
663 # lookAhead => 'true'
665 if ($self->testRegExpr($text, '<\\?(?:=|php)?', 0, 0, 1, undef, 0, '##PHP/PHP', undef)) {
671 sub parseFindRuleSets {
672 my ($self, $text) = @_;
673 # context => 'FindPHP'
674 # type => 'IncludeRules'
675 if ($self->includeRules('FindPHP', $text)) {
678 # String => '@media\b'
679 # attribute => 'Media'
682 if ($self->testRegExpr($text, '@media\\b', 0, 0, 0, undef, 0, 'Media', 'Media')) {
685 # String => '@import\b'
686 # attribute => 'At Rule'
687 # context => 'Import'
689 if ($self->testRegExpr($text, '@import\\b', 0, 0, 0, undef, 0, 'Import', 'At Rule')) {
692 # String => '@(font-face|charset)\b'
693 # attribute => 'At Rule'
696 if ($self->testRegExpr($text, '@(font-face|charset)\\b', 0, 0, 0, undef, 0, '#stay', 'At Rule')) {
699 # attribute => 'Property'
700 # beginRegion => 'ruleset'
702 # context => 'RuleSet'
703 # type => 'DetectChar'
704 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RuleSet', 'Property')) {
707 # attribute => 'Selector Attr'
709 # context => 'SelAttr'
710 # type => 'DetectChar'
711 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'SelAttr', 'Selector Attr')) {
714 # String => '#[A-Za-z0-9][\w\-]*'
715 # attribute => 'Selector Id'
718 if ($self->testRegExpr($text, '#[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Id')) {
721 # String => '\.[A-Za-z0-9][\w\-]*'
722 # attribute => 'Selector Class'
725 if ($self->testRegExpr($text, '\\.[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Class')) {
728 # String => ':lang\([\w_-]+\)'
729 # attribute => 'Selector Pseudo'
732 if ($self->testRegExpr($text, ':lang\\([\\w_-]+\\)', 0, 0, 0, undef, 0, '#stay', 'Selector Pseudo')) {
735 # attribute => 'Selector Pseudo'
737 # context => 'SelPseudo'
738 # type => 'DetectChar'
739 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'SelPseudo', 'Selector Pseudo')) {
742 # context => 'FindStrings'
743 # type => 'IncludeRules'
744 if ($self->includeRules('FindStrings', $text)) {
747 # context => 'FindComments'
748 # type => 'IncludeRules'
749 if ($self->includeRules('FindComments', $text)) {
755 sub parseFindStrings {
756 my ($self, $text) = @_;
757 # context => 'FindPHP'
758 # type => 'IncludeRules'
759 if ($self->includeRules('FindPHP', $text)) {
762 # attribute => 'String'
764 # context => 'StringDQ'
765 # type => 'DetectChar'
766 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'StringDQ', 'String')) {
769 # attribute => 'String'
771 # context => 'StringSQ'
772 # type => 'DetectChar'
773 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'StringSQ', 'String')) {
779 sub parseFindValues {
780 my ($self, $text) = @_;
781 # context => 'FindPHP'
782 # type => 'IncludeRules'
783 if ($self->includeRules('FindPHP', $text)) {
786 # String => '[-+]?[0-9.]+(em|ex|px|in|cm|mm|pt|pc|deg|rad|grad|ms|s|Hz|kHz)\b'
787 # attribute => 'Value'
790 if ($self->testRegExpr($text, '[-+]?[0-9.]+(em|ex|px|in|cm|mm|pt|pc|deg|rad|grad|ms|s|Hz|kHz)\\b', 0, 0, 0, undef, 0, '#stay', 'Value')) {
793 # String => '[-+]?[0-9.]+[%]?'
794 # attribute => 'Value'
797 if ($self->testRegExpr($text, '[-+]?[0-9.]+[%]?', 0, 0, 0, undef, 0, '#stay', 'Value')) {
800 # String => '[\w\-]+'
801 # attribute => 'Normal Text'
804 if ($self->testRegExpr($text, '[\\w\\-]+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
811 my ($self, $text) = @_;
812 # context => 'FindPHP'
813 # type => 'IncludeRules'
814 if ($self->includeRules('FindPHP', $text)) {
817 # attribute => 'At Rule'
820 # type => 'DetectChar'
821 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'At Rule')) {
824 # String => 'mediatypes'
825 # attribute => 'Media'
828 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
831 # context => 'FindValues'
832 # type => 'IncludeRules'
833 if ($self->includeRules('FindValues', $text)) {
836 # context => 'FindStrings'
837 # type => 'IncludeRules'
838 if ($self->includeRules('FindStrings', $text)) {
841 # context => 'FindComments'
842 # type => 'IncludeRules'
843 if ($self->includeRules('FindComments', $text)) {
849 sub parseInsideString {
850 my ($self, $text) = @_;
851 # context => 'FindPHP'
852 # type => 'IncludeRules'
853 if ($self->includeRules('FindPHP', $text)) {
857 # attribute => 'String'
860 if ($self->testRegExpr($text, '\\\\["\']', 0, 0, 0, undef, 0, '#stay', 'String')) {
863 # type => 'DetectIdentifier'
864 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
871 my ($self, $text) = @_;
872 # context => 'FindPHP'
873 # type => 'IncludeRules'
874 if ($self->includeRules('FindPHP', $text)) {
877 # attribute => 'Media'
878 # beginRegion => 'media'
880 # context => 'Media2'
881 # type => 'DetectChar'
882 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Media2', 'Media')) {
885 # String => 'mediatypes'
886 # attribute => 'Media'
889 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
892 # attribute => 'Media'
895 # type => 'DetectChar'
896 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#stay', 'Media')) {
899 # context => 'FindComments'
900 # type => 'IncludeRules'
901 if ($self->includeRules('FindComments', $text)) {
905 # attribute => 'Error'
908 if ($self->testRegExpr($text, '\\S+', 0, 0, 0, undef, 0, '#stay', 'Error')) {
915 my ($self, $text) = @_;
916 # context => 'FindPHP'
917 # type => 'IncludeRules'
918 if ($self->includeRules('FindPHP', $text)) {
921 # attribute => 'Media'
923 # context => '#pop#pop'
924 # endRegion => 'media'
925 # type => 'DetectChar'
926 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Media')) {
929 # context => 'FindRuleSets'
930 # type => 'IncludeRules'
931 if ($self->includeRules('FindRuleSets', $text)) {
938 my ($self, $text) = @_;
939 # context => 'FindPHP'
940 # type => 'IncludeRules'
941 if ($self->includeRules('FindPHP', $text)) {
944 # attribute => 'Value'
946 # context => 'PropParen2'
947 # type => 'DetectChar'
948 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'PropParen2', 'Value')) {
951 # context => 'FindComments'
952 # type => 'IncludeRules'
953 if ($self->includeRules('FindComments', $text)) {
957 # attribute => 'Error'
960 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
966 sub parsePropParen2 {
967 my ($self, $text) = @_;
968 # context => 'FindPHP'
969 # type => 'IncludeRules'
970 if ($self->includeRules('FindPHP', $text)) {
973 # attribute => 'Value'
975 # context => '#pop#pop'
976 # type => 'DetectChar'
977 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) {
980 # context => 'FindValues'
981 # type => 'IncludeRules'
982 if ($self->includeRules('FindValues', $text)) {
985 # context => 'FindStrings'
986 # type => 'IncludeRules'
987 if ($self->includeRules('FindStrings', $text)) {
990 # context => 'FindComments'
991 # type => 'IncludeRules'
992 if ($self->includeRules('FindComments', $text)) {
999 my ($self, $text) = @_;
1000 # context => 'FindPHP'
1001 # type => 'IncludeRules'
1002 if ($self->includeRules('FindPHP', $text)) {
1005 # attribute => 'Property'
1007 # context => 'Rule2'
1008 # type => 'DetectChar'
1009 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule2', 'Property')) {
1013 # attribute => 'Error'
1014 # context => '#stay'
1016 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
1023 my ($self, $text) = @_;
1024 # context => 'FindPHP'
1025 # type => 'IncludeRules'
1026 if ($self->includeRules('FindPHP', $text)) {
1029 # attribute => 'Property'
1031 # context => '#pop#pop'
1032 # type => 'DetectChar'
1033 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop', 'Property')) {
1036 # attribute => 'Property'
1038 # context => '#pop#pop#pop'
1039 # endRegion => 'ruleset'
1040 # type => 'DetectChar'
1041 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Property')) {
1045 # attribute => 'Value'
1046 # context => '#stay'
1048 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Value')) {
1051 # String => 'colors'
1052 # attribute => 'Value'
1053 # context => '#stay'
1055 if ($self->testKeyword($text, 'colors', 0, undef, 0, '#stay', 'Value')) {
1058 # String => '#([0-9A-Fa-f]{3}){1,4}\b'
1059 # attribute => 'Value'
1060 # context => '#stay'
1062 if ($self->testRegExpr($text, '#([0-9A-Fa-f]{3}){1,4}\\b', 0, 0, 0, undef, 0, '#stay', 'Value')) {
1066 # attribute => 'Value'
1067 # context => 'PropParen'
1069 if ($self->testKeyword($text, 'paren', 0, undef, 0, 'PropParen', 'Value')) {
1072 # String => '!important\b'
1073 # attribute => 'Important'
1074 # context => '#stay'
1076 if ($self->testRegExpr($text, '!important\\b', 0, 0, 0, undef, 0, '#stay', 'Important')) {
1079 # context => 'FindValues'
1080 # type => 'IncludeRules'
1081 if ($self->includeRules('FindValues', $text)) {
1084 # context => 'FindStrings'
1085 # type => 'IncludeRules'
1086 if ($self->includeRules('FindStrings', $text)) {
1089 # context => 'FindComments'
1090 # type => 'IncludeRules'
1091 if ($self->includeRules('FindComments', $text)) {
1098 my ($self, $text) = @_;
1099 # context => 'FindPHP'
1100 # type => 'IncludeRules'
1101 if ($self->includeRules('FindPHP', $text)) {
1104 # attribute => 'Property'
1107 # endRegion => 'ruleset'
1108 # type => 'DetectChar'
1109 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Property')) {
1112 # String => 'properties'
1113 # attribute => 'Property'
1116 if ($self->testKeyword($text, 'properties', 0, undef, 0, 'Rule', 'Property')) {
1119 # String => '-?[A-Za-z_-]+(?=\s*:)'
1120 # attribute => 'Unknown Property'
1123 if ($self->testRegExpr($text, '-?[A-Za-z_-]+(?=\\s*:)', 0, 0, 0, undef, 0, 'Rule', 'Unknown Property')) {
1126 # context => 'FindComments'
1127 # type => 'IncludeRules'
1128 if ($self->includeRules('FindComments', $text)) {
1132 # attribute => 'Error'
1133 # context => '#stay'
1135 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
1142 my ($self, $text) = @_;
1143 # context => 'FindPHP'
1144 # type => 'IncludeRules'
1145 if ($self->includeRules('FindPHP', $text)) {
1148 # attribute => 'Selector Attr'
1151 # type => 'DetectChar'
1152 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Selector Attr')) {
1155 # context => 'FindStrings'
1156 # type => 'IncludeRules'
1157 if ($self->includeRules('FindStrings', $text)) {
1163 sub parseSelPseudo {
1164 my ($self, $text) = @_;
1165 # context => 'FindPHP'
1166 # type => 'IncludeRules'
1167 if ($self->includeRules('FindPHP', $text)) {
1170 # String => 'pseudoclasses'
1171 # attribute => 'Selector Pseudo'
1174 if ($self->testKeyword($text, 'pseudoclasses', 0, undef, 0, '#pop', 'Selector Pseudo')) {
1181 my ($self, $text) = @_;
1182 # context => 'FindPHP'
1183 # type => 'IncludeRules'
1184 if ($self->includeRules('FindPHP', $text)) {
1187 # attribute => 'String'
1190 # type => 'DetectChar'
1191 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
1194 # context => 'InsideString'
1195 # type => 'IncludeRules'
1196 if ($self->includeRules('InsideString', $text)) {
1203 my ($self, $text) = @_;
1204 # context => 'FindPHP'
1205 # type => 'IncludeRules'
1206 if ($self->includeRules('FindPHP', $text)) {
1209 # attribute => 'String'
1212 # type => 'DetectChar'
1213 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
1216 # context => 'InsideString'
1217 # type => 'IncludeRules'
1218 if ($self->includeRules('InsideString', $text)) {
1231 Syntax::Highlight::Engine::Kate::CSS_PHP - a Plugin for CSS/PHP syntax highlighting
1235 require Syntax::Highlight::Engine::Kate::CSS_PHP;
1236 my $sh = new Syntax::Highlight::Engine::Kate::CSS_PHP([
1241 Syntax::Highlight::Engine::Kate::CSS_PHP is a plugin module that provides syntax highlighting
1242 for CSS/PHP to the Syntax::Haghlight::Engine::Kate highlighting engine.
1244 This code is generated from the syntax definition files used
1245 by the Kate project.
1246 It works quite fine, but can use refinement and optimization.
1248 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
1254 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
1260 Unknown. If you find any, please contact the author