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.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:05 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::HTML; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
19
|
1
|
|
|
1
|
|
4
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2254
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
3
|
|
|
3
|
0
|
614
|
my $proto = shift; |
23
|
3
|
|
33
|
|
|
19
|
my $class = ref($proto) || $proto; |
24
|
3
|
|
|
|
|
19
|
my $self = $class->SUPER::new(@_); |
25
|
3
|
|
|
|
|
43
|
$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
|
|
|
|
|
146
|
$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
|
|
|
|
|
|
|
'JS' => { |
112
|
|
|
|
|
|
|
callback => \&parseJS, |
113
|
|
|
|
|
|
|
attribute => 'Normal Text', |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
'JS comment close' => { |
116
|
|
|
|
|
|
|
callback => \&parseJScommentclose, |
117
|
|
|
|
|
|
|
attribute => 'Comment', |
118
|
|
|
|
|
|
|
lineending => '#pop', |
119
|
|
|
|
|
|
|
}, |
120
|
|
|
|
|
|
|
'JS content' => { |
121
|
|
|
|
|
|
|
callback => \&parseJScontent, |
122
|
|
|
|
|
|
|
attribute => 'Normal Text', |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
'PI' => { |
125
|
|
|
|
|
|
|
callback => \&parsePI, |
126
|
|
|
|
|
|
|
attribute => 'Normal Text', |
127
|
|
|
|
|
|
|
}, |
128
|
|
|
|
|
|
|
'Start' => { |
129
|
|
|
|
|
|
|
callback => \&parseStart, |
130
|
|
|
|
|
|
|
attribute => 'Normal Text', |
131
|
|
|
|
|
|
|
}, |
132
|
|
|
|
|
|
|
'Value' => { |
133
|
|
|
|
|
|
|
callback => \&parseValue, |
134
|
|
|
|
|
|
|
attribute => 'Normal Text', |
135
|
|
|
|
|
|
|
fallthrough => 'Value NQ', |
136
|
|
|
|
|
|
|
}, |
137
|
|
|
|
|
|
|
'Value DQ' => { |
138
|
|
|
|
|
|
|
callback => \&parseValueDQ, |
139
|
|
|
|
|
|
|
attribute => 'Value', |
140
|
|
|
|
|
|
|
}, |
141
|
|
|
|
|
|
|
'Value NQ' => { |
142
|
|
|
|
|
|
|
callback => \&parseValueNQ, |
143
|
|
|
|
|
|
|
attribute => 'Normal Text', |
144
|
|
|
|
|
|
|
lineending => '#pop#pop', |
145
|
|
|
|
|
|
|
fallthrough => '#pop#pop', |
146
|
|
|
|
|
|
|
}, |
147
|
|
|
|
|
|
|
'Value SQ' => { |
148
|
|
|
|
|
|
|
callback => \&parseValueSQ, |
149
|
|
|
|
|
|
|
attribute => 'Value', |
150
|
|
|
|
|
|
|
}, |
151
|
|
|
|
|
|
|
}); |
152
|
3
|
|
|
|
|
18
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
153
|
3
|
|
|
|
|
13
|
$self->basecontext('Start'); |
154
|
3
|
|
|
|
|
12
|
$self->keywordscase(1); |
155
|
3
|
|
|
|
|
12
|
$self->initialize; |
156
|
3
|
|
|
|
|
6
|
bless ($self, $class); |
157
|
3
|
|
|
|
|
22
|
return $self; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub language { |
161
|
0
|
|
|
0
|
0
|
0
|
return 'HTML'; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub parseCDATA { |
165
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
166
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
167
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
168
|
0
|
|
|
|
|
0
|
return 1 |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
# type => 'DetectIdentifier' |
171
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
172
|
0
|
|
|
|
|
0
|
return 1 |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
# String => ']]>' |
175
|
|
|
|
|
|
|
# attribute => 'CDATA' |
176
|
|
|
|
|
|
|
# context => '#pop' |
177
|
|
|
|
|
|
|
# endRegion => 'cdata' |
178
|
|
|
|
|
|
|
# type => 'StringDetect' |
179
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) { |
180
|
0
|
|
|
|
|
0
|
return 1 |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
# String => ']]>' |
183
|
|
|
|
|
|
|
# attribute => 'EntityRef' |
184
|
|
|
|
|
|
|
# context => '#stay' |
185
|
|
|
|
|
|
|
# type => 'StringDetect' |
186
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { |
187
|
0
|
|
|
|
|
0
|
return 1 |
188
|
|
|
|
|
|
|
} |
189
|
0
|
|
|
|
|
0
|
return 0; |
190
|
|
|
|
|
|
|
}; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub parseCSS { |
193
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
194
|
|
|
|
|
|
|
# attribute => 'Element' |
195
|
|
|
|
|
|
|
# char => '/' |
196
|
|
|
|
|
|
|
# char1 => '>' |
197
|
|
|
|
|
|
|
# context => '#pop' |
198
|
|
|
|
|
|
|
# endRegion => 'style' |
199
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
200
|
0
|
0
|
|
|
|
0
|
if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { |
201
|
0
|
|
|
|
|
0
|
return 1 |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
# attribute => 'Element' |
204
|
|
|
|
|
|
|
# char => '>' |
205
|
|
|
|
|
|
|
# context => 'CSS content' |
206
|
|
|
|
|
|
|
# type => 'DetectChar' |
207
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'CSS content', 'Element')) { |
208
|
0
|
|
|
|
|
0
|
return 1 |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
# context => 'FindAttributes' |
211
|
|
|
|
|
|
|
# type => 'IncludeRules' |
212
|
0
|
0
|
|
|
|
0
|
if ($self->includeRules('FindAttributes', $text)) { |
213
|
0
|
|
|
|
|
0
|
return 1 |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
# String => '\S' |
216
|
|
|
|
|
|
|
# attribute => 'Error' |
217
|
|
|
|
|
|
|
# context => '#stay' |
218
|
|
|
|
|
|
|
# type => 'RegExpr' |
219
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
220
|
0
|
|
|
|
|
0
|
return 1 |
221
|
|
|
|
|
|
|
} |
222
|
0
|
|
|
|
|
0
|
return 0; |
223
|
|
|
|
|
|
|
}; |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub parseCSScontent { |
226
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
227
|
|
|
|
|
|
|
# String => '
|
228
|
|
|
|
|
|
|
# attribute => 'Element' |
229
|
|
|
|
|
|
|
# context => 'El Close 2' |
230
|
|
|
|
|
|
|
# endRegion => 'style' |
231
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
232
|
|
|
|
|
|
|
# type => 'RegExpr' |
233
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '
|
234
|
0
|
|
|
|
|
0
|
return 1 |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
# context => '##CSS' |
237
|
|
|
|
|
|
|
# includeAttrib => 'true' |
238
|
|
|
|
|
|
|
# type => 'IncludeRules' |
239
|
0
|
0
|
|
|
|
0
|
if ($self->includePlugin('CSS', $text)) { |
240
|
0
|
|
|
|
|
0
|
return 1 |
241
|
|
|
|
|
|
|
} |
242
|
0
|
|
|
|
|
0
|
return 0; |
243
|
|
|
|
|
|
|
}; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub parseComment { |
246
|
24
|
|
|
24
|
0
|
44
|
my ($self, $text) = @_; |
247
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
248
|
24
|
50
|
|
|
|
69
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
249
|
0
|
|
|
|
|
0
|
return 1 |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
# context => '##Alerts' |
252
|
|
|
|
|
|
|
# type => 'IncludeRules' |
253
|
24
|
50
|
|
|
|
85
|
if ($self->includePlugin('Alerts', $text)) { |
254
|
0
|
|
|
|
|
0
|
return 1 |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
# type => 'DetectIdentifier' |
257
|
24
|
100
|
|
|
|
82
|
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
258
|
8
|
|
|
|
|
21
|
return 1 |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
# String => '-->' |
261
|
|
|
|
|
|
|
# attribute => 'Comment' |
262
|
|
|
|
|
|
|
# context => '#pop' |
263
|
|
|
|
|
|
|
# endRegion => 'comment' |
264
|
|
|
|
|
|
|
# type => 'StringDetect' |
265
|
16
|
100
|
|
|
|
47
|
if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
266
|
4
|
|
|
|
|
9
|
return 1 |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
# String => '-(-(?!->))+' |
269
|
|
|
|
|
|
|
# attribute => 'Error' |
270
|
|
|
|
|
|
|
# context => '#stay' |
271
|
|
|
|
|
|
|
# type => 'RegExpr' |
272
|
12
|
50
|
|
|
|
42
|
if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
273
|
0
|
|
|
|
|
0
|
return 1 |
274
|
|
|
|
|
|
|
} |
275
|
12
|
|
|
|
|
30
|
return 0; |
276
|
|
|
|
|
|
|
}; |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub parseDoctype { |
279
|
198
|
|
|
198
|
0
|
322
|
my ($self, $text) = @_; |
280
|
|
|
|
|
|
|
# attribute => 'Doctype' |
281
|
|
|
|
|
|
|
# char => '>' |
282
|
|
|
|
|
|
|
# context => '#pop' |
283
|
|
|
|
|
|
|
# endRegion => 'doctype' |
284
|
|
|
|
|
|
|
# type => 'DetectChar' |
285
|
198
|
100
|
|
|
|
443
|
if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
286
|
2
|
|
|
|
|
7
|
return 1 |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
# attribute => 'Doctype' |
289
|
|
|
|
|
|
|
# beginRegion => 'int_subset' |
290
|
|
|
|
|
|
|
# char => '[' |
291
|
|
|
|
|
|
|
# context => 'Doctype Internal Subset' |
292
|
|
|
|
|
|
|
# type => 'DetectChar' |
293
|
196
|
50
|
|
|
|
429
|
if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) { |
294
|
0
|
|
|
|
|
0
|
return 1 |
295
|
|
|
|
|
|
|
} |
296
|
196
|
|
|
|
|
335
|
return 0; |
297
|
|
|
|
|
|
|
}; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub parseDoctypeInternalSubset { |
300
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
301
|
|
|
|
|
|
|
# attribute => 'Doctype' |
302
|
|
|
|
|
|
|
# char => ']' |
303
|
|
|
|
|
|
|
# context => '#pop' |
304
|
|
|
|
|
|
|
# endRegion => 'int_subset' |
305
|
|
|
|
|
|
|
# type => 'DetectChar' |
306
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
307
|
0
|
|
|
|
|
0
|
return 1 |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
# context => 'FindDTDRules' |
310
|
|
|
|
|
|
|
# type => 'IncludeRules' |
311
|
0
|
0
|
|
|
|
0
|
if ($self->includeRules('FindDTDRules', $text)) { |
312
|
0
|
|
|
|
|
0
|
return 1 |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
# String => ' |