| 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 'awk.xml' file of the syntax highlight |
|
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 0.90 |
|
9
|
|
|
|
|
|
|
#kate version 2.3 |
|
10
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:04 2008, localtime |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::AWK; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
597
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
18
|
1
|
|
|
1
|
|
4
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
592
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
|
21
|
2
|
|
|
2
|
0
|
571
|
my $proto = shift; |
|
22
|
2
|
|
33
|
|
|
12
|
my $class = ref($proto) || $proto; |
|
23
|
2
|
|
|
|
|
12
|
my $self = $class->SUPER::new(@_); |
|
24
|
2
|
|
|
|
|
17
|
$self->attributes({ |
|
25
|
|
|
|
|
|
|
'Builtin' => 'DataType', |
|
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
|
27
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
|
28
|
|
|
|
|
|
|
'Field' => 'Others', |
|
29
|
|
|
|
|
|
|
'Float' => 'Float', |
|
30
|
|
|
|
|
|
|
'Function' => 'Function', |
|
31
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
|
32
|
|
|
|
|
|
|
'Normal' => 'Normal', |
|
33
|
|
|
|
|
|
|
'Pattern' => 'String', |
|
34
|
|
|
|
|
|
|
'String' => 'String', |
|
35
|
|
|
|
|
|
|
}); |
|
36
|
2
|
|
|
|
|
8
|
$self->listAdd('builtins', |
|
37
|
|
|
|
|
|
|
'ARGC', |
|
38
|
|
|
|
|
|
|
'ARGV', |
|
39
|
|
|
|
|
|
|
'CONVFMT', |
|
40
|
|
|
|
|
|
|
'ENVIRON', |
|
41
|
|
|
|
|
|
|
'FILENAME', |
|
42
|
|
|
|
|
|
|
'FNR', |
|
43
|
|
|
|
|
|
|
'FS', |
|
44
|
|
|
|
|
|
|
'NF', |
|
45
|
|
|
|
|
|
|
'NR', |
|
46
|
|
|
|
|
|
|
'OFMT', |
|
47
|
|
|
|
|
|
|
'OFS', |
|
48
|
|
|
|
|
|
|
'ORS', |
|
49
|
|
|
|
|
|
|
'RLENGTH', |
|
50
|
|
|
|
|
|
|
'RS', |
|
51
|
|
|
|
|
|
|
'RSTART', |
|
52
|
|
|
|
|
|
|
'SUBSEP', |
|
53
|
|
|
|
|
|
|
); |
|
54
|
2
|
|
|
|
|
6
|
$self->listAdd('functions', |
|
55
|
|
|
|
|
|
|
'atan2', |
|
56
|
|
|
|
|
|
|
'close', |
|
57
|
|
|
|
|
|
|
'cos', |
|
58
|
|
|
|
|
|
|
'exp', |
|
59
|
|
|
|
|
|
|
'fflush', |
|
60
|
|
|
|
|
|
|
'gensub', |
|
61
|
|
|
|
|
|
|
'gsub', |
|
62
|
|
|
|
|
|
|
'index', |
|
63
|
|
|
|
|
|
|
'int', |
|
64
|
|
|
|
|
|
|
'length', |
|
65
|
|
|
|
|
|
|
'log', |
|
66
|
|
|
|
|
|
|
'match', |
|
67
|
|
|
|
|
|
|
'rand', |
|
68
|
|
|
|
|
|
|
'sin', |
|
69
|
|
|
|
|
|
|
'split', |
|
70
|
|
|
|
|
|
|
'sprintf', |
|
71
|
|
|
|
|
|
|
'sqrt', |
|
72
|
|
|
|
|
|
|
'srand', |
|
73
|
|
|
|
|
|
|
'sub', |
|
74
|
|
|
|
|
|
|
'substr', |
|
75
|
|
|
|
|
|
|
'system', |
|
76
|
|
|
|
|
|
|
'tolower', |
|
77
|
|
|
|
|
|
|
'toupper', |
|
78
|
|
|
|
|
|
|
); |
|
79
|
2
|
|
|
|
|
4
|
$self->listAdd('keywords', |
|
80
|
|
|
|
|
|
|
'break', |
|
81
|
|
|
|
|
|
|
'continue', |
|
82
|
|
|
|
|
|
|
'do', |
|
83
|
|
|
|
|
|
|
'else', |
|
84
|
|
|
|
|
|
|
'exit', |
|
85
|
|
|
|
|
|
|
'for', |
|
86
|
|
|
|
|
|
|
'function', |
|
87
|
|
|
|
|
|
|
'getline', |
|
88
|
|
|
|
|
|
|
'if', |
|
89
|
|
|
|
|
|
|
'in', |
|
90
|
|
|
|
|
|
|
'next', |
|
91
|
|
|
|
|
|
|
'print', |
|
92
|
|
|
|
|
|
|
'printf', |
|
93
|
|
|
|
|
|
|
'return', |
|
94
|
|
|
|
|
|
|
'while', |
|
95
|
|
|
|
|
|
|
); |
|
96
|
2
|
|
|
|
|
17
|
$self->contextdata({ |
|
97
|
|
|
|
|
|
|
'Base' => { |
|
98
|
|
|
|
|
|
|
callback => \&parseBase, |
|
99
|
|
|
|
|
|
|
attribute => 'Normal', |
|
100
|
|
|
|
|
|
|
}, |
|
101
|
|
|
|
|
|
|
'Comment' => { |
|
102
|
|
|
|
|
|
|
callback => \&parseComment, |
|
103
|
|
|
|
|
|
|
attribute => 'Comment', |
|
104
|
|
|
|
|
|
|
lineending => '#pop', |
|
105
|
|
|
|
|
|
|
}, |
|
106
|
|
|
|
|
|
|
'String' => { |
|
107
|
|
|
|
|
|
|
callback => \&parseString, |
|
108
|
|
|
|
|
|
|
attribute => 'String', |
|
109
|
|
|
|
|
|
|
}, |
|
110
|
|
|
|
|
|
|
}); |
|
111
|
2
|
|
|
|
|
8
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
|
112
|
2
|
|
|
|
|
7
|
$self->basecontext('Base'); |
|
113
|
2
|
|
|
|
|
8
|
$self->keywordscase(0); |
|
114
|
2
|
|
|
|
|
4
|
$self->initialize; |
|
115
|
2
|
|
|
|
|
4
|
bless ($self, $class); |
|
116
|
2
|
|
|
|
|
8
|
return $self; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub language { |
|
120
|
0
|
|
|
0
|
0
|
0
|
return 'AWK'; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub parseBase { |
|
124
|
136
|
|
|
136
|
0
|
198
|
my ($self, $text) = @_; |
|
125
|
|
|
|
|
|
|
# String => '\b(BEGIN|END)\b' |
|
126
|
|
|
|
|
|
|
# attribute => 'Pattern' |
|
127
|
|
|
|
|
|
|
# context => '#stay' |
|
128
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
129
|
136
|
100
|
|
|
|
290
|
if ($self->testRegExpr($text, '\\b(BEGIN|END)\\b', 0, 0, 0, undef, 0, '#stay', 'Pattern')) { |
|
130
|
4
|
|
|
|
|
9
|
return 1 |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
# String => '/([^\/[]|\\.|\[\]?(\[[^]]+\]|.)+\])+/' |
|
133
|
|
|
|
|
|
|
# attribute => 'Pattern' |
|
134
|
|
|
|
|
|
|
# context => '#stay' |
|
135
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
136
|
132
|
100
|
|
|
|
291
|
if ($self->testRegExpr($text, '/([^\\/[]|\\\\.|\\[\\]?(\\[[^]]+\\]|.)+\\])+/', 0, 0, 0, undef, 0, '#stay', 'Pattern')) { |
|
137
|
10
|
|
|
|
|
22
|
return 1 |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
# attribute => 'Keyword' |
|
140
|
|
|
|
|
|
|
# beginRegion => 'block' |
|
141
|
|
|
|
|
|
|
# char => '{' |
|
142
|
|
|
|
|
|
|
# context => '#stay' |
|
143
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
144
|
122
|
100
|
|
|
|
315
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
|
145
|
8
|
|
|
|
|
17
|
return 1 |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
# attribute => 'Keyword' |
|
148
|
|
|
|
|
|
|
# char => '}' |
|
149
|
|
|
|
|
|
|
# context => '#stay' |
|
150
|
|
|
|
|
|
|
# endRegion => 'block' |
|
151
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
152
|
114
|
100
|
|
|
|
240
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
|
153
|
8
|
|
|
|
|
16
|
return 1 |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
# attribute => 'Comment' |
|
156
|
|
|
|
|
|
|
# char => '#' |
|
157
|
|
|
|
|
|
|
# context => 'Comment' |
|
158
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
159
|
106
|
100
|
|
|
|
221
|
if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
|
160
|
10
|
|
|
|
|
28
|
return 1 |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
# attribute => 'String' |
|
163
|
|
|
|
|
|
|
# char => '"' |
|
164
|
|
|
|
|
|
|
# context => 'String' |
|
165
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
166
|
96
|
100
|
|
|
|
200
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
|
167
|
2
|
|
|
|
|
4
|
return 1 |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
# String => 'keywords' |
|
170
|
|
|
|
|
|
|
# attribute => 'Keyword' |
|
171
|
|
|
|
|
|
|
# context => '#stay' |
|
172
|
|
|
|
|
|
|
# type => 'keyword' |
|
173
|
94
|
100
|
|
|
|
211
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
|
174
|
4
|
|
|
|
|
10
|
return 1 |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
# String => 'builtins' |
|
177
|
|
|
|
|
|
|
# attribute => 'Builtin' |
|
178
|
|
|
|
|
|
|
# context => '#stay' |
|
179
|
|
|
|
|
|
|
# type => 'keyword' |
|
180
|
90
|
50
|
|
|
|
195
|
if ($self->testKeyword($text, 'builtins', 0, undef, 0, '#stay', 'Builtin')) { |
|
181
|
0
|
|
|
|
|
0
|
return 1 |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
# String => 'functions' |
|
184
|
|
|
|
|
|
|
# attribute => 'Function' |
|
185
|
|
|
|
|
|
|
# context => '#stay' |
|
186
|
|
|
|
|
|
|
# type => 'keyword' |
|
187
|
90
|
50
|
|
|
|
203
|
if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) { |
|
188
|
0
|
|
|
|
|
0
|
return 1 |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
# attribute => 'Float' |
|
191
|
|
|
|
|
|
|
# context => '#stay' |
|
192
|
|
|
|
|
|
|
# type => 'Float' |
|
193
|
90
|
100
|
|
|
|
199
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
|
194
|
4
|
|
|
|
|
8
|
return 1 |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
# attribute => 'Decimal' |
|
197
|
|
|
|
|
|
|
# context => '#stay' |
|
198
|
|
|
|
|
|
|
# type => 'Int' |
|
199
|
86
|
50
|
|
|
|
183
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
|
200
|
0
|
|
|
|
|
0
|
return 1 |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
# String => '\$[A-Za-z0-9_]+' |
|
203
|
|
|
|
|
|
|
# attribute => 'Field' |
|
204
|
|
|
|
|
|
|
# context => '#stay' |
|
205
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
206
|
86
|
100
|
|
|
|
183
|
if ($self->testRegExpr($text, '\\$[A-Za-z0-9_]+', 0, 0, 0, undef, 0, '#stay', 'Field')) { |
|
207
|
2
|
|
|
|
|
6
|
return 1 |
|
208
|
|
|
|
|
|
|
} |
|
209
|
84
|
|
|
|
|
155
|
return 0; |
|
210
|
|
|
|
|
|
|
}; |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub parseComment { |
|
213
|
352
|
|
|
352
|
0
|
473
|
my ($self, $text) = @_; |
|
214
|
|
|
|
|
|
|
# context => '##Alerts' |
|
215
|
|
|
|
|
|
|
# type => 'IncludeRules' |
|
216
|
352
|
50
|
|
|
|
601
|
if ($self->includePlugin('Alerts', $text)) { |
|
217
|
0
|
|
|
|
|
0
|
return 1 |
|
218
|
|
|
|
|
|
|
} |
|
219
|
352
|
|
|
|
|
544
|
return 0; |
|
220
|
|
|
|
|
|
|
}; |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub parseString { |
|
223
|
22
|
|
|
22
|
0
|
35
|
my ($self, $text) = @_; |
|
224
|
|
|
|
|
|
|
# attribute => 'String' |
|
225
|
|
|
|
|
|
|
# char => '"' |
|
226
|
|
|
|
|
|
|
# context => '#pop' |
|
227
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
228
|
22
|
100
|
|
|
|
44
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
|
229
|
2
|
|
|
|
|
5
|
return 1 |
|
230
|
|
|
|
|
|
|
} |
|
231
|
|
|
|
|
|
|
# attribute => 'String' |
|
232
|
|
|
|
|
|
|
# context => '#stay' |
|
233
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
|
234
|
20
|
50
|
|
|
|
47
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String')) { |
|
235
|
0
|
|
|
|
|
0
|
return 1 |
|
236
|
|
|
|
|
|
|
} |
|
237
|
20
|
|
|
|
|
32
|
return 0; |
|
238
|
|
|
|
|
|
|
}; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
1; |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
__END__ |