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