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 'ansic89.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.09 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Dominik Haumann (dhdev@gmx.de) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:04 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::ANSI_C89; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
958
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
18
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
19
|
1
|
|
|
1
|
|
5
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1549
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
645
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
8
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
11
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
19
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Char' => 'Char', |
27
|
|
|
|
|
|
|
'Comment' => 'Comment', |
28
|
|
|
|
|
|
|
'Data Type' => 'DataType', |
29
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
30
|
|
|
|
|
|
|
'Float' => 'Float', |
31
|
|
|
|
|
|
|
'Hex' => 'BaseN', |
32
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
33
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
34
|
|
|
|
|
|
|
'Octal' => 'BaseN', |
35
|
|
|
|
|
|
|
'Prep. Lib' => 'Others', |
36
|
|
|
|
|
|
|
'Preprocessor' => 'Others', |
37
|
|
|
|
|
|
|
'String' => 'String', |
38
|
|
|
|
|
|
|
'String Char' => 'Char', |
39
|
|
|
|
|
|
|
'Symbol' => 'Normal', |
40
|
|
|
|
|
|
|
}); |
41
|
1
|
|
|
|
|
10
|
$self->listAdd('keywords', |
42
|
|
|
|
|
|
|
'break', |
43
|
|
|
|
|
|
|
'case', |
44
|
|
|
|
|
|
|
'continue', |
45
|
|
|
|
|
|
|
'default', |
46
|
|
|
|
|
|
|
'do', |
47
|
|
|
|
|
|
|
'else', |
48
|
|
|
|
|
|
|
'enum', |
49
|
|
|
|
|
|
|
'extern', |
50
|
|
|
|
|
|
|
'for', |
51
|
|
|
|
|
|
|
'goto', |
52
|
|
|
|
|
|
|
'if', |
53
|
|
|
|
|
|
|
'return', |
54
|
|
|
|
|
|
|
'sizeof', |
55
|
|
|
|
|
|
|
'struct', |
56
|
|
|
|
|
|
|
'switch', |
57
|
|
|
|
|
|
|
'typedef', |
58
|
|
|
|
|
|
|
'union', |
59
|
|
|
|
|
|
|
'while', |
60
|
|
|
|
|
|
|
); |
61
|
1
|
|
|
|
|
4
|
$self->listAdd('types', |
62
|
|
|
|
|
|
|
'auto', |
63
|
|
|
|
|
|
|
'char', |
64
|
|
|
|
|
|
|
'const', |
65
|
|
|
|
|
|
|
'double', |
66
|
|
|
|
|
|
|
'float', |
67
|
|
|
|
|
|
|
'int', |
68
|
|
|
|
|
|
|
'long', |
69
|
|
|
|
|
|
|
'register', |
70
|
|
|
|
|
|
|
'short', |
71
|
|
|
|
|
|
|
'signed', |
72
|
|
|
|
|
|
|
'static', |
73
|
|
|
|
|
|
|
'unsigned', |
74
|
|
|
|
|
|
|
'void', |
75
|
|
|
|
|
|
|
'volatile', |
76
|
|
|
|
|
|
|
); |
77
|
1
|
|
|
|
|
23
|
$self->contextdata({ |
78
|
|
|
|
|
|
|
'Define' => { |
79
|
|
|
|
|
|
|
callback => \&parseDefine, |
80
|
|
|
|
|
|
|
attribute => 'Preprocessor', |
81
|
|
|
|
|
|
|
lineending => '#pop', |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
'Normal' => { |
84
|
|
|
|
|
|
|
callback => \&parseNormal, |
85
|
|
|
|
|
|
|
attribute => 'Normal Text', |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
'Outscoped' => { |
88
|
|
|
|
|
|
|
callback => \&parseOutscoped, |
89
|
|
|
|
|
|
|
attribute => 'Comment', |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
'Outscoped intern' => { |
92
|
|
|
|
|
|
|
callback => \&parseOutscopedintern, |
93
|
|
|
|
|
|
|
attribute => 'Comment', |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
'Preprocessor' => { |
96
|
|
|
|
|
|
|
callback => \&parsePreprocessor, |
97
|
|
|
|
|
|
|
attribute => 'Preprocessor', |
98
|
|
|
|
|
|
|
lineending => '#pop', |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
'String' => { |
101
|
|
|
|
|
|
|
callback => \&parseString, |
102
|
|
|
|
|
|
|
attribute => 'String', |
103
|
|
|
|
|
|
|
lineending => '#pop', |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
'comment' => { |
106
|
|
|
|
|
|
|
callback => \&parsecomment, |
107
|
|
|
|
|
|
|
attribute => 'Comment', |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
}); |
110
|
1
|
|
|
|
|
8
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
111
|
1
|
|
|
|
|
4
|
$self->basecontext('Normal'); |
112
|
1
|
|
|
|
|
9
|
$self->keywordscase(0); |
113
|
1
|
|
|
|
|
4
|
$self->initialize; |
114
|
1
|
|
|
|
|
4
|
bless ($self, $class); |
115
|
1
|
|
|
|
|
4
|
return $self; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub language { |
119
|
0
|
|
|
0
|
0
|
|
return 'ANSI C89'; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub parseDefine { |
123
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
124
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
125
|
|
|
|
|
|
|
# context => '#stay' |
126
|
|
|
|
|
|
|
# type => 'LineContinue' |
127
|
0
|
0
|
|
|
|
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) { |
128
|
0
|
|
|
|
|
|
return 1 |
129
|
|
|
|
|
|
|
} |
130
|
0
|
|
|
|
|
|
return 0; |
131
|
|
|
|
|
|
|
}; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub parseNormal { |
134
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
135
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
136
|
0
|
0
|
|
|
|
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
137
|
0
|
|
|
|
|
|
return 1 |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
# String => '#\s*if\s+0' |
140
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
141
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
142
|
|
|
|
|
|
|
# context => 'Outscoped' |
143
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
144
|
|
|
|
|
|
|
# type => 'RegExpr' |
145
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#\\s*if\\s+0', 0, 0, 0, undef, 1, 'Outscoped', 'Preprocessor')) { |
146
|
0
|
|
|
|
|
|
return 1 |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
149
|
|
|
|
|
|
|
# char => '#' |
150
|
|
|
|
|
|
|
# context => 'Preprocessor' |
151
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
152
|
|
|
|
|
|
|
# type => 'DetectChar' |
153
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Preprocessor', 'Preprocessor')) { |
154
|
0
|
|
|
|
|
|
return 1 |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
# String => 'keywords' |
157
|
|
|
|
|
|
|
# attribute => 'Keyword' |
158
|
|
|
|
|
|
|
# context => '#stay' |
159
|
|
|
|
|
|
|
# type => 'keyword' |
160
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
161
|
0
|
|
|
|
|
|
return 1 |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
# String => 'types' |
164
|
|
|
|
|
|
|
# attribute => 'Data Type' |
165
|
|
|
|
|
|
|
# context => '#stay' |
166
|
|
|
|
|
|
|
# type => 'keyword' |
167
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) { |
168
|
0
|
|
|
|
|
|
return 1 |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
# type => 'DetectIdentifier' |
171
|
0
|
0
|
|
|
|
|
if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
172
|
0
|
|
|
|
|
|
return 1 |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
# attribute => 'Symbol' |
175
|
|
|
|
|
|
|
# beginRegion => 'Brace1' |
176
|
|
|
|
|
|
|
# char => '{' |
177
|
|
|
|
|
|
|
# context => '#stay' |
178
|
|
|
|
|
|
|
# type => 'DetectChar' |
179
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
180
|
0
|
|
|
|
|
|
return 1 |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
# attribute => 'Symbol' |
183
|
|
|
|
|
|
|
# char => '}' |
184
|
|
|
|
|
|
|
# context => '#stay' |
185
|
|
|
|
|
|
|
# endRegion => 'Brace1' |
186
|
|
|
|
|
|
|
# type => 'DetectChar' |
187
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
188
|
0
|
|
|
|
|
|
return 1 |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
# attribute => 'Float' |
191
|
|
|
|
|
|
|
# context => '#stay' |
192
|
|
|
|
|
|
|
# items => 'ARRAY(0xec1180)' |
193
|
|
|
|
|
|
|
# type => 'Float' |
194
|
0
|
0
|
|
|
|
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
195
|
|
|
|
|
|
|
# String => 'fF' |
196
|
|
|
|
|
|
|
# attribute => 'Float' |
197
|
|
|
|
|
|
|
# context => '#stay' |
198
|
|
|
|
|
|
|
# type => 'AnyChar' |
199
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) { |
200
|
0
|
|
|
|
|
|
return 1 |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
# attribute => 'Octal' |
204
|
|
|
|
|
|
|
# context => '#stay' |
205
|
|
|
|
|
|
|
# type => 'HlCOct' |
206
|
0
|
0
|
|
|
|
|
if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) { |
207
|
0
|
|
|
|
|
|
return 1 |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
# attribute => 'Hex' |
210
|
|
|
|
|
|
|
# context => '#stay' |
211
|
|
|
|
|
|
|
# type => 'HlCHex' |
212
|
0
|
0
|
|
|
|
|
if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) { |
213
|
0
|
|
|
|
|
|
return 1 |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
# attribute => 'Decimal' |
216
|
|
|
|
|
|
|
# context => '#stay' |
217
|
|
|
|
|
|
|
# items => 'ARRAY(0xef8f50)' |
218
|
|
|
|
|
|
|
# type => 'Int' |
219
|
0
|
0
|
|
|
|
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
220
|
|
|
|
|
|
|
# String => 'ULL' |
221
|
|
|
|
|
|
|
# attribute => 'Decimal' |
222
|
|
|
|
|
|
|
# context => '#stay' |
223
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
224
|
|
|
|
|
|
|
# type => 'StringDetect' |
225
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
226
|
0
|
|
|
|
|
|
return 1 |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
# String => 'LUL' |
229
|
|
|
|
|
|
|
# attribute => 'Decimal' |
230
|
|
|
|
|
|
|
# context => '#stay' |
231
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
232
|
|
|
|
|
|
|
# type => 'StringDetect' |
233
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
234
|
0
|
|
|
|
|
|
return 1 |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
# String => 'LLU' |
237
|
|
|
|
|
|
|
# attribute => 'Decimal' |
238
|
|
|
|
|
|
|
# context => '#stay' |
239
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
240
|
|
|
|
|
|
|
# type => 'StringDetect' |
241
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
242
|
0
|
|
|
|
|
|
return 1 |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
# String => 'UL' |
245
|
|
|
|
|
|
|
# attribute => 'Decimal' |
246
|
|
|
|
|
|
|
# context => '#stay' |
247
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
248
|
|
|
|
|
|
|
# type => 'StringDetect' |
249
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
250
|
0
|
|
|
|
|
|
return 1 |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
# String => 'LU' |
253
|
|
|
|
|
|
|
# attribute => 'Decimal' |
254
|
|
|
|
|
|
|
# context => '#stay' |
255
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
256
|
|
|
|
|
|
|
# type => 'StringDetect' |
257
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
258
|
0
|
|
|
|
|
|
return 1 |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
# String => 'LL' |
261
|
|
|
|
|
|
|
# attribute => 'Decimal' |
262
|
|
|
|
|
|
|
# context => '#stay' |
263
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
264
|
|
|
|
|
|
|
# type => 'StringDetect' |
265
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
266
|
0
|
|
|
|
|
|
return 1 |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
# String => 'U' |
269
|
|
|
|
|
|
|
# attribute => 'Decimal' |
270
|
|
|
|
|
|
|
# context => '#stay' |
271
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
272
|
|
|
|
|
|
|
# type => 'StringDetect' |
273
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
274
|
0
|
|
|
|
|
|
return 1 |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
# String => 'L' |
277
|
|
|
|
|
|
|
# attribute => 'Decimal' |
278
|
|
|
|
|
|
|
# context => '#stay' |
279
|
|
|
|
|
|
|
# insensitive => 'TRUE' |
280
|
|
|
|
|
|
|
# type => 'StringDetect' |
281
|
0
|
0
|
|
|
|
|
if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
282
|
0
|
|
|
|
|
|
return 1 |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
# attribute => 'Char' |
286
|
|
|
|
|
|
|
# context => '#stay' |
287
|
|
|
|
|
|
|
# type => 'HlCChar' |
288
|
0
|
0
|
|
|
|
|
if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) { |
289
|
0
|
|
|
|
|
|
return 1 |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
# attribute => 'String' |
292
|
|
|
|
|
|
|
# char => '"' |
293
|
|
|
|
|
|
|
# context => 'String' |
294
|
|
|
|
|
|
|
# type => 'DetectChar' |
295
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
296
|
0
|
|
|
|
|
|
return 1 |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
# attribute => 'Comment' |
299
|
|
|
|
|
|
|
# beginRegion => 'blockcomment' |
300
|
|
|
|
|
|
|
# char => '/' |
301
|
|
|
|
|
|
|
# char1 => '*' |
302
|
|
|
|
|
|
|
# context => 'comment' |
303
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
304
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment', 'Comment')) { |
305
|
0
|
|
|
|
|
|
return 1 |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
# String => ':!%&()+,-/.*<=>?[]|~^;' |
308
|
|
|
|
|
|
|
# attribute => 'Symbol' |
309
|
|
|
|
|
|
|
# context => '#stay' |
310
|
|
|
|
|
|
|
# type => 'AnyChar' |
311
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) { |
312
|
0
|
|
|
|
|
|
return 1 |
313
|
|
|
|
|
|
|
} |
314
|
0
|
|
|
|
|
|
return 0; |
315
|
|
|
|
|
|
|
}; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
sub parseOutscoped { |
318
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
319
|
|
|
|
|
|
|
# attribute => 'Comment' |
320
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
321
|
|
|
|
|
|
|
# char => '/' |
322
|
|
|
|
|
|
|
# char1 => '*' |
323
|
|
|
|
|
|
|
# context => 'comment' |
324
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
325
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment', 'Comment')) { |
326
|
0
|
|
|
|
|
|
return 1 |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
# context => '##Alerts' |
329
|
|
|
|
|
|
|
# type => 'IncludeRules' |
330
|
0
|
0
|
|
|
|
|
if ($self->includePlugin('Alerts', $text)) { |
331
|
0
|
|
|
|
|
|
return 1 |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
# String => '#\s*if' |
334
|
|
|
|
|
|
|
# attribute => 'Comment' |
335
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
336
|
|
|
|
|
|
|
# context => 'Outscoped intern' |
337
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
338
|
|
|
|
|
|
|
# type => 'RegExpr' |
339
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) { |
340
|
0
|
|
|
|
|
|
return 1 |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
# String => '#\s*(endif|else|elif)' |
343
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
344
|
|
|
|
|
|
|
# context => '#pop' |
345
|
|
|
|
|
|
|
# endRegion => 'Outscoped' |
346
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
347
|
|
|
|
|
|
|
# type => 'RegExpr' |
348
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#\\s*(endif|else|elif)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) { |
349
|
0
|
|
|
|
|
|
return 1 |
350
|
|
|
|
|
|
|
} |
351
|
0
|
|
|
|
|
|
return 0; |
352
|
|
|
|
|
|
|
}; |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub parseOutscopedintern { |
355
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
356
|
|
|
|
|
|
|
# attribute => 'Comment' |
357
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
358
|
|
|
|
|
|
|
# char => '/' |
359
|
|
|
|
|
|
|
# char1 => '*' |
360
|
|
|
|
|
|
|
# context => 'comment' |
361
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
362
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment', 'Comment')) { |
363
|
0
|
|
|
|
|
|
return 1 |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
# String => '#\s*if' |
366
|
|
|
|
|
|
|
# attribute => 'Comment' |
367
|
|
|
|
|
|
|
# beginRegion => 'Outscoped' |
368
|
|
|
|
|
|
|
# context => 'Outscoped intern' |
369
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
370
|
|
|
|
|
|
|
# type => 'RegExpr' |
371
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) { |
372
|
0
|
|
|
|
|
|
return 1 |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
# String => '#\s*endif' |
375
|
|
|
|
|
|
|
# attribute => 'Comment' |
376
|
|
|
|
|
|
|
# context => '#pop' |
377
|
|
|
|
|
|
|
# endRegion => 'Outscoped' |
378
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
379
|
|
|
|
|
|
|
# type => 'RegExpr' |
380
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) { |
381
|
0
|
|
|
|
|
|
return 1 |
382
|
|
|
|
|
|
|
} |
383
|
0
|
|
|
|
|
|
return 0; |
384
|
|
|
|
|
|
|
}; |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
sub parsePreprocessor { |
387
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
388
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
389
|
|
|
|
|
|
|
# context => '#stay' |
390
|
|
|
|
|
|
|
# type => 'LineContinue' |
391
|
0
|
0
|
|
|
|
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) { |
392
|
0
|
|
|
|
|
|
return 1 |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
# String => 'define.*((?=\\))' |
395
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
396
|
|
|
|
|
|
|
# context => 'Define' |
397
|
|
|
|
|
|
|
# type => 'RegExpr' |
398
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, 'define.*((?=\\\\))', 0, 0, 0, undef, 0, 'Define', 'Preprocessor')) { |
399
|
0
|
|
|
|
|
|
return 1 |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
# String => 'define.*' |
402
|
|
|
|
|
|
|
# attribute => 'Preprocessor' |
403
|
|
|
|
|
|
|
# context => '#stay' |
404
|
|
|
|
|
|
|
# type => 'RegExpr' |
405
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, 'define.*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) { |
406
|
0
|
|
|
|
|
|
return 1 |
407
|
|
|
|
|
|
|
} |
408
|
|
|
|
|
|
|
# attribute => 'Prep. Lib' |
409
|
|
|
|
|
|
|
# char => '"' |
410
|
|
|
|
|
|
|
# char1 => '"' |
411
|
|
|
|
|
|
|
# context => '#stay' |
412
|
|
|
|
|
|
|
# type => 'RangeDetect' |
413
|
0
|
0
|
|
|
|
|
if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) { |
414
|
0
|
|
|
|
|
|
return 1 |
415
|
|
|
|
|
|
|
} |
416
|
|
|
|
|
|
|
# attribute => 'Prep. Lib' |
417
|
|
|
|
|
|
|
# char => '<' |
418
|
|
|
|
|
|
|
# char1 => '>' |
419
|
|
|
|
|
|
|
# context => '#stay' |
420
|
|
|
|
|
|
|
# type => 'RangeDetect' |
421
|
0
|
0
|
|
|
|
|
if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) { |
422
|
0
|
|
|
|
|
|
return 1 |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
# attribute => 'Comment' |
425
|
|
|
|
|
|
|
# beginRegion => 'blockcomment' |
426
|
|
|
|
|
|
|
# char => '/' |
427
|
|
|
|
|
|
|
# char1 => '*' |
428
|
|
|
|
|
|
|
# context => 'comment' |
429
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
430
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment', 'Comment')) { |
431
|
0
|
|
|
|
|
|
return 1 |
432
|
|
|
|
|
|
|
} |
433
|
0
|
|
|
|
|
|
return 0; |
434
|
|
|
|
|
|
|
}; |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub parseString { |
437
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
438
|
|
|
|
|
|
|
# attribute => 'String' |
439
|
|
|
|
|
|
|
# context => '#stay' |
440
|
|
|
|
|
|
|
# type => 'LineContinue' |
441
|
0
|
0
|
|
|
|
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) { |
442
|
0
|
|
|
|
|
|
return 1 |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
# attribute => 'String Char' |
445
|
|
|
|
|
|
|
# context => '#stay' |
446
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
447
|
0
|
0
|
|
|
|
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
448
|
0
|
|
|
|
|
|
return 1 |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
# attribute => 'String' |
451
|
|
|
|
|
|
|
# char => '"' |
452
|
|
|
|
|
|
|
# context => '#pop' |
453
|
|
|
|
|
|
|
# type => 'DetectChar' |
454
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
455
|
0
|
|
|
|
|
|
return 1 |
456
|
|
|
|
|
|
|
} |
457
|
0
|
|
|
|
|
|
return 0; |
458
|
|
|
|
|
|
|
}; |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
sub parsecomment { |
461
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
462
|
|
|
|
|
|
|
# attribute => 'Comment' |
463
|
|
|
|
|
|
|
# char => '*' |
464
|
|
|
|
|
|
|
# char1 => '/' |
465
|
|
|
|
|
|
|
# context => '#pop' |
466
|
|
|
|
|
|
|
# endRegion => 'blockcomment' |
467
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
468
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
469
|
0
|
|
|
|
|
|
return 1 |
470
|
|
|
|
|
|
|
} |
471
|
|
|
|
|
|
|
# context => '##Alerts' |
472
|
|
|
|
|
|
|
# type => 'IncludeRules' |
473
|
0
|
0
|
|
|
|
|
if ($self->includePlugin('Alerts', $text)) { |
474
|
0
|
|
|
|
|
|
return 1 |
475
|
|
|
|
|
|
|
} |
476
|
0
|
|
|
|
|
|
return 0; |
477
|
|
|
|
|
|
|
}; |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
1; |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
__END__ |