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 'lex.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.01 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Jan Villat (jan.villat@net2000.ch) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Lex_Flex; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1052
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
18
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
19
|
1
|
|
|
1
|
|
8
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2510
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
705
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
15
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
26
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
27
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Alert' => 'Alert', |
27
|
|
|
|
|
|
|
'Backslash Code' => 'String', |
28
|
|
|
|
|
|
|
'Comment' => 'Comment', |
29
|
|
|
|
|
|
|
'Content-Type Delimiter' => 'BaseN', |
30
|
|
|
|
|
|
|
'Definition' => 'DataType', |
31
|
|
|
|
|
|
|
'Directive' => 'Keyword', |
32
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
33
|
|
|
|
|
|
|
'RegExpr' => 'String', |
34
|
|
|
|
|
|
|
}); |
35
|
2
|
|
|
|
|
106
|
$self->contextdata({ |
36
|
|
|
|
|
|
|
'Action' => { |
37
|
|
|
|
|
|
|
callback => \&parseAction, |
38
|
|
|
|
|
|
|
attribute => 'Normal Text', |
39
|
|
|
|
|
|
|
lineending => '#pop', |
40
|
|
|
|
|
|
|
fallthrough => 'Action C', |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
'Action C' => { |
43
|
|
|
|
|
|
|
callback => \&parseActionC, |
44
|
|
|
|
|
|
|
attribute => 'Normal Text', |
45
|
|
|
|
|
|
|
lineending => '#pop', |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
'Comment' => { |
48
|
|
|
|
|
|
|
callback => \&parseComment, |
49
|
|
|
|
|
|
|
attribute => 'Comment', |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'Definition RegExpr' => { |
52
|
|
|
|
|
|
|
callback => \&parseDefinitionRegExpr, |
53
|
|
|
|
|
|
|
attribute => 'RegExpr', |
54
|
|
|
|
|
|
|
lineending => '#pop', |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
'Definitions' => { |
57
|
|
|
|
|
|
|
callback => \&parseDefinitions, |
58
|
|
|
|
|
|
|
attribute => 'Normal Text', |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
'Detect C' => { |
61
|
|
|
|
|
|
|
callback => \&parseDetectC, |
62
|
|
|
|
|
|
|
attribute => 'Normal Text', |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
'Indented C' => { |
65
|
|
|
|
|
|
|
callback => \&parseIndentedC, |
66
|
|
|
|
|
|
|
attribute => 'Normal Text', |
67
|
|
|
|
|
|
|
lineending => '#pop', |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
'Lex C Bloc' => { |
70
|
|
|
|
|
|
|
callback => \&parseLexCBloc, |
71
|
|
|
|
|
|
|
attribute => 'Normal Text', |
72
|
|
|
|
|
|
|
}, |
73
|
|
|
|
|
|
|
'Lex Rule C Bloc' => { |
74
|
|
|
|
|
|
|
callback => \&parseLexRuleCBloc, |
75
|
|
|
|
|
|
|
attribute => 'Normal Text', |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
'Normal C Bloc' => { |
78
|
|
|
|
|
|
|
callback => \&parseNormalCBloc, |
79
|
|
|
|
|
|
|
attribute => 'Normal Text', |
80
|
|
|
|
|
|
|
}, |
81
|
|
|
|
|
|
|
'Percent Command' => { |
82
|
|
|
|
|
|
|
callback => \&parsePercentCommand, |
83
|
|
|
|
|
|
|
attribute => 'Directive', |
84
|
|
|
|
|
|
|
lineending => '#pop', |
85
|
|
|
|
|
|
|
}, |
86
|
|
|
|
|
|
|
'Pre Start' => { |
87
|
|
|
|
|
|
|
callback => \&parsePreStart, |
88
|
|
|
|
|
|
|
attribute => 'Normal Text', |
89
|
|
|
|
|
|
|
}, |
90
|
|
|
|
|
|
|
'RegExpr (' => { |
91
|
|
|
|
|
|
|
callback => \&parseRegExprBo, |
92
|
|
|
|
|
|
|
attribute => 'RegExpr', |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
'RegExpr Base' => { |
95
|
|
|
|
|
|
|
callback => \&parseRegExprBase, |
96
|
|
|
|
|
|
|
attribute => 'RegExpr', |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
'RegExpr Q' => { |
99
|
|
|
|
|
|
|
callback => \&parseRegExprQ, |
100
|
|
|
|
|
|
|
attribute => 'RegExpr', |
101
|
|
|
|
|
|
|
}, |
102
|
|
|
|
|
|
|
'RegExpr [' => { |
103
|
|
|
|
|
|
|
callback => \&parseRegExprSo, |
104
|
|
|
|
|
|
|
attribute => 'RegExpr', |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
'RegExpr {' => { |
107
|
|
|
|
|
|
|
callback => \&parseRegExprCo, |
108
|
|
|
|
|
|
|
attribute => 'RegExpr', |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
'Rule RegExpr' => { |
111
|
|
|
|
|
|
|
callback => \&parseRuleRegExpr, |
112
|
|
|
|
|
|
|
attribute => 'RegExpr', |
113
|
|
|
|
|
|
|
lineending => '#pop', |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
'Rules' => { |
116
|
|
|
|
|
|
|
callback => \&parseRules, |
117
|
|
|
|
|
|
|
attribute => 'Normal Text', |
118
|
|
|
|
|
|
|
fallthrough => 'Rule RegExpr', |
119
|
|
|
|
|
|
|
}, |
120
|
|
|
|
|
|
|
'Start Conditions Scope' => { |
121
|
|
|
|
|
|
|
callback => \&parseStartConditionsScope, |
122
|
|
|
|
|
|
|
attribute => 'Normal Text', |
123
|
|
|
|
|
|
|
fallthrough => 'Rule RegExpr', |
124
|
|
|
|
|
|
|
}, |
125
|
|
|
|
|
|
|
'User Code' => { |
126
|
|
|
|
|
|
|
callback => \&parseUserCode, |
127
|
|
|
|
|
|
|
attribute => 'Normal Text', |
128
|
|
|
|
|
|
|
}, |
129
|
|
|
|
|
|
|
}); |
130
|
2
|
|
|
|
|
16
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
131
|
2
|
|
|
|
|
10
|
$self->basecontext('Pre Start'); |
132
|
2
|
|
|
|
|
12
|
$self->keywordscase(1); |
133
|
2
|
|
|
|
|
7
|
$self->initialize; |
134
|
2
|
|
|
|
|
6
|
bless ($self, $class); |
135
|
2
|
|
|
|
|
13
|
return $self; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub language { |
139
|
0
|
|
|
0
|
0
|
0
|
return 'Lex/Flex'; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub parseAction { |
143
|
46
|
|
|
46
|
0
|
122
|
my ($self, $text) = @_; |
144
|
|
|
|
|
|
|
# String => '\|\s*$' |
145
|
|
|
|
|
|
|
# attribute => 'Directive' |
146
|
|
|
|
|
|
|
# context => '#stay' |
147
|
|
|
|
|
|
|
# type => 'RegExpr' |
148
|
46
|
50
|
|
|
|
194
|
if ($self->testRegExpr($text, '\\|\\s*$', 0, 0, 0, undef, 0, '#stay', 'Directive')) { |
149
|
0
|
|
|
|
|
0
|
return 1 |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
152
|
|
|
|
|
|
|
# beginRegion => 'lexCbloc' |
153
|
|
|
|
|
|
|
# char => '%' |
154
|
|
|
|
|
|
|
# char1 => '{' |
155
|
|
|
|
|
|
|
# context => 'Lex Rule C Bloc' |
156
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
157
|
46
|
50
|
|
|
|
218
|
if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, 'Lex Rule C Bloc', 'Content-Type Delimiter')) { |
158
|
0
|
|
|
|
|
0
|
return 1 |
159
|
|
|
|
|
|
|
} |
160
|
46
|
|
|
|
|
143
|
return 0; |
161
|
|
|
|
|
|
|
}; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub parseActionC { |
164
|
472
|
|
|
472
|
0
|
772
|
my ($self, $text) = @_; |
165
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
166
|
|
|
|
|
|
|
# beginRegion => 'bloc' |
167
|
|
|
|
|
|
|
# char => '{' |
168
|
|
|
|
|
|
|
# context => 'Normal C Bloc' |
169
|
|
|
|
|
|
|
# type => 'DetectChar' |
170
|
472
|
100
|
|
|
|
1671
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) { |
171
|
10
|
|
|
|
|
36
|
return 1 |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
# attribute => 'Alert' |
174
|
|
|
|
|
|
|
# char => '}' |
175
|
|
|
|
|
|
|
# context => '#stay' |
176
|
|
|
|
|
|
|
# type => 'DetectChar' |
177
|
462
|
100
|
|
|
|
1684
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Alert')) { |
178
|
2
|
|
|
|
|
6
|
return 1 |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
# context => '##C++' |
181
|
|
|
|
|
|
|
# type => 'IncludeRules' |
182
|
460
|
100
|
|
|
|
1381
|
if ($self->includePlugin('C++', $text)) { |
183
|
244
|
|
|
|
|
665
|
return 1 |
184
|
|
|
|
|
|
|
} |
185
|
216
|
|
|
|
|
577
|
return 0; |
186
|
|
|
|
|
|
|
}; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub parseComment { |
189
|
149
|
|
|
149
|
0
|
227
|
my ($self, $text) = @_; |
190
|
|
|
|
|
|
|
# attribute => 'Comment' |
191
|
|
|
|
|
|
|
# char => '*' |
192
|
|
|
|
|
|
|
# char1 => '/' |
193
|
|
|
|
|
|
|
# context => '#pop' |
194
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
195
|
149
|
100
|
|
|
|
477
|
if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
196
|
5
|
|
|
|
|
18
|
return 1 |
197
|
|
|
|
|
|
|
} |
198
|
144
|
|
|
|
|
450
|
return 0; |
199
|
|
|
|
|
|
|
}; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub parseDefinitionRegExpr { |
202
|
4
|
|
|
4
|
0
|
8
|
my ($self, $text) = @_; |
203
|
|
|
|
|
|
|
# context => 'RegExpr Base' |
204
|
|
|
|
|
|
|
# type => 'IncludeRules' |
205
|
4
|
50
|
|
|
|
18
|
if ($self->includeRules('RegExpr Base', $text)) { |
206
|
4
|
|
|
|
|
11
|
return 1 |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
# String => '\S' |
209
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
210
|
|
|
|
|
|
|
# context => '#stay' |
211
|
|
|
|
|
|
|
# type => 'RegExpr' |
212
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
213
|
0
|
|
|
|
|
0
|
return 1 |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
# String => '.*' |
216
|
|
|
|
|
|
|
# attribute => 'Alert' |
217
|
|
|
|
|
|
|
# context => '#stay' |
218
|
|
|
|
|
|
|
# type => 'RegExpr' |
219
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '.*', 0, 0, 0, undef, 0, '#stay', 'Alert')) { |
220
|
0
|
|
|
|
|
0
|
return 1 |
221
|
|
|
|
|
|
|
} |
222
|
0
|
|
|
|
|
0
|
return 0; |
223
|
|
|
|
|
|
|
}; |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub parseDefinitions { |
226
|
75
|
|
|
75
|
0
|
135
|
my ($self, $text) = @_; |
227
|
|
|
|
|
|
|
# context => 'Detect C' |
228
|
|
|
|
|
|
|
# type => 'IncludeRules' |
229
|
75
|
100
|
|
|
|
257
|
if ($self->includeRules('Detect C', $text)) { |
230
|
4
|
|
|
|
|
16
|
return 1 |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
233
|
|
|
|
|
|
|
# beginRegion => 'rules' |
234
|
|
|
|
|
|
|
# char => '%' |
235
|
|
|
|
|
|
|
# char1 => '%' |
236
|
|
|
|
|
|
|
# context => 'Rules' |
237
|
|
|
|
|
|
|
# endRegion => 'definitions' |
238
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
239
|
71
|
100
|
|
|
|
244
|
if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Rules', 'Content-Type Delimiter')) { |
240
|
2
|
|
|
|
|
8
|
return 1 |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
# attribute => 'Directive' |
243
|
|
|
|
|
|
|
# char => '%' |
244
|
|
|
|
|
|
|
# context => 'Percent Command' |
245
|
|
|
|
|
|
|
# type => 'DetectChar' |
246
|
69
|
100
|
|
|
|
253
|
if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Percent Command', 'Directive')) { |
247
|
6
|
|
|
|
|
20
|
return 1 |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
# attribute => 'Comment' |
250
|
|
|
|
|
|
|
# char => '/' |
251
|
|
|
|
|
|
|
# char1 => '*' |
252
|
|
|
|
|
|
|
# column => '0' |
253
|
|
|
|
|
|
|
# context => 'Comment' |
254
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
255
|
63
|
100
|
|
|
|
208
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, 0, 0, 'Comment', 'Comment')) { |
256
|
5
|
|
|
|
|
18
|
return 1 |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
# String => '[A-Za-z_]\w*\s+' |
259
|
|
|
|
|
|
|
# attribute => 'Definition' |
260
|
|
|
|
|
|
|
# column => '0' |
261
|
|
|
|
|
|
|
# context => 'Definition RegExpr' |
262
|
|
|
|
|
|
|
# type => 'RegExpr' |
263
|
58
|
100
|
|
|
|
184
|
if ($self->testRegExpr($text, '[A-Za-z_]\\w*\\s+', 0, 0, 0, 0, 0, 'Definition RegExpr', 'Definition')) { |
264
|
4
|
|
|
|
|
13
|
return 1 |
265
|
|
|
|
|
|
|
} |
266
|
54
|
|
|
|
|
163
|
return 0; |
267
|
|
|
|
|
|
|
}; |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub parseDetectC { |
270
|
85
|
|
|
85
|
0
|
156
|
my ($self, $text) = @_; |
271
|
|
|
|
|
|
|
# String => '^\s' |
272
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
273
|
|
|
|
|
|
|
# context => 'Indented C' |
274
|
|
|
|
|
|
|
# type => 'RegExpr' |
275
|
85
|
100
|
|
|
|
321
|
if ($self->testRegExpr($text, '^\\s', 0, 0, 0, undef, 0, 'Indented C', 'Normal Text')) { |
276
|
6
|
|
|
|
|
32
|
return 1 |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
279
|
|
|
|
|
|
|
# beginRegion => 'lexCbloc' |
280
|
|
|
|
|
|
|
# char => '%' |
281
|
|
|
|
|
|
|
# char1 => '{' |
282
|
|
|
|
|
|
|
# column => '0' |
283
|
|
|
|
|
|
|
# context => 'Lex C Bloc' |
284
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
285
|
79
|
100
|
|
|
|
315
|
if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'Lex C Bloc', 'Content-Type Delimiter')) { |
286
|
2
|
|
|
|
|
9
|
return 1 |
287
|
|
|
|
|
|
|
} |
288
|
77
|
|
|
|
|
303
|
return 0; |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub parseIndentedC { |
292
|
6
|
|
|
6
|
0
|
13
|
my ($self, $text) = @_; |
293
|
|
|
|
|
|
|
# context => '##C++' |
294
|
|
|
|
|
|
|
# type => 'IncludeRules' |
295
|
6
|
50
|
|
|
|
38
|
if ($self->includePlugin('C++', $text)) { |
296
|
6
|
|
|
|
|
19
|
return 1 |
297
|
|
|
|
|
|
|
} |
298
|
0
|
|
|
|
|
0
|
return 0; |
299
|
|
|
|
|
|
|
}; |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
sub parseLexCBloc { |
302
|
18
|
|
|
18
|
0
|
32
|
my ($self, $text) = @_; |
303
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
304
|
|
|
|
|
|
|
# char => '%' |
305
|
|
|
|
|
|
|
# char1 => '}' |
306
|
|
|
|
|
|
|
# column => '0' |
307
|
|
|
|
|
|
|
# context => '#pop' |
308
|
|
|
|
|
|
|
# endRegion => 'lexCbloc' |
309
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
310
|
18
|
100
|
|
|
|
71
|
if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, 0, 0, '#pop', 'Content-Type Delimiter')) { |
311
|
2
|
|
|
|
|
9
|
return 1 |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
# context => '##C++' |
314
|
|
|
|
|
|
|
# type => 'IncludeRules' |
315
|
16
|
100
|
|
|
|
61
|
if ($self->includePlugin('C++', $text)) { |
316
|
12
|
|
|
|
|
41
|
return 1 |
317
|
|
|
|
|
|
|
} |
318
|
4
|
|
|
|
|
14
|
return 0; |
319
|
|
|
|
|
|
|
}; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub parseLexRuleCBloc { |
322
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
323
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
324
|
|
|
|
|
|
|
# char => '%' |
325
|
|
|
|
|
|
|
# char1 => '}' |
326
|
|
|
|
|
|
|
# context => '#pop' |
327
|
|
|
|
|
|
|
# endRegion => 'lexCbloc' |
328
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
329
|
0
|
0
|
|
|
|
0
|
if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) { |
330
|
0
|
|
|
|
|
0
|
return 1 |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
# context => '##C++' |
333
|
|
|
|
|
|
|
# type => 'IncludeRules' |
334
|
0
|
0
|
|
|
|
0
|
if ($self->includePlugin('C++', $text)) { |
335
|
0
|
|
|
|
|
0
|
return 1 |
336
|
|
|
|
|
|
|
} |
337
|
0
|
|
|
|
|
0
|
return 0; |
338
|
|
|
|
|
|
|
}; |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub parseNormalCBloc { |
341
|
436
|
|
|
436
|
0
|
748
|
my ($self, $text) = @_; |
342
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
343
|
|
|
|
|
|
|
# beginRegion => 'bloc' |
344
|
|
|
|
|
|
|
# char => '{' |
345
|
|
|
|
|
|
|
# context => 'Normal C Bloc' |
346
|
|
|
|
|
|
|
# type => 'DetectChar' |
347
|
436
|
100
|
|
|
|
1467
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) { |
348
|
4
|
|
|
|
|
14
|
return 1 |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
351
|
|
|
|
|
|
|
# char => '}' |
352
|
|
|
|
|
|
|
# context => '#pop' |
353
|
|
|
|
|
|
|
# endRegion => 'bloc' |
354
|
|
|
|
|
|
|
# type => 'DetectChar' |
355
|
432
|
100
|
|
|
|
1378
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
356
|
14
|
|
|
|
|
44
|
return 1 |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
# context => '##C++' |
359
|
|
|
|
|
|
|
# type => 'IncludeRules' |
360
|
418
|
100
|
|
|
|
1410
|
if ($self->includePlugin('C++', $text)) { |
361
|
162
|
|
|
|
|
506
|
return 1 |
362
|
|
|
|
|
|
|
} |
363
|
256
|
|
|
|
|
708
|
return 0; |
364
|
|
|
|
|
|
|
}; |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub parsePercentCommand { |
367
|
104
|
|
|
104
|
0
|
327
|
my ($self, $text) = @_; |
368
|
104
|
|
|
|
|
251
|
return 0; |
369
|
|
|
|
|
|
|
}; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub parsePreStart { |
372
|
2
|
|
|
2
|
0
|
5
|
my ($self, $text) = @_; |
373
|
|
|
|
|
|
|
# String => '.' |
374
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
375
|
|
|
|
|
|
|
# beginRegion => 'definitions' |
376
|
|
|
|
|
|
|
# context => 'Definitions' |
377
|
|
|
|
|
|
|
# lookAhead => 'true' |
378
|
|
|
|
|
|
|
# type => 'RegExpr' |
379
|
2
|
50
|
|
|
|
16
|
if ($self->testRegExpr($text, '.', 0, 0, 1, undef, 0, 'Definitions', 'Normal Text')) { |
380
|
2
|
|
|
|
|
6
|
return 1 |
381
|
|
|
|
|
|
|
} |
382
|
0
|
|
|
|
|
0
|
return 0; |
383
|
|
|
|
|
|
|
}; |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
sub parseRegExprBo { |
386
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
387
|
|
|
|
|
|
|
# context => 'RegExpr Base' |
388
|
|
|
|
|
|
|
# type => 'IncludeRules' |
389
|
0
|
0
|
|
|
|
0
|
if ($self->includeRules('RegExpr Base', $text)) { |
390
|
0
|
|
|
|
|
0
|
return 1 |
391
|
|
|
|
|
|
|
} |
392
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
393
|
|
|
|
|
|
|
# char => ')' |
394
|
|
|
|
|
|
|
# context => '#pop' |
395
|
|
|
|
|
|
|
# type => 'DetectChar' |
396
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) { |
397
|
0
|
|
|
|
|
0
|
return 1 |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
# String => '.' |
400
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
401
|
|
|
|
|
|
|
# context => '#stay' |
402
|
|
|
|
|
|
|
# type => 'RegExpr' |
403
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
404
|
0
|
|
|
|
|
0
|
return 1 |
405
|
|
|
|
|
|
|
} |
406
|
0
|
|
|
|
|
0
|
return 0; |
407
|
|
|
|
|
|
|
}; |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
sub parseRegExprBase { |
410
|
30
|
|
|
30
|
0
|
63
|
my ($self, $text) = @_; |
411
|
|
|
|
|
|
|
# String => '\\.' |
412
|
|
|
|
|
|
|
# attribute => 'Backslash Code' |
413
|
|
|
|
|
|
|
# context => '#stay' |
414
|
|
|
|
|
|
|
# type => 'RegExpr' |
415
|
30
|
50
|
|
|
|
112
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) { |
416
|
0
|
|
|
|
|
0
|
return 1 |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
419
|
|
|
|
|
|
|
# char => '(' |
420
|
|
|
|
|
|
|
# context => 'RegExpr (' |
421
|
|
|
|
|
|
|
# type => 'DetectChar' |
422
|
30
|
50
|
|
|
|
135
|
if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'RegExpr (', 'RegExpr')) { |
423
|
0
|
|
|
|
|
0
|
return 1 |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
426
|
|
|
|
|
|
|
# char => '[' |
427
|
|
|
|
|
|
|
# context => 'RegExpr [' |
428
|
|
|
|
|
|
|
# type => 'DetectChar' |
429
|
30
|
100
|
|
|
|
189
|
if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'RegExpr [', 'RegExpr')) { |
430
|
6
|
|
|
|
|
27
|
return 1 |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
433
|
|
|
|
|
|
|
# char => '{' |
434
|
|
|
|
|
|
|
# context => 'RegExpr {' |
435
|
|
|
|
|
|
|
# type => 'DetectChar' |
436
|
24
|
50
|
|
|
|
97
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'RegExpr {', 'RegExpr')) { |
437
|
0
|
|
|
|
|
0
|
return 1 |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
440
|
|
|
|
|
|
|
# char => '"' |
441
|
|
|
|
|
|
|
# context => 'RegExpr Q' |
442
|
|
|
|
|
|
|
# type => 'DetectChar' |
443
|
24
|
50
|
|
|
|
98
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'RegExpr Q', 'RegExpr')) { |
444
|
0
|
|
|
|
|
0
|
return 1 |
445
|
|
|
|
|
|
|
} |
446
|
24
|
|
|
|
|
88
|
return 0; |
447
|
|
|
|
|
|
|
}; |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
sub parseRegExprQ { |
450
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
451
|
|
|
|
|
|
|
# String => '\\.' |
452
|
|
|
|
|
|
|
# attribute => 'Backslash Code' |
453
|
|
|
|
|
|
|
# context => '#stay' |
454
|
|
|
|
|
|
|
# type => 'RegExpr' |
455
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) { |
456
|
0
|
|
|
|
|
0
|
return 1 |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
459
|
|
|
|
|
|
|
# char => '"' |
460
|
|
|
|
|
|
|
# context => '#pop' |
461
|
|
|
|
|
|
|
# type => 'DetectChar' |
462
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) { |
463
|
0
|
|
|
|
|
0
|
return 1 |
464
|
|
|
|
|
|
|
} |
465
|
|
|
|
|
|
|
# String => '.' |
466
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
467
|
|
|
|
|
|
|
# context => '#stay' |
468
|
|
|
|
|
|
|
# type => 'RegExpr' |
469
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
470
|
0
|
|
|
|
|
0
|
return 1 |
471
|
|
|
|
|
|
|
} |
472
|
0
|
|
|
|
|
0
|
return 0; |
473
|
|
|
|
|
|
|
}; |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
sub parseRegExprSo { |
476
|
34
|
|
|
34
|
0
|
62
|
my ($self, $text) = @_; |
477
|
|
|
|
|
|
|
# String => '\\.' |
478
|
|
|
|
|
|
|
# attribute => 'Backslash Code' |
479
|
|
|
|
|
|
|
# context => '#stay' |
480
|
|
|
|
|
|
|
# type => 'RegExpr' |
481
|
34
|
100
|
|
|
|
119
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) { |
482
|
6
|
|
|
|
|
19
|
return 1 |
483
|
|
|
|
|
|
|
} |
484
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
485
|
|
|
|
|
|
|
# char => ']' |
486
|
|
|
|
|
|
|
# context => '#pop' |
487
|
|
|
|
|
|
|
# type => 'DetectChar' |
488
|
28
|
100
|
|
|
|
104
|
if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) { |
489
|
6
|
|
|
|
|
17
|
return 1 |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
# String => '.' |
492
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
493
|
|
|
|
|
|
|
# context => '#stay' |
494
|
|
|
|
|
|
|
# type => 'RegExpr' |
495
|
22
|
50
|
|
|
|
79
|
if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
496
|
22
|
|
|
|
|
61
|
return 1 |
497
|
|
|
|
|
|
|
} |
498
|
0
|
|
|
|
|
0
|
return 0; |
499
|
|
|
|
|
|
|
}; |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
sub parseRegExprCo { |
502
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
503
|
|
|
|
|
|
|
# String => '\\.' |
504
|
|
|
|
|
|
|
# attribute => 'Backslash Code' |
505
|
|
|
|
|
|
|
# context => '#stay' |
506
|
|
|
|
|
|
|
# type => 'RegExpr' |
507
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) { |
508
|
0
|
|
|
|
|
0
|
return 1 |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
511
|
|
|
|
|
|
|
# char => '}' |
512
|
|
|
|
|
|
|
# context => '#pop' |
513
|
|
|
|
|
|
|
# type => 'DetectChar' |
514
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'RegExpr')) { |
515
|
0
|
|
|
|
|
0
|
return 1 |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
# String => '.' |
518
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
519
|
|
|
|
|
|
|
# context => '#stay' |
520
|
|
|
|
|
|
|
# type => 'RegExpr' |
521
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
522
|
0
|
|
|
|
|
0
|
return 1 |
523
|
|
|
|
|
|
|
} |
524
|
0
|
|
|
|
|
0
|
return 0; |
525
|
|
|
|
|
|
|
}; |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
sub parseRuleRegExpr { |
528
|
26
|
|
|
26
|
0
|
53
|
my ($self, $text) = @_; |
529
|
|
|
|
|
|
|
# String => '\{$' |
530
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
531
|
|
|
|
|
|
|
# beginRegion => 'SCscope' |
532
|
|
|
|
|
|
|
# context => 'Start Conditions Scope' |
533
|
|
|
|
|
|
|
# type => 'RegExpr' |
534
|
26
|
50
|
|
|
|
106
|
if ($self->testRegExpr($text, '\\{$', 0, 0, 0, undef, 0, 'Start Conditions Scope', 'Content-Type Delimiter')) { |
535
|
0
|
|
|
|
|
0
|
return 1 |
536
|
|
|
|
|
|
|
} |
537
|
|
|
|
|
|
|
# context => 'RegExpr Base' |
538
|
|
|
|
|
|
|
# type => 'IncludeRules' |
539
|
26
|
100
|
|
|
|
109
|
if ($self->includeRules('RegExpr Base', $text)) { |
540
|
2
|
|
|
|
|
7
|
return 1 |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
# String => '\S' |
543
|
|
|
|
|
|
|
# attribute => 'RegExpr' |
544
|
|
|
|
|
|
|
# context => '#stay' |
545
|
|
|
|
|
|
|
# type => 'RegExpr' |
546
|
24
|
100
|
|
|
|
91
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'RegExpr')) { |
547
|
14
|
|
|
|
|
49
|
return 1 |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
# String => '\s+' |
550
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
551
|
|
|
|
|
|
|
# context => 'Action' |
552
|
|
|
|
|
|
|
# type => 'RegExpr' |
553
|
10
|
50
|
|
|
|
44
|
if ($self->testRegExpr($text, '\\s+', 0, 0, 0, undef, 0, 'Action', 'Normal Text')) { |
554
|
10
|
|
|
|
|
32
|
return 1 |
555
|
|
|
|
|
|
|
} |
556
|
0
|
|
|
|
|
0
|
return 0; |
557
|
|
|
|
|
|
|
}; |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
sub parseRules { |
560
|
10
|
|
|
10
|
0
|
29
|
my ($self, $text) = @_; |
561
|
|
|
|
|
|
|
# context => 'Detect C' |
562
|
|
|
|
|
|
|
# type => 'IncludeRules' |
563
|
10
|
100
|
|
|
|
44
|
if ($self->includeRules('Detect C', $text)) { |
564
|
4
|
|
|
|
|
10
|
return 1 |
565
|
|
|
|
|
|
|
} |
566
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
567
|
|
|
|
|
|
|
# beginRegion => 'code' |
568
|
|
|
|
|
|
|
# char => '%' |
569
|
|
|
|
|
|
|
# char1 => '%' |
570
|
|
|
|
|
|
|
# context => 'User Code' |
571
|
|
|
|
|
|
|
# endRegion => 'rules' |
572
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
573
|
6
|
50
|
|
|
|
29
|
if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'User Code', 'Content-Type Delimiter')) { |
574
|
0
|
|
|
|
|
0
|
return 1 |
575
|
|
|
|
|
|
|
} |
576
|
6
|
|
|
|
|
17
|
return 0; |
577
|
|
|
|
|
|
|
}; |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
sub parseStartConditionsScope { |
580
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
581
|
|
|
|
|
|
|
# String => '\s*\}' |
582
|
|
|
|
|
|
|
# attribute => 'Content-Type Delimiter' |
583
|
|
|
|
|
|
|
# context => '#pop' |
584
|
|
|
|
|
|
|
# endRegion => 'SCscope' |
585
|
|
|
|
|
|
|
# type => 'RegExpr' |
586
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\s*\\}', 0, 0, 0, undef, 0, '#pop', 'Content-Type Delimiter')) { |
587
|
0
|
|
|
|
|
|
return 1 |
588
|
|
|
|
|
|
|
} |
589
|
|
|
|
|
|
|
# String => '\s*' |
590
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
591
|
|
|
|
|
|
|
# context => 'Rule RegExpr' |
592
|
|
|
|
|
|
|
# type => 'RegExpr' |
593
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, 'Rule RegExpr', 'Normal Text')) { |
594
|
0
|
|
|
|
|
|
return 1 |
595
|
|
|
|
|
|
|
} |
596
|
0
|
|
|
|
|
|
return 0; |
597
|
|
|
|
|
|
|
}; |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
sub parseUserCode { |
600
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
601
|
|
|
|
|
|
|
# context => '##C++' |
602
|
|
|
|
|
|
|
# type => 'IncludeRules' |
603
|
0
|
0
|
|
|
|
|
if ($self->includePlugin('C++', $text)) { |
604
|
0
|
|
|
|
|
|
return 1 |
605
|
|
|
|
|
|
|
} |
606
|
0
|
|
|
|
|
|
return 0; |
607
|
|
|
|
|
|
|
}; |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
1; |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
__END__ |