Commit | Line | Data |
3fea05b9 |
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-php.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.99 |
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_PHP; |
14 | |
15 | our $VERSION = '0.06'; |
16 | |
17 | use strict; |
18 | use warnings; |
19 | use base('Syntax::Highlight::Engine::Kate::Template'); |
20 | |
21 | sub new { |
22 | my $proto = shift; |
23 | my $class = ref($proto) || $proto; |
24 | my $self = $class->SUPER::new(@_); |
25 | $self->attributes({ |
26 | 'Alert' => 'Alert', |
27 | 'At Rule' => 'DecVal', |
28 | 'Comment' => 'Comment', |
29 | 'Error' => 'Error', |
30 | 'Important' => 'Keyword', |
31 | 'Media' => 'DecVal', |
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', |
39 | 'String' => 'String', |
40 | 'Unknown Property' => 'Error', |
41 | 'Value' => 'DataType', |
42 | }); |
43 | $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 | $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 | $self->listAdd('paren', |
102 | 'attr', |
103 | 'counter', |
104 | 'counters', |
105 | 'format', |
106 | 'local', |
107 | 'rect', |
108 | 'rgb', |
109 | 'url', |
110 | ); |
111 | $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 | $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 | 'only-child', |
284 | 'only-of-type', |
285 | 'root', |
286 | 'selection', |
287 | 'target', |
288 | 'visited', |
289 | ); |
290 | $self->listAdd('types', |
291 | '100', |
292 | '200', |
293 | '300', |
294 | '400', |
295 | '500', |
296 | '600', |
297 | '700', |
298 | '800', |
299 | '900', |
300 | 'above', |
301 | 'absolute', |
302 | 'always', |
303 | 'armenian', |
304 | 'auto', |
305 | 'avoid', |
306 | 'baseline', |
307 | 'below', |
308 | 'bidi-override', |
309 | 'blink', |
310 | 'block', |
311 | 'bold', |
312 | 'bolder', |
313 | 'border-box', |
314 | 'both', |
315 | 'bottom', |
316 | 'box', |
317 | 'break', |
318 | 'capitalize', |
319 | 'caption', |
320 | 'center', |
321 | 'circle', |
322 | 'cjk-ideographic', |
323 | 'close-quote', |
324 | 'collapse', |
325 | 'compact', |
326 | 'condensed', |
327 | 'content-box', |
328 | 'crop', |
329 | 'cross', |
330 | 'crosshair', |
331 | 'cursive', |
332 | 'dashed', |
333 | 'decimal', |
334 | 'decimal-leading-zero', |
335 | 'default', |
336 | 'disc', |
337 | 'dotted', |
338 | 'double', |
339 | 'e-resize', |
340 | 'embed', |
341 | 'expanded', |
342 | 'extra-condensed', |
343 | 'extra-expanded', |
344 | 'fantasy', |
345 | 'fixed', |
346 | 'georgian', |
347 | 'groove', |
348 | 'hand', |
349 | 'hebrew', |
350 | 'help', |
351 | 'hidden', |
352 | 'hide', |
353 | 'higher', |
354 | 'hiragana', |
355 | 'hiragana-iroha', |
356 | 'icon', |
357 | 'inherit', |
358 | 'inline', |
359 | 'inline-table', |
360 | 'inset', |
361 | 'inside', |
362 | 'invert', |
363 | 'italic', |
364 | 'justify', |
365 | 'katakana', |
366 | 'katakana-iroha', |
367 | 'konq-center', |
368 | 'landscape', |
369 | 'large', |
370 | 'larger', |
371 | 'left', |
372 | 'level', |
373 | 'light', |
374 | 'lighter', |
375 | 'line-through', |
376 | 'list-item', |
377 | 'loud', |
378 | 'lower', |
379 | 'lower-alpha', |
380 | 'lower-greek', |
381 | 'lower-latin', |
382 | 'lower-roman', |
383 | 'lowercase', |
384 | 'ltr', |
385 | 'marker', |
386 | 'medium', |
387 | 'menu', |
388 | 'message-box', |
389 | 'middle', |
390 | 'mix', |
391 | 'monospace', |
392 | 'move', |
393 | 'n-resize', |
394 | 'narrower', |
395 | 'ne-resize', |
396 | 'no-close-quote', |
397 | 'no-open-quote', |
398 | 'no-repeat', |
399 | 'none', |
400 | 'normal', |
401 | 'nowrap', |
402 | 'nw-resize', |
403 | 'oblique', |
404 | 'open-quote', |
405 | 'outset', |
406 | 'outside', |
407 | 'overline', |
408 | 'pointer', |
409 | 'portrait', |
410 | 'pre', |
411 | 'pre-line', |
412 | 'pre-wrap', |
413 | 'relative', |
414 | 'repeat', |
415 | 'repeat-x', |
416 | 'repeat-y', |
417 | 'ridge', |
418 | 'right', |
419 | 'rtl', |
420 | 'run-in', |
421 | 's-resize', |
422 | 'sans-serif', |
423 | 'scroll', |
424 | 'se-resize', |
425 | 'semi-condensed', |
426 | 'semi-expanded', |
427 | 'separate', |
428 | 'serif', |
429 | 'show', |
430 | 'small', |
431 | 'small-caps', |
432 | 'small-caption', |
433 | 'smaller', |
434 | 'solid', |
435 | 'square', |
436 | 'static', |
437 | 'static-position', |
438 | 'status-bar', |
439 | 'sub', |
440 | 'super', |
441 | 'sw-resize', |
442 | 'table', |
443 | 'table-caption', |
444 | 'table-cell', |
445 | 'table-column', |
446 | 'table-column-group', |
447 | 'table-footer-group', |
448 | 'table-header-group', |
449 | 'table-row', |
450 | 'table-row-group', |
451 | 'text', |
452 | 'text-bottom', |
453 | 'text-top', |
454 | 'thick', |
455 | 'thin', |
456 | 'top', |
457 | 'transparent', |
458 | 'ultra-condensed', |
459 | 'ultra-expanded', |
460 | 'underline', |
461 | 'upper-alpha', |
462 | 'upper-latin', |
463 | 'upper-roman', |
464 | 'uppercase', |
465 | 'visible', |
466 | 'w-resize', |
467 | 'wait', |
468 | 'wider', |
469 | 'x-large', |
470 | 'x-small', |
471 | 'xx-large', |
472 | 'xx-small', |
473 | ); |
474 | $self->contextdata({ |
475 | 'Base' => { |
476 | callback => \&parseBase, |
477 | attribute => 'Normal Text', |
478 | }, |
479 | 'Comment' => { |
480 | callback => \&parseComment, |
481 | attribute => 'Comment', |
482 | }, |
483 | 'FindComments' => { |
484 | callback => \&parseFindComments, |
485 | attribute => 'Normal Text', |
486 | }, |
487 | 'FindPHP' => { |
488 | callback => \&parseFindPHP, |
489 | }, |
490 | 'FindRuleSets' => { |
491 | callback => \&parseFindRuleSets, |
492 | attribute => 'Normal Text', |
493 | }, |
494 | 'FindStrings' => { |
495 | callback => \&parseFindStrings, |
496 | attribute => 'Normal Text', |
497 | }, |
498 | 'FindValues' => { |
499 | callback => \&parseFindValues, |
500 | attribute => 'Normal Text', |
501 | }, |
502 | 'Import' => { |
503 | callback => \&parseImport, |
504 | attribute => 'Normal Text', |
505 | }, |
506 | 'InsideString' => { |
507 | callback => \&parseInsideString, |
508 | attribute => 'String', |
509 | }, |
510 | 'Media' => { |
511 | callback => \&parseMedia, |
512 | attribute => 'Normal Text', |
513 | }, |
514 | 'Media2' => { |
515 | callback => \&parseMedia2, |
516 | attribute => 'Normal Text', |
517 | }, |
518 | 'PropParen' => { |
519 | callback => \&parsePropParen, |
520 | attribute => 'Normal Text', |
521 | }, |
522 | 'PropParen2' => { |
523 | callback => \&parsePropParen2, |
524 | attribute => 'Normal Text', |
525 | }, |
526 | 'Rule' => { |
527 | callback => \&parseRule, |
528 | attribute => 'Normal Text', |
529 | }, |
530 | 'Rule2' => { |
531 | callback => \&parseRule2, |
532 | attribute => 'Normal Text', |
533 | }, |
534 | 'RuleSet' => { |
535 | callback => \&parseRuleSet, |
536 | attribute => 'Normal Text', |
537 | }, |
538 | 'SelAttr' => { |
539 | callback => \&parseSelAttr, |
540 | attribute => 'Selector Attr', |
541 | }, |
542 | 'SelPseudo' => { |
543 | callback => \&parseSelPseudo, |
544 | attribute => 'Selector Pseudo', |
545 | lineending => '#pop', |
546 | fallthrough => '#pop', |
547 | }, |
548 | 'StringDQ' => { |
549 | callback => \&parseStringDQ, |
550 | attribute => 'String', |
551 | }, |
552 | 'StringSQ' => { |
553 | callback => \&parseStringSQ, |
554 | attribute => 'String', |
555 | }, |
556 | }); |
557 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|<|=|>|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|-|\\%'); |
558 | $self->basecontext('Base'); |
559 | $self->keywordscase(0); |
560 | $self->initialize; |
561 | bless ($self, $class); |
562 | return $self; |
563 | } |
564 | |
565 | sub language { |
566 | return 'CSS/PHP'; |
567 | } |
568 | |
569 | sub parseBase { |
570 | my ($self, $text) = @_; |
571 | # context => 'FindPHP' |
572 | # type => 'IncludeRules' |
573 | if ($self->includeRules('FindPHP', $text)) { |
574 | return 1 |
575 | } |
576 | # type => 'LineContinue' |
577 | if ($self->testLineContinue($text, 0, undef, 0, '#stay', undef)) { |
578 | return 1 |
579 | } |
580 | # type => 'DetectSpaces' |
581 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
582 | return 1 |
583 | } |
584 | # context => 'FindRuleSets' |
585 | # type => 'IncludeRules' |
586 | if ($self->includeRules('FindRuleSets', $text)) { |
587 | return 1 |
588 | } |
589 | return 0; |
590 | }; |
591 | |
592 | sub parseComment { |
593 | my ($self, $text) = @_; |
594 | # context => 'FindPHP' |
595 | # type => 'IncludeRules' |
596 | if ($self->includeRules('FindPHP', $text)) { |
597 | return 1 |
598 | } |
599 | # type => 'DetectSpaces' |
600 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
601 | return 1 |
602 | } |
603 | # attribute => 'Comment' |
604 | # char => '*' |
605 | # char1 => '/' |
606 | # context => '#pop' |
607 | # endRegion => 'comment' |
608 | # type => 'Detect2Chars' |
609 | if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
610 | return 1 |
611 | } |
612 | # context => '##Alerts' |
613 | # type => 'IncludeRules' |
614 | if ($self->includePlugin('Alerts', $text)) { |
615 | return 1 |
616 | } |
617 | # type => 'DetectIdentifier' |
618 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
619 | return 1 |
620 | } |
621 | return 0; |
622 | }; |
623 | |
624 | sub parseFindComments { |
625 | my ($self, $text) = @_; |
626 | # context => 'FindPHP' |
627 | # type => 'IncludeRules' |
628 | if ($self->includeRules('FindPHP', $text)) { |
629 | return 1 |
630 | } |
631 | # String => '/\*BEGIN.*\*/' |
632 | # attribute => 'Region Marker' |
633 | # beginRegion => 'UserDefined' |
634 | # context => '#stay' |
635 | # type => 'RegExpr' |
636 | if ($self->testRegExpr($text, '/\\*BEGIN.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) { |
637 | return 1 |
638 | } |
639 | # String => '/\*END.*\*/' |
640 | # attribute => 'Region Marker' |
641 | # context => '#stay' |
642 | # endRegion => 'UserDefined' |
643 | # type => 'RegExpr' |
644 | if ($self->testRegExpr($text, '/\\*END.*\\*/', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) { |
645 | return 1 |
646 | } |
647 | # attribute => 'Comment' |
648 | # beginRegion => 'comment' |
649 | # char => '/' |
650 | # char1 => '*' |
651 | # context => 'Comment' |
652 | # type => 'Detect2Chars' |
653 | if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
654 | return 1 |
655 | } |
656 | return 0; |
657 | }; |
658 | |
659 | sub parseFindPHP { |
660 | my ($self, $text) = @_; |
661 | # String => '<\?(?:=|php)?' |
662 | # context => '##PHP/PHP' |
663 | # lookAhead => 'true' |
664 | # type => 'RegExpr' |
665 | if ($self->testRegExpr($text, '<\\?(?:=|php)?', 0, 0, 1, undef, 0, '##PHP/PHP', undef)) { |
666 | return 1 |
667 | } |
668 | return 0; |
669 | }; |
670 | |
671 | sub parseFindRuleSets { |
672 | my ($self, $text) = @_; |
673 | # context => 'FindPHP' |
674 | # type => 'IncludeRules' |
675 | if ($self->includeRules('FindPHP', $text)) { |
676 | return 1 |
677 | } |
678 | # String => '@media\b' |
679 | # attribute => 'Media' |
680 | # context => 'Media' |
681 | # type => 'RegExpr' |
682 | if ($self->testRegExpr($text, '@media\\b', 0, 0, 0, undef, 0, 'Media', 'Media')) { |
683 | return 1 |
684 | } |
685 | # String => '@import\b' |
686 | # attribute => 'At Rule' |
687 | # context => 'Import' |
688 | # type => 'RegExpr' |
689 | if ($self->testRegExpr($text, '@import\\b', 0, 0, 0, undef, 0, 'Import', 'At Rule')) { |
690 | return 1 |
691 | } |
692 | # String => '@(font-face|charset)\b' |
693 | # attribute => 'At Rule' |
694 | # context => '#stay' |
695 | # type => 'RegExpr' |
696 | if ($self->testRegExpr($text, '@(font-face|charset)\\b', 0, 0, 0, undef, 0, '#stay', 'At Rule')) { |
697 | return 1 |
698 | } |
699 | # attribute => 'Property' |
700 | # beginRegion => 'ruleset' |
701 | # char => '{' |
702 | # context => 'RuleSet' |
703 | # type => 'DetectChar' |
704 | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RuleSet', 'Property')) { |
705 | return 1 |
706 | } |
707 | # attribute => 'Selector Attr' |
708 | # char => '[' |
709 | # context => 'SelAttr' |
710 | # type => 'DetectChar' |
711 | if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'SelAttr', 'Selector Attr')) { |
712 | return 1 |
713 | } |
714 | # String => '#[A-Za-z0-9][\w\-]*' |
715 | # attribute => 'Selector Id' |
716 | # context => '#stay' |
717 | # type => 'RegExpr' |
718 | if ($self->testRegExpr($text, '#[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Id')) { |
719 | return 1 |
720 | } |
721 | # String => '\.[A-Za-z0-9][\w\-]*' |
722 | # attribute => 'Selector Class' |
723 | # context => '#stay' |
724 | # type => 'RegExpr' |
725 | if ($self->testRegExpr($text, '\\.[A-Za-z0-9][\\w\\-]*', 0, 0, 0, undef, 0, '#stay', 'Selector Class')) { |
726 | return 1 |
727 | } |
728 | # String => ':lang\([\w_-]+\)' |
729 | # attribute => 'Selector Pseudo' |
730 | # context => '#stay' |
731 | # type => 'RegExpr' |
732 | if ($self->testRegExpr($text, ':lang\\([\\w_-]+\\)', 0, 0, 0, undef, 0, '#stay', 'Selector Pseudo')) { |
733 | return 1 |
734 | } |
735 | # attribute => 'Selector Pseudo' |
736 | # char => ':' |
737 | # context => 'SelPseudo' |
738 | # type => 'DetectChar' |
739 | if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'SelPseudo', 'Selector Pseudo')) { |
740 | return 1 |
741 | } |
742 | # context => 'FindStrings' |
743 | # type => 'IncludeRules' |
744 | if ($self->includeRules('FindStrings', $text)) { |
745 | return 1 |
746 | } |
747 | # context => 'FindComments' |
748 | # type => 'IncludeRules' |
749 | if ($self->includeRules('FindComments', $text)) { |
750 | return 1 |
751 | } |
752 | return 0; |
753 | }; |
754 | |
755 | sub parseFindStrings { |
756 | my ($self, $text) = @_; |
757 | # context => 'FindPHP' |
758 | # type => 'IncludeRules' |
759 | if ($self->includeRules('FindPHP', $text)) { |
760 | return 1 |
761 | } |
762 | # attribute => 'String' |
763 | # char => '"' |
764 | # context => 'StringDQ' |
765 | # type => 'DetectChar' |
766 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'StringDQ', 'String')) { |
767 | return 1 |
768 | } |
769 | # attribute => 'String' |
770 | # char => ''' |
771 | # context => 'StringSQ' |
772 | # type => 'DetectChar' |
773 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'StringSQ', 'String')) { |
774 | return 1 |
775 | } |
776 | return 0; |
777 | }; |
778 | |
779 | sub parseFindValues { |
780 | my ($self, $text) = @_; |
781 | # context => 'FindPHP' |
782 | # type => 'IncludeRules' |
783 | if ($self->includeRules('FindPHP', $text)) { |
784 | return 1 |
785 | } |
786 | # String => '[-+]?[0-9.]+(em|ex|px|in|cm|mm|pt|pc|deg|rad|grad|ms|s|Hz|kHz)\b' |
787 | # attribute => 'Value' |
788 | # context => '#stay' |
789 | # type => 'RegExpr' |
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')) { |
791 | return 1 |
792 | } |
793 | # String => '[-+]?[0-9.]+[%]?' |
794 | # attribute => 'Value' |
795 | # context => '#stay' |
796 | # type => 'RegExpr' |
797 | if ($self->testRegExpr($text, '[-+]?[0-9.]+[%]?', 0, 0, 0, undef, 0, '#stay', 'Value')) { |
798 | return 1 |
799 | } |
800 | # String => '[\w\-]+' |
801 | # attribute => 'Normal Text' |
802 | # context => '#stay' |
803 | # type => 'RegExpr' |
804 | if ($self->testRegExpr($text, '[\\w\\-]+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
805 | return 1 |
806 | } |
807 | return 0; |
808 | }; |
809 | |
810 | sub parseImport { |
811 | my ($self, $text) = @_; |
812 | # context => 'FindPHP' |
813 | # type => 'IncludeRules' |
814 | if ($self->includeRules('FindPHP', $text)) { |
815 | return 1 |
816 | } |
817 | # attribute => 'At Rule' |
818 | # char => ';' |
819 | # context => '#pop' |
820 | # type => 'DetectChar' |
821 | if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'At Rule')) { |
822 | return 1 |
823 | } |
824 | # String => 'mediatypes' |
825 | # attribute => 'Media' |
826 | # context => '#stay' |
827 | # type => 'keyword' |
828 | if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) { |
829 | return 1 |
830 | } |
831 | # context => 'FindValues' |
832 | # type => 'IncludeRules' |
833 | if ($self->includeRules('FindValues', $text)) { |
834 | return 1 |
835 | } |
836 | # context => 'FindStrings' |
837 | # type => 'IncludeRules' |
838 | if ($self->includeRules('FindStrings', $text)) { |
839 | return 1 |
840 | } |
841 | # context => 'FindComments' |
842 | # type => 'IncludeRules' |
843 | if ($self->includeRules('FindComments', $text)) { |
844 | return 1 |
845 | } |
846 | return 0; |
847 | }; |
848 | |
849 | sub parseInsideString { |
850 | my ($self, $text) = @_; |
851 | # context => 'FindPHP' |
852 | # type => 'IncludeRules' |
853 | if ($self->includeRules('FindPHP', $text)) { |
854 | return 1 |
855 | } |
856 | # String => '\\["']' |
857 | # attribute => 'String' |
858 | # context => '#stay' |
859 | # type => 'RegExpr' |
860 | if ($self->testRegExpr($text, '\\\\["\']', 0, 0, 0, undef, 0, '#stay', 'String')) { |
861 | return 1 |
862 | } |
863 | # type => 'DetectIdentifier' |
864 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
865 | return 1 |
866 | } |
867 | return 0; |
868 | }; |
869 | |
870 | sub parseMedia { |
871 | my ($self, $text) = @_; |
872 | # context => 'FindPHP' |
873 | # type => 'IncludeRules' |
874 | if ($self->includeRules('FindPHP', $text)) { |
875 | return 1 |
876 | } |
877 | # attribute => 'Media' |
878 | # beginRegion => 'media' |
879 | # char => '{' |
880 | # context => 'Media2' |
881 | # type => 'DetectChar' |
882 | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Media2', 'Media')) { |
883 | return 1 |
884 | } |
885 | # String => 'mediatypes' |
886 | # attribute => 'Media' |
887 | # context => '#stay' |
888 | # type => 'keyword' |
889 | if ($self->testKeyword($text, 'mediatypes', 0, undef, 0, '#stay', 'Media')) { |
890 | return 1 |
891 | } |
892 | # attribute => 'Media' |
893 | # char => ',' |
894 | # context => '#stay' |
895 | # type => 'DetectChar' |
896 | if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#stay', 'Media')) { |
897 | return 1 |
898 | } |
899 | # context => 'FindComments' |
900 | # type => 'IncludeRules' |
901 | if ($self->includeRules('FindComments', $text)) { |
902 | return 1 |
903 | } |
904 | # String => '\S+' |
905 | # attribute => 'Error' |
906 | # context => '#stay' |
907 | # type => 'RegExpr' |
908 | if ($self->testRegExpr($text, '\\S+', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
909 | return 1 |
910 | } |
911 | return 0; |
912 | }; |
913 | |
914 | sub parseMedia2 { |
915 | my ($self, $text) = @_; |
916 | # context => 'FindPHP' |
917 | # type => 'IncludeRules' |
918 | if ($self->includeRules('FindPHP', $text)) { |
919 | return 1 |
920 | } |
921 | # attribute => 'Media' |
922 | # char => '}' |
923 | # context => '#pop#pop' |
924 | # endRegion => 'media' |
925 | # type => 'DetectChar' |
926 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Media')) { |
927 | return 1 |
928 | } |
929 | # context => 'FindRuleSets' |
930 | # type => 'IncludeRules' |
931 | if ($self->includeRules('FindRuleSets', $text)) { |
932 | return 1 |
933 | } |
934 | return 0; |
935 | }; |
936 | |
937 | sub parsePropParen { |
938 | my ($self, $text) = @_; |
939 | # context => 'FindPHP' |
940 | # type => 'IncludeRules' |
941 | if ($self->includeRules('FindPHP', $text)) { |
942 | return 1 |
943 | } |
944 | # attribute => 'Value' |
945 | # char => '(' |
946 | # context => 'PropParen2' |
947 | # type => 'DetectChar' |
948 | if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'PropParen2', 'Value')) { |
949 | return 1 |
950 | } |
951 | # context => 'FindComments' |
952 | # type => 'IncludeRules' |
953 | if ($self->includeRules('FindComments', $text)) { |
954 | return 1 |
955 | } |
956 | # String => '\S' |
957 | # attribute => 'Error' |
958 | # context => '#stay' |
959 | # type => 'RegExpr' |
960 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
961 | return 1 |
962 | } |
963 | return 0; |
964 | }; |
965 | |
966 | sub parsePropParen2 { |
967 | my ($self, $text) = @_; |
968 | # context => 'FindPHP' |
969 | # type => 'IncludeRules' |
970 | if ($self->includeRules('FindPHP', $text)) { |
971 | return 1 |
972 | } |
973 | # attribute => 'Value' |
974 | # char => ')' |
975 | # context => '#pop#pop' |
976 | # type => 'DetectChar' |
977 | if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) { |
978 | return 1 |
979 | } |
980 | # context => 'FindValues' |
981 | # type => 'IncludeRules' |
982 | if ($self->includeRules('FindValues', $text)) { |
983 | return 1 |
984 | } |
985 | # context => 'FindStrings' |
986 | # type => 'IncludeRules' |
987 | if ($self->includeRules('FindStrings', $text)) { |
988 | return 1 |
989 | } |
990 | # context => 'FindComments' |
991 | # type => 'IncludeRules' |
992 | if ($self->includeRules('FindComments', $text)) { |
993 | return 1 |
994 | } |
995 | return 0; |
996 | }; |
997 | |
998 | sub parseRule { |
999 | my ($self, $text) = @_; |
1000 | # context => 'FindPHP' |
1001 | # type => 'IncludeRules' |
1002 | if ($self->includeRules('FindPHP', $text)) { |
1003 | return 1 |
1004 | } |
1005 | # attribute => 'Property' |
1006 | # char => ':' |
1007 | # context => 'Rule2' |
1008 | # type => 'DetectChar' |
1009 | if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule2', 'Property')) { |
1010 | return 1 |
1011 | } |
1012 | # String => '\S' |
1013 | # attribute => 'Error' |
1014 | # context => '#stay' |
1015 | # type => 'RegExpr' |
1016 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
1017 | return 1 |
1018 | } |
1019 | return 0; |
1020 | }; |
1021 | |
1022 | sub parseRule2 { |
1023 | my ($self, $text) = @_; |
1024 | # context => 'FindPHP' |
1025 | # type => 'IncludeRules' |
1026 | if ($self->includeRules('FindPHP', $text)) { |
1027 | return 1 |
1028 | } |
1029 | # attribute => 'Property' |
1030 | # char => ';' |
1031 | # context => '#pop#pop' |
1032 | # type => 'DetectChar' |
1033 | if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop#pop', 'Property')) { |
1034 | return 1 |
1035 | } |
1036 | # attribute => 'Property' |
1037 | # char => '}' |
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')) { |
1042 | return 1 |
1043 | } |
1044 | # String => 'types' |
1045 | # attribute => 'Value' |
1046 | # context => '#stay' |
1047 | # type => 'keyword' |
1048 | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Value')) { |
1049 | return 1 |
1050 | } |
1051 | # String => 'colors' |
1052 | # attribute => 'Value' |
1053 | # context => '#stay' |
1054 | # type => 'keyword' |
1055 | if ($self->testKeyword($text, 'colors', 0, undef, 0, '#stay', 'Value')) { |
1056 | return 1 |
1057 | } |
1058 | # String => '#([0-9A-Fa-f]{3}){1,4}\b' |
1059 | # attribute => 'Value' |
1060 | # context => '#stay' |
1061 | # type => 'RegExpr' |
1062 | if ($self->testRegExpr($text, '#([0-9A-Fa-f]{3}){1,4}\\b', 0, 0, 0, undef, 0, '#stay', 'Value')) { |
1063 | return 1 |
1064 | } |
1065 | # String => 'paren' |
1066 | # attribute => 'Value' |
1067 | # context => 'PropParen' |
1068 | # type => 'keyword' |
1069 | if ($self->testKeyword($text, 'paren', 0, undef, 0, 'PropParen', 'Value')) { |
1070 | return 1 |
1071 | } |
1072 | # String => '!important\b' |
1073 | # attribute => 'Important' |
1074 | # context => '#stay' |
1075 | # type => 'RegExpr' |
1076 | if ($self->testRegExpr($text, '!important\\b', 0, 0, 0, undef, 0, '#stay', 'Important')) { |
1077 | return 1 |
1078 | } |
1079 | # context => 'FindValues' |
1080 | # type => 'IncludeRules' |
1081 | if ($self->includeRules('FindValues', $text)) { |
1082 | return 1 |
1083 | } |
1084 | # context => 'FindStrings' |
1085 | # type => 'IncludeRules' |
1086 | if ($self->includeRules('FindStrings', $text)) { |
1087 | return 1 |
1088 | } |
1089 | # context => 'FindComments' |
1090 | # type => 'IncludeRules' |
1091 | if ($self->includeRules('FindComments', $text)) { |
1092 | return 1 |
1093 | } |
1094 | return 0; |
1095 | }; |
1096 | |
1097 | sub parseRuleSet { |
1098 | my ($self, $text) = @_; |
1099 | # context => 'FindPHP' |
1100 | # type => 'IncludeRules' |
1101 | if ($self->includeRules('FindPHP', $text)) { |
1102 | return 1 |
1103 | } |
1104 | # attribute => 'Property' |
1105 | # char => '}' |
1106 | # context => '#pop' |
1107 | # endRegion => 'ruleset' |
1108 | # type => 'DetectChar' |
1109 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Property')) { |
1110 | return 1 |
1111 | } |
1112 | # String => 'properties' |
1113 | # attribute => 'Property' |
1114 | # context => 'Rule' |
1115 | # type => 'keyword' |
1116 | if ($self->testKeyword($text, 'properties', 0, undef, 0, 'Rule', 'Property')) { |
1117 | return 1 |
1118 | } |
1119 | # String => '-?[A-Za-z_-]+(?=\s*:)' |
1120 | # attribute => 'Unknown Property' |
1121 | # context => 'Rule' |
1122 | # type => 'RegExpr' |
1123 | if ($self->testRegExpr($text, '-?[A-Za-z_-]+(?=\\s*:)', 0, 0, 0, undef, 0, 'Rule', 'Unknown Property')) { |
1124 | return 1 |
1125 | } |
1126 | # context => 'FindComments' |
1127 | # type => 'IncludeRules' |
1128 | if ($self->includeRules('FindComments', $text)) { |
1129 | return 1 |
1130 | } |
1131 | # String => '\S' |
1132 | # attribute => 'Error' |
1133 | # context => '#stay' |
1134 | # type => 'RegExpr' |
1135 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
1136 | return 1 |
1137 | } |
1138 | return 0; |
1139 | }; |
1140 | |
1141 | sub parseSelAttr { |
1142 | my ($self, $text) = @_; |
1143 | # context => 'FindPHP' |
1144 | # type => 'IncludeRules' |
1145 | if ($self->includeRules('FindPHP', $text)) { |
1146 | return 1 |
1147 | } |
1148 | # attribute => 'Selector Attr' |
1149 | # char => ']' |
1150 | # context => '#pop' |
1151 | # type => 'DetectChar' |
1152 | if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Selector Attr')) { |
1153 | return 1 |
1154 | } |
1155 | # context => 'FindStrings' |
1156 | # type => 'IncludeRules' |
1157 | if ($self->includeRules('FindStrings', $text)) { |
1158 | return 1 |
1159 | } |
1160 | return 0; |
1161 | }; |
1162 | |
1163 | sub parseSelPseudo { |
1164 | my ($self, $text) = @_; |
1165 | # context => 'FindPHP' |
1166 | # type => 'IncludeRules' |
1167 | if ($self->includeRules('FindPHP', $text)) { |
1168 | return 1 |
1169 | } |
1170 | # String => 'pseudoclasses' |
1171 | # attribute => 'Selector Pseudo' |
1172 | # context => '#pop' |
1173 | # type => 'keyword' |
1174 | if ($self->testKeyword($text, 'pseudoclasses', 0, undef, 0, '#pop', 'Selector Pseudo')) { |
1175 | return 1 |
1176 | } |
1177 | return 0; |
1178 | }; |
1179 | |
1180 | sub parseStringDQ { |
1181 | my ($self, $text) = @_; |
1182 | # context => 'FindPHP' |
1183 | # type => 'IncludeRules' |
1184 | if ($self->includeRules('FindPHP', $text)) { |
1185 | return 1 |
1186 | } |
1187 | # attribute => 'String' |
1188 | # char => '"' |
1189 | # context => '#pop' |
1190 | # type => 'DetectChar' |
1191 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
1192 | return 1 |
1193 | } |
1194 | # context => 'InsideString' |
1195 | # type => 'IncludeRules' |
1196 | if ($self->includeRules('InsideString', $text)) { |
1197 | return 1 |
1198 | } |
1199 | return 0; |
1200 | }; |
1201 | |
1202 | sub parseStringSQ { |
1203 | my ($self, $text) = @_; |
1204 | # context => 'FindPHP' |
1205 | # type => 'IncludeRules' |
1206 | if ($self->includeRules('FindPHP', $text)) { |
1207 | return 1 |
1208 | } |
1209 | # attribute => 'String' |
1210 | # char => ''' |
1211 | # context => '#pop' |
1212 | # type => 'DetectChar' |
1213 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
1214 | return 1 |
1215 | } |
1216 | # context => 'InsideString' |
1217 | # type => 'IncludeRules' |
1218 | if ($self->includeRules('InsideString', $text)) { |
1219 | return 1 |
1220 | } |
1221 | return 0; |
1222 | }; |
1223 | |
1224 | |
1225 | 1; |
1226 | |
1227 | __END__ |
1228 | |
1229 | =head1 NAME |
1230 | |
1231 | Syntax::Highlight::Engine::Kate::CSS_PHP - a Plugin for CSS/PHP syntax highlighting |
1232 | |
1233 | =head1 SYNOPSIS |
1234 | |
1235 | require Syntax::Highlight::Engine::Kate::CSS_PHP; |
1236 | my $sh = new Syntax::Highlight::Engine::Kate::CSS_PHP([ |
1237 | ]); |
1238 | |
1239 | =head1 DESCRIPTION |
1240 | |
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. |
1243 | |
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. |
1247 | |
1248 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
1249 | |
1250 | =cut |
1251 | |
1252 | =head1 AUTHOR |
1253 | |
1254 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
1255 | |
1256 | =cut |
1257 | |
1258 | =head1 BUGS |
1259 | |
1260 | Unknown. If you find any, please contact the author |
1261 | |
1262 | =cut |
1263 | |