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 'lua.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 0.22 |
9
|
|
|
|
|
|
|
#kate version 2.3 |
10
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Lua; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1079
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
17
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
18
|
1
|
|
|
1
|
|
6
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
984
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
0
|
745
|
my $proto = shift; |
22
|
1
|
|
33
|
|
|
11
|
my $class = ref($proto) || $proto; |
23
|
1
|
|
|
|
|
14
|
my $self = $class->SUPER::new(@_); |
24
|
1
|
|
|
|
|
16
|
$self->attributes({ |
25
|
|
|
|
|
|
|
'Alert' => 'Alert', |
26
|
|
|
|
|
|
|
'BaseFunc' => 'Normal', |
27
|
|
|
|
|
|
|
'Comment' => 'Comment', |
28
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
29
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
30
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
31
|
|
|
|
|
|
|
'Number' => 'BaseN', |
32
|
|
|
|
|
|
|
'String' => 'String', |
33
|
|
|
|
|
|
|
'Symbol' => 'Normal', |
34
|
|
|
|
|
|
|
}); |
35
|
1
|
|
|
|
|
18
|
$self->listAdd('basefunc', |
36
|
|
|
|
|
|
|
'LUA_PATH', |
37
|
|
|
|
|
|
|
'_ALERT', |
38
|
|
|
|
|
|
|
'_ERRORMESSAGE', |
39
|
|
|
|
|
|
|
'_LOADED', |
40
|
|
|
|
|
|
|
'_VERSION', |
41
|
|
|
|
|
|
|
'abs', |
42
|
|
|
|
|
|
|
'acos', |
43
|
|
|
|
|
|
|
'appendto', |
44
|
|
|
|
|
|
|
'ascii', |
45
|
|
|
|
|
|
|
'asin', |
46
|
|
|
|
|
|
|
'assert', |
47
|
|
|
|
|
|
|
'atan', |
48
|
|
|
|
|
|
|
'atan2', |
49
|
|
|
|
|
|
|
'call', |
50
|
|
|
|
|
|
|
'ceil', |
51
|
|
|
|
|
|
|
'clock', |
52
|
|
|
|
|
|
|
'closefile', |
53
|
|
|
|
|
|
|
'collectgarbage', |
54
|
|
|
|
|
|
|
'copytagmethods', |
55
|
|
|
|
|
|
|
'cos', |
56
|
|
|
|
|
|
|
'date', |
57
|
|
|
|
|
|
|
'debug.gethook', |
58
|
|
|
|
|
|
|
'debug.getinfo', |
59
|
|
|
|
|
|
|
'debug.getlocal', |
60
|
|
|
|
|
|
|
'debug.sethook', |
61
|
|
|
|
|
|
|
'debug.setlocal', |
62
|
|
|
|
|
|
|
'deg', |
63
|
|
|
|
|
|
|
'dofile', |
64
|
|
|
|
|
|
|
'dostring', |
65
|
|
|
|
|
|
|
'error', |
66
|
|
|
|
|
|
|
'execute', |
67
|
|
|
|
|
|
|
'exit', |
68
|
|
|
|
|
|
|
'exp', |
69
|
|
|
|
|
|
|
'floor', |
70
|
|
|
|
|
|
|
'flush', |
71
|
|
|
|
|
|
|
'foreach', |
72
|
|
|
|
|
|
|
'foreachi', |
73
|
|
|
|
|
|
|
'format', |
74
|
|
|
|
|
|
|
'frexp', |
75
|
|
|
|
|
|
|
'gcinfo', |
76
|
|
|
|
|
|
|
'getenv', |
77
|
|
|
|
|
|
|
'getglobal', |
78
|
|
|
|
|
|
|
'getglobals', |
79
|
|
|
|
|
|
|
'getinfo', |
80
|
|
|
|
|
|
|
'getlocal', |
81
|
|
|
|
|
|
|
'getmetatable', |
82
|
|
|
|
|
|
|
'getn', |
83
|
|
|
|
|
|
|
'gettagmethod', |
84
|
|
|
|
|
|
|
'globals', |
85
|
|
|
|
|
|
|
'gsub', |
86
|
|
|
|
|
|
|
'io.close', |
87
|
|
|
|
|
|
|
'io.flush', |
88
|
|
|
|
|
|
|
'io.input', |
89
|
|
|
|
|
|
|
'io.lines', |
90
|
|
|
|
|
|
|
'io.open', |
91
|
|
|
|
|
|
|
'io.output', |
92
|
|
|
|
|
|
|
'io.read', |
93
|
|
|
|
|
|
|
'io.stderr', |
94
|
|
|
|
|
|
|
'io.stdin', |
95
|
|
|
|
|
|
|
'io.stdout', |
96
|
|
|
|
|
|
|
'io.tmpfile', |
97
|
|
|
|
|
|
|
'io.write', |
98
|
|
|
|
|
|
|
'ipairs', |
99
|
|
|
|
|
|
|
'ldexp', |
100
|
|
|
|
|
|
|
'loadfile', |
101
|
|
|
|
|
|
|
'loadstring', |
102
|
|
|
|
|
|
|
'log', |
103
|
|
|
|
|
|
|
'log10', |
104
|
|
|
|
|
|
|
'math.abs', |
105
|
|
|
|
|
|
|
'math.acos', |
106
|
|
|
|
|
|
|
'math.asin', |
107
|
|
|
|
|
|
|
'math.atan', |
108
|
|
|
|
|
|
|
'math.atan2', |
109
|
|
|
|
|
|
|
'math.ceil', |
110
|
|
|
|
|
|
|
'math.cos', |
111
|
|
|
|
|
|
|
'math.deg', |
112
|
|
|
|
|
|
|
'math.exp', |
113
|
|
|
|
|
|
|
'math.floor', |
114
|
|
|
|
|
|
|
'math.frexp', |
115
|
|
|
|
|
|
|
'math.ldexp', |
116
|
|
|
|
|
|
|
'math.log', |
117
|
|
|
|
|
|
|
'math.log10', |
118
|
|
|
|
|
|
|
'math.max', |
119
|
|
|
|
|
|
|
'math.min', |
120
|
|
|
|
|
|
|
'math.mod', |
121
|
|
|
|
|
|
|
'math.rad', |
122
|
|
|
|
|
|
|
'math.random', |
123
|
|
|
|
|
|
|
'math.randomseed', |
124
|
|
|
|
|
|
|
'math.sin', |
125
|
|
|
|
|
|
|
'math.squrt', |
126
|
|
|
|
|
|
|
'math.tan', |
127
|
|
|
|
|
|
|
'max', |
128
|
|
|
|
|
|
|
'min', |
129
|
|
|
|
|
|
|
'mod', |
130
|
|
|
|
|
|
|
'newtag', |
131
|
|
|
|
|
|
|
'next', |
132
|
|
|
|
|
|
|
'openfile', |
133
|
|
|
|
|
|
|
'os.clock', |
134
|
|
|
|
|
|
|
'os.date', |
135
|
|
|
|
|
|
|
'os.difftime', |
136
|
|
|
|
|
|
|
'os.execute', |
137
|
|
|
|
|
|
|
'os.exit', |
138
|
|
|
|
|
|
|
'os.getenv', |
139
|
|
|
|
|
|
|
'os.remove', |
140
|
|
|
|
|
|
|
'os.rename', |
141
|
|
|
|
|
|
|
'os.setlocale', |
142
|
|
|
|
|
|
|
'os.time', |
143
|
|
|
|
|
|
|
'os.tmpname', |
144
|
|
|
|
|
|
|
'pairs', |
145
|
|
|
|
|
|
|
'pcall', |
146
|
|
|
|
|
|
|
'print', |
147
|
|
|
|
|
|
|
'rad', |
148
|
|
|
|
|
|
|
'random', |
149
|
|
|
|
|
|
|
'randomseed', |
150
|
|
|
|
|
|
|
'rawget', |
151
|
|
|
|
|
|
|
'rawset', |
152
|
|
|
|
|
|
|
'read', |
153
|
|
|
|
|
|
|
'readfrom', |
154
|
|
|
|
|
|
|
'remove', |
155
|
|
|
|
|
|
|
'rename', |
156
|
|
|
|
|
|
|
'require', |
157
|
|
|
|
|
|
|
'seek', |
158
|
|
|
|
|
|
|
'setcallhook', |
159
|
|
|
|
|
|
|
'setglobal', |
160
|
|
|
|
|
|
|
'setglobals', |
161
|
|
|
|
|
|
|
'setlinehook', |
162
|
|
|
|
|
|
|
'setlocal', |
163
|
|
|
|
|
|
|
'setlocale', |
164
|
|
|
|
|
|
|
'setmetatable', |
165
|
|
|
|
|
|
|
'settag', |
166
|
|
|
|
|
|
|
'settagmethod', |
167
|
|
|
|
|
|
|
'sin', |
168
|
|
|
|
|
|
|
'sort', |
169
|
|
|
|
|
|
|
'squrt', |
170
|
|
|
|
|
|
|
'strbyte', |
171
|
|
|
|
|
|
|
'strchar', |
172
|
|
|
|
|
|
|
'strfind', |
173
|
|
|
|
|
|
|
'string.byte', |
174
|
|
|
|
|
|
|
'string.char', |
175
|
|
|
|
|
|
|
'string.find', |
176
|
|
|
|
|
|
|
'string.format', |
177
|
|
|
|
|
|
|
'string.gfind', |
178
|
|
|
|
|
|
|
'string.gsub', |
179
|
|
|
|
|
|
|
'string.len', |
180
|
|
|
|
|
|
|
'string.lower', |
181
|
|
|
|
|
|
|
'string.rep', |
182
|
|
|
|
|
|
|
'string.sub', |
183
|
|
|
|
|
|
|
'string.upper', |
184
|
|
|
|
|
|
|
'strlen', |
185
|
|
|
|
|
|
|
'strlower', |
186
|
|
|
|
|
|
|
'strrep', |
187
|
|
|
|
|
|
|
'strsub', |
188
|
|
|
|
|
|
|
'strupper', |
189
|
|
|
|
|
|
|
'table.concat', |
190
|
|
|
|
|
|
|
'table.foreach', |
191
|
|
|
|
|
|
|
'table.foreachi', |
192
|
|
|
|
|
|
|
'table.getn', |
193
|
|
|
|
|
|
|
'table.insert', |
194
|
|
|
|
|
|
|
'table.remove', |
195
|
|
|
|
|
|
|
'table.setn', |
196
|
|
|
|
|
|
|
'table.sort', |
197
|
|
|
|
|
|
|
'tag', |
198
|
|
|
|
|
|
|
'tan', |
199
|
|
|
|
|
|
|
'tinsert', |
200
|
|
|
|
|
|
|
'tmpname', |
201
|
|
|
|
|
|
|
'tonumber', |
202
|
|
|
|
|
|
|
'tostring', |
203
|
|
|
|
|
|
|
'tremove', |
204
|
|
|
|
|
|
|
'type', |
205
|
|
|
|
|
|
|
'unpack', |
206
|
|
|
|
|
|
|
'write', |
207
|
|
|
|
|
|
|
'writeto', |
208
|
|
|
|
|
|
|
); |
209
|
1
|
|
|
|
|
7
|
$self->listAdd('keywords', |
210
|
|
|
|
|
|
|
'and', |
211
|
|
|
|
|
|
|
'break', |
212
|
|
|
|
|
|
|
'do', |
213
|
|
|
|
|
|
|
'else', |
214
|
|
|
|
|
|
|
'elsif', |
215
|
|
|
|
|
|
|
'end', |
216
|
|
|
|
|
|
|
'for', |
217
|
|
|
|
|
|
|
'function', |
218
|
|
|
|
|
|
|
'if', |
219
|
|
|
|
|
|
|
'in', |
220
|
|
|
|
|
|
|
'local', |
221
|
|
|
|
|
|
|
'nil', |
222
|
|
|
|
|
|
|
'not', |
223
|
|
|
|
|
|
|
'or', |
224
|
|
|
|
|
|
|
'repeat', |
225
|
|
|
|
|
|
|
'return', |
226
|
|
|
|
|
|
|
'then', |
227
|
|
|
|
|
|
|
'until', |
228
|
|
|
|
|
|
|
'while', |
229
|
|
|
|
|
|
|
); |
230
|
1
|
|
|
|
|
18
|
$self->contextdata({ |
231
|
|
|
|
|
|
|
'Comment' => { |
232
|
|
|
|
|
|
|
callback => \&parseComment, |
233
|
|
|
|
|
|
|
attribute => 'Comment', |
234
|
|
|
|
|
|
|
lineending => '#pop', |
235
|
|
|
|
|
|
|
}, |
236
|
|
|
|
|
|
|
'Normal' => { |
237
|
|
|
|
|
|
|
callback => \&parseNormal, |
238
|
|
|
|
|
|
|
attribute => 'Normal Text', |
239
|
|
|
|
|
|
|
}, |
240
|
|
|
|
|
|
|
'String' => { |
241
|
|
|
|
|
|
|
callback => \&parseString, |
242
|
|
|
|
|
|
|
attribute => 'String', |
243
|
|
|
|
|
|
|
lineending => '#pop', |
244
|
|
|
|
|
|
|
}, |
245
|
|
|
|
|
|
|
}); |
246
|
1
|
|
|
|
|
11
|
$self->deliminators('\\s||\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|\\.'); |
247
|
1
|
|
|
|
|
6
|
$self->basecontext('Normal'); |
248
|
1
|
|
|
|
|
8
|
$self->keywordscase(0); |
249
|
1
|
|
|
|
|
5
|
$self->initialize; |
250
|
1
|
|
|
|
|
4
|
bless ($self, $class); |
251
|
1
|
|
|
|
|
3
|
return $self; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub language { |
255
|
0
|
|
|
0
|
0
|
|
return 'Lua'; |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub parseComment { |
259
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
260
|
|
|
|
|
|
|
# String => '(FIXME|TODO)' |
261
|
|
|
|
|
|
|
# attribute => 'Alert' |
262
|
|
|
|
|
|
|
# context => '#stay' |
263
|
|
|
|
|
|
|
# type => 'RegExpr' |
264
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) { |
265
|
0
|
|
|
|
|
|
return 1 |
266
|
|
|
|
|
|
|
} |
267
|
0
|
|
|
|
|
|
return 0; |
268
|
|
|
|
|
|
|
}; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub parseNormal { |
271
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
272
|
|
|
|
|
|
|
# String => 'keywords' |
273
|
|
|
|
|
|
|
# attribute => 'Keyword' |
274
|
|
|
|
|
|
|
# context => '#stay' |
275
|
|
|
|
|
|
|
# type => 'keyword' |
276
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
277
|
0
|
|
|
|
|
|
return 1 |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
# String => 'basefunc' |
280
|
|
|
|
|
|
|
# attribute => 'BaseFunc' |
281
|
|
|
|
|
|
|
# context => '#stay' |
282
|
|
|
|
|
|
|
# type => 'keyword' |
283
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'basefunc', 0, undef, 0, '#stay', 'BaseFunc')) { |
284
|
0
|
|
|
|
|
|
return 1 |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
# attribute => 'Char' |
287
|
|
|
|
|
|
|
# context => '#stay' |
288
|
|
|
|
|
|
|
# type => 'HlCChar' |
289
|
|
|
|
|
|
|
#This rule is buggy, not sending it to output |
290
|
|
|
|
|
|
|
# attribute => 'Comment' |
291
|
|
|
|
|
|
|
# char => '-' |
292
|
|
|
|
|
|
|
# char1 => '-' |
293
|
|
|
|
|
|
|
# context => 'Comment' |
294
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
295
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
296
|
0
|
|
|
|
|
|
return 1 |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
# attribute => 'Comment' |
299
|
|
|
|
|
|
|
# char => '#' |
300
|
|
|
|
|
|
|
# context => 'Comment' |
301
|
|
|
|
|
|
|
# type => 'DetectChar' |
302
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
303
|
0
|
|
|
|
|
|
return 1 |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
# attribute => 'String' |
306
|
|
|
|
|
|
|
# char => '"' |
307
|
|
|
|
|
|
|
# context => 'String' |
308
|
|
|
|
|
|
|
# type => 'DetectChar' |
309
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
310
|
0
|
|
|
|
|
|
return 1 |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
# String => '!%&()+,-<=>?[]^{|}~' |
313
|
|
|
|
|
|
|
# attribute => 'Symbol' |
314
|
|
|
|
|
|
|
# context => '#stay' |
315
|
|
|
|
|
|
|
# type => 'AnyChar' |
316
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, '!%&()+,-<=>?[]^{|}~', 0, 0, undef, 0, '#stay', 'Symbol')) { |
317
|
0
|
|
|
|
|
|
return 1 |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
# String => '\d*\.?\d*e?\d+' |
320
|
|
|
|
|
|
|
# attribute => 'Number' |
321
|
|
|
|
|
|
|
# context => '#stay' |
322
|
|
|
|
|
|
|
# type => 'RegExpr' |
323
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\d*\\.?\\d*e?\\d+', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
324
|
0
|
|
|
|
|
|
return 1 |
325
|
|
|
|
|
|
|
} |
326
|
0
|
|
|
|
|
|
return 0; |
327
|
|
|
|
|
|
|
}; |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub parseString { |
330
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
331
|
|
|
|
|
|
|
# attribute => 'String' |
332
|
|
|
|
|
|
|
# char => '"' |
333
|
|
|
|
|
|
|
# context => '#pop' |
334
|
|
|
|
|
|
|
# type => 'DetectChar' |
335
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
336
|
0
|
|
|
|
|
|
return 1 |
337
|
|
|
|
|
|
|
} |
338
|
0
|
|
|
|
|
|
return 0; |
339
|
|
|
|
|
|
|
}; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
1; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
__END__ |