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 'python.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.23 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Per Wigren |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Python; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
599
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
19
|
1
|
|
|
1
|
|
6
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1258
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
623
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
10
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
15
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
25
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Builtin Function' => 'DataType', |
27
|
|
|
|
|
|
|
'Comment' => 'Comment', |
28
|
|
|
|
|
|
|
'Complex' => 'Others', |
29
|
|
|
|
|
|
|
'Float' => 'Float', |
30
|
|
|
|
|
|
|
'Hex' => 'Others', |
31
|
|
|
|
|
|
|
'Int' => 'DecVal', |
32
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
33
|
|
|
|
|
|
|
'Long' => 'Others', |
34
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
35
|
|
|
|
|
|
|
'Octal' => 'Others', |
36
|
|
|
|
|
|
|
'Operator' => 'Char', |
37
|
|
|
|
|
|
|
'Preprocessor' => 'Char', |
38
|
|
|
|
|
|
|
'Raw String' => 'String', |
39
|
|
|
|
|
|
|
'Special Variable' => 'Others', |
40
|
|
|
|
|
|
|
'String' => 'String', |
41
|
|
|
|
|
|
|
}); |
42
|
2
|
|
|
|
|
13
|
$self->listAdd('builtinfuncs', |
43
|
|
|
|
|
|
|
'abs', |
44
|
|
|
|
|
|
|
'apply', |
45
|
|
|
|
|
|
|
'buffer', |
46
|
|
|
|
|
|
|
'callable', |
47
|
|
|
|
|
|
|
'chr', |
48
|
|
|
|
|
|
|
'cmp', |
49
|
|
|
|
|
|
|
'coerce', |
50
|
|
|
|
|
|
|
'compile', |
51
|
|
|
|
|
|
|
'complex', |
52
|
|
|
|
|
|
|
'copyright', |
53
|
|
|
|
|
|
|
'credits', |
54
|
|
|
|
|
|
|
'delattr', |
55
|
|
|
|
|
|
|
'dir', |
56
|
|
|
|
|
|
|
'divmod', |
57
|
|
|
|
|
|
|
'eval', |
58
|
|
|
|
|
|
|
'execfile', |
59
|
|
|
|
|
|
|
'exit', |
60
|
|
|
|
|
|
|
'filter', |
61
|
|
|
|
|
|
|
'float', |
62
|
|
|
|
|
|
|
'getattr', |
63
|
|
|
|
|
|
|
'globals', |
64
|
|
|
|
|
|
|
'hasattr', |
65
|
|
|
|
|
|
|
'hash', |
66
|
|
|
|
|
|
|
'hex', |
67
|
|
|
|
|
|
|
'id', |
68
|
|
|
|
|
|
|
'input', |
69
|
|
|
|
|
|
|
'int', |
70
|
|
|
|
|
|
|
'intern', |
71
|
|
|
|
|
|
|
'isinstance', |
72
|
|
|
|
|
|
|
'issubclass', |
73
|
|
|
|
|
|
|
'iter', |
74
|
|
|
|
|
|
|
'len', |
75
|
|
|
|
|
|
|
'license', |
76
|
|
|
|
|
|
|
'list', |
77
|
|
|
|
|
|
|
'locals', |
78
|
|
|
|
|
|
|
'long', |
79
|
|
|
|
|
|
|
'map', |
80
|
|
|
|
|
|
|
'max', |
81
|
|
|
|
|
|
|
'min', |
82
|
|
|
|
|
|
|
'oct', |
83
|
|
|
|
|
|
|
'open', |
84
|
|
|
|
|
|
|
'ord', |
85
|
|
|
|
|
|
|
'pow', |
86
|
|
|
|
|
|
|
'quit', |
87
|
|
|
|
|
|
|
'range', |
88
|
|
|
|
|
|
|
'raw_input', |
89
|
|
|
|
|
|
|
'reduce', |
90
|
|
|
|
|
|
|
'reload', |
91
|
|
|
|
|
|
|
'repr', |
92
|
|
|
|
|
|
|
'round', |
93
|
|
|
|
|
|
|
'setattr', |
94
|
|
|
|
|
|
|
'slice', |
95
|
|
|
|
|
|
|
'str', |
96
|
|
|
|
|
|
|
'tuple', |
97
|
|
|
|
|
|
|
'type', |
98
|
|
|
|
|
|
|
'unichr', |
99
|
|
|
|
|
|
|
'unicode', |
100
|
|
|
|
|
|
|
'vars', |
101
|
|
|
|
|
|
|
'xrange', |
102
|
|
|
|
|
|
|
'zip', |
103
|
|
|
|
|
|
|
); |
104
|
2
|
|
|
|
|
8
|
$self->listAdd('prep', |
105
|
|
|
|
|
|
|
'as', |
106
|
|
|
|
|
|
|
'from', |
107
|
|
|
|
|
|
|
'import', |
108
|
|
|
|
|
|
|
); |
109
|
2
|
|
|
|
|
7
|
$self->listAdd('specialvars', |
110
|
|
|
|
|
|
|
'Ellipsis', |
111
|
|
|
|
|
|
|
'False', |
112
|
|
|
|
|
|
|
'None', |
113
|
|
|
|
|
|
|
'NotImplemented', |
114
|
|
|
|
|
|
|
'True', |
115
|
|
|
|
|
|
|
'self', |
116
|
|
|
|
|
|
|
); |
117
|
2
|
|
|
|
|
7
|
$self->listAdd('statements', |
118
|
|
|
|
|
|
|
'and', |
119
|
|
|
|
|
|
|
'assert', |
120
|
|
|
|
|
|
|
'break', |
121
|
|
|
|
|
|
|
'class', |
122
|
|
|
|
|
|
|
'continue', |
123
|
|
|
|
|
|
|
'def', |
124
|
|
|
|
|
|
|
'del', |
125
|
|
|
|
|
|
|
'elif', |
126
|
|
|
|
|
|
|
'else', |
127
|
|
|
|
|
|
|
'except', |
128
|
|
|
|
|
|
|
'exec', |
129
|
|
|
|
|
|
|
'finally', |
130
|
|
|
|
|
|
|
'for', |
131
|
|
|
|
|
|
|
'global', |
132
|
|
|
|
|
|
|
'if', |
133
|
|
|
|
|
|
|
'in', |
134
|
|
|
|
|
|
|
'is', |
135
|
|
|
|
|
|
|
'lambda', |
136
|
|
|
|
|
|
|
'not', |
137
|
|
|
|
|
|
|
'or', |
138
|
|
|
|
|
|
|
'pass', |
139
|
|
|
|
|
|
|
'print', |
140
|
|
|
|
|
|
|
'raise', |
141
|
|
|
|
|
|
|
'return', |
142
|
|
|
|
|
|
|
'try', |
143
|
|
|
|
|
|
|
'while', |
144
|
|
|
|
|
|
|
'yield', |
145
|
|
|
|
|
|
|
); |
146
|
2
|
|
|
|
|
31
|
$self->contextdata({ |
147
|
|
|
|
|
|
|
'Normal' => { |
148
|
|
|
|
|
|
|
callback => \&parseNormal, |
149
|
|
|
|
|
|
|
attribute => 'Normal Text', |
150
|
|
|
|
|
|
|
}, |
151
|
|
|
|
|
|
|
'Raw A-string' => { |
152
|
|
|
|
|
|
|
callback => \&parseRawAstring, |
153
|
|
|
|
|
|
|
attribute => 'Raw String', |
154
|
|
|
|
|
|
|
}, |
155
|
|
|
|
|
|
|
'Raw Q-string' => { |
156
|
|
|
|
|
|
|
callback => \&parseRawQstring, |
157
|
|
|
|
|
|
|
attribute => 'Raw String', |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
'Single A-comment' => { |
160
|
|
|
|
|
|
|
callback => \&parseSingleAcomment, |
161
|
|
|
|
|
|
|
attribute => 'Comment', |
162
|
|
|
|
|
|
|
}, |
163
|
|
|
|
|
|
|
'Single A-string' => { |
164
|
|
|
|
|
|
|
callback => \&parseSingleAstring, |
165
|
|
|
|
|
|
|
attribute => 'String', |
166
|
|
|
|
|
|
|
}, |
167
|
|
|
|
|
|
|
'Single Q-comment' => { |
168
|
|
|
|
|
|
|
callback => \&parseSingleQcomment, |
169
|
|
|
|
|
|
|
attribute => 'Comment', |
170
|
|
|
|
|
|
|
}, |
171
|
|
|
|
|
|
|
'Single Q-string' => { |
172
|
|
|
|
|
|
|
callback => \&parseSingleQstring, |
173
|
|
|
|
|
|
|
attribute => 'String', |
174
|
|
|
|
|
|
|
}, |
175
|
|
|
|
|
|
|
'Tripple A-comment' => { |
176
|
|
|
|
|
|
|
callback => \&parseTrippleAcomment, |
177
|
|
|
|
|
|
|
attribute => 'Comment', |
178
|
|
|
|
|
|
|
}, |
179
|
|
|
|
|
|
|
'Tripple A-string' => { |
180
|
|
|
|
|
|
|
callback => \&parseTrippleAstring, |
181
|
|
|
|
|
|
|
attribute => 'String', |
182
|
|
|
|
|
|
|
}, |
183
|
|
|
|
|
|
|
'Tripple Q-comment' => { |
184
|
|
|
|
|
|
|
callback => \&parseTrippleQcomment, |
185
|
|
|
|
|
|
|
attribute => 'Comment', |
186
|
|
|
|
|
|
|
}, |
187
|
|
|
|
|
|
|
'Tripple Q-string' => { |
188
|
|
|
|
|
|
|
callback => \&parseTrippleQstring, |
189
|
|
|
|
|
|
|
attribute => 'String', |
190
|
|
|
|
|
|
|
}, |
191
|
|
|
|
|
|
|
}); |
192
|
2
|
|
|
|
|
9
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
193
|
2
|
|
|
|
|
6
|
$self->basecontext('Normal'); |
194
|
2
|
|
|
|
|
8
|
$self->keywordscase(0); |
195
|
2
|
|
|
|
|
5
|
$self->initialize; |
196
|
2
|
|
|
|
|
4
|
bless ($self, $class); |
197
|
2
|
|
|
|
|
15
|
return $self; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub language { |
201
|
0
|
|
|
0
|
0
|
0
|
return 'Python'; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub parseNormal { |
205
|
2764
|
|
|
2764
|
0
|
4958
|
my ($self, $text) = @_; |
206
|
|
|
|
|
|
|
# String => 'prep' |
207
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
208
|
|
|
|
|
|
|
# context => '#stay' |
209
|
|
|
|
|
|
|
# type => 'keyword' |
210
|
2764
|
100
|
|
|
|
7938
|
if ($self->testKeyword($text, 'prep', 0, undef, 0, '#stay', 'Preprocessor')) { |
211
|
15
|
|
|
|
|
49
|
return 1 |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
# String => 'statements' |
214
|
|
|
|
|
|
|
# attribute => 'Keyword' |
215
|
|
|
|
|
|
|
# context => '#stay' |
216
|
|
|
|
|
|
|
# type => 'keyword' |
217
|
2749
|
100
|
|
|
|
7347
|
if ($self->testKeyword($text, 'statements', 0, undef, 0, '#stay', 'Keyword')) { |
218
|
82
|
|
|
|
|
217
|
return 1 |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
# String => 'builtinfuncs' |
221
|
|
|
|
|
|
|
# attribute => 'Builtin Function' |
222
|
|
|
|
|
|
|
# context => '#stay' |
223
|
|
|
|
|
|
|
# type => 'keyword' |
224
|
2667
|
100
|
|
|
|
7034
|
if ($self->testKeyword($text, 'builtinfuncs', 0, undef, 0, '#stay', 'Builtin Function')) { |
225
|
2
|
|
|
|
|
7
|
return 1 |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
# String => 'specialvars' |
228
|
|
|
|
|
|
|
# attribute => 'Special Variable' |
229
|
|
|
|
|
|
|
# context => '#stay' |
230
|
|
|
|
|
|
|
# type => 'keyword' |
231
|
2665
|
100
|
|
|
|
7089
|
if ($self->testKeyword($text, 'specialvars', 0, undef, 0, '#stay', 'Special Variable')) { |
232
|
38
|
|
|
|
|
96
|
return 1 |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
# String => '[a-zA-Z_]\w+' |
235
|
|
|
|
|
|
|
# attribute => 'Normal' |
236
|
|
|
|
|
|
|
# context => '#stay' |
237
|
|
|
|
|
|
|
# type => 'RegExpr' |
238
|
2627
|
100
|
|
|
|
7850
|
if ($self->testRegExpr($text, '[a-zA-Z_]\\w+', 0, 0, 0, undef, 0, '#stay', 'Normal')) { |
239
|
473
|
|
|
|
|
1209
|
return 1 |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
# String => ' (((\d*\.\d+|\d+\.)|(\d+|(\d*\.\d+|\d+\.))[eE][+-]?\d+)|\d+)[jJ]' |
242
|
|
|
|
|
|
|
# attribute => 'Complex' |
243
|
|
|
|
|
|
|
# context => '#stay' |
244
|
|
|
|
|
|
|
# type => 'RegExpr' |
245
|
2154
|
50
|
|
|
|
6413
|
if ($self->testRegExpr($text, ' (((\\d*\\.\\d+|\\d+\\.)|(\\d+|(\\d*\\.\\d+|\\d+\\.))[eE][+-]?\\d+)|\\d+)[jJ]', 0, 0, 0, undef, 0, '#stay', 'Complex')) { |
246
|
0
|
|
|
|
|
0
|
return 1 |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
# String => '(\d+\.\d*|\.\d+)([eE]\d+)?' |
249
|
|
|
|
|
|
|
# attribute => 'Float' |
250
|
|
|
|
|
|
|
# context => '#stay' |
251
|
|
|
|
|
|
|
# type => 'RegExpr' |
252
|
2154
|
50
|
|
|
|
6114
|
if ($self->testRegExpr($text, '(\\d+\\.\\d*|\\.\\d+)([eE]\\d+)?', 0, 0, 0, undef, 0, '#stay', 'Float')) { |
253
|
0
|
|
|
|
|
0
|
return 1 |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
# String => '([1-9]\d*([eE]\d+)?|0)' |
256
|
|
|
|
|
|
|
# attribute => 'Int' |
257
|
|
|
|
|
|
|
# context => '#stay' |
258
|
|
|
|
|
|
|
# type => 'RegExpr' |
259
|
2154
|
100
|
|
|
|
6210
|
if ($self->testRegExpr($text, '([1-9]\\d*([eE]\\d+)?|0)', 0, 0, 0, undef, 0, '#stay', 'Int')) { |
260
|
12
|
|
|
|
|
43
|
return 1 |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
# String => '[1-9]\d*([eE][\d.]+)?[Ll]' |
263
|
|
|
|
|
|
|
# attribute => 'Long' |
264
|
|
|
|
|
|
|
# context => '#stay' |
265
|
|
|
|
|
|
|
# type => 'RegExpr' |
266
|
2142
|
50
|
|
|
|
5831
|
if ($self->testRegExpr($text, '[1-9]\\d*([eE][\\d.]+)?[Ll]', 0, 0, 0, undef, 0, '#stay', 'Long')) { |
267
|
0
|
|
|
|
|
0
|
return 1 |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
# String => '0[Xx][\da-fA-F]+' |
270
|
|
|
|
|
|
|
# attribute => 'Hex' |
271
|
|
|
|
|
|
|
# context => '#stay' |
272
|
|
|
|
|
|
|
# type => 'RegExpr' |
273
|
2142
|
50
|
|
|
|
6320
|
if ($self->testRegExpr($text, '0[Xx][\\da-fA-F]+', 0, 0, 0, undef, 0, '#stay', 'Hex')) { |
274
|
0
|
|
|
|
|
0
|
return 1 |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
# String => '0[1-9]\d*' |
277
|
|
|
|
|
|
|
# attribute => 'Octal' |
278
|
|
|
|
|
|
|
# context => '#stay' |
279
|
|
|
|
|
|
|
# type => 'RegExpr' |
280
|
2142
|
50
|
|
|
|
5889
|
if ($self->testRegExpr($text, '0[1-9]\\d*', 0, 0, 0, undef, 0, '#stay', 'Octal')) { |
281
|
0
|
|
|
|
|
0
|
return 1 |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
# String => '[rR]'' |
284
|
|
|
|
|
|
|
# attribute => 'Raw String' |
285
|
|
|
|
|
|
|
# context => 'Raw A-string' |
286
|
|
|
|
|
|
|
# type => 'RegExpr' |
287
|
2142
|
50
|
|
|
|
5895
|
if ($self->testRegExpr($text, '[rR]\'', 0, 0, 0, undef, 0, 'Raw A-string', 'Raw String')) { |
288
|
0
|
|
|
|
|
0
|
return 1 |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
# String => '[rR]"' |
291
|
|
|
|
|
|
|
# attribute => 'Raw String' |
292
|
|
|
|
|
|
|
# context => 'Raw Q-string' |
293
|
|
|
|
|
|
|
# type => 'RegExpr' |
294
|
2142
|
50
|
|
|
|
5782
|
if ($self->testRegExpr($text, '[rR]"', 0, 0, 0, undef, 0, 'Raw Q-string', 'Raw String')) { |
295
|
0
|
|
|
|
|
0
|
return 1 |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
# String => '#.*$' |
298
|
|
|
|
|
|
|
# attribute => 'Comment' |
299
|
|
|
|
|
|
|
# context => '#stay' |
300
|
|
|
|
|
|
|
# type => 'RegExpr' |
301
|
2142
|
50
|
|
|
|
5703
|
if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { |
302
|
0
|
|
|
|
|
0
|
return 1 |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
# String => ''''' |
305
|
|
|
|
|
|
|
# attribute => 'Comment' |
306
|
|
|
|
|
|
|
# context => 'Tripple A-comment' |
307
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
308
|
|
|
|
|
|
|
# type => 'StringDetect' |
309
|
2142
|
50
|
|
|
|
5717
|
if ($self->testStringDetect($text, '\'\'\'', 0, 0, 0, undef, 1, 'Tripple A-comment', 'Comment')) { |
310
|
0
|
|
|
|
|
0
|
return 1 |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
# String => '"""' |
313
|
|
|
|
|
|
|
# attribute => 'Comment' |
314
|
|
|
|
|
|
|
# context => 'Tripple Q-comment' |
315
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
316
|
|
|
|
|
|
|
# type => 'StringDetect' |
317
|
2142
|
50
|
|
|
|
5253
|
if ($self->testStringDetect($text, '"""', 0, 0, 0, undef, 1, 'Tripple Q-comment', 'Comment')) { |
318
|
0
|
|
|
|
|
0
|
return 1 |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
# String => ''''' |
321
|
|
|
|
|
|
|
# attribute => 'String' |
322
|
|
|
|
|
|
|
# context => 'Tripple A-string' |
323
|
|
|
|
|
|
|
# type => 'StringDetect' |
324
|
2142
|
50
|
|
|
|
4788
|
if ($self->testStringDetect($text, '\'\'\'', 0, 0, 0, undef, 0, 'Tripple A-string', 'String')) { |
325
|
0
|
|
|
|
|
0
|
return 1 |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
# String => '"""' |
328
|
|
|
|
|
|
|
# attribute => 'String' |
329
|
|
|
|
|
|
|
# context => 'Tripple Q-string' |
330
|
|
|
|
|
|
|
# type => 'StringDetect' |
331
|
2142
|
100
|
|
|
|
5361
|
if ($self->testStringDetect($text, '"""', 0, 0, 0, undef, 0, 'Tripple Q-string', 'String')) { |
332
|
8
|
|
|
|
|
24
|
return 1 |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
# attribute => 'String' |
335
|
|
|
|
|
|
|
# char => ''' |
336
|
|
|
|
|
|
|
# context => 'Single A-string' |
337
|
|
|
|
|
|
|
# type => 'DetectChar' |
338
|
2134
|
100
|
|
|
|
5280
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Single A-string', 'String')) { |
339
|
14
|
|
|
|
|
53
|
return 1 |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
# attribute => 'String' |
342
|
|
|
|
|
|
|
# char => '"' |
343
|
|
|
|
|
|
|
# context => 'Single Q-string' |
344
|
|
|
|
|
|
|
# type => 'DetectChar' |
345
|
2120
|
100
|
|
|
|
4778
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Single Q-string', 'String')) { |
346
|
80
|
|
|
|
|
247
|
return 1 |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
# String => '[+*/\(\)%\|\[\]\{\}:=;\!<>!^&~-]' |
349
|
|
|
|
|
|
|
# attribute => 'Operator' |
350
|
|
|
|
|
|
|
# context => '#stay' |
351
|
|
|
|
|
|
|
# type => 'RegExpr' |
352
|
2040
|
100
|
|
|
|
5353
|
if ($self->testRegExpr($text, '[+*/\\(\\)%\\|\\[\\]\\{\\}:=;\\!<>!^&~-]', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
353
|
290
|
|
|
|
|
878
|
return 1 |
354
|
|
|
|
|
|
|
} |
355
|
1750
|
|
|
|
|
4319
|
return 0; |
356
|
|
|
|
|
|
|
}; |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub parseRawAstring { |
359
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
360
|
|
|
|
|
|
|
# attribute => 'Raw String' |
361
|
|
|
|
|
|
|
# context => '#stay' |
362
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
363
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'Raw String')) { |
364
|
0
|
|
|
|
|
0
|
return 1 |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
# attribute => 'Raw String' |
367
|
|
|
|
|
|
|
# char => ''' |
368
|
|
|
|
|
|
|
# context => '#pop' |
369
|
|
|
|
|
|
|
# type => 'DetectChar' |
370
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Raw String')) { |
371
|
0
|
|
|
|
|
0
|
return 1 |
372
|
|
|
|
|
|
|
} |
373
|
0
|
|
|
|
|
0
|
return 0; |
374
|
|
|
|
|
|
|
}; |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub parseRawQstring { |
377
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
378
|
|
|
|
|
|
|
# attribute => 'Raw String' |
379
|
|
|
|
|
|
|
# context => '#stay' |
380
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
381
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'Raw String')) { |
382
|
0
|
|
|
|
|
0
|
return 1 |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
# attribute => 'Raw String' |
385
|
|
|
|
|
|
|
# char => '"' |
386
|
|
|
|
|
|
|
# context => '#pop' |
387
|
|
|
|
|
|
|
# type => 'DetectChar' |
388
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Raw String')) { |
389
|
0
|
|
|
|
|
0
|
return 1 |
390
|
|
|
|
|
|
|
} |
391
|
0
|
|
|
|
|
0
|
return 0; |
392
|
|
|
|
|
|
|
}; |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
sub parseSingleAcomment { |
395
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
396
|
|
|
|
|
|
|
# attribute => 'Comment' |
397
|
|
|
|
|
|
|
# context => '#stay' |
398
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
399
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'Comment')) { |
400
|
0
|
|
|
|
|
0
|
return 1 |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
# attribute => 'Comment' |
403
|
|
|
|
|
|
|
# char => ''' |
404
|
|
|
|
|
|
|
# context => '#pop' |
405
|
|
|
|
|
|
|
# type => 'DetectChar' |
406
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
407
|
0
|
|
|
|
|
0
|
return 1 |
408
|
|
|
|
|
|
|
} |
409
|
0
|
|
|
|
|
0
|
return 0; |
410
|
|
|
|
|
|
|
}; |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub parseSingleAstring { |
413
|
192
|
|
|
192
|
0
|
359
|
my ($self, $text) = @_; |
414
|
|
|
|
|
|
|
# attribute => 'String' |
415
|
|
|
|
|
|
|
# context => '#stay' |
416
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
417
|
192
|
100
|
|
|
|
548
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String')) { |
418
|
2
|
|
|
|
|
6
|
return 1 |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
# String => '%[a-zA-Z]' |
421
|
|
|
|
|
|
|
# attribute => 'Operator' |
422
|
|
|
|
|
|
|
# context => '#stay' |
423
|
|
|
|
|
|
|
# type => 'RegExpr' |
424
|
190
|
50
|
|
|
|
542
|
if ($self->testRegExpr($text, '%[a-zA-Z]', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
425
|
0
|
|
|
|
|
0
|
return 1 |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
# attribute => 'String' |
428
|
|
|
|
|
|
|
# char => ''' |
429
|
|
|
|
|
|
|
# context => '#pop' |
430
|
|
|
|
|
|
|
# type => 'DetectChar' |
431
|
190
|
100
|
|
|
|
581
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
432
|
14
|
|
|
|
|
34
|
return 1 |
433
|
|
|
|
|
|
|
} |
434
|
176
|
|
|
|
|
383
|
return 0; |
435
|
|
|
|
|
|
|
}; |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
sub parseSingleQcomment { |
438
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
439
|
|
|
|
|
|
|
# attribute => 'Comment' |
440
|
|
|
|
|
|
|
# context => '#stay' |
441
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
442
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'Comment')) { |
443
|
0
|
|
|
|
|
0
|
return 1 |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
# attribute => 'Comment' |
446
|
|
|
|
|
|
|
# char => '"' |
447
|
|
|
|
|
|
|
# context => '#pop' |
448
|
|
|
|
|
|
|
# type => 'DetectChar' |
449
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
450
|
0
|
|
|
|
|
0
|
return 1 |
451
|
|
|
|
|
|
|
} |
452
|
0
|
|
|
|
|
0
|
return 0; |
453
|
|
|
|
|
|
|
}; |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
sub parseSingleQstring { |
456
|
1318
|
|
|
1318
|
0
|
2304
|
my ($self, $text) = @_; |
457
|
|
|
|
|
|
|
# attribute => 'String' |
458
|
|
|
|
|
|
|
# context => '#stay' |
459
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
460
|
1318
|
100
|
|
|
|
3218
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String')) { |
461
|
4
|
|
|
|
|
8
|
return 1 |
462
|
|
|
|
|
|
|
} |
463
|
|
|
|
|
|
|
# String => '%[a-zA-Z]' |
464
|
|
|
|
|
|
|
# attribute => 'Operator' |
465
|
|
|
|
|
|
|
# context => '#stay' |
466
|
|
|
|
|
|
|
# type => 'RegExpr' |
467
|
1314
|
50
|
|
|
|
3130
|
if ($self->testRegExpr($text, '%[a-zA-Z]', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
468
|
0
|
|
|
|
|
0
|
return 1 |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
# attribute => 'String' |
471
|
|
|
|
|
|
|
# char => '"' |
472
|
|
|
|
|
|
|
# context => '#pop' |
473
|
|
|
|
|
|
|
# type => 'DetectChar' |
474
|
1314
|
100
|
|
|
|
3485
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
475
|
80
|
|
|
|
|
251
|
return 1 |
476
|
|
|
|
|
|
|
} |
477
|
1234
|
|
|
|
|
2408
|
return 0; |
478
|
|
|
|
|
|
|
}; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
sub parseTrippleAcomment { |
481
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
482
|
|
|
|
|
|
|
# attribute => 'Comment' |
483
|
|
|
|
|
|
|
# context => '#stay' |
484
|
|
|
|
|
|
|
# type => 'HlCChar' |
485
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Comment')) { |
486
|
0
|
|
|
|
|
0
|
return 1 |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
# String => ''''' |
489
|
|
|
|
|
|
|
# attribute => 'Comment' |
490
|
|
|
|
|
|
|
# context => '#pop' |
491
|
|
|
|
|
|
|
# type => 'StringDetect' |
492
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, '\'\'\'', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
493
|
0
|
|
|
|
|
0
|
return 1 |
494
|
|
|
|
|
|
|
} |
495
|
0
|
|
|
|
|
0
|
return 0; |
496
|
|
|
|
|
|
|
}; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
sub parseTrippleAstring { |
499
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
500
|
|
|
|
|
|
|
# attribute => 'String' |
501
|
|
|
|
|
|
|
# context => '#stay' |
502
|
|
|
|
|
|
|
# type => 'HlCChar' |
503
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'String')) { |
504
|
0
|
|
|
|
|
0
|
return 1 |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
# String => '%[a-zA-Z]' |
507
|
|
|
|
|
|
|
# attribute => 'Operator' |
508
|
|
|
|
|
|
|
# context => '#stay' |
509
|
|
|
|
|
|
|
# type => 'RegExpr' |
510
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '%[a-zA-Z]', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
511
|
0
|
|
|
|
|
0
|
return 1 |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
# String => ''''' |
514
|
|
|
|
|
|
|
# attribute => 'String' |
515
|
|
|
|
|
|
|
# context => '#pop' |
516
|
|
|
|
|
|
|
# type => 'StringDetect' |
517
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, '\'\'\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
518
|
0
|
|
|
|
|
0
|
return 1 |
519
|
|
|
|
|
|
|
} |
520
|
0
|
|
|
|
|
0
|
return 0; |
521
|
|
|
|
|
|
|
}; |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
sub parseTrippleQcomment { |
524
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
525
|
|
|
|
|
|
|
# attribute => 'Comment' |
526
|
|
|
|
|
|
|
# context => '#stay' |
527
|
|
|
|
|
|
|
# type => 'HlCChar' |
528
|
0
|
0
|
|
|
|
0
|
if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Comment')) { |
529
|
0
|
|
|
|
|
0
|
return 1 |
530
|
|
|
|
|
|
|
} |
531
|
|
|
|
|
|
|
# String => '"""' |
532
|
|
|
|
|
|
|
# attribute => 'Comment' |
533
|
|
|
|
|
|
|
# context => '#pop' |
534
|
|
|
|
|
|
|
# type => 'StringDetect' |
535
|
0
|
0
|
|
|
|
0
|
if ($self->testStringDetect($text, '"""', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
536
|
0
|
|
|
|
|
0
|
return 1 |
537
|
|
|
|
|
|
|
} |
538
|
0
|
|
|
|
|
0
|
return 0; |
539
|
|
|
|
|
|
|
}; |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
sub parseTrippleQstring { |
542
|
738
|
|
|
738
|
0
|
1239
|
my ($self, $text) = @_; |
543
|
|
|
|
|
|
|
# attribute => 'String' |
544
|
|
|
|
|
|
|
# context => '#stay' |
545
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
546
|
738
|
50
|
|
|
|
1622
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String')) { |
547
|
0
|
|
|
|
|
0
|
return 1 |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
# String => '%[a-zA-Z]' |
550
|
|
|
|
|
|
|
# attribute => 'Operator' |
551
|
|
|
|
|
|
|
# context => '#stay' |
552
|
|
|
|
|
|
|
# type => 'RegExpr' |
553
|
738
|
50
|
|
|
|
1744
|
if ($self->testRegExpr($text, '%[a-zA-Z]', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
554
|
0
|
|
|
|
|
0
|
return 1 |
555
|
|
|
|
|
|
|
} |
556
|
|
|
|
|
|
|
# String => '"""' |
557
|
|
|
|
|
|
|
# attribute => 'String' |
558
|
|
|
|
|
|
|
# context => '#pop' |
559
|
|
|
|
|
|
|
# type => 'StringDetect' |
560
|
738
|
100
|
|
|
|
1644
|
if ($self->testStringDetect($text, '"""', 0, 0, 0, undef, 0, '#pop', 'String')) { |
561
|
8
|
|
|
|
|
28
|
return 1 |
562
|
|
|
|
|
|
|
} |
563
|
730
|
|
|
|
|
1248
|
return 0; |
564
|
|
|
|
|
|
|
}; |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
1; |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
__END__ |