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 'pike.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.07 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Paul Pogonyshev |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Pike; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
647
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
19
|
1
|
|
|
1
|
|
5
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1080
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
572
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
10
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
11
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
25
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Binary' => 'BaseN', |
27
|
|
|
|
|
|
|
'Builtin Function' => 'Function', |
28
|
|
|
|
|
|
|
'Char' => 'Char', |
29
|
|
|
|
|
|
|
'Comment' => 'Comment', |
30
|
|
|
|
|
|
|
'Data Type' => 'DataType', |
31
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
32
|
|
|
|
|
|
|
'Float' => 'Float', |
33
|
|
|
|
|
|
|
'Hex' => 'BaseN', |
34
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
35
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
36
|
|
|
|
|
|
|
'Note' => 'Alert', |
37
|
|
|
|
|
|
|
'Octal' => 'BaseN', |
38
|
|
|
|
|
|
|
'Preprocessor' => 'Others', |
39
|
|
|
|
|
|
|
'Preprocessor Lib' => 'String', |
40
|
|
|
|
|
|
|
'String' => 'String', |
41
|
|
|
|
|
|
|
'String Char' => 'Char', |
42
|
|
|
|
|
|
|
}); |
43
|
2
|
|
|
|
|
10
|
$self->listAdd('builtins', |
44
|
|
|
|
|
|
|
'catch', |
45
|
|
|
|
|
|
|
'gauge', |
46
|
|
|
|
|
|
|
'sscanf', |
47
|
|
|
|
|
|
|
'typeof', |
48
|
|
|
|
|
|
|
); |
49
|
2
|
|
|
|
|
7
|
$self->listAdd('keywords', |
50
|
|
|
|
|
|
|
'break', |
51
|
|
|
|
|
|
|
'case', |
52
|
|
|
|
|
|
|
'class', |
53
|
|
|
|
|
|
|
'continue', |
54
|
|
|
|
|
|
|
'default', |
55
|
|
|
|
|
|
|
'do', |
56
|
|
|
|
|
|
|
'else', |
57
|
|
|
|
|
|
|
'for', |
58
|
|
|
|
|
|
|
'foreach', |
59
|
|
|
|
|
|
|
'if', |
60
|
|
|
|
|
|
|
'return', |
61
|
|
|
|
|
|
|
'switch', |
62
|
|
|
|
|
|
|
'while', |
63
|
|
|
|
|
|
|
); |
64
|
2
|
|
|
|
|
6
|
$self->listAdd('types', |
65
|
|
|
|
|
|
|
'array', |
66
|
|
|
|
|
|
|
'float', |
67
|
|
|
|
|
|
|
'function', |
68
|
|
|
|
|
|
|
'int', |
69
|
|
|
|
|
|
|
'mapping', |
70
|
|
|
|
|
|
|
'mixed', |
71
|
|
|
|
|
|
|
'multiset>', |
72
|
|
|
|
|
|
|
'object', |
73
|
|
|
|
|
|
|
'program', |
74
|
|
|
|
|
|
|
'static', |
75
|
|
|
|
|
|
|
'string', |
76
|
|
|
|
|
|
|
'void', |
77
|
|
|
|
|
|
|
); |
78
|
2
|
|
|
|
|
28
|
$self->contextdata({ |
79
|
|
|
|
|
|
|
'Block Comment' => { |
80
|
|
|
|
|
|
|
callback => \&parseBlockComment, |
81
|
|
|
|
|
|
|
attribute => 'Comment', |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
'Line Comment' => { |
84
|
|
|
|
|
|
|
callback => \&parseLineComment, |
85
|
|
|
|
|
|
|
attribute => 'Comment', |
86
|
|
|
|
|
|
|
lineending => '#pop', |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
'Normal' => { |
89
|
|
|
|
|
|
|
callback => \&parseNormal, |
90
|
|
|
|
|
|
|
attribute => 'Normal Text', |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
'Outscoped' => { |
93
|
|
|
|
|
|
|
callback => \&parseOutscoped, |
94
|
|
|
|
|
|
|
attribute => 'Comment', |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
'Outscoped intern' => { |
97
|
|
|
|
|
|
|
callback => \&parseOutscopedintern, |
98
|
|
|
|
|
|
|
attribute => 'Comment', |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
'Preprocessor' => { |
101
|
|
|
|
|
|
|
callback => \&parsePreprocessor, |
102
|
|
|
|
|
|
|
attribute => 'Preprocessor', |
103
|
|
|
|
|
|
|
lineending => '#pop', |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
'String' => { |
106
|
|
|
|
|
|
|
callback => \&parseString, |
107
|
|
|
|
|
|
|
attribute => 'String', |
108
|
|
|
|
|
|
|
lineending => '#pop', |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
}); |
111
|
2
|
|
|
|
|
9
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
112
|
2
|
|
|
|
|
8
|
$self->basecontext('Normal'); |
113
|
2
|
|
|
|
|
8
|
$self->keywordscase(0); |
114
|
2
|
|
|
|
|
5
|
$self->initialize; |
115
|
2
|
|
|
|
|
3
|
bless ($self, $class); |
116
|
2
|
|
|
|
|
11
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub language { |
120
|
0
|
|
|
0
|
0
|
0
|
return 'Pike'; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub parseBlockComment { |
124
|
286
|
|
|
286
|
0
|
426
|
my ($self, $text) = @_; |
125
|
|
|
|
|
|
|
# attribute => 'Comment' |
126
|
|
|
|
|
|
|
# char => '*' |
127
|
|
|
|
|
|
|
# char1 => '/' |
128
|
|
|
|
|
|
|
# context => '#pop' |
129
|
|
|
|
|
|
|
# endRegion => 'Comment' |
130
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
131
|
286
|
100
|
|
|
|
565
|
if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
132
|
4
|
|
|
|
|
11
|
return 1 |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
# String => '(FIXME|TODO|NOT(IC)?E):?' |
135
|
|
|
|
|
|
|
# attribute => 'Note' |
136
|
|
|
|
|
|
|
# context => '#stay' |
137
|
|
|
|
|
|
|
# type => 'RegExpr' |
138
|
282
|
100
|
|
|
|
569
|
if ($self->testRegExpr($text, '(FIXME|TODO|NOT(IC)?E):?', 0, 0, 0, undef, 0, '#stay', 'Note')) { |
139
|
2
|
|
|
|
|
6
|
return 1 |
140
|
|
|
|
|
|
|
} |
141
|
280
|
|
|
|
|
485
|
return 0; |
142
|
|
|
|
|
|
|
}; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub parseLineComment { |
145
|
92
|
|
|
92
|
0
|
126
|
my ($self, $text) = @_; |
146
|
|
|
|
|
|
|
# String => '(FIXME|TODO|NOT(IC)?E):?' |
147
|
|
|
|
|
|
|
# attribute => 'Note' |
148
|
|
|
|
|
|
|
# context => '#stay' |
149
|
|
|
|
|
|
|
# type => 'RegExpr' |
150
|
92
|
50
|
|
|
|
175
|
if ($self->testRegExpr($text, '(FIXME|TODO|NOT(IC)?E):?', 0, 0, 0, undef, 0, '#stay', 'Note')) { |
151
|
0
|
|
|
|
|
0
|
return 1 |
152
|
|
|
|
|
|
|
} |
153
|
92
|
|
|
|
|
164
|
return 0; |
154
|
|
|
|
|
|
|
}; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub parseNormal { |
157
|
438
|
|
|
438
|
0
|
743
|
my ($self, $text) = @_; |
158
|
|
|
|
|
|
|
# String => 'keywords' |
159
|
|
|
|
|
|
|
# attribute => 'Keyword' |
160
|
|
|
|
|
|
|
# context => '#stay' |
161
|
|
|
|
|
|
|
# type => 'keyword' |
162
|
438
|
100
|
|
|
|
1099
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
163
|
4
|
|
|
|
|
11
|
return 1 |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
# String => 'types' |
166
|
|
|
|
|
|
|
# attribute => 'Data Type' |
167
|
|
|
|
|
|
|
# context => '#stay' |
168
|
|
|
|
|
|
|
# type => 'keyword' |
169
|
434
|
100
|
|
|
|
987
|
if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) { |
170
|
10
|
|
|
|
|
23
|
return 1 |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
# String => 'builtins' |
173
|
|
|
|
|
|
|
# attribute => 'Builtin Function' |
174
|
|
|
|
|
|
|
# context => '#stay' |
175
|
|
|
|
|
|
|
# type => 'keyword' |
176
|
424
|
50
|
|
|
|
899
|
if ($self->testKeyword($text, 'builtins', 0, undef, 0, '#stay', 'Builtin Function')) { |
177
|
0
|
|
|
|
|
0
|
return 1 |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
# String => '`([\+\-\*/%~&\|^]|[!=<>]=|<|>>?|(\[\]|->)=?)' |
180
|
|
|
|
|
|
|
# attribute => 'Builtin Function' |
181
|
|
|
|
|
|
|
# context => '#stay' |
182
|
|
|
|
|
|
|
# type => 'RegExpr' |
183
|
424
|
100
|
|
|
|
980
|
if ($self->testRegExpr($text, '`([\\+\\-\\*/%~&\\|^]|[!=<>]=|<|>>?|(\\[\\]|->)=?)', 0, 0, 0, undef, 0, '#stay', 'Builtin Function')) { |
184
|
4
|
|
|
|
|
10
|
return 1 |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
# attribute => 'Float' |
187
|
|
|
|
|
|
|
# context => '#stay' |
188
|
|
|
|
|
|
|
# type => 'Float' |
189
|
420
|
100
|
|
|
|
1169
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
190
|
6
|
|
|
|
|
15
|
return 1 |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
# String => '0[bB][01]+' |
193
|
|
|
|
|
|
|
# attribute => 'Binary' |
194
|
|
|
|
|
|
|
# context => '#stay' |
195
|
|
|
|
|
|
|
# type => 'RegExpr' |
196
|
414
|
50
|
|
|
|
954
|
if ($self->testRegExpr($text, '0[bB][01]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) { |
197
|
0
|
|
|
|
|
0
|
return 1 |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
# attribute => 'Octal' |
200
|
|
|
|
|
|
|
# context => '#stay' |
201
|
|
|
|
|
|
|
# type => 'HlCOct' |
202
|
414
|
50
|
|
|
|
1071
|
if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) { |
203
|
0
|
|
|
|
|
0
|
return 1 |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
# attribute => 'Hex' |
206
|
|
|
|
|
|
|
# context => '#stay' |
207
|
|
|
|
|
|
|
# type => 'HlCHex' |
208
|
414
|
50
|
|
|
|
933
|
if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) { |
209
|
0
|
|
|
|
|
0
|
return 1 |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
# attribute => 'Decimal' |
212
|
|
|
|
|
|
|
# context => '#stay' |
213
|
|
|
|
|
|
|
# type => 'Int' |
214
|
414
|
50
|
|
|
|
918
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
215
|
0
|
|
|
|
|
0
|
return 1 |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
# attribute => 'Char' |
218
|
|
|
|
|
|
|
# context => '#stay' |
219
|
|
|
|
|
|
|
# type => 'HlCChar' |
220
|
414
|
50
|
|
|
|
928
|
if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) { |
221
|
0
|
|
|
|
|
0
|
return 1 |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
224
|
|
|
|
|
|
|
# beginRegion => 'Brace' |
225
|
|
|
|
|
|
|
# char => '{' |
226
|
|
|
|
|
|
|
# context => '#stay' |
227
|
|
|
|
|
|
|
# type => 'DetectChar' |
228
|
414
|
100
|
|
|
|
888
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
229
|
4
|
|
|
|
|
10
|
return 1 |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
232
|
|
|
|
|
|
|
# char => '}' |
233
|
|
|
|
|
|
|
# context => '#stay' |
234
|
|
|
|
|
|
|
# endRegion => 'Brace' |
235
|
|
|
|
|
|
|
# type => 'DetectChar' |
236
|
410
|
100
|
|
|
|
879
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
237
|
4
|
|
|
|
|
9
|
return 1 |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
# attribute => 'String' |
240
|
|
|
|
|
|
|
# char => '"' |
241
|
|
|
|
|
|
|
# context => 'String' |
242
|
|
|
|
|
|
|
# type => 'DetectChar' |
243
|
406
|
100
|
|
|
|
864
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
244
|
24
|
|
|
|
|
62
|
return 1 |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
# attribute => 'Comment' |
247
|
|
|
|
|
|
|
# char => '/' |
248
|
|
|
|
|
|
|
# char1 => '/' |
249
|
|
|
|
|
|
|
# context => 'Line Comment' |
250
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
251
|
382
|
100
|
|
|
|
835
|
if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Line Comment', 'Comment')) { |
252
|
2
|
|
|
|
|
6
|
return 1 |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
# attribute => 'Comment' |
255
|
|
|
|
|
|
|
# char => '#' |
256
|
|
|
|
|
|
|
# char1 => '!' |
257
|
|
|
|
|
|
|
# context => 'Line Comment' |
258
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
259
|
380
|
100
|
|
|
|
841
|
if ($self->testDetect2Chars($text, '#', '!', 0, 0, 0, undef, 0, 'Line Comment', 'Comment')) { |
260
|
2
|
|
|
|
|
5
|
return 1 |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
# attribute => 'Comment' |
263
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
264
|
|
|
|
|
|
|
# char => '/' |
265
|
|
|
|
|
|
|
# char1 => '*' |
266
|
|
|
|
|
|
|
# context => 'Block Comment' |
267
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
268
|
378
|
100
|
|
|
|
809
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Block Comment', 'Comment')) { |
269
|
2
|
|
|
|
|
5
|
return 1 |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
# String => '#\s*if\s+0' |
272
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
273
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
274
|
|
|
|
|
|
|
# context => 'Outscoped' |
275
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
276
|
|
|
|
|
|
|
# type => 'RegExpr' |
277
|
376
|
50
|
|
|
|
968
|
if ($self->testRegExpr($text, '#\\s*if\\s+0', 0, 0, 0, undef, 1, 'Outscoped', 'Preprocessor')) { |
278
|
0
|
|
|
|
|
0
|
return 1 |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
281
|
|
|
|
|
|
|
# char => '#' |
282
|
|
|
|
|
|
|
# context => 'Preprocessor' |
283
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
284
|
|
|
|
|
|
|
# type => 'DetectChar' |
285
|
376
|
100
|
|
|
|
904
|
if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Preprocessor', 'Preprocessor')) { |
286
|
2
|
|
|
|
|
7
|
return 1 |
287
|
|
|
|
|
|
|
} |
288
|
374
|
|
|
|
|
670
|
return 0; |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub parseOutscoped { |
292
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
293
|
|
|
|
|
|
|
# String => '(FIXME|TODO|NOT(IC)?E):?' |
294
|
|
|
|
|
|
|
# attribute => 'Note' |
295
|
|
|
|
|
|
|
# context => '#stay' |
296
|
|
|
|
|
|
|
# type => 'RegExpr' |
297
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '(FIXME|TODO|NOT(IC)?E):?', 0, 0, 0, undef, 0, '#stay', 'Note')) { |
298
|
0
|
|
|
|
|
0
|
return 1 |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
# attribute => 'Comment' |
301
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
302
|
|
|
|
|
|
|
# char => '/' |
303
|
|
|
|
|
|
|
# char1 => '*' |
304
|
|
|
|
|
|
|
# context => 'Block Comment' |
305
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
306
|
0
|
0
|
|
|
|
0
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Block Comment', 'Comment')) { |
307
|
0
|
|
|
|
|
0
|
return 1 |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
# String => '#\s*if' |
310
|
|
|
|
|
|
|
# attribute => 'Comment' |
311
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
312
|
|
|
|
|
|
|
# context => 'Outscoped intern' |
313
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
314
|
|
|
|
|
|
|
# type => 'RegExpr' |
315
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) { |
316
|
0
|
|
|
|
|
0
|
return 1 |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
# String => '#\s*(endif|elif|else)' |
319
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
320
|
|
|
|
|
|
|
# context => '#pop' |
321
|
|
|
|
|
|
|
# endRegion => 'Outscoped' |
322
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
323
|
|
|
|
|
|
|
# type => 'RegExpr' |
324
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '#\\s*(endif|elif|else)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) { |
325
|
0
|
|
|
|
|
0
|
return 1 |
326
|
|
|
|
|
|
|
} |
327
|
0
|
|
|
|
|
0
|
return 0; |
328
|
|
|
|
|
|
|
}; |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub parseOutscopedintern { |
331
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
332
|
|
|
|
|
|
|
# attribute => 'Comment' |
333
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
334
|
|
|
|
|
|
|
# char => '/' |
335
|
|
|
|
|
|
|
# char1 => '*' |
336
|
|
|
|
|
|
|
# context => 'Block Comment' |
337
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
338
|
0
|
0
|
|
|
|
0
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Block Comment', 'Comment')) { |
339
|
0
|
|
|
|
|
0
|
return 1 |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
# String => '#\s*if' |
342
|
|
|
|
|
|
|
# attribute => 'Comment' |
343
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
344
|
|
|
|
|
|
|
# context => 'Outscoped intern' |
345
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
346
|
|
|
|
|
|
|
# type => 'RegExpr' |
347
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) { |
348
|
0
|
|
|
|
|
0
|
return 1 |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
# String => '#\s*endif' |
351
|
|
|
|
|
|
|
# attribute => 'Comment' |
352
|
|
|
|
|
|
|
# context => '#pop' |
353
|
|
|
|
|
|
|
# endRegion => 'Outscoped' |
354
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
355
|
|
|
|
|
|
|
# type => 'RegExpr' |
356
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) { |
357
|
0
|
|
|
|
|
0
|
return 1 |
358
|
|
|
|
|
|
|
} |
359
|
0
|
|
|
|
|
0
|
return 0; |
360
|
|
|
|
|
|
|
}; |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub parsePreprocessor { |
363
|
56
|
|
|
56
|
0
|
87
|
my ($self, $text) = @_; |
364
|
|
|
|
|
|
|
# attribute => 'Preprocessor Lib' |
365
|
|
|
|
|
|
|
# char => '"' |
366
|
|
|
|
|
|
|
# char1 => '"' |
367
|
|
|
|
|
|
|
# context => '#stay' |
368
|
|
|
|
|
|
|
# type => 'RangeDetect' |
369
|
56
|
100
|
|
|
|
132
|
if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Preprocessor Lib')) { |
370
|
2
|
|
|
|
|
5
|
return 1 |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
# attribute => 'Preprocessor Lib' |
373
|
|
|
|
|
|
|
# char => '<' |
374
|
|
|
|
|
|
|
# char1 => '>' |
375
|
|
|
|
|
|
|
# context => '#stay' |
376
|
|
|
|
|
|
|
# type => 'RangeDetect' |
377
|
54
|
50
|
|
|
|
120
|
if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Preprocessor Lib')) { |
378
|
0
|
|
|
|
|
0
|
return 1 |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
# attribute => 'Comment' |
381
|
|
|
|
|
|
|
# char => '/' |
382
|
|
|
|
|
|
|
# char1 => '/' |
383
|
|
|
|
|
|
|
# context => 'Line Comment' |
384
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
385
|
54
|
50
|
|
|
|
138
|
if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Line Comment', 'Comment')) { |
386
|
0
|
|
|
|
|
0
|
return 1 |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
# attribute => 'Comment' |
389
|
|
|
|
|
|
|
# char => '/' |
390
|
|
|
|
|
|
|
# char1 => '*' |
391
|
|
|
|
|
|
|
# context => 'Block Comment' |
392
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
393
|
54
|
100
|
|
|
|
111
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Block Comment', 'Comment')) { |
394
|
2
|
|
|
|
|
6
|
return 1 |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
397
|
|
|
|
|
|
|
# context => '#stay' |
398
|
|
|
|
|
|
|
# type => 'LineContinue' |
399
|
52
|
50
|
|
|
|
118
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) { |
400
|
0
|
|
|
|
|
0
|
return 1 |
401
|
|
|
|
|
|
|
} |
402
|
52
|
|
|
|
|
91
|
return 0; |
403
|
|
|
|
|
|
|
}; |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub parseString { |
406
|
180
|
|
|
180
|
0
|
282
|
my ($self, $text) = @_; |
407
|
|
|
|
|
|
|
# String => '\\d[0-9]+' |
408
|
|
|
|
|
|
|
# attribute => 'String Char' |
409
|
|
|
|
|
|
|
# context => '#stay' |
410
|
|
|
|
|
|
|
# type => 'RegExpr' |
411
|
180
|
50
|
|
|
|
381
|
if ($self->testRegExpr($text, '\\\\d[0-9]+', 0, 0, 0, undef, 0, '#stay', 'String Char')) { |
412
|
0
|
|
|
|
|
0
|
return 1 |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
# attribute => 'String Char' |
415
|
|
|
|
|
|
|
# context => '#stay' |
416
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
417
|
180
|
100
|
|
|
|
418
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
418
|
12
|
|
|
|
|
30
|
return 1 |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
# attribute => 'String' |
421
|
|
|
|
|
|
|
# char => '"' |
422
|
|
|
|
|
|
|
# context => '#pop' |
423
|
|
|
|
|
|
|
# type => 'DetectChar' |
424
|
168
|
100
|
|
|
|
364
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
425
|
24
|
|
|
|
|
46
|
return 1 |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
# attribute => 'String' |
428
|
|
|
|
|
|
|
# context => '#stay' |
429
|
|
|
|
|
|
|
# type => 'LineContinue' |
430
|
144
|
50
|
|
|
|
295
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) { |
431
|
0
|
|
|
|
|
0
|
return 1 |
432
|
|
|
|
|
|
|
} |
433
|
144
|
|
|
|
|
259
|
return 0; |
434
|
|
|
|
|
|
|
}; |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
1; |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
__END__ |