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.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;
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' => 'BaseN',
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',
295 $self->listAdd('types',
339 'decimal-leading-zero',
452 'table-column-group',
453 'table-footer-group',
454 'table-header-group',
482 callback => \&parseBase,
483 attribute => 'Normal Text',
486 callback => \&parseComment,
487 attribute => 'Comment',
490 callback => \&parseFindComments,
491 attribute => 'Normal Text',
494 callback => \&parseFindRuleSets,
495 attribute => 'Normal Text',
498 callback => \&parseFindStrings,
499 attribute => 'Normal Text',
502 callback => \&parseFindValues,
503 attribute => 'Normal Text',
506 callback => \&parseImport,
507 attribute => 'Normal Text',
510 callback => \&parseInsideString,
511 attribute => 'String',
514 callback => \&parseMedia,
515 attribute => 'Normal Text',
518 callback => \&parseMedia2,
519 attribute => 'Normal Text',
522 callback => \&parsePropParen,
523 attribute => 'Normal Text',
526 callback => \&parsePropParen2,
527 attribute => 'Normal Text',
530 callback => \&parseRule,
531 attribute => 'Normal Text',
534 callback => \&parseRule2,
535 attribute => 'Normal Text',
538 callback => \&parseRuleSet,
539 attribute => 'Normal Text',
542 callback => \&parseSelAttr,
543 attribute => 'Selector Attr',
546 callback => \&parseSelPseudo,
547 attribute => 'Selector Pseudo',
548 lineending => '#pop',
549 fallthrough => '#pop',
552 callback => \&parseStringDQ,
553 attribute => 'String',
556 callback => \&parseStringSQ,
557 attribute => 'String',
560 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|<|=|>|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|-|\\%');
561 $self->basecontext('Base');
562 $self->keywordscase(0);
564 bless ($self, $class);
573 my ($self, $text) = @_;
574 # type => 'LineContinue'
575 if ($self->testLineContinue($text, 0, undef, 0, '#stay', undef)) {
578 # type => 'DetectSpaces'
579 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
582 # context => 'FindRuleSets'
583 # type => 'IncludeRules'
584 if ($self->includeRules('FindRuleSets', $text)) {
591 my ($self, $text) = @_;
592 # type => 'DetectSpaces'
593 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
596 # attribute => 'Comment'
600 # endRegion => 'comment'
601 # type => 'Detect2Chars'
602 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
605 # context => '##Alerts'
606 # type => 'IncludeRules'
607 if ($self->includePlugin('Alerts', $text)) {
610 # type => 'DetectIdentifier'
611 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
617 sub parseFindComments {
618 my ($self, $text) = @_;
619 # String => '/\*BEGIN.*\*/'
620 # attribute => 'Region Marker'
621 # beginRegion => 'UserDefined'
624 if ($self->testRegExpr($text, '/\\*BEGIN.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
627 # String => '/\*END.*\*/'
628 # attribute => 'Region Marker'
630 # endRegion => 'UserDefined'
632 if ($self->testRegExpr($text, '/\\*END.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
635 # attribute => 'Comment'
636 # beginRegion => 'comment'
639 # context => 'Comment'
640 # type => 'Detect2Chars'
641 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
647 sub parseFindRuleSets {
648 my ($self, $text) = @_;
649 # String => '@media\b'
650 # attribute => 'Media'
653 if ($self->testRegExpr($text, '@media\\b', 0, 0, 0, undef, 0, 'Media', 'Media')) {
656 # String => '@import\b'
657 # attribute => 'At Rule'
658 # context => 'Import'
660 if ($self->testRegExpr($text, '@import\\b', 0, 0, 0, undef, 0, 'Import', 'At Rule')) {
663 # String => '@(font-face|charset)\b'
664 # attribute => 'At Rule'
667 if ($self->testRegExpr($text, '@(font-face|charset)\\b', 0, 0, 0, undef, 0, '#stay', 'At Rule')) {
670 # attribute => 'Property'
671 # beginRegion => 'ruleset'
673 # context => 'RuleSet'
674 # type => 'DetectChar'
675 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RuleSet', 'Property')) {
678 # attribute => 'Selector Attr'
680 # context => 'SelAttr'
681 # type => 'DetectChar'
682 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'SelAttr', 'Selector Attr')) {
685 # String => '#[A-Za-z0-9][\w\-]*'
686 # attribute => 'Selector Id'
689 if ($self->testRegExpr($text, '#[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Id')) {
692 # String => '\.[A-Za-z0-9][\w\-]*'
693 # attribute => 'Selector Class'
696 if ($self->testRegExpr($text, '\\.[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Class')) {
699 # String => ':lang\([\w_-]+\)'
700 # attribute => 'Selector Pseudo'
703 if ($self->testRegExpr($text, ':lang\\([\\w_-]+\\)', 0, 0, 0, undef, 0, '#stay', 'Selector Pseudo')) {
706 # attribute => 'Selector Pseudo'
708 # context => 'SelPseudo'
709 # type => 'DetectChar'
710 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'SelPseudo', 'Selector Pseudo')) {
713 # context => 'FindStrings'
714 # type => 'IncludeRules'
715 if ($self->includeRules('FindStrings', $text)) {
718 # context => 'FindComments'
719 # type => 'IncludeRules'
720 if ($self->includeRules('FindComments', $text)) {
726 sub parseFindStrings {
727 my ($self, $text) = @_;
728 # attribute => 'String'
730 # context => 'StringDQ'
731 # type => 'DetectChar'
732 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'StringDQ', 'String')) {
735 # attribute => 'String'
737 # context => 'StringSQ'
738 # type => 'DetectChar'
739 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'StringSQ', 'String')) {
745 sub parseFindValues {
746 my ($self, $text) = @_;
747 # String => '[-+]?[0-9.]+(em|ex|px|in|cm|mm|pt|pc|deg|rad|grad|ms|s|Hz|kHz)\b'
748 # attribute => 'Value'
751 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')) {
754 # String => '[-+]?[0-9.]+[%]?'
755 # attribute => 'Value'
758 if ($self->testRegExpr($text, '[-+]?[0-9.]+[%]?', 0, 0, 0, undef, 0, '#stay', 'Value')) {
761 # String => '[\w\-]+'
762 # attribute => 'Normal Text'
765 if ($self->testRegExpr($text, '[\\w\\-]+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
772 my ($self, $text) = @_;
773 # attribute => 'At Rule'
776 # type => 'DetectChar'
777 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'At Rule')) {
780 # String => 'mediatypes'
781 # attribute => 'Media'
784 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
787 # context => 'FindValues'
788 # type => 'IncludeRules'
789 if ($self->includeRules('FindValues', $text)) {
792 # context => 'FindStrings'
793 # type => 'IncludeRules'
794 if ($self->includeRules('FindStrings', $text)) {
797 # context => 'FindComments'
798 # type => 'IncludeRules'
799 if ($self->includeRules('FindComments', $text)) {
805 sub parseInsideString {
806 my ($self, $text) = @_;
808 # attribute => 'String'
811 if ($self->testRegExpr($text, '\\\\["\']', 0, 0, 0, undef, 0, '#stay', 'String')) {
814 # type => 'DetectIdentifier'
815 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
822 my ($self, $text) = @_;
823 # attribute => 'Media'
824 # beginRegion => 'media'
826 # context => 'Media2'
827 # type => 'DetectChar'
828 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Media2', 'Media')) {
831 # String => 'mediatypes'
832 # attribute => 'Media'
835 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
838 # attribute => 'Media'
841 # type => 'DetectChar'
842 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#stay', 'Media')) {
845 # context => 'FindComments'
846 # type => 'IncludeRules'
847 if ($self->includeRules('FindComments', $text)) {
851 # attribute => 'Error'
854 if ($self->testRegExpr($text, '\\S+', 0, 0, 0, undef, 0, '#stay', 'Error')) {
861 my ($self, $text) = @_;
862 # attribute => 'Media'
864 # context => '#pop#pop'
865 # endRegion => 'media'
866 # type => 'DetectChar'
867 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Media')) {
870 # context => 'FindRuleSets'
871 # type => 'IncludeRules'
872 if ($self->includeRules('FindRuleSets', $text)) {
879 my ($self, $text) = @_;
880 # attribute => 'Value'
882 # context => 'PropParen2'
883 # type => 'DetectChar'
884 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'PropParen2', 'Value')) {
887 # context => 'FindComments'
888 # type => 'IncludeRules'
889 if ($self->includeRules('FindComments', $text)) {
893 # attribute => 'Error'
896 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
902 sub parsePropParen2 {
903 my ($self, $text) = @_;
904 # attribute => 'Value'
906 # context => '#pop#pop'
907 # type => 'DetectChar'
908 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) {
911 # context => 'FindValues'
912 # type => 'IncludeRules'
913 if ($self->includeRules('FindValues', $text)) {
916 # context => 'FindStrings'
917 # type => 'IncludeRules'
918 if ($self->includeRules('FindStrings', $text)) {
921 # context => 'FindComments'
922 # type => 'IncludeRules'
923 if ($self->includeRules('FindComments', $text)) {
930 my ($self, $text) = @_;
931 # attribute => 'Property'
934 # type => 'DetectChar'
935 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule2', 'Property')) {
939 # attribute => 'Error'
942 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
949 my ($self, $text) = @_;
950 # attribute => 'Property'
952 # context => '#pop#pop'
953 # type => 'DetectChar'
954 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop', 'Property')) {
957 # attribute => 'Property'
959 # context => '#pop#pop#pop'
960 # endRegion => 'ruleset'
961 # type => 'DetectChar'
962 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Property')) {
966 # attribute => 'Value'
969 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Value')) {
973 # attribute => 'Value'
976 if ($self->testKeyword($text, 'colors', 0, undef, 0, '#stay', 'Value')) {
979 # String => '#([0-9A-Fa-f]{3}){1,4}\b'
980 # attribute => 'Value'
983 if ($self->testRegExpr($text, '#([0-9A-Fa-f]{3}){1,4}\\b', 0, 0, 0, undef, 0, '#stay', 'Value')) {
987 # attribute => 'Value'
988 # context => 'PropParen'
990 if ($self->testKeyword($text, 'paren', 0, undef, 0, 'PropParen', 'Value')) {
993 # String => '!important\b'
994 # attribute => 'Important'
997 if ($self->testRegExpr($text, '!important\\b', 0, 0, 0, undef, 0, '#stay', 'Important')) {
1000 # context => 'FindValues'
1001 # type => 'IncludeRules'
1002 if ($self->includeRules('FindValues', $text)) {
1005 # context => 'FindStrings'
1006 # type => 'IncludeRules'
1007 if ($self->includeRules('FindStrings', $text)) {
1010 # context => 'FindComments'
1011 # type => 'IncludeRules'
1012 if ($self->includeRules('FindComments', $text)) {
1019 my ($self, $text) = @_;
1020 # attribute => 'Property'
1023 # endRegion => 'ruleset'
1024 # type => 'DetectChar'
1025 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Property')) {
1028 # String => 'properties'
1029 # attribute => 'Property'
1032 if ($self->testKeyword($text, 'properties', 0, undef, 0, 'Rule', 'Property')) {
1035 # String => '-?[A-Za-z_-]+(?=\s*:)'
1036 # attribute => 'Unknown Property'
1039 if ($self->testRegExpr($text, '-?[A-Za-z_-]+(?=\\s*:)', 0, 0, 0, undef, 0, 'Rule', 'Unknown Property')) {
1042 # context => 'FindComments'
1043 # type => 'IncludeRules'
1044 if ($self->includeRules('FindComments', $text)) {
1048 # attribute => 'Error'
1049 # context => '#stay'
1051 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
1058 my ($self, $text) = @_;
1059 # attribute => 'Selector Attr'
1062 # type => 'DetectChar'
1063 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Selector Attr')) {
1066 # context => 'FindStrings'
1067 # type => 'IncludeRules'
1068 if ($self->includeRules('FindStrings', $text)) {
1074 sub parseSelPseudo {
1075 my ($self, $text) = @_;
1076 # String => 'pseudoclasses'
1077 # attribute => 'Selector Pseudo'
1080 if ($self->testKeyword($text, 'pseudoclasses', 0, undef, 0, '#pop', 'Selector Pseudo')) {
1087 my ($self, $text) = @_;
1088 # attribute => 'String'
1091 # type => 'DetectChar'
1092 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
1095 # context => 'InsideString'
1096 # type => 'IncludeRules'
1097 if ($self->includeRules('InsideString', $text)) {
1104 my ($self, $text) = @_;
1105 # attribute => 'String'
1108 # type => 'DetectChar'
1109 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
1112 # context => 'InsideString'
1113 # type => 'IncludeRules'
1114 if ($self->includeRules('InsideString', $text)) {
1127 Syntax::Highlight::Engine::Kate::CSS - a Plugin for CSS syntax highlighting
1131 require Syntax::Highlight::Engine::Kate::CSS;
1132 my $sh = new Syntax::Highlight::Engine::Kate::CSS([
1137 Syntax::Highlight::Engine::Kate::CSS is a plugin module that provides syntax highlighting
1138 for CSS to the Syntax::Haghlight::Engine::Kate highlighting engine.
1140 This code is generated from the syntax definition files used
1141 by the Kate project.
1142 It works quite fine, but can use refinement and optimization.
1144 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
1150 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
1156 Unknown. If you find any, please contact the author