| 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 'xml.xml' file of the syntax highlight |
|
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.96 |
|
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::XML; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
50
|
|
|
18
|
1
|
|
|
1
|
|
36
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
19
|
1
|
|
|
1
|
|
5
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1554
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
2
|
|
|
2
|
0
|
759
|
my $proto = shift; |
|
23
|
2
|
|
33
|
|
|
12
|
my $class = ref($proto) || $proto; |
|
24
|
2
|
|
|
|
|
16
|
my $self = $class->SUPER::new(@_); |
|
25
|
2
|
|
|
|
|
24
|
$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
|
2
|
|
|
|
|
65
|
$self->contextdata({ |
|
39
|
|
|
|
|
|
|
'Attribute' => { |
|
40
|
|
|
|
|
|
|
callback => \&parseAttribute, |
|
41
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
42
|
|
|
|
|
|
|
}, |
|
43
|
|
|
|
|
|
|
'CDATA' => { |
|
44
|
|
|
|
|
|
|
callback => \&parseCDATA, |
|
45
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
46
|
|
|
|
|
|
|
}, |
|
47
|
|
|
|
|
|
|
'Comment' => { |
|
48
|
|
|
|
|
|
|
callback => \&parseComment, |
|
49
|
|
|
|
|
|
|
attribute => 'Comment', |
|
50
|
|
|
|
|
|
|
}, |
|
51
|
|
|
|
|
|
|
'Doctype' => { |
|
52
|
|
|
|
|
|
|
callback => \&parseDoctype, |
|
53
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
54
|
|
|
|
|
|
|
}, |
|
55
|
|
|
|
|
|
|
'Doctype Internal Subset' => { |
|
56
|
|
|
|
|
|
|
callback => \&parseDoctypeInternalSubset, |
|
57
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
58
|
|
|
|
|
|
|
}, |
|
59
|
|
|
|
|
|
|
'Doctype Markupdecl' => { |
|
60
|
|
|
|
|
|
|
callback => \&parseDoctypeMarkupdecl, |
|
61
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
62
|
|
|
|
|
|
|
}, |
|
63
|
|
|
|
|
|
|
'Doctype Markupdecl DQ' => { |
|
64
|
|
|
|
|
|
|
callback => \&parseDoctypeMarkupdeclDQ, |
|
65
|
|
|
|
|
|
|
attribute => 'Value', |
|
66
|
|
|
|
|
|
|
}, |
|
67
|
|
|
|
|
|
|
'Doctype Markupdecl SQ' => { |
|
68
|
|
|
|
|
|
|
callback => \&parseDoctypeMarkupdeclSQ, |
|
69
|
|
|
|
|
|
|
attribute => 'Value', |
|
70
|
|
|
|
|
|
|
}, |
|
71
|
|
|
|
|
|
|
'El Content' => { |
|
72
|
|
|
|
|
|
|
callback => \&parseElContent, |
|
73
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
'El End' => { |
|
76
|
|
|
|
|
|
|
callback => \&parseElEnd, |
|
77
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
78
|
|
|
|
|
|
|
}, |
|
79
|
|
|
|
|
|
|
'Element' => { |
|
80
|
|
|
|
|
|
|
callback => \&parseElement, |
|
81
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
82
|
|
|
|
|
|
|
}, |
|
83
|
|
|
|
|
|
|
'FindEntityRefs' => { |
|
84
|
|
|
|
|
|
|
callback => \&parseFindEntityRefs, |
|
85
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
86
|
|
|
|
|
|
|
}, |
|
87
|
|
|
|
|
|
|
'FindPEntityRefs' => { |
|
88
|
|
|
|
|
|
|
callback => \&parseFindPEntityRefs, |
|
89
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
90
|
|
|
|
|
|
|
}, |
|
91
|
|
|
|
|
|
|
'FindXML' => { |
|
92
|
|
|
|
|
|
|
callback => \&parseFindXML, |
|
93
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
94
|
|
|
|
|
|
|
}, |
|
95
|
|
|
|
|
|
|
'PI' => { |
|
96
|
|
|
|
|
|
|
callback => \&parsePI, |
|
97
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
98
|
|
|
|
|
|
|
}, |
|
99
|
|
|
|
|
|
|
'Start' => { |
|
100
|
|
|
|
|
|
|
callback => \&parseStart, |
|
101
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
102
|
|
|
|
|
|
|
}, |
|
103
|
|
|
|
|
|
|
'Value' => { |
|
104
|
|
|
|
|
|
|
callback => \&parseValue, |
|
105
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
106
|
|
|
|
|
|
|
}, |
|
107
|
|
|
|
|
|
|
'Value DQ' => { |
|
108
|
|
|
|
|
|
|
callback => \&parseValueDQ, |
|
109
|
|
|
|
|
|
|
attribute => 'Value', |
|
110
|
|
|
|
|
|
|
}, |
|
111
|
|
|
|
|
|
|
'Value SQ' => { |
|
112
|
|
|
|
|
|
|
callback => \&parseValueSQ, |
|
113
|
|
|
|
|
|
|
attribute => 'Value', |
|
114
|
|
|
|
|
|
|
}, |
|
115
|
|
|
|
|
|
|
}); |
|
116
|
2
|
|
|
|
|
12
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
|
117
|
2
|
|
|
|
|
10
|
$self->basecontext('Start'); |
|
118
|
2
|
|
|
|
|
8
|
$self->keywordscase(1); |
|
119
|
2
|
|
|
|
|
7
|
$self->initialize; |
|
120
|
2
|
|
|
|
|
4
|
bless ($self, $class); |
|
121
|
2
|
|
|
|
|
10
|
return $self; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub language { |
|
125
|
0
|
|
|
0
|
0
|
0
|
return 'XML'; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub parseAttribute { |
|
129
|
26
|
|
|
26
|
0
|
65
|
my ($self, $text) = @_; |
|
130
|
|
|
|
|
|
|
# attribute => 'Attribute' |
|
131
|
|
|
|
|
|
|
# char => '=' |
|
132
|
|
|
|
|
|
|
# context => 'Value' |
|
133
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
134
|
26
|
100
|
|
|
|
89
|
if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) { |
|
135
|
20
|
|
|
|
|
60
|
return 1 |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
# String => '\S' |
|
138
|
|
|
|
|
|
|
# attribute => 'Error' |
|
139
|
|
|
|
|
|
|
# context => '#stay' |
|
140
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
141
|
6
|
50
|
|
|
|
22
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
|
142
|
0
|
|
|
|
|
0
|
return 1 |
|
143
|
|
|
|
|
|
|
} |
|
144
|
6
|
|
|
|
|
15
|
return 0; |
|
145
|
|
|
|
|
|
|
}; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub parseCDATA { |
|
148
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
|
149
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
|
150
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
|
151
|
0
|
|
|
|
|
0
|
return 1 |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
# type => 'DetectIdentifier' |
|
154
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
|
155
|
0
|
|
|
|
|
0
|
return 1 |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
# String => ']]>' |
|
158
|
|
|
|
|
|
|
# attribute => 'CDATA' |
|
159
|
|
|
|
|
|
|
# context => '#pop' |
|
160
|
|
|
|
|
|
|
# endRegion => 'cdata' |
|
161
|
|
|
|
|
|
|
# type => 'StringDetect' |
|
162
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) { |
|
163
|
0
|
|
|
|
|
0
|
return 1 |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
# String => ']]>' |
|
166
|
|
|
|
|
|
|
# attribute => 'EntityRef' |
|
167
|
|
|
|
|
|
|
# context => '#stay' |
|
168
|
|
|
|
|
|
|
# type => 'StringDetect' |
|
169
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { |
|
170
|
0
|
|
|
|
|
0
|
return 1 |
|
171
|
|
|
|
|
|
|
} |
|
172
|
0
|
|
|
|
|
0
|
return 0; |
|
173
|
|
|
|
|
|
|
}; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub parseComment { |
|
176
|
144
|
|
|
144
|
0
|
283
|
my ($self, $text) = @_; |
|
177
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
|
178
|
144
|
100
|
|
|
|
380
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
|
179
|
8
|
|
|
|
|
25
|
return 1 |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
# String => '-->' |
|
182
|
|
|
|
|
|
|
# attribute => 'Comment' |
|
183
|
|
|
|
|
|
|
# context => '#pop' |
|
184
|
|
|
|
|
|
|
# endRegion => 'comment' |
|
185
|
|
|
|
|
|
|
# type => 'StringDetect' |
|
186
|
136
|
100
|
|
|
|
425
|
if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
|
187
|
10
|
|
|
|
|
39
|
return 1 |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
# String => '-(-(?!->))+' |
|
190
|
|
|
|
|
|
|
# attribute => 'Error' |
|
191
|
|
|
|
|
|
|
# context => '#stay' |
|
192
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
193
|
126
|
50
|
|
|
|
365
|
if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) { |
|
194
|
0
|
|
|
|
|
0
|
return 1 |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
# context => '##Alerts' |
|
197
|
|
|
|
|
|
|
# type => 'IncludeRules' |
|
198
|
126
|
50
|
|
|
|
409
|
if ($self->includePlugin('Alerts', $text)) { |
|
199
|
0
|
|
|
|
|
0
|
return 1 |
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
# type => 'DetectIdentifier' |
|
202
|
126
|
100
|
|
|
|
420
|
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
|
203
|
48
|
|
|
|
|
138
|
return 1 |
|
204
|
|
|
|
|
|
|
} |
|
205
|
78
|
|
|
|
|
174
|
return 0; |
|
206
|
|
|
|
|
|
|
}; |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub parseDoctype { |
|
209
|
180
|
|
|
180
|
0
|
289
|
my ($self, $text) = @_; |
|
210
|
|
|
|
|
|
|
# attribute => 'Doctype' |
|
211
|
|
|
|
|
|
|
# char => '>' |
|
212
|
|
|
|
|
|
|
# context => '#pop' |
|
213
|
|
|
|
|
|
|
# endRegion => 'doctype' |
|
214
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
215
|
180
|
100
|
|
|
|
420
|
if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
|
216
|
4
|
|
|
|
|
18
|
return 1 |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
# attribute => 'Doctype' |
|
219
|
|
|
|
|
|
|
# beginRegion => 'int_subset' |
|
220
|
|
|
|
|
|
|
# char => '[' |
|
221
|
|
|
|
|
|
|
# context => 'Doctype Internal Subset' |
|
222
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
223
|
176
|
50
|
|
|
|
476
|
if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) { |
|
224
|
0
|
|
|
|
|
0
|
return 1 |
|
225
|
|
|
|
|
|
|
} |
|
226
|
176
|
|
|
|
|
349
|
return 0; |
|
227
|
|
|
|
|
|
|
}; |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub parseDoctypeInternalSubset { |
|
230
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
|
231
|
|
|
|
|
|
|
# attribute => 'Doctype' |
|
232
|
|
|
|
|
|
|
# char => ']' |
|
233
|
|
|
|
|
|
|
# context => '#pop' |
|
234
|
|
|
|
|
|
|
# endRegion => 'int_subset' |
|
235
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
236
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { |
|
237
|
0
|
|
|
|
|
0
|
return 1 |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
# String => '
|
|
240
|
|
|
|
|
|
|
# attribute => 'Doctype' |
|
241
|
|
|
|
|
|
|
# context => 'Doctype Markupdecl' |
|
242
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
243
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '
|
|
244
|
0
|
|
|
|
|
0
|
return 1 |
|
245
|
|
|
|
|
|
|
} |
|
246
|
|
|
|
|
|
|
# String => ' |