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 'haskell.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.04 |
9
|
|
|
|
|
|
|
#kate version 2.3 |
10
|
|
|
|
|
|
|
#kate author Marcel Martin (mmar@freenet.de) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Haskell; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
700
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
19
|
1
|
|
|
1
|
|
9
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1075
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
741
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
11
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
15
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
36
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Char' => 'Char', |
27
|
|
|
|
|
|
|
'Class' => 'Keyword', |
28
|
|
|
|
|
|
|
'Comment' => 'Comment', |
29
|
|
|
|
|
|
|
'Constructor' => 'Others', |
30
|
|
|
|
|
|
|
'Data Constructor' => 'Keyword', |
31
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
32
|
|
|
|
|
|
|
'Float' => 'Float', |
33
|
|
|
|
|
|
|
'Function' => 'Function', |
34
|
|
|
|
|
|
|
'Function Definition' => 'Function', |
35
|
|
|
|
|
|
|
'Infix Operator' => 'Others', |
36
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
37
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
38
|
|
|
|
|
|
|
'String' => 'String', |
39
|
|
|
|
|
|
|
'Type Constructor' => 'DataType', |
40
|
|
|
|
|
|
|
}); |
41
|
2
|
|
|
|
|
14
|
$self->listAdd('classes', |
42
|
|
|
|
|
|
|
'Bounded', |
43
|
|
|
|
|
|
|
'Enum', |
44
|
|
|
|
|
|
|
'Eq', |
45
|
|
|
|
|
|
|
'Floating', |
46
|
|
|
|
|
|
|
'Fractional', |
47
|
|
|
|
|
|
|
'Functor', |
48
|
|
|
|
|
|
|
'Integral', |
49
|
|
|
|
|
|
|
'Ix', |
50
|
|
|
|
|
|
|
'Monad', |
51
|
|
|
|
|
|
|
'Num', |
52
|
|
|
|
|
|
|
'Ord', |
53
|
|
|
|
|
|
|
'Read', |
54
|
|
|
|
|
|
|
'Real', |
55
|
|
|
|
|
|
|
'RealFloat', |
56
|
|
|
|
|
|
|
'RealFrac', |
57
|
|
|
|
|
|
|
'Show', |
58
|
|
|
|
|
|
|
); |
59
|
2
|
|
|
|
|
8
|
$self->listAdd('data constructors', |
60
|
|
|
|
|
|
|
'EQ', |
61
|
|
|
|
|
|
|
'False', |
62
|
|
|
|
|
|
|
'GT', |
63
|
|
|
|
|
|
|
'Just', |
64
|
|
|
|
|
|
|
'LT', |
65
|
|
|
|
|
|
|
'Left', |
66
|
|
|
|
|
|
|
'Nothing', |
67
|
|
|
|
|
|
|
'Right', |
68
|
|
|
|
|
|
|
'True', |
69
|
|
|
|
|
|
|
); |
70
|
2
|
|
|
|
|
14
|
$self->listAdd('functions', |
71
|
|
|
|
|
|
|
'FilePath', |
72
|
|
|
|
|
|
|
'IOError', |
73
|
|
|
|
|
|
|
'abs', |
74
|
|
|
|
|
|
|
'acos', |
75
|
|
|
|
|
|
|
'acosh', |
76
|
|
|
|
|
|
|
'all', |
77
|
|
|
|
|
|
|
'and', |
78
|
|
|
|
|
|
|
'any', |
79
|
|
|
|
|
|
|
'appendFile', |
80
|
|
|
|
|
|
|
'approxRational', |
81
|
|
|
|
|
|
|
'asTypeOf', |
82
|
|
|
|
|
|
|
'asin', |
83
|
|
|
|
|
|
|
'asinh', |
84
|
|
|
|
|
|
|
'atan', |
85
|
|
|
|
|
|
|
'atan2', |
86
|
|
|
|
|
|
|
'atanh', |
87
|
|
|
|
|
|
|
'basicIORun', |
88
|
|
|
|
|
|
|
'break', |
89
|
|
|
|
|
|
|
'catch', |
90
|
|
|
|
|
|
|
'ceiling', |
91
|
|
|
|
|
|
|
'chr', |
92
|
|
|
|
|
|
|
'compare', |
93
|
|
|
|
|
|
|
'concat', |
94
|
|
|
|
|
|
|
'concatMap', |
95
|
|
|
|
|
|
|
'const', |
96
|
|
|
|
|
|
|
'cos', |
97
|
|
|
|
|
|
|
'cosh', |
98
|
|
|
|
|
|
|
'curry', |
99
|
|
|
|
|
|
|
'cycle', |
100
|
|
|
|
|
|
|
'decodeFloat', |
101
|
|
|
|
|
|
|
'denominator', |
102
|
|
|
|
|
|
|
'digitToInt', |
103
|
|
|
|
|
|
|
'div', |
104
|
|
|
|
|
|
|
'divMod', |
105
|
|
|
|
|
|
|
'drop', |
106
|
|
|
|
|
|
|
'dropWhile', |
107
|
|
|
|
|
|
|
'either', |
108
|
|
|
|
|
|
|
'elem', |
109
|
|
|
|
|
|
|
'encodeFloat', |
110
|
|
|
|
|
|
|
'enumFrom', |
111
|
|
|
|
|
|
|
'enumFromThen', |
112
|
|
|
|
|
|
|
'enumFromThenTo', |
113
|
|
|
|
|
|
|
'enumFromTo', |
114
|
|
|
|
|
|
|
'error', |
115
|
|
|
|
|
|
|
'even', |
116
|
|
|
|
|
|
|
'exp', |
117
|
|
|
|
|
|
|
'exponent', |
118
|
|
|
|
|
|
|
'fail', |
119
|
|
|
|
|
|
|
'filter', |
120
|
|
|
|
|
|
|
'flip', |
121
|
|
|
|
|
|
|
'floatDigits', |
122
|
|
|
|
|
|
|
'floatRadix', |
123
|
|
|
|
|
|
|
'floatRange', |
124
|
|
|
|
|
|
|
'floor', |
125
|
|
|
|
|
|
|
'fmap', |
126
|
|
|
|
|
|
|
'foldl', |
127
|
|
|
|
|
|
|
'foldl1', |
128
|
|
|
|
|
|
|
'foldr', |
129
|
|
|
|
|
|
|
'foldr1', |
130
|
|
|
|
|
|
|
'fromDouble', |
131
|
|
|
|
|
|
|
'fromEnum', |
132
|
|
|
|
|
|
|
'fromInt', |
133
|
|
|
|
|
|
|
'fromInteger', |
134
|
|
|
|
|
|
|
'fromIntegral', |
135
|
|
|
|
|
|
|
'fromRational', |
136
|
|
|
|
|
|
|
'fst', |
137
|
|
|
|
|
|
|
'gcd', |
138
|
|
|
|
|
|
|
'getChar', |
139
|
|
|
|
|
|
|
'getContents', |
140
|
|
|
|
|
|
|
'getLine', |
141
|
|
|
|
|
|
|
'head', |
142
|
|
|
|
|
|
|
'id', |
143
|
|
|
|
|
|
|
'inRange', |
144
|
|
|
|
|
|
|
'index', |
145
|
|
|
|
|
|
|
'init', |
146
|
|
|
|
|
|
|
'intToDigit', |
147
|
|
|
|
|
|
|
'interact', |
148
|
|
|
|
|
|
|
'ioError', |
149
|
|
|
|
|
|
|
'isAlpha', |
150
|
|
|
|
|
|
|
'isAlphaNum', |
151
|
|
|
|
|
|
|
'isAscii', |
152
|
|
|
|
|
|
|
'isControl', |
153
|
|
|
|
|
|
|
'isDenormalized', |
154
|
|
|
|
|
|
|
'isDigit', |
155
|
|
|
|
|
|
|
'isHexDigit', |
156
|
|
|
|
|
|
|
'isIEEE', |
157
|
|
|
|
|
|
|
'isInfinite', |
158
|
|
|
|
|
|
|
'isLower', |
159
|
|
|
|
|
|
|
'isNaN', |
160
|
|
|
|
|
|
|
'isNegativeZero', |
161
|
|
|
|
|
|
|
'isOctDigit', |
162
|
|
|
|
|
|
|
'isPrint', |
163
|
|
|
|
|
|
|
'isSpace', |
164
|
|
|
|
|
|
|
'isUpper', |
165
|
|
|
|
|
|
|
'iterate', |
166
|
|
|
|
|
|
|
'last', |
167
|
|
|
|
|
|
|
'lcm', |
168
|
|
|
|
|
|
|
'length', |
169
|
|
|
|
|
|
|
'lex', |
170
|
|
|
|
|
|
|
'lexDigits', |
171
|
|
|
|
|
|
|
'lexLitChar', |
172
|
|
|
|
|
|
|
'lines', |
173
|
|
|
|
|
|
|
'log', |
174
|
|
|
|
|
|
|
'logBase', |
175
|
|
|
|
|
|
|
'lookup', |
176
|
|
|
|
|
|
|
'map', |
177
|
|
|
|
|
|
|
'mapM', |
178
|
|
|
|
|
|
|
'mapM_', |
179
|
|
|
|
|
|
|
'max', |
180
|
|
|
|
|
|
|
'maxBound', |
181
|
|
|
|
|
|
|
'maximum', |
182
|
|
|
|
|
|
|
'maybe', |
183
|
|
|
|
|
|
|
'min', |
184
|
|
|
|
|
|
|
'minBound', |
185
|
|
|
|
|
|
|
'minimum', |
186
|
|
|
|
|
|
|
'mod', |
187
|
|
|
|
|
|
|
'negate', |
188
|
|
|
|
|
|
|
'not', |
189
|
|
|
|
|
|
|
'notElem', |
190
|
|
|
|
|
|
|
'null', |
191
|
|
|
|
|
|
|
'numerator', |
192
|
|
|
|
|
|
|
'odd', |
193
|
|
|
|
|
|
|
'or', |
194
|
|
|
|
|
|
|
'ord', |
195
|
|
|
|
|
|
|
'otherwise', |
196
|
|
|
|
|
|
|
'pi', |
197
|
|
|
|
|
|
|
'pred', |
198
|
|
|
|
|
|
|
'primExitWith', |
199
|
|
|
|
|
|
|
'print', |
200
|
|
|
|
|
|
|
'product', |
201
|
|
|
|
|
|
|
'properFraction', |
202
|
|
|
|
|
|
|
'putChar', |
203
|
|
|
|
|
|
|
'putStr', |
204
|
|
|
|
|
|
|
'putStrLn', |
205
|
|
|
|
|
|
|
'quot', |
206
|
|
|
|
|
|
|
'quotRem', |
207
|
|
|
|
|
|
|
'range', |
208
|
|
|
|
|
|
|
'rangeSize', |
209
|
|
|
|
|
|
|
'read', |
210
|
|
|
|
|
|
|
'readDec', |
211
|
|
|
|
|
|
|
'readFile', |
212
|
|
|
|
|
|
|
'readFloat', |
213
|
|
|
|
|
|
|
'readHex', |
214
|
|
|
|
|
|
|
'readIO', |
215
|
|
|
|
|
|
|
'readInt', |
216
|
|
|
|
|
|
|
'readList', |
217
|
|
|
|
|
|
|
'readLitChar', |
218
|
|
|
|
|
|
|
'readLn', |
219
|
|
|
|
|
|
|
'readOct', |
220
|
|
|
|
|
|
|
'readParen', |
221
|
|
|
|
|
|
|
'readSigned', |
222
|
|
|
|
|
|
|
'reads', |
223
|
|
|
|
|
|
|
'readsPrec', |
224
|
|
|
|
|
|
|
'realToFrac', |
225
|
|
|
|
|
|
|
'recip', |
226
|
|
|
|
|
|
|
'rem', |
227
|
|
|
|
|
|
|
'repeat', |
228
|
|
|
|
|
|
|
'replicate', |
229
|
|
|
|
|
|
|
'return', |
230
|
|
|
|
|
|
|
'reverse', |
231
|
|
|
|
|
|
|
'round', |
232
|
|
|
|
|
|
|
'scaleFloat', |
233
|
|
|
|
|
|
|
'scanl', |
234
|
|
|
|
|
|
|
'scanl1', |
235
|
|
|
|
|
|
|
'scanr', |
236
|
|
|
|
|
|
|
'scanr1', |
237
|
|
|
|
|
|
|
'seq', |
238
|
|
|
|
|
|
|
'sequence', |
239
|
|
|
|
|
|
|
'sequence_', |
240
|
|
|
|
|
|
|
'show', |
241
|
|
|
|
|
|
|
'showChar', |
242
|
|
|
|
|
|
|
'showInt', |
243
|
|
|
|
|
|
|
'showList', |
244
|
|
|
|
|
|
|
'showLitChar', |
245
|
|
|
|
|
|
|
'showParen', |
246
|
|
|
|
|
|
|
'showSigned', |
247
|
|
|
|
|
|
|
'showString', |
248
|
|
|
|
|
|
|
'shows', |
249
|
|
|
|
|
|
|
'showsPrec', |
250
|
|
|
|
|
|
|
'significand', |
251
|
|
|
|
|
|
|
'signum', |
252
|
|
|
|
|
|
|
'sin', |
253
|
|
|
|
|
|
|
'sinh', |
254
|
|
|
|
|
|
|
'snd', |
255
|
|
|
|
|
|
|
'span', |
256
|
|
|
|
|
|
|
'splitAt', |
257
|
|
|
|
|
|
|
'sqrt', |
258
|
|
|
|
|
|
|
'subtract', |
259
|
|
|
|
|
|
|
'succ', |
260
|
|
|
|
|
|
|
'sum', |
261
|
|
|
|
|
|
|
'tail', |
262
|
|
|
|
|
|
|
'take', |
263
|
|
|
|
|
|
|
'takeWhile', |
264
|
|
|
|
|
|
|
'tan', |
265
|
|
|
|
|
|
|
'tanh', |
266
|
|
|
|
|
|
|
'threadToIOResult', |
267
|
|
|
|
|
|
|
'toEnum', |
268
|
|
|
|
|
|
|
'toInt', |
269
|
|
|
|
|
|
|
'toInteger', |
270
|
|
|
|
|
|
|
'toLower', |
271
|
|
|
|
|
|
|
'toRational', |
272
|
|
|
|
|
|
|
'toUpper', |
273
|
|
|
|
|
|
|
'truncate', |
274
|
|
|
|
|
|
|
'uncurry', |
275
|
|
|
|
|
|
|
'undefined', |
276
|
|
|
|
|
|
|
'unlines', |
277
|
|
|
|
|
|
|
'until', |
278
|
|
|
|
|
|
|
'unwords', |
279
|
|
|
|
|
|
|
'unzip', |
280
|
|
|
|
|
|
|
'unzip3', |
281
|
|
|
|
|
|
|
'userError', |
282
|
|
|
|
|
|
|
'words', |
283
|
|
|
|
|
|
|
'writeFile', |
284
|
|
|
|
|
|
|
'zip', |
285
|
|
|
|
|
|
|
'zip3', |
286
|
|
|
|
|
|
|
'zipWith', |
287
|
|
|
|
|
|
|
'zipWith3', |
288
|
|
|
|
|
|
|
); |
289
|
2
|
|
|
|
|
9
|
$self->listAdd('infix operators', |
290
|
|
|
|
|
|
|
'div', |
291
|
|
|
|
|
|
|
'elem', |
292
|
|
|
|
|
|
|
'mod', |
293
|
|
|
|
|
|
|
'notElem', |
294
|
|
|
|
|
|
|
'quot', |
295
|
|
|
|
|
|
|
'rem', |
296
|
|
|
|
|
|
|
'seq', |
297
|
|
|
|
|
|
|
); |
298
|
2
|
|
|
|
|
8
|
$self->listAdd('keywords', |
299
|
|
|
|
|
|
|
'case', |
300
|
|
|
|
|
|
|
'class', |
301
|
|
|
|
|
|
|
'data', |
302
|
|
|
|
|
|
|
'deriving', |
303
|
|
|
|
|
|
|
'do', |
304
|
|
|
|
|
|
|
'else', |
305
|
|
|
|
|
|
|
'if', |
306
|
|
|
|
|
|
|
'in', |
307
|
|
|
|
|
|
|
'infixl', |
308
|
|
|
|
|
|
|
'infixr', |
309
|
|
|
|
|
|
|
'instance', |
310
|
|
|
|
|
|
|
'let', |
311
|
|
|
|
|
|
|
'module', |
312
|
|
|
|
|
|
|
'of', |
313
|
|
|
|
|
|
|
'primitive', |
314
|
|
|
|
|
|
|
'then', |
315
|
|
|
|
|
|
|
'type', |
316
|
|
|
|
|
|
|
'where', |
317
|
|
|
|
|
|
|
); |
318
|
2
|
|
|
|
|
7
|
$self->listAdd('type constructors', |
319
|
|
|
|
|
|
|
'Bool', |
320
|
|
|
|
|
|
|
'Char', |
321
|
|
|
|
|
|
|
'Double', |
322
|
|
|
|
|
|
|
'Either', |
323
|
|
|
|
|
|
|
'Float', |
324
|
|
|
|
|
|
|
'IO', |
325
|
|
|
|
|
|
|
'Int', |
326
|
|
|
|
|
|
|
'Integer', |
327
|
|
|
|
|
|
|
'Maybe', |
328
|
|
|
|
|
|
|
'Ordering', |
329
|
|
|
|
|
|
|
'Ratio', |
330
|
|
|
|
|
|
|
'Rational', |
331
|
|
|
|
|
|
|
'ReadS', |
332
|
|
|
|
|
|
|
'ShowS', |
333
|
|
|
|
|
|
|
'String', |
334
|
|
|
|
|
|
|
); |
335
|
2
|
|
|
|
|
38
|
$self->contextdata({ |
336
|
|
|
|
|
|
|
'comment_multi_line' => { |
337
|
|
|
|
|
|
|
callback => \&parsecomment_multi_line, |
338
|
|
|
|
|
|
|
attribute => 'Comment', |
339
|
|
|
|
|
|
|
}, |
340
|
|
|
|
|
|
|
'comment_single_line' => { |
341
|
|
|
|
|
|
|
callback => \&parsecomment_single_line, |
342
|
|
|
|
|
|
|
attribute => 'Comment', |
343
|
|
|
|
|
|
|
lineending => '#pop', |
344
|
|
|
|
|
|
|
}, |
345
|
|
|
|
|
|
|
'function_definition' => { |
346
|
|
|
|
|
|
|
callback => \&parsefunction_definition, |
347
|
|
|
|
|
|
|
attribute => 'Function Definition', |
348
|
|
|
|
|
|
|
lineending => '#pop', |
349
|
|
|
|
|
|
|
}, |
350
|
|
|
|
|
|
|
'infix' => { |
351
|
|
|
|
|
|
|
callback => \&parseinfix, |
352
|
|
|
|
|
|
|
attribute => 'Infix Operator', |
353
|
|
|
|
|
|
|
}, |
354
|
|
|
|
|
|
|
'normal' => { |
355
|
|
|
|
|
|
|
callback => \&parsenormal, |
356
|
|
|
|
|
|
|
attribute => 'Normal Text', |
357
|
|
|
|
|
|
|
}, |
358
|
|
|
|
|
|
|
'single_char' => { |
359
|
|
|
|
|
|
|
callback => \&parsesingle_char, |
360
|
|
|
|
|
|
|
attribute => 'Char', |
361
|
|
|
|
|
|
|
lineending => '#pop', |
362
|
|
|
|
|
|
|
}, |
363
|
|
|
|
|
|
|
'string' => { |
364
|
|
|
|
|
|
|
callback => \&parsestring, |
365
|
|
|
|
|
|
|
attribute => 'String', |
366
|
|
|
|
|
|
|
}, |
367
|
|
|
|
|
|
|
}); |
368
|
2
|
|
|
|
|
11
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
369
|
2
|
|
|
|
|
6
|
$self->basecontext('normal'); |
370
|
2
|
|
|
|
|
9
|
$self->keywordscase(0); |
371
|
2
|
|
|
|
|
6
|
$self->initialize; |
372
|
2
|
|
|
|
|
5
|
bless ($self, $class); |
373
|
2
|
|
|
|
|
14
|
return $self; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub language { |
377
|
0
|
|
|
0
|
0
|
0
|
return 'Haskell'; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub parsecomment_multi_line { |
381
|
292
|
|
|
292
|
0
|
489
|
my ($self, $text) = @_; |
382
|
|
|
|
|
|
|
# attribute => 'Comment' |
383
|
|
|
|
|
|
|
# char => '-' |
384
|
|
|
|
|
|
|
# char1 => '}' |
385
|
|
|
|
|
|
|
# context => '#pop' |
386
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
387
|
292
|
100
|
|
|
|
693
|
if ($self->testDetect2Chars($text, '-', '}', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
388
|
2
|
|
|
|
|
7
|
return 1 |
389
|
|
|
|
|
|
|
} |
390
|
290
|
|
|
|
|
540
|
return 0; |
391
|
|
|
|
|
|
|
}; |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
sub parsecomment_single_line { |
394
|
36
|
|
|
36
|
0
|
65
|
my ($self, $text) = @_; |
395
|
36
|
|
|
|
|
75
|
return 0; |
396
|
|
|
|
|
|
|
}; |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub parsefunction_definition { |
399
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
400
|
|
|
|
|
|
|
# attribute => 'Function Definition' |
401
|
|
|
|
|
|
|
# char => ';' |
402
|
|
|
|
|
|
|
# context => '#pop' |
403
|
|
|
|
|
|
|
# type => 'DetectChar' |
404
|
0
|
0
|
|
|
|
0
|
if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Function Definition')) { |
405
|
0
|
|
|
|
|
0
|
return 1 |
406
|
|
|
|
|
|
|
} |
407
|
0
|
|
|
|
|
0
|
return 0; |
408
|
|
|
|
|
|
|
}; |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub parseinfix { |
411
|
50
|
|
|
50
|
0
|
100
|
my ($self, $text) = @_; |
412
|
|
|
|
|
|
|
# attribute => 'Infix Operator' |
413
|
|
|
|
|
|
|
# char => '`' |
414
|
|
|
|
|
|
|
# context => '#pop' |
415
|
|
|
|
|
|
|
# type => 'DetectChar' |
416
|
50
|
100
|
|
|
|
140
|
if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'Infix Operator')) { |
417
|
12
|
|
|
|
|
32
|
return 1 |
418
|
|
|
|
|
|
|
} |
419
|
38
|
|
|
|
|
87
|
return 0; |
420
|
|
|
|
|
|
|
}; |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub parsenormal { |
423
|
4596
|
|
|
4596
|
0
|
8316
|
my ($self, $text) = @_; |
424
|
|
|
|
|
|
|
# attribute => 'Comment' |
425
|
|
|
|
|
|
|
# char => '{' |
426
|
|
|
|
|
|
|
# char1 => '-' |
427
|
|
|
|
|
|
|
# context => 'comment_multi_line' |
428
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
429
|
4596
|
100
|
|
|
|
11759
|
if ($self->testDetect2Chars($text, '{', '-', 0, 0, 0, undef, 0, 'comment_multi_line', 'Comment')) { |
430
|
2
|
|
|
|
|
9
|
return 1 |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
# attribute => 'Comment' |
433
|
|
|
|
|
|
|
# char => '-' |
434
|
|
|
|
|
|
|
# char1 => '-' |
435
|
|
|
|
|
|
|
# context => 'comment_single_line' |
436
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
437
|
4594
|
100
|
|
|
|
11430
|
if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, 'comment_single_line', 'Comment')) { |
438
|
2
|
|
|
|
|
9
|
return 1 |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
# String => 'keywords' |
441
|
|
|
|
|
|
|
# attribute => 'Keyword' |
442
|
|
|
|
|
|
|
# context => '#stay' |
443
|
|
|
|
|
|
|
# type => 'keyword' |
444
|
4592
|
100
|
|
|
|
12104
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
445
|
64
|
|
|
|
|
183
|
return 1 |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
# String => 'classes' |
448
|
|
|
|
|
|
|
# attribute => 'Class' |
449
|
|
|
|
|
|
|
# context => '#stay' |
450
|
|
|
|
|
|
|
# type => 'keyword' |
451
|
4528
|
100
|
|
|
|
12005
|
if ($self->testKeyword($text, 'classes', 0, undef, 0, '#stay', 'Class')) { |
452
|
52
|
|
|
|
|
151
|
return 1 |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
# String => 'type constructors' |
455
|
|
|
|
|
|
|
# attribute => 'Type Constructor' |
456
|
|
|
|
|
|
|
# context => '#stay' |
457
|
|
|
|
|
|
|
# type => 'keyword' |
458
|
4476
|
100
|
|
|
|
11760
|
if ($self->testKeyword($text, 'type constructors', 0, undef, 0, '#stay', 'Type Constructor')) { |
459
|
52
|
|
|
|
|
146
|
return 1 |
460
|
|
|
|
|
|
|
} |
461
|
|
|
|
|
|
|
# String => 'functions' |
462
|
|
|
|
|
|
|
# attribute => 'Function' |
463
|
|
|
|
|
|
|
# context => '#stay' |
464
|
|
|
|
|
|
|
# type => 'keyword' |
465
|
4424
|
100
|
|
|
|
11540
|
if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) { |
466
|
486
|
|
|
|
|
1325
|
return 1 |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
# String => 'data constructors' |
469
|
|
|
|
|
|
|
# attribute => 'Data Constructor' |
470
|
|
|
|
|
|
|
# context => '#stay' |
471
|
|
|
|
|
|
|
# type => 'keyword' |
472
|
3938
|
100
|
|
|
|
10907
|
if ($self->testKeyword($text, 'data constructors', 0, undef, 0, '#stay', 'Data Constructor')) { |
473
|
16
|
|
|
|
|
41
|
return 1 |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
# attribute => 'String' |
476
|
|
|
|
|
|
|
# char => '"' |
477
|
|
|
|
|
|
|
# context => 'string' |
478
|
|
|
|
|
|
|
# type => 'DetectChar' |
479
|
3922
|
100
|
|
|
|
11033
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) { |
480
|
24
|
|
|
|
|
80
|
return 1 |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
# attribute => 'Infix Operator' |
483
|
|
|
|
|
|
|
# char => '`' |
484
|
|
|
|
|
|
|
# context => 'infix' |
485
|
|
|
|
|
|
|
# type => 'DetectChar' |
486
|
3898
|
100
|
|
|
|
10021
|
if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'infix', 'Infix Operator')) { |
487
|
12
|
|
|
|
|
38
|
return 1 |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
# String => '\w[']+' |
490
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
491
|
|
|
|
|
|
|
# context => '#stay' |
492
|
|
|
|
|
|
|
# type => 'RegExpr' |
493
|
3886
|
100
|
|
|
|
10884
|
if ($self->testRegExpr($text, '\\w[\']+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
494
|
12
|
|
|
|
|
37
|
return 1 |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
# attribute => 'Char' |
497
|
|
|
|
|
|
|
# char => ''' |
498
|
|
|
|
|
|
|
# context => 'single_char' |
499
|
|
|
|
|
|
|
# type => 'DetectChar' |
500
|
3874
|
100
|
|
|
|
11732
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'single_char', 'Char')) { |
501
|
12
|
|
|
|
|
49
|
return 1 |
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
# String => '[a-z_]+\w*'*\s*::' |
504
|
|
|
|
|
|
|
# attribute => 'Function Definition' |
505
|
|
|
|
|
|
|
# context => '#stay' |
506
|
|
|
|
|
|
|
# type => 'RegExpr' |
507
|
3862
|
100
|
|
|
|
9775
|
if ($self->testRegExpr($text, '[a-z_]+\\w*\'*\\s*::', 0, 0, 0, undef, 0, '#stay', 'Function Definition')) { |
508
|
8
|
|
|
|
|
26
|
return 1 |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
# attribute => 'Float' |
511
|
|
|
|
|
|
|
# context => '#stay' |
512
|
|
|
|
|
|
|
# type => 'Float' |
513
|
3854
|
100
|
|
|
|
11509
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
514
|
42
|
|
|
|
|
141
|
return 1 |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
# attribute => 'Decimal' |
517
|
|
|
|
|
|
|
# context => '#stay' |
518
|
|
|
|
|
|
|
# type => 'Int' |
519
|
3812
|
50
|
|
|
|
11339
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
520
|
0
|
|
|
|
|
0
|
return 1 |
521
|
|
|
|
|
|
|
} |
522
|
3812
|
|
|
|
|
8136
|
return 0; |
523
|
|
|
|
|
|
|
}; |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
sub parsesingle_char { |
526
|
50
|
|
|
50
|
0
|
95
|
my ($self, $text) = @_; |
527
|
|
|
|
|
|
|
# String => '\\.' |
528
|
|
|
|
|
|
|
# attribute => 'Char' |
529
|
|
|
|
|
|
|
# context => '#stay' |
530
|
|
|
|
|
|
|
# type => 'RegExpr' |
531
|
50
|
100
|
|
|
|
133
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
532
|
4
|
|
|
|
|
14
|
return 1 |
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
# attribute => 'Char' |
535
|
|
|
|
|
|
|
# char => ''' |
536
|
|
|
|
|
|
|
# context => '#pop' |
537
|
|
|
|
|
|
|
# type => 'DetectChar' |
538
|
46
|
100
|
|
|
|
142
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Char')) { |
539
|
12
|
|
|
|
|
35
|
return 1 |
540
|
|
|
|
|
|
|
} |
541
|
34
|
|
|
|
|
67
|
return 0; |
542
|
|
|
|
|
|
|
}; |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
sub parsestring { |
545
|
184
|
|
|
184
|
0
|
329
|
my ($self, $text) = @_; |
546
|
|
|
|
|
|
|
# String => '\\.' |
547
|
|
|
|
|
|
|
# attribute => 'String' |
548
|
|
|
|
|
|
|
# context => '#stay' |
549
|
|
|
|
|
|
|
# type => 'RegExpr' |
550
|
184
|
50
|
|
|
|
462
|
if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'String')) { |
551
|
0
|
|
|
|
|
0
|
return 1 |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
# attribute => 'String' |
554
|
|
|
|
|
|
|
# char => '"' |
555
|
|
|
|
|
|
|
# context => '#pop' |
556
|
|
|
|
|
|
|
# type => 'DetectChar' |
557
|
184
|
100
|
|
|
|
538
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
558
|
24
|
|
|
|
|
68
|
return 1 |
559
|
|
|
|
|
|
|
} |
560
|
160
|
|
|
|
|
304
|
return 0; |
561
|
|
|
|
|
|
|
}; |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
1; |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
__END__ |