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 'html-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.98 |
9 | #kate version 2.4 |
10 | #kate author Wilbert Berendsen (wilbert@kde.nl) |
11 | #generated: Sun Feb 3 22:02:06 2008, localtime |
12 | |
13 | package Syntax::Highlight::Engine::Kate::PHP_HTML; |
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 | 'Attribute' => 'Others', |
27 | 'CDATA' => 'BaseN', |
28 | 'Comment' => 'Comment', |
29 | 'Doctype' => 'DataType', |
30 | 'Element' => 'Keyword', |
31 | 'EntityRef' => 'DecVal', |
32 | 'Error' => 'Error', |
33 | 'Normal Text' => 'Normal', |
34 | 'PEntityRef' => 'DecVal', |
35 | 'Processing Instruction' => 'Keyword', |
36 | 'Value' => 'String', |
37 | }); |
38 | $self->contextdata({ |
39 | 'CDATA' => { |
40 | callback => \&parseCDATA, |
41 | attribute => 'Normal Text', |
42 | }, |
43 | 'CSS' => { |
44 | callback => \&parseCSS, |
45 | attribute => 'Normal Text', |
46 | }, |
47 | 'CSS content' => { |
48 | callback => \&parseCSScontent, |
49 | attribute => 'Normal Text', |
50 | }, |
51 | 'Comment' => { |
52 | callback => \&parseComment, |
53 | attribute => 'Comment', |
54 | }, |
55 | 'Doctype' => { |
56 | callback => \&parseDoctype, |
57 | attribute => 'Normal Text', |
58 | }, |
59 | 'Doctype Internal Subset' => { |
60 | callback => \&parseDoctypeInternalSubset, |
61 | attribute => 'Normal Text', |
62 | }, |
63 | 'Doctype Markupdecl' => { |
64 | callback => \&parseDoctypeMarkupdecl, |
65 | attribute => 'Normal Text', |
66 | }, |
67 | 'Doctype Markupdecl DQ' => { |
68 | callback => \&parseDoctypeMarkupdeclDQ, |
69 | attribute => 'Value', |
70 | }, |
71 | 'Doctype Markupdecl SQ' => { |
72 | callback => \&parseDoctypeMarkupdeclSQ, |
73 | attribute => 'Value', |
74 | }, |
75 | 'El Close' => { |
76 | callback => \&parseElClose, |
77 | attribute => 'Normal Text', |
78 | }, |
79 | 'El Close 2' => { |
80 | callback => \&parseElClose2, |
81 | attribute => 'Normal Text', |
82 | }, |
83 | 'El Close 3' => { |
84 | callback => \&parseElClose3, |
85 | attribute => 'Normal Text', |
86 | }, |
87 | 'El Open' => { |
88 | callback => \&parseElOpen, |
89 | attribute => 'Normal Text', |
90 | }, |
91 | 'FindAttributes' => { |
92 | callback => \&parseFindAttributes, |
93 | attribute => 'Normal Text', |
94 | }, |
95 | 'FindDTDRules' => { |
96 | callback => \&parseFindDTDRules, |
97 | attribute => 'Normal Text', |
98 | }, |
99 | 'FindEntityRefs' => { |
100 | callback => \&parseFindEntityRefs, |
101 | attribute => 'Normal Text', |
102 | }, |
103 | 'FindHTML' => { |
104 | callback => \&parseFindHTML, |
105 | attribute => 'Normal Text', |
106 | }, |
107 | 'FindPEntityRefs' => { |
108 | callback => \&parseFindPEntityRefs, |
109 | attribute => 'Normal Text', |
110 | }, |
111 | 'FindPHP' => { |
112 | callback => \&parseFindPHP, |
113 | }, |
114 | 'JS' => { |
115 | callback => \&parseJS, |
116 | attribute => 'Normal Text', |
117 | }, |
118 | 'JS comment close' => { |
119 | callback => \&parseJScommentclose, |
120 | attribute => 'Comment', |
121 | lineending => '#pop', |
122 | }, |
123 | 'JS content' => { |
124 | callback => \&parseJScontent, |
125 | attribute => 'Normal Text', |
126 | }, |
127 | 'PI' => { |
128 | callback => \&parsePI, |
129 | attribute => 'Normal Text', |
130 | }, |
131 | 'Start' => { |
132 | callback => \&parseStart, |
133 | attribute => 'Normal Text', |
134 | }, |
135 | 'Value' => { |
136 | callback => \&parseValue, |
137 | attribute => 'Normal Text', |
138 | fallthrough => 'Value NQ', |
139 | }, |
140 | 'Value DQ' => { |
141 | callback => \&parseValueDQ, |
142 | attribute => 'Value', |
143 | }, |
144 | 'Value NQ' => { |
145 | callback => \&parseValueNQ, |
146 | attribute => 'Normal Text', |
147 | lineending => '#pop#pop', |
148 | fallthrough => '#pop#pop', |
149 | }, |
150 | 'Value SQ' => { |
151 | callback => \&parseValueSQ, |
152 | attribute => 'Value', |
153 | }, |
154 | }); |
155 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
156 | $self->basecontext('Start'); |
157 | $self->keywordscase(1); |
158 | $self->initialize; |
159 | bless ($self, $class); |
160 | return $self; |
161 | } |
162 | |
163 | sub language { |
164 | return 'PHP (HTML)'; |
165 | } |
166 | |
167 | sub parseCDATA { |
168 | my ($self, $text) = @_; |
169 | # context => 'FindPHP' |
170 | # type => 'IncludeRules' |
171 | if ($self->includeRules('FindPHP', $text)) { |
172 | return 1 |
173 | } |
174 | # type => 'DetectSpaces' |
175 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
176 | return 1 |
177 | } |
178 | # type => 'DetectIdentifier' |
179 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
180 | return 1 |
181 | } |
182 | # String => ']]>' |
183 | # attribute => 'CDATA' |
184 | # context => '#pop' |
185 | # endRegion => 'cdata' |
186 | # type => 'StringDetect' |
187 | if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) { |
188 | return 1 |
189 | } |
190 | # String => ']]>' |
191 | # attribute => 'EntityRef' |
192 | # context => '#stay' |
193 | # type => 'StringDetect' |
194 | if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { |
195 | return 1 |
196 | } |
197 | return 0; |
198 | }; |
199 | |
200 | sub parseCSS { |
201 | my ($self, $text) = @_; |
202 | # context => 'FindPHP' |
203 | # type => 'IncludeRules' |
204 | if ($self->includeRules('FindPHP', $text)) { |
205 | return 1 |
206 | } |
207 | # attribute => 'Element' |
208 | # char => '/' |
209 | # char1 => '>' |
210 | # context => '#pop' |
211 | # endRegion => 'style' |
212 | # type => 'Detect2Chars' |
213 | if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
214 | return 1 |
215 | } |
216 | # attribute => 'Element' |
217 | # char => '>' |
218 | # context => 'CSS content' |
219 | # type => 'DetectChar' |
220 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'CSS content', 'Element')) { |
221 | return 1 |
222 | } |
223 | # context => 'FindAttributes' |
224 | # type => 'IncludeRules' |
225 | if ($self->includeRules('FindAttributes', $text)) { |
226 | return 1 |
227 | } |
228 | # String => '\S' |
229 | # attribute => 'Error' |
230 | # context => '#stay' |
231 | # type => 'RegExpr' |
232 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
233 | return 1 |
234 | } |
235 | return 0; |
236 | }; |
237 | |
238 | sub parseCSScontent { |
239 | my ($self, $text) = @_; |
240 | # context => 'FindPHP' |
241 | # type => 'IncludeRules' |
242 | if ($self->includeRules('FindPHP', $text)) { |
243 | return 1 |
244 | } |
245 | # String => '</style\b' |
246 | # attribute => 'Element' |
247 | # context => 'El Close 2' |
248 | # endRegion => 'style' |
249 | # insensitive => 'TRUE' |
250 | # type => 'RegExpr' |
251 | if ($self->testRegExpr($text, '</style\\b', 1, 0, 0, undef, 0, 'El Close 2', 'Element')) { |
252 | return 1 |
253 | } |
254 | # context => '##CSS/PHP' |
255 | # includeAttrib => 'true' |
256 | # type => 'IncludeRules' |
257 | if ($self->includePlugin('CSS/PHP', $text)) { |
258 | return 1 |
259 | } |
260 | return 0; |
261 | }; |
262 | |
263 | sub parseComment { |
264 | my ($self, $text) = @_; |
265 | # context => 'FindPHP' |
266 | # type => 'IncludeRules' |
267 | if ($self->includeRules('FindPHP', $text)) { |
268 | return 1 |
269 | } |
270 | # type => 'DetectSpaces' |
271 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
272 | return 1 |
273 | } |
274 | # context => '##Alerts' |
275 | # type => 'IncludeRules' |
276 | if ($self->includePlugin('Alerts', $text)) { |
277 | return 1 |
278 | } |
279 | # type => 'DetectIdentifier' |
280 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
281 | return 1 |
282 | } |
283 | # String => '-->' |
284 | # attribute => 'Comment' |
285 | # context => '#pop' |
286 | # endRegion => 'comment' |
287 | # type => 'StringDetect' |
288 | if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
289 | return 1 |
290 | } |
291 | # String => '-(-(?!->))+' |
292 | # attribute => 'Error' |
293 | # context => '#stay' |
294 | # type => 'RegExpr' |
295 | if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
296 | return 1 |
297 | } |
298 | return 0; |
299 | }; |
300 | |
301 | sub parseDoctype { |
302 | my ($self, $text) = @_; |
303 | # context => 'FindPHP' |
304 | # type => 'IncludeRules' |
305 | if ($self->includeRules('FindPHP', $text)) { |
306 | return 1 |
307 | } |
308 | # attribute => 'Doctype' |
309 | # char => '>' |
310 | # context => '#pop' |
311 | # endRegion => 'doctype' |
312 | # type => 'DetectChar' |
313 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
314 | return 1 |
315 | } |
316 | # attribute => 'Doctype' |
317 | # beginRegion => 'int_subset' |
318 | # char => '[' |
319 | # context => 'Doctype Internal Subset' |
320 | # type => 'DetectChar' |
321 | if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) { |
322 | return 1 |
323 | } |
324 | return 0; |
325 | }; |
326 | |
327 | sub parseDoctypeInternalSubset { |
328 | my ($self, $text) = @_; |
329 | # context => 'FindPHP' |
330 | # type => 'IncludeRules' |
331 | if ($self->includeRules('FindPHP', $text)) { |
332 | return 1 |
333 | } |
334 | # attribute => 'Doctype' |
335 | # char => ']' |
336 | # context => '#pop' |
337 | # endRegion => 'int_subset' |
338 | # type => 'DetectChar' |
339 | if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
340 | return 1 |
341 | } |
342 | # context => 'FindDTDRules' |
343 | # type => 'IncludeRules' |
344 | if ($self->includeRules('FindDTDRules', $text)) { |
345 | return 1 |
346 | } |
347 | # String => '<!--' |
348 | # attribute => 'Comment' |
349 | # beginRegion => 'comment' |
350 | # context => 'Comment' |
351 | # type => 'StringDetect' |
352 | if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
353 | return 1 |
354 | } |
355 | # String => '<\?[\w:-]*' |
356 | # attribute => 'Processing Instruction' |
357 | # beginRegion => 'pi' |
358 | # context => 'PI' |
359 | # type => 'RegExpr' |
360 | if ($self->testRegExpr($text, '<\\?[\\w:-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) { |
361 | return 1 |
362 | } |
363 | # context => 'FindPEntityRefs' |
364 | # type => 'IncludeRules' |
365 | if ($self->includeRules('FindPEntityRefs', $text)) { |
366 | return 1 |
367 | } |
368 | return 0; |
369 | }; |
370 | |
371 | sub parseDoctypeMarkupdecl { |
372 | my ($self, $text) = @_; |
373 | # context => 'FindPHP' |
374 | # type => 'IncludeRules' |
375 | if ($self->includeRules('FindPHP', $text)) { |
376 | return 1 |
377 | } |
378 | # attribute => 'Doctype' |
379 | # char => '>' |
380 | # context => '#pop' |
381 | # type => 'DetectChar' |
382 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
383 | return 1 |
384 | } |
385 | # attribute => 'Value' |
386 | # char => '"' |
387 | # context => 'Doctype Markupdecl DQ' |
388 | # type => 'DetectChar' |
389 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Doctype Markupdecl DQ', 'Value')) { |
390 | return 1 |
391 | } |
392 | # attribute => 'Value' |
393 | # char => ''' |
394 | # context => 'Doctype Markupdecl SQ' |
395 | # type => 'DetectChar' |
396 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Doctype Markupdecl SQ', 'Value')) { |
397 | return 1 |
398 | } |
399 | return 0; |
400 | }; |
401 | |
402 | sub parseDoctypeMarkupdeclDQ { |
403 | my ($self, $text) = @_; |
404 | # context => 'FindPHP' |
405 | # type => 'IncludeRules' |
406 | if ($self->includeRules('FindPHP', $text)) { |
407 | return 1 |
408 | } |
409 | # attribute => 'Value' |
410 | # char => '"' |
411 | # context => '#pop' |
412 | # type => 'DetectChar' |
413 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Value')) { |
414 | return 1 |
415 | } |
416 | # context => 'FindPEntityRefs' |
417 | # type => 'IncludeRules' |
418 | if ($self->includeRules('FindPEntityRefs', $text)) { |
419 | return 1 |
420 | } |
421 | return 0; |
422 | }; |
423 | |
424 | sub parseDoctypeMarkupdeclSQ { |
425 | my ($self, $text) = @_; |
426 | # context => 'FindPHP' |
427 | # type => 'IncludeRules' |
428 | if ($self->includeRules('FindPHP', $text)) { |
429 | return 1 |
430 | } |
431 | # attribute => 'Value' |
432 | # char => ''' |
433 | # context => '#pop' |
434 | # type => 'DetectChar' |
435 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Value')) { |
436 | return 1 |
437 | } |
438 | # context => 'FindPEntityRefs' |
439 | # type => 'IncludeRules' |
440 | if ($self->includeRules('FindPEntityRefs', $text)) { |
441 | return 1 |
442 | } |
443 | return 0; |
444 | }; |
445 | |
446 | sub parseElClose { |
447 | my ($self, $text) = @_; |
448 | # context => 'FindPHP' |
449 | # type => 'IncludeRules' |
450 | if ($self->includeRules('FindPHP', $text)) { |
451 | return 1 |
452 | } |
453 | # attribute => 'Element' |
454 | # char => '>' |
455 | # context => '#pop' |
456 | # type => 'DetectChar' |
457 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
458 | return 1 |
459 | } |
460 | # String => '\S' |
461 | # attribute => 'Error' |
462 | # context => '#stay' |
463 | # type => 'RegExpr' |
464 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
465 | return 1 |
466 | } |
467 | return 0; |
468 | }; |
469 | |
470 | sub parseElClose2 { |
471 | my ($self, $text) = @_; |
472 | # context => 'FindPHP' |
473 | # type => 'IncludeRules' |
474 | if ($self->includeRules('FindPHP', $text)) { |
475 | return 1 |
476 | } |
477 | # attribute => 'Element' |
478 | # char => '>' |
479 | # context => '#pop#pop#pop' |
480 | # type => 'DetectChar' |
481 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Element')) { |
482 | return 1 |
483 | } |
484 | # String => '\S' |
485 | # attribute => 'Error' |
486 | # context => '#stay' |
487 | # type => 'RegExpr' |
488 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
489 | return 1 |
490 | } |
491 | return 0; |
492 | }; |
493 | |
494 | sub parseElClose3 { |
495 | my ($self, $text) = @_; |
496 | # context => 'FindPHP' |
497 | # type => 'IncludeRules' |
498 | if ($self->includeRules('FindPHP', $text)) { |
499 | return 1 |
500 | } |
501 | # attribute => 'Element' |
502 | # char => '>' |
503 | # context => '#pop#pop#pop#pop' |
504 | # type => 'DetectChar' |
505 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop#pop', 'Element')) { |
506 | return 1 |
507 | } |
508 | # String => '\S' |
509 | # attribute => 'Error' |
510 | # context => '#stay' |
511 | # type => 'RegExpr' |
512 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
513 | return 1 |
514 | } |
515 | return 0; |
516 | }; |
517 | |
518 | sub parseElOpen { |
519 | my ($self, $text) = @_; |
520 | # context => 'FindPHP' |
521 | # type => 'IncludeRules' |
522 | if ($self->includeRules('FindPHP', $text)) { |
523 | return 1 |
524 | } |
525 | # attribute => 'Element' |
526 | # char => '/' |
527 | # char1 => '>' |
528 | # context => '#pop' |
529 | # type => 'Detect2Chars' |
530 | if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
531 | return 1 |
532 | } |
533 | # attribute => 'Element' |
534 | # char => '>' |
535 | # context => '#pop' |
536 | # type => 'DetectChar' |
537 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
538 | return 1 |
539 | } |
540 | # context => 'FindAttributes' |
541 | # type => 'IncludeRules' |
542 | if ($self->includeRules('FindAttributes', $text)) { |
543 | return 1 |
544 | } |
545 | # String => '\S' |
546 | # attribute => 'Error' |
547 | # context => '#stay' |
548 | # type => 'RegExpr' |
549 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
550 | return 1 |
551 | } |
552 | return 0; |
553 | }; |
554 | |
555 | sub parseFindAttributes { |
556 | my ($self, $text) = @_; |
557 | # context => 'FindPHP' |
558 | # type => 'IncludeRules' |
559 | if ($self->includeRules('FindPHP', $text)) { |
560 | return 1 |
561 | } |
562 | # String => '[A-Za-z_:][\w.:_-]*' |
563 | # attribute => 'Attribute' |
564 | # column => '0' |
565 | # context => '#stay' |
566 | # type => 'RegExpr' |
567 | if ($self->testRegExpr($text, '[A-Za-z_:][\\w.:_-]*', 0, 0, 0, 0, 0, '#stay', 'Attribute')) { |
568 | return 1 |
569 | } |
570 | # String => '\s+[A-Za-z_:][\w.:_-]*' |
571 | # attribute => 'Attribute' |
572 | # context => '#stay' |
573 | # type => 'RegExpr' |
574 | if ($self->testRegExpr($text, '\\s+[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'Attribute')) { |
575 | return 1 |
576 | } |
577 | # attribute => 'Attribute' |
578 | # char => '=' |
579 | # context => 'Value' |
580 | # type => 'DetectChar' |
581 | if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) { |
582 | return 1 |
583 | } |
584 | return 0; |
585 | }; |
586 | |
587 | sub parseFindDTDRules { |
588 | my ($self, $text) = @_; |
589 | # context => 'FindPHP' |
590 | # type => 'IncludeRules' |
591 | if ($self->includeRules('FindPHP', $text)) { |
592 | return 1 |
593 | } |
594 | # String => '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b' |
595 | # attribute => 'Doctype' |
596 | # context => 'Doctype Markupdecl' |
597 | # type => 'RegExpr' |
598 | if ($self->testRegExpr($text, '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\\b', 0, 0, 0, undef, 0, 'Doctype Markupdecl', 'Doctype')) { |
599 | return 1 |
600 | } |
601 | return 0; |
602 | }; |
603 | |
604 | sub parseFindEntityRefs { |
605 | my ($self, $text) = @_; |
606 | # context => 'FindPHP' |
607 | # type => 'IncludeRules' |
608 | if ($self->includeRules('FindPHP', $text)) { |
609 | return 1 |
610 | } |
611 | # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);' |
612 | # attribute => 'EntityRef' |
613 | # context => '#stay' |
614 | # type => 'RegExpr' |
615 | if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { |
616 | return 1 |
617 | } |
618 | # String => '&<' |
619 | # attribute => 'Error' |
620 | # context => '#stay' |
621 | # type => 'AnyChar' |
622 | if ($self->testAnyChar($text, '&<', 0, 0, undef, 0, '#stay', 'Error')) { |
623 | return 1 |
624 | } |
625 | return 0; |
626 | }; |
627 | |
628 | sub parseFindHTML { |
629 | my ($self, $text) = @_; |
630 | # context => 'FindPHP' |
631 | # type => 'IncludeRules' |
632 | if ($self->includeRules('FindPHP', $text)) { |
633 | return 1 |
634 | } |
635 | # type => 'DetectSpaces' |
636 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
637 | return 1 |
638 | } |
639 | # type => 'DetectIdentifier' |
640 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
641 | return 1 |
642 | } |
643 | # String => '<!--' |
644 | # attribute => 'Comment' |
645 | # beginRegion => 'comment' |
646 | # context => 'Comment' |
647 | # type => 'StringDetect' |
648 | if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
649 | return 1 |
650 | } |
651 | # String => '<![CDATA[' |
652 | # attribute => 'CDATA' |
653 | # beginRegion => 'cdata' |
654 | # context => 'CDATA' |
655 | # type => 'StringDetect' |
656 | if ($self->testStringDetect($text, '<![CDATA[', 0, 0, 0, undef, 0, 'CDATA', 'CDATA')) { |
657 | return 1 |
658 | } |
659 | # String => '<!DOCTYPE\s+' |
660 | # attribute => 'Doctype' |
661 | # beginRegion => 'doctype' |
662 | # context => 'Doctype' |
663 | # type => 'RegExpr' |
664 | if ($self->testRegExpr($text, '<!DOCTYPE\\s+', 0, 0, 0, undef, 0, 'Doctype', 'Doctype')) { |
665 | return 1 |
666 | } |
667 | # String => '<\?[\w:-]*' |
668 | # attribute => 'Processing Instruction' |
669 | # beginRegion => 'pi' |
670 | # context => 'PI' |
671 | # type => 'RegExpr' |
672 | if ($self->testRegExpr($text, '<\\?[\\w:-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) { |
673 | return 1 |
674 | } |
675 | # String => '<style\b' |
676 | # attribute => 'Element' |
677 | # beginRegion => 'style' |
678 | # context => 'CSS' |
679 | # insensitive => 'TRUE' |
680 | # type => 'RegExpr' |
681 | if ($self->testRegExpr($text, '<style\\b', 1, 0, 0, undef, 0, 'CSS', 'Element')) { |
682 | return 1 |
683 | } |
684 | # String => '<script\b' |
685 | # attribute => 'Element' |
686 | # beginRegion => 'script' |
687 | # context => 'JS' |
688 | # insensitive => 'TRUE' |
689 | # type => 'RegExpr' |
690 | if ($self->testRegExpr($text, '<script\\b', 1, 0, 0, undef, 0, 'JS', 'Element')) { |
691 | return 1 |
692 | } |
693 | # String => '<pre\b' |
694 | # attribute => 'Element' |
695 | # beginRegion => 'pre' |
696 | # context => 'El Open' |
697 | # insensitive => 'TRUE' |
698 | # type => 'RegExpr' |
699 | if ($self->testRegExpr($text, '<pre\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { |
700 | return 1 |
701 | } |
702 | # String => '<div\b' |
703 | # attribute => 'Element' |
704 | # beginRegion => 'div' |
705 | # context => 'El Open' |
706 | # insensitive => 'TRUE' |
707 | # type => 'RegExpr' |
708 | if ($self->testRegExpr($text, '<div\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { |
709 | return 1 |
710 | } |
711 | # String => '<table\b' |
712 | # attribute => 'Element' |
713 | # beginRegion => 'table' |
714 | # context => 'El Open' |
715 | # insensitive => 'TRUE' |
716 | # type => 'RegExpr' |
717 | if ($self->testRegExpr($text, '<table\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { |
718 | return 1 |
719 | } |
720 | # String => '<[A-Za-z_:][\w.:_-]*' |
721 | # attribute => 'Element' |
722 | # context => 'El Open' |
723 | # type => 'RegExpr' |
724 | if ($self->testRegExpr($text, '<[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'El Open', 'Element')) { |
725 | return 1 |
726 | } |
727 | # String => '</pre\b' |
728 | # attribute => 'Element' |
729 | # context => 'El Close' |
730 | # endRegion => 'pre' |
731 | # insensitive => 'TRUE' |
732 | # type => 'RegExpr' |
733 | if ($self->testRegExpr($text, '</pre\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { |
734 | return 1 |
735 | } |
736 | # String => '</div\b' |
737 | # attribute => 'Element' |
738 | # context => 'El Close' |
739 | # endRegion => 'div' |
740 | # insensitive => 'TRUE' |
741 | # type => 'RegExpr' |
742 | if ($self->testRegExpr($text, '</div\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { |
743 | return 1 |
744 | } |
745 | # String => '</table\b' |
746 | # attribute => 'Element' |
747 | # context => 'El Close' |
748 | # endRegion => 'table' |
749 | # insensitive => 'TRUE' |
750 | # type => 'RegExpr' |
751 | if ($self->testRegExpr($text, '</table\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { |
752 | return 1 |
753 | } |
754 | # String => '</[A-Za-z_:][\w.:_-]*' |
755 | # attribute => 'Element' |
756 | # context => 'El Close' |
757 | # type => 'RegExpr' |
758 | if ($self->testRegExpr($text, '</[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'El Close', 'Element')) { |
759 | return 1 |
760 | } |
761 | # context => 'FindDTDRules' |
762 | # type => 'IncludeRules' |
763 | if ($self->includeRules('FindDTDRules', $text)) { |
764 | return 1 |
765 | } |
766 | # context => 'FindEntityRefs' |
767 | # type => 'IncludeRules' |
768 | if ($self->includeRules('FindEntityRefs', $text)) { |
769 | return 1 |
770 | } |
771 | return 0; |
772 | }; |
773 | |
774 | sub parseFindPEntityRefs { |
775 | my ($self, $text) = @_; |
776 | # context => 'FindPHP' |
777 | # type => 'IncludeRules' |
778 | if ($self->includeRules('FindPHP', $text)) { |
779 | return 1 |
780 | } |
781 | # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);' |
782 | # attribute => 'EntityRef' |
783 | # context => '#stay' |
784 | # type => 'RegExpr' |
785 | if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { |
786 | return 1 |
787 | } |
788 | # String => '%[A-Za-z_:][\w.:_-]*;' |
789 | # attribute => 'PEntityRef' |
790 | # context => '#stay' |
791 | # type => 'RegExpr' |
792 | if ($self->testRegExpr($text, '%[A-Za-z_:][\\w.:_-]*;', 0, 0, 0, undef, 0, '#stay', 'PEntityRef')) { |
793 | return 1 |
794 | } |
795 | # String => '&%' |
796 | # attribute => 'Error' |
797 | # context => '#stay' |
798 | # type => 'AnyChar' |
799 | if ($self->testAnyChar($text, '&%', 0, 0, undef, 0, '#stay', 'Error')) { |
800 | return 1 |
801 | } |
802 | return 0; |
803 | }; |
804 | |
805 | sub parseFindPHP { |
806 | my ($self, $text) = @_; |
807 | # String => '<\?(?:=|php)?' |
808 | # context => '##PHP/PHP' |
809 | # lookAhead => 'true' |
810 | # type => 'RegExpr' |
811 | if ($self->testRegExpr($text, '<\\?(?:=|php)?', 0, 0, 1, undef, 0, '##PHP/PHP', undef)) { |
812 | return 1 |
813 | } |
814 | return 0; |
815 | }; |
816 | |
817 | sub parseJS { |
818 | my ($self, $text) = @_; |
819 | # context => 'FindPHP' |
820 | # type => 'IncludeRules' |
821 | if ($self->includeRules('FindPHP', $text)) { |
822 | return 1 |
823 | } |
824 | # attribute => 'Element' |
825 | # char => '/' |
826 | # char1 => '>' |
827 | # context => '#pop' |
828 | # endRegion => 'script' |
829 | # type => 'Detect2Chars' |
830 | if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
831 | return 1 |
832 | } |
833 | # attribute => 'Element' |
834 | # char => '>' |
835 | # context => 'JS content' |
836 | # type => 'DetectChar' |
837 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'JS content', 'Element')) { |
838 | return 1 |
839 | } |
840 | # context => 'FindAttributes' |
841 | # type => 'IncludeRules' |
842 | if ($self->includeRules('FindAttributes', $text)) { |
843 | return 1 |
844 | } |
845 | # String => '\S' |
846 | # attribute => 'Error' |
847 | # context => '#stay' |
848 | # type => 'RegExpr' |
849 | if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
850 | return 1 |
851 | } |
852 | return 0; |
853 | }; |
854 | |
855 | sub parseJScommentclose { |
856 | my ($self, $text) = @_; |
857 | # context => 'FindPHP' |
858 | # type => 'IncludeRules' |
859 | if ($self->includeRules('FindPHP', $text)) { |
860 | return 1 |
861 | } |
862 | # String => '</script\b' |
863 | # attribute => 'Element' |
864 | # context => 'El Close 3' |
865 | # endRegion => 'script' |
866 | # insensitive => 'TRUE' |
867 | # type => 'RegExpr' |
868 | if ($self->testRegExpr($text, '</script\\b', 1, 0, 0, undef, 0, 'El Close 3', 'Element')) { |
869 | return 1 |
870 | } |
871 | # context => '##Alerts' |
872 | # type => 'IncludeRules' |
873 | if ($self->includePlugin('Alerts', $text)) { |
874 | return 1 |
875 | } |
876 | return 0; |
877 | }; |
878 | |
879 | sub parseJScontent { |
880 | my ($self, $text) = @_; |
881 | # context => 'FindPHP' |
882 | # type => 'IncludeRules' |
883 | if ($self->includeRules('FindPHP', $text)) { |
884 | return 1 |
885 | } |
886 | # String => '</script\b' |
887 | # attribute => 'Element' |
888 | # context => 'El Close 2' |
889 | # endRegion => 'script' |
890 | # insensitive => 'TRUE' |
891 | # type => 'RegExpr' |
892 | if ($self->testRegExpr($text, '</script\\b', 1, 0, 0, undef, 0, 'El Close 2', 'Element')) { |
893 | return 1 |
894 | } |
895 | # String => '//(?=.*</script\b)' |
896 | # attribute => 'Comment' |
897 | # context => 'JS comment close' |
898 | # insensitive => 'TRUE' |
899 | # type => 'RegExpr' |
900 | if ($self->testRegExpr($text, '//(?=.*</script\\b)', 1, 0, 0, undef, 0, 'JS comment close', 'Comment')) { |
901 | return 1 |
902 | } |
903 | # context => '##JavaScript/PHP' |
904 | # includeAttrib => 'true' |
905 | # type => 'IncludeRules' |
906 | if ($self->includePlugin('JavaScript/PHP', $text)) { |
907 | return 1 |
908 | } |
909 | return 0; |
910 | }; |
911 | |
912 | sub parsePI { |
913 | my ($self, $text) = @_; |
914 | # context => 'FindPHP' |
915 | # type => 'IncludeRules' |
916 | if ($self->includeRules('FindPHP', $text)) { |
917 | return 1 |
918 | } |
919 | # attribute => 'Processing Instruction' |
920 | # char => '?' |
921 | # char1 => '>' |
922 | # context => '#pop' |
923 | # endRegion => 'pi' |
924 | # type => 'Detect2Chars' |
925 | if ($self->testDetect2Chars($text, '?', '>', 0, 0, 0, undef, 0, '#pop', 'Processing Instruction')) { |
926 | return 1 |
927 | } |
928 | return 0; |
929 | }; |
930 | |
931 | sub parseStart { |
932 | my ($self, $text) = @_; |
933 | # context => 'FindPHP' |
934 | # type => 'IncludeRules' |
935 | if ($self->includeRules('FindPHP', $text)) { |
936 | return 1 |
937 | } |
938 | # context => 'FindHTML' |
939 | # type => 'IncludeRules' |
940 | if ($self->includeRules('FindHTML', $text)) { |
941 | return 1 |
942 | } |
943 | return 0; |
944 | }; |
945 | |
946 | sub parseValue { |
947 | my ($self, $text) = @_; |
948 | # context => 'FindPHP' |
949 | # type => 'IncludeRules' |
950 | if ($self->includeRules('FindPHP', $text)) { |
951 | return 1 |
952 | } |
953 | # attribute => 'Value' |
954 | # char => '"' |
955 | # context => 'Value DQ' |
956 | # type => 'DetectChar' |
957 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Value DQ', 'Value')) { |
958 | return 1 |
959 | } |
960 | # attribute => 'Value' |
961 | # char => ''' |
962 | # context => 'Value SQ' |
963 | # type => 'DetectChar' |
964 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Value SQ', 'Value')) { |
965 | return 1 |
966 | } |
967 | # type => 'DetectSpaces' |
968 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
969 | return 1 |
970 | } |
971 | return 0; |
972 | }; |
973 | |
974 | sub parseValueDQ { |
975 | my ($self, $text) = @_; |
976 | # context => 'FindPHP' |
977 | # type => 'IncludeRules' |
978 | if ($self->includeRules('FindPHP', $text)) { |
979 | return 1 |
980 | } |
981 | # attribute => 'Value' |
982 | # char => '"' |
983 | # context => '#pop#pop' |
984 | # type => 'DetectChar' |
985 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) { |
986 | return 1 |
987 | } |
988 | # context => 'FindEntityRefs' |
989 | # type => 'IncludeRules' |
990 | if ($self->includeRules('FindEntityRefs', $text)) { |
991 | return 1 |
992 | } |
993 | return 0; |
994 | }; |
995 | |
996 | sub parseValueNQ { |
997 | my ($self, $text) = @_; |
998 | # context => 'FindPHP' |
999 | # type => 'IncludeRules' |
1000 | if ($self->includeRules('FindPHP', $text)) { |
1001 | return 1 |
1002 | } |
1003 | # context => 'FindEntityRefs' |
1004 | # type => 'IncludeRules' |
1005 | if ($self->includeRules('FindEntityRefs', $text)) { |
1006 | return 1 |
1007 | } |
1008 | # String => '/(?!>)' |
1009 | # attribute => 'Value' |
1010 | # context => '#stay' |
1011 | # type => 'RegExpr' |
1012 | if ($self->testRegExpr($text, '/(?!>)', 0, 0, 0, undef, 0, '#stay', 'Value')) { |
1013 | return 1 |
1014 | } |
1015 | # String => '[^/><"'\s]' |
1016 | # attribute => 'Value' |
1017 | # context => '#stay' |
1018 | # type => 'RegExpr' |
1019 | if ($self->testRegExpr($text, '[^/><"\'\\s]', 0, 0, 0, undef, 0, '#stay', 'Value')) { |
1020 | return 1 |
1021 | } |
1022 | return 0; |
1023 | }; |
1024 | |
1025 | sub parseValueSQ { |
1026 | my ($self, $text) = @_; |
1027 | # context => 'FindPHP' |
1028 | # type => 'IncludeRules' |
1029 | if ($self->includeRules('FindPHP', $text)) { |
1030 | return 1 |
1031 | } |
1032 | # attribute => 'Value' |
1033 | # char => ''' |
1034 | # context => '#pop#pop' |
1035 | # type => 'DetectChar' |
1036 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) { |
1037 | return 1 |
1038 | } |
1039 | # context => 'FindEntityRefs' |
1040 | # type => 'IncludeRules' |
1041 | if ($self->includeRules('FindEntityRefs', $text)) { |
1042 | return 1 |
1043 | } |
1044 | return 0; |
1045 | }; |
1046 | |
1047 | |
1048 | 1; |
1049 | |
1050 | __END__ |
1051 | |
1052 | =head1 NAME |
1053 | |
1054 | Syntax::Highlight::Engine::Kate::PHP_HTML - a Plugin for PHP (HTML) syntax highlighting |
1055 | |
1056 | =head1 SYNOPSIS |
1057 | |
1058 | require Syntax::Highlight::Engine::Kate::PHP_HTML; |
1059 | my $sh = new Syntax::Highlight::Engine::Kate::PHP_HTML([ |
1060 | ]); |
1061 | |
1062 | =head1 DESCRIPTION |
1063 | |
1064 | Syntax::Highlight::Engine::Kate::PHP_HTML is a plugin module that provides syntax highlighting |
1065 | for PHP (HTML) to the Syntax::Haghlight::Engine::Kate highlighting engine. |
1066 | |
1067 | This code is generated from the syntax definition files used |
1068 | by the Kate project. |
1069 | It works quite fine, but can use refinement and optimization. |
1070 | |
1071 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
1072 | |
1073 | =cut |
1074 | |
1075 | =head1 AUTHOR |
1076 | |
1077 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
1078 | |
1079 | =cut |
1080 | |
1081 | =head1 BUGS |
1082 | |
1083 | Unknown. If you find any, please contact the author |
1084 | |
1085 | =cut |
1086 | |