File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/CSS.pm
Criterion Covered Total %
statement 162 207 78.2
branch 104 142 73.2
condition 1 3 33.3
subroutine 20 24 83.3
pod 0 21 0.0
total 287 397 72.2


line stmt bran cond sub pod time code
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.
4              
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
7              
8             #kate xml version 2.00
9             #kate version 2.4
10             #kate author Wilbert Berendsen (wilbert@kde.nl)
11             #generated: Sun Feb 3 22:02:04 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::CSS;
14              
15             our $VERSION = '0.16';
16              
17 1     1   843 use strict;
  1         4  
  1         39  
18 1     1   7 use warnings;
  1         1  
  1         71  
19 1     1   6 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1950  
20              
21             sub new {
22 2     2 0 696 my $proto = shift;
23 2   33     13 my $class = ref($proto) || $proto;
24 2         15 my $self = $class->SUPER::new(@_);
25 2         26 $self->attributes({
26             'Alert' => 'Alert',
27             'At Rule' => 'DecVal',
28             'Comment' => 'Comment',
29             'Error' => 'Error',
30             'Important' => 'Keyword',
31             'Media' => 'Others',
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',
39             'String' => 'String',
40             'Unknown Property' => 'Error',
41             'Value' => 'DataType',
42             });
43 2         9 $self->listAdd('colors',
44             'ActiveBorder',
45             'ActiveCaption',
46             'AppWorkspace',
47             'Background',
48             'ButtonFace',
49             'ButtonHighlight',
50             'ButtonShadow',
51             'ButtonText',
52             'CaptionText',
53             'GrayText',
54             'Highlight',
55             'HighlightText',
56             'InactiveBorder',
57             'InactiveCaption',
58             'InactiveCaptionText',
59             'InfoBackground',
60             'InfoText',
61             'Menu',
62             'MenuText',
63             'Scrollbar',
64             'ThreeDDarkShadow',
65             'ThreeDFace',
66             'ThreeDHighlight',
67             'ThreeDLightShadow',
68             'ThreeDShadow',
69             'Window',
70             'WindowFrame',
71             'WindowText',
72             'aqua',
73             'black',
74             'blue',
75             'fuchsia',
76             'gray',
77             'green',
78             'lime',
79             'maroon',
80             'navy',
81             'olive',
82             'purple',
83             'red',
84             'silver',
85             'teal',
86             'white',
87             'yellow',
88             );
89 2         6 $self->listAdd('mediatypes',
90             'all',
91             'aural',
92             'braille',
93             'embossed',
94             'handheld',
95             'print',
96             'projection',
97             'screen',
98             'tty',
99             'tv',
100             );
101 2         5 $self->listAdd('paren',
102             'attr',
103             'counter',
104             'counters',
105             'format',
106             'local',
107             'rect',
108             'rgb',
109             'url',
110             );
111 2         9 $self->listAdd('properties',
112             'ascent',
113             'azimuth',
114             'background',
115             'background-attachment',
116             'background-color',
117             'background-image',
118             'background-position',
119             'background-repeat',
120             'baseline',
121             'bbox',
122             'border',
123             'border-bottom',
124             'border-bottom-color',
125             'border-bottom-style',
126             'border-bottom-width',
127             'border-collapse',
128             'border-color',
129             'border-left',
130             'border-left-color',
131             'border-left-style',
132             'border-left-width',
133             'border-right',
134             'border-right-color',
135             'border-right-style',
136             'border-right-width',
137             'border-spacing',
138             'border-style',
139             'border-top',
140             'border-top-color',
141             'border-top-style',
142             'border-top-width',
143             'border-width',
144             'bottom',
145             'box-sizing',
146             'cap-height',
147             'caption-side',
148             'centerline',
149             'clear',
150             'clip',
151             'color',
152             'content',
153             'counter-increment',
154             'counter-reset',
155             'cue',
156             'cue-after',
157             'cue-before',
158             'cursor',
159             'definition-src',
160             'descent',
161             'direction',
162             'display',
163             'elevation',
164             'empty-cells',
165             'float',
166             'font',
167             'font-family',
168             'font-family',
169             'font-size',
170             'font-size',
171             'font-size-adjust',
172             'font-stretch',
173             'font-stretch',
174             'font-style',
175             'font-style',
176             'font-variant',
177             'font-variant',
178             'font-weight',
179             'font-weight',
180             'height',
181             'konq_bgpos_x',
182             'konq_bgpos_y',
183             'left',
184             'letter-spacing',
185             'line-height',
186             'list-style',
187             'list-style-image',
188             'list-style-keyword',
189             'list-style-position',
190             'list-style-type',
191             'margin',
192             'margin-bottom',
193             'margin-left',
194             'margin-right',
195             'margin-top',
196             'marker-offset',
197             'mathline',
198             'max-height',
199             'max-width',
200             'min-height',
201             'min-width',
202             'opacity',
203             'orphans',
204             'outline',
205             'outline-color',
206             'outline-style',
207             'outline-width',
208             'overflow',
209             'padding',
210             'padding-bottom',
211             'padding-left',
212             'padding-right',
213             'padding-top',
214             'page',
215             'page-break-after',
216             'page-break-before',
217             'page-break-inside',
218             'panose-1',
219             'pause',
220             'pause-after',
221             'pause-before',
222             'pitch',
223             'pitch-range',
224             'play-during',
225             'position',
226             'quotes',
227             'richness',
228             'right',
229             'size',
230             'slope',
231             'speak',
232             'speak-header',
233             'speak-numeral',
234             'speak-punctuation',
235             'speech-rate',
236             'src',
237             'stemh',
238             'stemv',
239             'stress',
240             'table-layout',
241             'text-align',
242             'text-decoration',
243             'text-decoration-color',
244             'text-indent',
245             'text-shadow',
246             'text-shadow',
247             'text-transform',
248             'top',
249             'topline',
250             'unicode-bidi',
251             'unicode-range',
252             'units-per-em',
253             'vertical-align',
254             'visibility',
255             'voice-family',
256             'volume',
257             'white-space',
258             'widows',
259             'width',
260             'widths',
261             'word-spacing',
262             'x-height',
263             'z-index',
264             );
265 2         6 $self->listAdd('pseudoclasses',
266             'active',
267             'after',
268             'before',
269             'checked',
270             'disabled',
271             'empty',
272             'enabled',
273             'first-child',
274             'first-letter',
275             'first-line',
276             'first-of-type',
277             'focus',
278             'hover',
279             'indeterminate',
280             'last-child',
281             'last-of-type',
282             'link',
283             'not',
284             'nth-child',
285             'nth-last-child',
286             'nth-last-of-type',
287             'nth-of-type',
288             'only-child',
289             'only-of-type',
290             'root',
291             'selection',
292             'target',
293             'visited',
294             );
295 2         10 $self->listAdd('types',
296             '100',
297             '200',
298             '300',
299             '400',
300             '500',
301             '600',
302             '700',
303             '800',
304             '900',
305             'above',
306             'absolute',
307             'always',
308             'armenian',
309             'auto',
310             'avoid',
311             'baseline',
312             'below',
313             'bidi-override',
314             'blink',
315             'block',
316             'bold',
317             'bolder',
318             'border-box',
319             'both',
320             'bottom',
321             'box',
322             'break',
323             'capitalize',
324             'caption',
325             'center',
326             'circle',
327             'cjk-ideographic',
328             'close-quote',
329             'collapse',
330             'compact',
331             'condensed',
332             'content-box',
333             'crop',
334             'cross',
335             'crosshair',
336             'cursive',
337             'dashed',
338             'decimal',
339             'decimal-leading-zero',
340             'default',
341             'disc',
342             'dotted',
343             'double',
344             'e-resize',
345             'embed',
346             'expanded',
347             'extra-condensed',
348             'extra-expanded',
349             'fantasy',
350             'fixed',
351             'georgian',
352             'groove',
353             'hand',
354             'hebrew',
355             'help',
356             'hidden',
357             'hide',
358             'higher',
359             'hiragana',
360             'hiragana-iroha',
361             'icon',
362             'inherit',
363             'inline',
364             'inline-block',
365             'inline-table',
366             'inset',
367             'inside',
368             'invert',
369             'italic',
370             'justify',
371             'katakana',
372             'katakana-iroha',
373             'konq-center',
374             'landscape',
375             'large',
376             'larger',
377             'left',
378             'level',
379             'light',
380             'lighter',
381             'line-through',
382             'list-item',
383             'loud',
384             'lower',
385             'lower-alpha',
386             'lower-greek',
387             'lower-latin',
388             'lower-roman',
389             'lowercase',
390             'ltr',
391             'marker',
392             'medium',
393             'menu',
394             'message-box',
395             'middle',
396             'mix',
397             'monospace',
398             'move',
399             'n-resize',
400             'narrower',
401             'ne-resize',
402             'no-close-quote',
403             'no-open-quote',
404             'no-repeat',
405             'none',
406             'normal',
407             'nowrap',
408             'nw-resize',
409             'oblique',
410             'open-quote',
411             'outset',
412             'outside',
413             'overline',
414             'pointer',
415             'portrait',
416             'pre',
417             'pre-line',
418             'pre-wrap',
419             'relative',
420             'repeat',
421             'repeat-x',
422             'repeat-y',
423             'ridge',
424             'right',
425             'rtl',
426             'run-in',
427             's-resize',
428             'sans-serif',
429             'scroll',
430             'se-resize',
431             'semi-condensed',
432             'semi-expanded',
433             'separate',
434             'serif',
435             'show',
436             'small',
437             'small-caps',
438             'small-caption',
439             'smaller',
440             'solid',
441             'square',
442             'static',
443             'static-position',
444             'status-bar',
445             'sub',
446             'super',
447             'sw-resize',
448             'table',
449             'table-caption',
450             'table-cell',
451             'table-column',
452             'table-column-group',
453             'table-footer-group',
454             'table-header-group',
455             'table-row',
456             'table-row-group',
457             'text',
458             'text-bottom',
459             'text-top',
460             'thick',
461             'thin',
462             'top',
463             'transparent',
464             'ultra-condensed',
465             'ultra-expanded',
466             'underline',
467             'upper-alpha',
468             'upper-latin',
469             'upper-roman',
470             'uppercase',
471             'visible',
472             'w-resize',
473             'wait',
474             'wider',
475             'x-large',
476             'x-small',
477             'xx-large',
478             'xx-small',
479             );
480 2         124 $self->contextdata({
481             'Base' => {
482             callback => \&parseBase,
483             attribute => 'Normal Text',
484             },
485             'Comment' => {
486             callback => \&parseComment,
487             attribute => 'Comment',
488             },
489             'FindComments' => {
490             callback => \&parseFindComments,
491             attribute => 'Normal Text',
492             },
493             'FindRuleSets' => {
494             callback => \&parseFindRuleSets,
495             attribute => 'Normal Text',
496             },
497             'FindStrings' => {
498             callback => \&parseFindStrings,
499             attribute => 'Normal Text',
500             },
501             'FindValues' => {
502             callback => \&parseFindValues,
503             attribute => 'Normal Text',
504             },
505             'Import' => {
506             callback => \&parseImport,
507             attribute => 'Normal Text',
508             },
509             'InsideString' => {
510             callback => \&parseInsideString,
511             attribute => 'String',
512             },
513             'Media' => {
514             callback => \&parseMedia,
515             attribute => 'Normal Text',
516             },
517             'Media2' => {
518             callback => \&parseMedia2,
519             attribute => 'Normal Text',
520             },
521             'PropParen' => {
522             callback => \&parsePropParen,
523             attribute => 'Normal Text',
524             },
525             'PropParen2' => {
526             callback => \&parsePropParen2,
527             attribute => 'Normal Text',
528             },
529             'Rule' => {
530             callback => \&parseRule,
531             attribute => 'Normal Text',
532             },
533             'Rule2' => {
534             callback => \&parseRule2,
535             attribute => 'Normal Text',
536             },
537             'RuleSet' => {
538             callback => \&parseRuleSet,
539             attribute => 'Normal Text',
540             },
541             'SelAttr' => {
542             callback => \&parseSelAttr,
543             attribute => 'Selector Attr',
544             },
545             'SelPseudo' => {
546             callback => \&parseSelPseudo,
547             attribute => 'Selector Pseudo',
548             lineending => '#pop',
549             fallthrough => '#pop',
550             },
551             'StringDQ' => {
552             callback => \&parseStringDQ,
553             attribute => 'String',
554             },
555             'StringSQ' => {
556             callback => \&parseStringSQ,
557             attribute => 'String',
558             },
559             });
560 2         10 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|<|=|>|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|-|\\%');
561 2         8 $self->basecontext('Base');
562 2         7 $self->keywordscase(0);
563 2         6 $self->initialize;
564 2         4 bless ($self, $class);
565 2         9 return $self;
566             }
567              
568             sub language {
569 0     0 0 0 return 'CSS';
570             }
571              
572             sub parseBase {
573 60     60 0 107 my ($self, $text) = @_;
574             # type => 'LineContinue'
575 60 50       184 if ($self->testLineContinue($text, 0, undef, 0, '#stay', undef)) {
576 0         0 return 1
577             }
578             # type => 'DetectSpaces'
579 60 100       185 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
580 4         10 return 1
581             }
582             # context => 'FindRuleSets'
583             # type => 'IncludeRules'
584 56 100       197 if ($self->includeRules('FindRuleSets', $text)) {
585 30         78 return 1
586             }
587 26         56 return 0;
588             };
589              
590             sub parseComment {
591 138     138 0 219 my ($self, $text) = @_;
592             # type => 'DetectSpaces'
593 138 100       316 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
594 58         123 return 1
595             }
596             # attribute => 'Comment'
597             # char => '*'
598             # char1 => '/'
599             # context => '#pop'
600             # endRegion => 'comment'
601             # type => 'Detect2Chars'
602 80 100       251 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
603 8         18 return 1
604             }
605             # context => '##Alerts'
606             # type => 'IncludeRules'
607 72 100       171 if ($self->includePlugin('Alerts', $text)) {
608 2         8 return 1
609             }
610             # type => 'DetectIdentifier'
611 70 100       197 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
612 46         100 return 1
613             }
614 24         41 return 0;
615             };
616              
617             sub parseFindComments {
618 202     202 0 384 my ($self, $text) = @_;
619             # String => '/\*BEGIN.*\*/'
620             # attribute => 'Region Marker'
621             # beginRegion => 'UserDefined'
622             # context => '#stay'
623             # type => 'RegExpr'
624 202 50       578 if ($self->testRegExpr($text, '/\\*BEGIN.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
625 0         0 return 1
626             }
627             # String => '/\*END.*\*/'
628             # attribute => 'Region Marker'
629             # context => '#stay'
630             # endRegion => 'UserDefined'
631             # type => 'RegExpr'
632 202 50       566 if ($self->testRegExpr($text, '/\\*END.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
633 0         0 return 1
634             }
635             # attribute => 'Comment'
636             # beginRegion => 'comment'
637             # char => '/'
638             # char1 => '*'
639             # context => 'Comment'
640             # type => 'Detect2Chars'
641 202 100       576 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
642 8         24 return 1
643             }
644 194         653 return 0;
645             };
646              
647             sub parseFindRuleSets {
648 64     64 0 119 my ($self, $text) = @_;
649             # String => '@media\b'
650             # attribute => 'Media'
651             # context => 'Media'
652             # type => 'RegExpr'
653 64 100       205 if ($self->testRegExpr($text, '@media\\b', 0, 0, 0, undef, 0, 'Media', 'Media')) {
654 2         10 return 1
655             }
656             # String => '@import\b'
657             # attribute => 'At Rule'
658             # context => 'Import'
659             # type => 'RegExpr'
660 62 100       222 if ($self->testRegExpr($text, '@import\\b', 0, 0, 0, undef, 0, 'Import', 'At Rule')) {
661 2         6 return 1
662             }
663             # String => '@(font-face|charset)\b'
664             # attribute => 'At Rule'
665             # context => '#stay'
666             # type => 'RegExpr'
667 60 50       202 if ($self->testRegExpr($text, '@(font-face|charset)\\b', 0, 0, 0, undef, 0, '#stay', 'At Rule')) {
668 0         0 return 1
669             }
670             # attribute => 'Property'
671             # beginRegion => 'ruleset'
672             # char => '{'
673             # context => 'RuleSet'
674             # type => 'DetectChar'
675 60 100       227 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RuleSet', 'Property')) {
676 10         37 return 1
677             }
678             # attribute => 'Selector Attr'
679             # char => '['
680             # context => 'SelAttr'
681             # type => 'DetectChar'
682 50 100       188 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'SelAttr', 'Selector Attr')) {
683 2         9 return 1
684             }
685             # String => '#[A-Za-z0-9][\w\-]*'
686             # attribute => 'Selector Id'
687             # context => '#stay'
688             # type => 'RegExpr'
689 48 100       135 if ($self->testRegExpr($text, '#[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Id')) {
690 4         17 return 1
691             }
692             # String => '\.[A-Za-z0-9][\w\-]*'
693             # attribute => 'Selector Class'
694             # context => '#stay'
695             # type => 'RegExpr'
696 44 100       170 if ($self->testRegExpr($text, '\\.[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Class')) {
697 4         20 return 1
698             }
699             # String => ':lang\([\w_-]+\)'
700             # attribute => 'Selector Pseudo'
701             # context => '#stay'
702             # type => 'RegExpr'
703 40 100       142 if ($self->testRegExpr($text, ':lang\\([\\w_-]+\\)', 0, 0, 0, undef, 0, '#stay', 'Selector Pseudo')) {
704 2         11 return 1
705             }
706             # attribute => 'Selector Pseudo'
707             # char => ':'
708             # context => 'SelPseudo'
709             # type => 'DetectChar'
710 38 100       131 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'SelPseudo', 'Selector Pseudo')) {
711 4         18 return 1
712             }
713             # context => 'FindStrings'
714             # type => 'IncludeRules'
715 34 50       152 if ($self->includeRules('FindStrings', $text)) {
716 0         0 return 1
717             }
718             # context => 'FindComments'
719             # type => 'IncludeRules'
720 34 100       83 if ($self->includeRules('FindComments', $text)) {
721 4         10 return 1
722             }
723 30         109 return 0;
724             };
725              
726             sub parseFindStrings {
727 98     98 0 220 my ($self, $text) = @_;
728             # attribute => 'String'
729             # char => '"'
730             # context => 'StringDQ'
731             # type => 'DetectChar'
732 98 100       270 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'StringDQ', 'String')) {
733 6         23 return 1
734             }
735             # attribute => 'String'
736             # char => '''
737             # context => 'StringSQ'
738             # type => 'DetectChar'
739 92 50       257 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'StringSQ', 'String')) {
740 0         0 return 1
741             }
742 92         252 return 0;
743             };
744              
745             sub parseFindValues {
746 72     72 0 120 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'
749             # context => '#stay'
750             # type => 'RegExpr'
751 72 100       165 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')) {
752 16         58 return 1
753             }
754             # String => '[-+]?[0-9.]+[%]?'
755             # attribute => 'Value'
756             # context => '#stay'
757             # type => 'RegExpr'
758 56 50       241 if ($self->testRegExpr($text, '[-+]?[0-9.]+[%]?', 0, 0, 0, undef, 0, '#stay', 'Value')) {
759 0         0 return 1
760             }
761             # String => '[\w\-]+'
762             # attribute => 'Normal Text'
763             # context => '#stay'
764             # type => 'RegExpr'
765 56 100       175 if ($self->testRegExpr($text, '[\\w\\-]+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
766 6         21 return 1
767             }
768 50         201 return 0;
769             };
770              
771             sub parseImport {
772 22     22 0 34 my ($self, $text) = @_;
773             # attribute => 'At Rule'
774             # char => ';'
775             # context => '#pop'
776             # type => 'DetectChar'
777 22 100       70 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'At Rule')) {
778 2         4 return 1
779             }
780             # String => 'mediatypes'
781             # attribute => 'Media'
782             # context => '#stay'
783             # type => 'keyword'
784 20 100       53 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
785 4         10 return 1
786             }
787             # context => 'FindValues'
788             # type => 'IncludeRules'
789 16 100       35 if ($self->includeRules('FindValues', $text)) {
790 2         5 return 1
791             }
792             # context => 'FindStrings'
793             # type => 'IncludeRules'
794 14 100       33 if ($self->includeRules('FindStrings', $text)) {
795 2         6 return 1
796             }
797             # context => 'FindComments'
798             # type => 'IncludeRules'
799 12 50       25 if ($self->includeRules('FindComments', $text)) {
800 0         0 return 1
801             }
802 12         23 return 0;
803             };
804              
805             sub parseInsideString {
806 18     18 0 33 my ($self, $text) = @_;
807             # String => '\\["']'
808             # attribute => 'String'
809             # context => '#stay'
810             # type => 'RegExpr'
811 18 50       49 if ($self->testRegExpr($text, '\\\\["\']', 0, 0, 0, undef, 0, '#stay', 'String')) {
812 0         0 return 1
813             }
814             # type => 'DetectIdentifier'
815 18 100       61 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
816 12         37 return 1
817             }
818 6         17 return 0;
819             };
820              
821             sub parseMedia {
822 8     8 0 19 my ($self, $text) = @_;
823             # attribute => 'Media'
824             # beginRegion => 'media'
825             # char => '{'
826             # context => 'Media2'
827             # type => 'DetectChar'
828 8 100       30 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Media2', 'Media')) {
829 2         6 return 1
830             }
831             # String => 'mediatypes'
832             # attribute => 'Media'
833             # context => '#stay'
834             # type => 'keyword'
835 6 100       23 if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) {
836 2         7 return 1
837             }
838             # attribute => 'Media'
839             # char => ','
840             # context => '#stay'
841             # type => 'DetectChar'
842 4 50       15 if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#stay', 'Media')) {
843 0         0 return 1
844             }
845             # context => 'FindComments'
846             # type => 'IncludeRules'
847 4 50       15 if ($self->includeRules('FindComments', $text)) {
848 0         0 return 1
849             }
850             # String => '\S+'
851             # attribute => 'Error'
852             # context => '#stay'
853             # type => 'RegExpr'
854 4 50       14 if ($self->testRegExpr($text, '\\S+', 0, 0, 0, undef, 0, '#stay', 'Error')) {
855 0         0 return 1
856             }
857 4         13 return 0;
858             };
859              
860             sub parseMedia2 {
861 10     10 0 24 my ($self, $text) = @_;
862             # attribute => 'Media'
863             # char => '}'
864             # context => '#pop#pop'
865             # endRegion => 'media'
866             # type => 'DetectChar'
867 10 100       35 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Media')) {
868 2         6 return 1
869             }
870             # context => 'FindRuleSets'
871             # type => 'IncludeRules'
872 8 100       29 if ($self->includeRules('FindRuleSets', $text)) {
873 4         12 return 1
874             }
875 4         12 return 0;
876             };
877              
878             sub parsePropParen {
879 0     0 0 0 my ($self, $text) = @_;
880             # attribute => 'Value'
881             # char => '('
882             # context => 'PropParen2'
883             # type => 'DetectChar'
884 0 0       0 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'PropParen2', 'Value')) {
885 0         0 return 1
886             }
887             # context => 'FindComments'
888             # type => 'IncludeRules'
889 0 0       0 if ($self->includeRules('FindComments', $text)) {
890 0         0 return 1
891             }
892             # String => '\S'
893             # attribute => 'Error'
894             # context => '#stay'
895             # type => 'RegExpr'
896 0 0       0 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
897 0         0 return 1
898             }
899 0         0 return 0;
900             };
901              
902             sub parsePropParen2 {
903 0     0 0 0 my ($self, $text) = @_;
904             # attribute => 'Value'
905             # char => ')'
906             # context => '#pop#pop'
907             # type => 'DetectChar'
908 0 0       0 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) {
909 0         0 return 1
910             }
911             # context => 'FindValues'
912             # type => 'IncludeRules'
913 0 0       0 if ($self->includeRules('FindValues', $text)) {
914 0         0 return 1
915             }
916             # context => 'FindStrings'
917             # type => 'IncludeRules'
918 0 0       0 if ($self->includeRules('FindStrings', $text)) {
919 0         0 return 1
920             }
921             # context => 'FindComments'
922             # type => 'IncludeRules'
923 0 0       0 if ($self->includeRules('FindComments', $text)) {
924 0         0 return 1
925             }
926 0         0 return 0;
927             };
928              
929             sub parseRule {
930 20     20 0 60 my ($self, $text) = @_;
931             # attribute => 'Property'
932             # char => ':'
933             # context => 'Rule2'
934             # type => 'DetectChar'
935 20 50       87 if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule2', 'Property')) {
936 20         56 return 1
937             }
938             # String => '\S'
939             # attribute => 'Error'
940             # context => '#stay'
941             # type => 'RegExpr'
942 0 0       0 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
943 0         0 return 1
944             }
945 0         0 return 0;
946             };
947              
948             sub parseRule2 {
949 86     86 0 147 my ($self, $text) = @_;
950             # attribute => 'Property'
951             # char => ';'
952             # context => '#pop#pop'
953             # type => 'DetectChar'
954 86 100       265 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop', 'Property')) {
955 20         46 return 1
956             }
957             # attribute => 'Property'
958             # char => '}'
959             # context => '#pop#pop#pop'
960             # endRegion => 'ruleset'
961             # type => 'DetectChar'
962 66 50       210 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Property')) {
963 0         0 return 1
964             }
965             # String => 'types'
966             # attribute => 'Value'
967             # context => '#stay'
968             # type => 'keyword'
969 66 100       229 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Value')) {
970 6         23 return 1
971             }
972             # String => 'colors'
973             # attribute => 'Value'
974             # context => '#stay'
975             # type => 'keyword'
976 60 100       169 if ($self->testKeyword($text, 'colors', 0, undef, 0, '#stay', 'Value')) {
977 2         7 return 1
978             }
979             # String => '#([0-9A-Fa-f]{3}){1,4}\b'
980             # attribute => 'Value'
981             # context => '#stay'
982             # type => 'RegExpr'
983 58 50       190 if ($self->testRegExpr($text, '#([0-9A-Fa-f]{3}){1,4}\\b', 0, 0, 0, undef, 0, '#stay', 'Value')) {
984 0         0 return 1
985             }
986             # String => 'paren'
987             # attribute => 'Value'
988             # context => 'PropParen'
989             # type => 'keyword'
990 58 50       198 if ($self->testKeyword($text, 'paren', 0, undef, 0, 'PropParen', 'Value')) {
991 0         0 return 1
992             }
993             # String => '!important\b'
994             # attribute => 'Important'
995             # context => '#stay'
996             # type => 'RegExpr'
997 58 100       165 if ($self->testRegExpr($text, '!important\\b', 0, 0, 0, undef, 0, '#stay', 'Important')) {
998 2         6 return 1
999             }
1000             # context => 'FindValues'
1001             # type => 'IncludeRules'
1002 56 100       181 if ($self->includeRules('FindValues', $text)) {
1003 20         53 return 1
1004             }
1005             # context => 'FindStrings'
1006             # type => 'IncludeRules'
1007 36 100       107 if ($self->includeRules('FindStrings', $text)) {
1008 2         7 return 1
1009             }
1010             # context => 'FindComments'
1011             # type => 'IncludeRules'
1012 34 50       81 if ($self->includeRules('FindComments', $text)) {
1013 0         0 return 1
1014             }
1015 34         71 return 0;
1016             };
1017              
1018             sub parseRuleSet {
1019 148     148 0 261 my ($self, $text) = @_;
1020             # attribute => 'Property'
1021             # char => '}'
1022             # context => '#pop'
1023             # endRegion => 'ruleset'
1024             # type => 'DetectChar'
1025 148 100       400 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Property')) {
1026 10         31 return 1
1027             }
1028             # String => 'properties'
1029             # attribute => 'Property'
1030             # context => 'Rule'
1031             # type => 'keyword'
1032 138 100       402 if ($self->testKeyword($text, 'properties', 0, undef, 0, 'Rule', 'Property')) {
1033 18         53 return 1
1034             }
1035             # String => '-?[A-Za-z_-]+(?=\s*:)'
1036             # attribute => 'Unknown Property'
1037             # context => 'Rule'
1038             # type => 'RegExpr'
1039 120 100       381 if ($self->testRegExpr($text, '-?[A-Za-z_-]+(?=\\s*:)', 0, 0, 0, undef, 0, 'Rule', 'Unknown Property')) {
1040 2         9 return 1
1041             }
1042             # context => 'FindComments'
1043             # type => 'IncludeRules'
1044 118 100       380 if ($self->includeRules('FindComments', $text)) {
1045 4         10 return 1
1046             }
1047             # String => '\S'
1048             # attribute => 'Error'
1049             # context => '#stay'
1050             # type => 'RegExpr'
1051 114 100       319 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
1052 66         171 return 1
1053             }
1054 48         107 return 0;
1055             };
1056              
1057             sub parseSelAttr {
1058 16     16 0 32 my ($self, $text) = @_;
1059             # attribute => 'Selector Attr'
1060             # char => ']'
1061             # context => '#pop'
1062             # type => 'DetectChar'
1063 16 100       48 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Selector Attr')) {
1064 2         7 return 1
1065             }
1066             # context => 'FindStrings'
1067             # type => 'IncludeRules'
1068 14 100       37 if ($self->includeRules('FindStrings', $text)) {
1069 2         6 return 1
1070             }
1071 12         28 return 0;
1072             };
1073              
1074             sub parseSelPseudo {
1075 4     4 0 11 my ($self, $text) = @_;
1076             # String => 'pseudoclasses'
1077             # attribute => 'Selector Pseudo'
1078             # context => '#pop'
1079             # type => 'keyword'
1080 4 50       16 if ($self->testKeyword($text, 'pseudoclasses', 0, undef, 0, '#pop', 'Selector Pseudo')) {
1081 4         13 return 1
1082             }
1083 0         0 return 0;
1084             };
1085              
1086             sub parseStringDQ {
1087 24     24 0 39 my ($self, $text) = @_;
1088             # attribute => 'String'
1089             # char => '"'
1090             # context => '#pop'
1091             # type => 'DetectChar'
1092 24 100       60 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
1093 6         14 return 1
1094             }
1095             # context => 'InsideString'
1096             # type => 'IncludeRules'
1097 18 100       61 if ($self->includeRules('InsideString', $text)) {
1098 12         23 return 1
1099             }
1100 6         13 return 0;
1101             };
1102              
1103             sub parseStringSQ {
1104 0     0 0   my ($self, $text) = @_;
1105             # attribute => 'String'
1106             # char => '''
1107             # context => '#pop'
1108             # type => 'DetectChar'
1109 0 0         if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
1110 0           return 1
1111             }
1112             # context => 'InsideString'
1113             # type => 'IncludeRules'
1114 0 0         if ($self->includeRules('InsideString', $text)) {
1115 0           return 1
1116             }
1117 0           return 0;
1118             };
1119              
1120              
1121             1;
1122              
1123             __END__