File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/PHP_HTML.pm
Criterion Covered Total %
statement 71 307 23.1
branch 37 230 16.0
condition 1 3 33.3
subroutine 11 33 33.3
pod 0 30 0.0
total 120 603 19.9


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 '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.07';
16              
17 2     2   1157 use strict;
  2         6  
  2         92  
18 2     2   12 use warnings;
  2         4  
  2         71  
19 2     2   13 use base('Syntax::Highlight::Engine::Kate::Template');
  2         4  
  2         12630  
20              
21             sub new {
22 3     3 0 752 my $proto = shift;
23 3   33     29 my $class = ref($proto) || $proto;
24 3         34 my $self = $class->SUPER::new(@_);
25 3         84 $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 3         202 $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 3         26 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
156 3         16 $self->basecontext('Start');
157 3         28 $self->keywordscase(1);
158 3         19 $self->initialize;
159 3         8 bless ($self, $class);
160 3         22 return $self;
161             }
162              
163             sub language {
164 0     0 0 0 return 'PHP (HTML)';
165             }
166              
167             sub parseCDATA {
168 0     0 0 0 my ($self, $text) = @_;
169             # context => 'FindPHP'
170             # type => 'IncludeRules'
171 0 0       0 if ($self->includeRules('FindPHP', $text)) {
172 0         0 return 1
173             }
174             # type => 'DetectSpaces'
175 0 0       0 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
176 0         0 return 1
177             }
178             # type => 'DetectIdentifier'
179 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
180 0         0 return 1
181             }
182             # String => ']]>'
183             # attribute => 'CDATA'
184             # context => '#pop'
185             # endRegion => 'cdata'
186             # type => 'StringDetect'
187 0 0       0 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) {
188 0         0 return 1
189             }
190             # String => ']]>'
191             # attribute => 'EntityRef'
192             # context => '#stay'
193             # type => 'StringDetect'
194 0 0       0 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) {
195 0         0 return 1
196             }
197 0         0 return 0;
198             };
199              
200             sub parseCSS {
201 0     0 0 0 my ($self, $text) = @_;
202             # context => 'FindPHP'
203             # type => 'IncludeRules'
204 0 0       0 if ($self->includeRules('FindPHP', $text)) {
205 0         0 return 1
206             }
207             # attribute => 'Element'
208             # char => '/'
209             # char1 => '>'
210             # context => '#pop'
211             # endRegion => 'style'
212             # type => 'Detect2Chars'
213 0 0       0 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) {
214 0         0 return 1
215             }
216             # attribute => 'Element'
217             # char => '>'
218             # context => 'CSS content'
219             # type => 'DetectChar'
220 0 0       0 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'CSS content', 'Element')) {
221 0         0 return 1
222             }
223             # context => 'FindAttributes'
224             # type => 'IncludeRules'
225 0 0       0 if ($self->includeRules('FindAttributes', $text)) {
226 0         0 return 1
227             }
228             # String => '\S'
229             # attribute => 'Error'
230             # context => '#stay'
231             # type => 'RegExpr'
232 0 0       0 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) {
233 0         0 return 1
234             }
235 0         0 return 0;
236             };
237              
238             sub parseCSScontent {
239 0     0 0 0 my ($self, $text) = @_;
240             # context => 'FindPHP'
241             # type => 'IncludeRules'
242 0 0       0 if ($self->includeRules('FindPHP', $text)) {
243 0         0 return 1
244             }
245             # String => '
246             # attribute => 'Element'
247             # context => 'El Close 2'
248             # endRegion => 'style'
249             # insensitive => 'TRUE'
250             # type => 'RegExpr'
251 0 0       0 if ($self->testRegExpr($text, '
252 0         0 return 1
253             }
254             # context => '##CSS/PHP'
255             # includeAttrib => 'true'
256             # type => 'IncludeRules'
257 0 0       0 if ($self->includePlugin('CSS/PHP', $text)) {
258 0         0 return 1
259             }
260 0         0 return 0;
261             };
262              
263             sub parseComment {
264 0     0 0 0 my ($self, $text) = @_;
265             # context => 'FindPHP'
266             # type => 'IncludeRules'
267 0 0       0 if ($self->includeRules('FindPHP', $text)) {
268 0         0 return 1
269             }
270             # type => 'DetectSpaces'
271 0 0       0 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
272 0         0 return 1
273             }
274             # context => '##Alerts'
275             # type => 'IncludeRules'
276 0 0       0 if ($self->includePlugin('Alerts', $text)) {
277 0         0 return 1
278             }
279             # type => 'DetectIdentifier'
280 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
281 0         0 return 1
282             }
283             # String => '-->'
284             # attribute => 'Comment'
285             # context => '#pop'
286             # endRegion => 'comment'
287             # type => 'StringDetect'
288 0 0       0 if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
289 0         0 return 1
290             }
291             # String => '-(-(?!->))+'
292             # attribute => 'Error'
293             # context => '#stay'
294             # type => 'RegExpr'
295 0 0       0 if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) {
296 0         0 return 1
297             }
298 0         0 return 0;
299             };
300              
301             sub parseDoctype {
302 0     0 0 0 my ($self, $text) = @_;
303             # context => 'FindPHP'
304             # type => 'IncludeRules'
305 0 0       0 if ($self->includeRules('FindPHP', $text)) {
306 0         0 return 1
307             }
308             # attribute => 'Doctype'
309             # char => '>'
310             # context => '#pop'
311             # endRegion => 'doctype'
312             # type => 'DetectChar'
313 0 0       0 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) {
314 0         0 return 1
315             }
316             # attribute => 'Doctype'
317             # beginRegion => 'int_subset'
318             # char => '['
319             # context => 'Doctype Internal Subset'
320             # type => 'DetectChar'
321 0 0       0 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) {
322 0         0 return 1
323             }
324 0         0 return 0;
325             };
326              
327             sub parseDoctypeInternalSubset {
328 0     0 0 0 my ($self, $text) = @_;
329             # context => 'FindPHP'
330             # type => 'IncludeRules'
331 0 0       0 if ($self->includeRules('FindPHP', $text)) {
332 0         0 return 1
333             }
334             # attribute => 'Doctype'
335             # char => ']'
336             # context => '#pop'
337             # endRegion => 'int_subset'
338             # type => 'DetectChar'
339 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) {
340 0         0 return 1
341             }
342             # context => 'FindDTDRules'
343             # type => 'IncludeRules'
344 0 0       0 if ($self->includeRules('FindDTDRules', $text)) {
345 0         0 return 1
346             }
347             # String => '