| 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 'ocaml.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.4 |
|
10
|
|
|
|
|
|
|
#kate author Glyn Webster (glyn@wave.co.nz) |
|
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Objective_Caml; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
431
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
19
|
1
|
|
|
1
|
|
4
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
725
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
1
|
|
|
1
|
0
|
569
|
my $proto = shift; |
|
23
|
1
|
|
33
|
|
|
7
|
my $class = ref($proto) || $proto; |
|
24
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new(@_); |
|
25
|
1
|
|
|
|
|
17
|
$self->attributes({ |
|
26
|
|
|
|
|
|
|
'Binary' => 'BaseN', |
|
27
|
|
|
|
|
|
|
'Camlp4 Quotation' => 'String', |
|
28
|
|
|
|
|
|
|
'Character' => 'Char', |
|
29
|
|
|
|
|
|
|
'Comment' => 'Comment', |
|
30
|
|
|
|
|
|
|
'Core Data Type' => 'DataType', |
|
31
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
|
32
|
|
|
|
|
|
|
'Directive' => 'Others', |
|
33
|
|
|
|
|
|
|
'Escaped characters' => 'Char', |
|
34
|
|
|
|
|
|
|
'Float' => 'Float', |
|
35
|
|
|
|
|
|
|
'Hexadecimal' => 'BaseN', |
|
36
|
|
|
|
|
|
|
'Identifier' => 'Normal', |
|
37
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
|
38
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
|
39
|
|
|
|
|
|
|
'Octal' => 'BaseN', |
|
40
|
|
|
|
|
|
|
'Revised Syntax Keyword' => 'Normal', |
|
41
|
|
|
|
|
|
|
'String' => 'String', |
|
42
|
|
|
|
|
|
|
}); |
|
43
|
1
|
|
|
|
|
5
|
$self->listAdd('core types', |
|
44
|
|
|
|
|
|
|
'array', |
|
45
|
|
|
|
|
|
|
'bool', |
|
46
|
|
|
|
|
|
|
'char', |
|
47
|
|
|
|
|
|
|
'exn', |
|
48
|
|
|
|
|
|
|
'format', |
|
49
|
|
|
|
|
|
|
'int', |
|
50
|
|
|
|
|
|
|
'lazy_t', |
|
51
|
|
|
|
|
|
|
'list', |
|
52
|
|
|
|
|
|
|
'option', |
|
53
|
|
|
|
|
|
|
'real', |
|
54
|
|
|
|
|
|
|
'ref', |
|
55
|
|
|
|
|
|
|
'string', |
|
56
|
|
|
|
|
|
|
'unit', |
|
57
|
|
|
|
|
|
|
); |
|
58
|
1
|
|
|
|
|
5
|
$self->listAdd('keywords', |
|
59
|
|
|
|
|
|
|
'and', |
|
60
|
|
|
|
|
|
|
'as', |
|
61
|
|
|
|
|
|
|
'asr', |
|
62
|
|
|
|
|
|
|
'assert', |
|
63
|
|
|
|
|
|
|
'begin', |
|
64
|
|
|
|
|
|
|
'class', |
|
65
|
|
|
|
|
|
|
'closed', |
|
66
|
|
|
|
|
|
|
'constraint', |
|
67
|
|
|
|
|
|
|
'do', |
|
68
|
|
|
|
|
|
|
'done', |
|
69
|
|
|
|
|
|
|
'downto', |
|
70
|
|
|
|
|
|
|
'else', |
|
71
|
|
|
|
|
|
|
'end', |
|
72
|
|
|
|
|
|
|
'exception', |
|
73
|
|
|
|
|
|
|
'external', |
|
74
|
|
|
|
|
|
|
'false', |
|
75
|
|
|
|
|
|
|
'for', |
|
76
|
|
|
|
|
|
|
'fun', |
|
77
|
|
|
|
|
|
|
'function', |
|
78
|
|
|
|
|
|
|
'functor', |
|
79
|
|
|
|
|
|
|
'if', |
|
80
|
|
|
|
|
|
|
'in', |
|
81
|
|
|
|
|
|
|
'include', |
|
82
|
|
|
|
|
|
|
'inherit', |
|
83
|
|
|
|
|
|
|
'land', |
|
84
|
|
|
|
|
|
|
'lazy', |
|
85
|
|
|
|
|
|
|
'let', |
|
86
|
|
|
|
|
|
|
'lor', |
|
87
|
|
|
|
|
|
|
'lsl', |
|
88
|
|
|
|
|
|
|
'lsr', |
|
89
|
|
|
|
|
|
|
'lxor', |
|
90
|
|
|
|
|
|
|
'match', |
|
91
|
|
|
|
|
|
|
'method', |
|
92
|
|
|
|
|
|
|
'mod', |
|
93
|
|
|
|
|
|
|
'module', |
|
94
|
|
|
|
|
|
|
'mutable', |
|
95
|
|
|
|
|
|
|
'new', |
|
96
|
|
|
|
|
|
|
'of', |
|
97
|
|
|
|
|
|
|
'open', |
|
98
|
|
|
|
|
|
|
'or', |
|
99
|
|
|
|
|
|
|
'parser', |
|
100
|
|
|
|
|
|
|
'private', |
|
101
|
|
|
|
|
|
|
'rec', |
|
102
|
|
|
|
|
|
|
'sig', |
|
103
|
|
|
|
|
|
|
'struct', |
|
104
|
|
|
|
|
|
|
'then', |
|
105
|
|
|
|
|
|
|
'to', |
|
106
|
|
|
|
|
|
|
'true', |
|
107
|
|
|
|
|
|
|
'try', |
|
108
|
|
|
|
|
|
|
'type', |
|
109
|
|
|
|
|
|
|
'val', |
|
110
|
|
|
|
|
|
|
'virtual', |
|
111
|
|
|
|
|
|
|
'when', |
|
112
|
|
|
|
|
|
|
'while', |
|
113
|
|
|
|
|
|
|
'with', |
|
114
|
|
|
|
|
|
|
); |
|
115
|
1
|
|
|
|
|
3
|
$self->listAdd('revised syntax keywords', |
|
116
|
|
|
|
|
|
|
'declare', |
|
117
|
|
|
|
|
|
|
'value', |
|
118
|
|
|
|
|
|
|
'where', |
|
119
|
|
|
|
|
|
|
); |
|
120
|
1
|
|
|
|
|
12
|
$self->contextdata({ |
|
121
|
|
|
|
|
|
|
'Camlp4 Quotation Constant' => { |
|
122
|
|
|
|
|
|
|
callback => \&parseCamlp4QuotationConstant, |
|
123
|
|
|
|
|
|
|
attribute => 'Camlp4 Quotation', |
|
124
|
|
|
|
|
|
|
}, |
|
125
|
|
|
|
|
|
|
'Multiline Comment' => { |
|
126
|
|
|
|
|
|
|
callback => \&parseMultilineComment, |
|
127
|
|
|
|
|
|
|
attribute => 'Comment', |
|
128
|
|
|
|
|
|
|
}, |
|
129
|
|
|
|
|
|
|
'Normal' => { |
|
130
|
|
|
|
|
|
|
callback => \&parseNormal, |
|
131
|
|
|
|
|
|
|
attribute => 'Normal Text', |
|
132
|
|
|
|
|
|
|
}, |
|
133
|
|
|
|
|
|
|
'String Constant' => { |
|
134
|
|
|
|
|
|
|
callback => \&parseStringConstant, |
|
135
|
|
|
|
|
|
|
attribute => 'String', |
|
136
|
|
|
|
|
|
|
}, |
|
137
|
|
|
|
|
|
|
}); |
|
138
|
1
|
|
|
|
|
4
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
|
139
|
1
|
|
|
|
|
3
|
$self->basecontext('Normal'); |
|
140
|
1
|
|
|
|
|
4
|
$self->keywordscase(0); |
|
141
|
1
|
|
|
|
|
4
|
$self->initialize; |
|
142
|
1
|
|
|
|
|
3
|
bless ($self, $class); |
|
143
|
1
|
|
|
|
|
3
|
return $self; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub language { |
|
147
|
0
|
|
|
0
|
0
|
|
return 'Objective Caml'; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub parseCamlp4QuotationConstant { |
|
151
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
|
152
|
|
|
|
|
|
|
# attribute => 'Camlp4 Quotation' |
|
153
|
|
|
|
|
|
|
# char => '>' |
|
154
|
|
|
|
|
|
|
# char1 => '>' |
|
155
|
|
|
|
|
|
|
# context => '#pop' |
|
156
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
157
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '>', '>', 0, 0, 0, undef, 0, '#pop', 'Camlp4 Quotation')) { |
|
158
|
0
|
|
|
|
|
|
return 1 |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
# attribute => 'Camlp4 Quotation' |
|
161
|
|
|
|
|
|
|
# char => '<' |
|
162
|
|
|
|
|
|
|
# char1 => '<' |
|
163
|
|
|
|
|
|
|
# context => 'Camlp4 Quotation Constant' |
|
164
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
165
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) { |
|
166
|
0
|
|
|
|
|
|
return 1 |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
# String => '<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<' |
|
169
|
|
|
|
|
|
|
# attribute => 'Camlp4 Quotation' |
|
170
|
|
|
|
|
|
|
# context => 'Camlp4 Quotation Constant' |
|
171
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
172
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) { |
|
173
|
0
|
|
|
|
|
|
return 1 |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
# String => '\\(\\|>>|<<)' |
|
176
|
|
|
|
|
|
|
# attribute => 'Escaped characters' |
|
177
|
|
|
|
|
|
|
# context => '#stay' |
|
178
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
179
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\\\(\\\\|>>|<<)', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) { |
|
180
|
0
|
|
|
|
|
|
return 1 |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
# String => '\\<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<' |
|
183
|
|
|
|
|
|
|
# attribute => 'Escaped characters' |
|
184
|
|
|
|
|
|
|
# context => '#stay' |
|
185
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
186
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\\\<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) { |
|
187
|
0
|
|
|
|
|
|
return 1 |
|
188
|
|
|
|
|
|
|
} |
|
189
|
0
|
|
|
|
|
|
return 0; |
|
190
|
|
|
|
|
|
|
}; |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub parseMultilineComment { |
|
193
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
|
194
|
|
|
|
|
|
|
# attribute => 'Comment' |
|
195
|
|
|
|
|
|
|
# char => '*' |
|
196
|
|
|
|
|
|
|
# char1 => ')' |
|
197
|
|
|
|
|
|
|
# context => '#pop' |
|
198
|
|
|
|
|
|
|
# endRegion => 'comment' |
|
199
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
200
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
|
201
|
0
|
|
|
|
|
|
return 1 |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
# attribute => 'Comment' |
|
204
|
|
|
|
|
|
|
# beginRegion => 'comment' |
|
205
|
|
|
|
|
|
|
# char => '(' |
|
206
|
|
|
|
|
|
|
# char1 => '*' |
|
207
|
|
|
|
|
|
|
# context => 'Multiline Comment' |
|
208
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
209
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) { |
|
210
|
0
|
|
|
|
|
|
return 1 |
|
211
|
|
|
|
|
|
|
} |
|
212
|
0
|
|
|
|
|
|
return 0; |
|
213
|
|
|
|
|
|
|
}; |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub parseNormal { |
|
216
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
|
217
|
|
|
|
|
|
|
# attribute => 'Comment' |
|
218
|
|
|
|
|
|
|
# beginRegion => 'comment' |
|
219
|
|
|
|
|
|
|
# char => '(' |
|
220
|
|
|
|
|
|
|
# char1 => '*' |
|
221
|
|
|
|
|
|
|
# context => 'Multiline Comment' |
|
222
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
223
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) { |
|
224
|
0
|
|
|
|
|
|
return 1 |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
# String => '#[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*.*$' |
|
227
|
|
|
|
|
|
|
# attribute => 'Directive' |
|
228
|
|
|
|
|
|
|
# context => '#stay' |
|
229
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
|
230
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
231
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*.*$', 0, 0, 0, undef, 1, '#stay', 'Directive')) { |
|
232
|
0
|
|
|
|
|
|
return 1 |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
# attribute => 'String' |
|
235
|
|
|
|
|
|
|
# char => '"' |
|
236
|
|
|
|
|
|
|
# context => 'String Constant' |
|
237
|
|
|
|
|
|
|
# type => 'DetectChar' |
|
238
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String Constant', 'String')) { |
|
239
|
0
|
|
|
|
|
|
return 1 |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
# String => ''((\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})|[^'])'' |
|
242
|
|
|
|
|
|
|
# attribute => 'Character' |
|
243
|
|
|
|
|
|
|
# context => '#stay' |
|
244
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
245
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\'((\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})|[^\'])\'', 0, 0, 0, undef, 0, '#stay', 'Character')) { |
|
246
|
0
|
|
|
|
|
|
return 1 |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
# attribute => 'Camlp4 Quotation' |
|
249
|
|
|
|
|
|
|
# char => '<' |
|
250
|
|
|
|
|
|
|
# char1 => '<' |
|
251
|
|
|
|
|
|
|
# context => 'Camlp4 Quotation Constant' |
|
252
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
|
253
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) { |
|
254
|
0
|
|
|
|
|
|
return 1 |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
# String => '<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<' |
|
257
|
|
|
|
|
|
|
# attribute => 'Camlp4 Quotation' |
|
258
|
|
|
|
|
|
|
# context => 'Camlp4 Quotation Constant' |
|
259
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
260
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) { |
|
261
|
0
|
|
|
|
|
|
return 1 |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
# String => 'keywords' |
|
264
|
|
|
|
|
|
|
# attribute => 'Keyword' |
|
265
|
|
|
|
|
|
|
# context => '#stay' |
|
266
|
|
|
|
|
|
|
# type => 'keyword' |
|
267
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
|
268
|
0
|
|
|
|
|
|
return 1 |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
# String => 'revised syntax keywords' |
|
271
|
|
|
|
|
|
|
# attribute => 'Revised Syntax Keyword' |
|
272
|
|
|
|
|
|
|
# context => '#stay' |
|
273
|
|
|
|
|
|
|
# type => 'keyword' |
|
274
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'revised syntax keywords', 0, undef, 0, '#stay', 'Revised Syntax Keyword')) { |
|
275
|
0
|
|
|
|
|
|
return 1 |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
# String => 'core types' |
|
278
|
|
|
|
|
|
|
# attribute => 'Core Data Type' |
|
279
|
|
|
|
|
|
|
# context => '#stay' |
|
280
|
|
|
|
|
|
|
# type => 'keyword' |
|
281
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'core types', 0, undef, 0, '#stay', 'Core Data Type')) { |
|
282
|
0
|
|
|
|
|
|
return 1 |
|
283
|
|
|
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
# String => '[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*' |
|
285
|
|
|
|
|
|
|
# attribute => 'Identifier' |
|
286
|
|
|
|
|
|
|
# context => '#stay' |
|
287
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
288
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*', 0, 0, 0, undef, 0, '#stay', 'Identifier')) { |
|
289
|
0
|
|
|
|
|
|
return 1 |
|
290
|
|
|
|
|
|
|
} |
|
291
|
|
|
|
|
|
|
# String => '-?0[xX][0-9A-Fa-f_]+' |
|
292
|
|
|
|
|
|
|
# attribute => 'Hexadecimal' |
|
293
|
|
|
|
|
|
|
# context => '#stay' |
|
294
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
295
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '-?0[xX][0-9A-Fa-f_]+', 0, 0, 0, undef, 0, '#stay', 'Hexadecimal')) { |
|
296
|
0
|
|
|
|
|
|
return 1 |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
# String => '-?0[oO][0-7_]+' |
|
299
|
|
|
|
|
|
|
# attribute => 'Octal' |
|
300
|
|
|
|
|
|
|
# context => '#stay' |
|
301
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
302
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '-?0[oO][0-7_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) { |
|
303
|
0
|
|
|
|
|
|
return 1 |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
# String => '-?0[bB][01_]+' |
|
306
|
|
|
|
|
|
|
# attribute => 'Binary' |
|
307
|
|
|
|
|
|
|
# context => '#stay' |
|
308
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
309
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '-?0[bB][01_]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) { |
|
310
|
0
|
|
|
|
|
|
return 1 |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
# String => '-?[0-9][0-9_]*(\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)' |
|
313
|
|
|
|
|
|
|
# attribute => 'Float' |
|
314
|
|
|
|
|
|
|
# context => '#stay' |
|
315
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
316
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '-?[0-9][0-9_]*(\\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)', 0, 0, 0, undef, 0, '#stay', 'Float')) { |
|
317
|
0
|
|
|
|
|
|
return 1 |
|
318
|
|
|
|
|
|
|
} |
|
319
|
|
|
|
|
|
|
# String => '-?[0-9][0-9_]*' |
|
320
|
|
|
|
|
|
|
# attribute => 'Decimal' |
|
321
|
|
|
|
|
|
|
# context => '#stay' |
|
322
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
323
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '-?[0-9][0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Decimal')) { |
|
324
|
0
|
|
|
|
|
|
return 1 |
|
325
|
|
|
|
|
|
|
} |
|
326
|
0
|
|
|
|
|
|
return 0; |
|
327
|
|
|
|
|
|
|
}; |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub parseStringConstant { |
|
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
|
|
|
|
|
|
|
# String => '(\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})' |
|
339
|
|
|
|
|
|
|
# attribute => 'Escaped characters' |
|
340
|
|
|
|
|
|
|
# context => '#stay' |
|
341
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
342
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '(\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) { |
|
343
|
0
|
|
|
|
|
|
return 1 |
|
344
|
|
|
|
|
|
|
} |
|
345
|
|
|
|
|
|
|
# String => '\\$' |
|
346
|
|
|
|
|
|
|
# attribute => 'Escaped characters' |
|
347
|
|
|
|
|
|
|
# context => '#stay' |
|
348
|
|
|
|
|
|
|
# type => 'RegExpr' |
|
349
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\\\$', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) { |
|
350
|
0
|
|
|
|
|
|
return 1 |
|
351
|
|
|
|
|
|
|
} |
|
352
|
0
|
|
|
|
|
|
return 0; |
|
353
|
|
|
|
|
|
|
}; |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
1; |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
__END__ |