racc 1.4.14 → 1.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Manifest.txt +50 -0
- data/ext/racc/com/headius/racc/Cparse.java +66 -23
- data/ext/racc/cparse.c +1 -1
- data/ext/racc/depend +1 -1
- data/lib/racc/info.rb +2 -2
- data/test/assets/bibtex.y +141 -0
- data/test/assets/cadenza.y +170 -0
- data/test/assets/cast.y +926 -0
- data/test/assets/csspool.y +729 -0
- data/test/assets/edtf.y +583 -0
- data/test/assets/huia.y +318 -0
- data/test/assets/journey.y +47 -0
- data/test/assets/liquor.y +313 -0
- data/test/assets/machete.y +423 -0
- data/test/assets/macruby.y +2197 -0
- data/test/assets/mediacloth.y +599 -0
- data/test/assets/mof.y +649 -0
- data/test/assets/namae.y +302 -0
- data/test/assets/nasl.y +626 -0
- data/test/assets/nokogiri-css.y +255 -0
- data/test/assets/opal.y +1807 -0
- data/test/assets/php_serialization.y +98 -0
- data/test/assets/rdblockparser.y +576 -0
- data/test/assets/rdinlineparser.y +561 -0
- data/test/assets/riml.y +665 -0
- data/test/assets/ruby18.y +1943 -0
- data/test/assets/ruby19.y +2174 -0
- data/test/assets/ruby20.y +2350 -0
- data/test/assets/ruby21.y +2359 -0
- data/test/assets/ruby22.y +2381 -0
- data/test/assets/tp_plus.y +622 -0
- data/test/assets/twowaysql.y +278 -0
- data/test/helper.rb +31 -15
- data/test/regress/bibtex +474 -0
- data/test/regress/cadenza +796 -0
- data/test/regress/cast +3425 -0
- data/test/regress/csspool +2318 -0
- data/test/regress/edtf +1794 -0
- data/test/regress/huia +1392 -0
- data/test/regress/journey +222 -0
- data/test/regress/liquor +885 -0
- data/test/regress/machete +833 -0
- data/test/regress/mediacloth +1463 -0
- data/test/regress/mof +1368 -0
- data/test/regress/namae +634 -0
- data/test/regress/nasl +2058 -0
- data/test/regress/nokogiri-css +836 -0
- data/test/regress/opal +6429 -0
- data/test/regress/php_serialization +336 -0
- data/test/regress/rdblockparser +1061 -0
- data/test/regress/rdinlineparser +1243 -0
- data/test/regress/riml +3297 -0
- data/test/regress/ruby18 +6351 -0
- data/test/regress/ruby22 +7456 -0
- data/test/regress/tp_plus +1933 -0
- data/test/regress/twowaysql +556 -0
- data/test/test_racc_command.rb +177 -0
- metadata +75 -20
@@ -0,0 +1,833 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.14
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
module Machete
|
9
|
+
class Parser < Racc::Parser
|
10
|
+
|
11
|
+
module_eval(<<'...end machete.y/module_eval...', 'machete.y', 175)
|
12
|
+
|
13
|
+
include Matchers
|
14
|
+
|
15
|
+
class SyntaxError < StandardError; end
|
16
|
+
|
17
|
+
def parse(input)
|
18
|
+
@input = input
|
19
|
+
@pos = 0
|
20
|
+
|
21
|
+
do_parse
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def integer_value(value)
|
27
|
+
if value =~ /^0[bB]/
|
28
|
+
value[2..-1].to_i(2)
|
29
|
+
elsif value =~ /^0[oO]/
|
30
|
+
value[2..-1].to_i(8)
|
31
|
+
elsif value =~ /^0[dD]/
|
32
|
+
value[2..-1].to_i(10)
|
33
|
+
elsif value =~ /^0[xX]/
|
34
|
+
value[2..-1].to_i(16)
|
35
|
+
elsif value =~ /^0/
|
36
|
+
value.to_i(8)
|
37
|
+
else
|
38
|
+
value.to_i
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def symbol_value(value)
|
43
|
+
value[1..-1].to_sym
|
44
|
+
end
|
45
|
+
|
46
|
+
def string_value(value)
|
47
|
+
quote = value[0..0]
|
48
|
+
if quote == "'"
|
49
|
+
value[1..-2].gsub("\\\\", "\\").gsub("\\'", "'")
|
50
|
+
elsif quote == '"'
|
51
|
+
value[1..-2].
|
52
|
+
gsub("\\\\", "\\").
|
53
|
+
gsub('\\"', '"').
|
54
|
+
gsub("\\n", "\n").
|
55
|
+
gsub("\\t", "\t").
|
56
|
+
gsub("\\r", "\r").
|
57
|
+
gsub("\\f", "\f").
|
58
|
+
gsub("\\v", "\v").
|
59
|
+
gsub("\\a", "\a").
|
60
|
+
gsub("\\e", "\e").
|
61
|
+
gsub("\\b", "\b").
|
62
|
+
gsub("\\s", "\s").
|
63
|
+
gsub(/\\([0-7]{1,3})/) { $1.to_i(8).chr }.
|
64
|
+
gsub(/\\x([0-9a-fA-F]{1,2})/) { $1.to_i(16).chr }
|
65
|
+
else
|
66
|
+
raise "Unknown quote: #{quote.inspect}."
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
REGEXP_OPTIONS = {
|
71
|
+
'i' => Regexp::IGNORECASE,
|
72
|
+
'm' => Regexp::MULTILINE,
|
73
|
+
'x' => Regexp::EXTENDED
|
74
|
+
}
|
75
|
+
|
76
|
+
def regexp_value(value)
|
77
|
+
/\A\/(.*)\/([imx]*)\z/ =~ value
|
78
|
+
pattern, options = $1, $2
|
79
|
+
|
80
|
+
Regexp.new(pattern, options.chars.map { |ch| REGEXP_OPTIONS[ch] }.inject(:|))
|
81
|
+
end
|
82
|
+
|
83
|
+
# "^" needs to be here because if it were among operators recognized by
|
84
|
+
# METHOD_NAME, "^=" would be recognized as two tokens.
|
85
|
+
SIMPLE_TOKENS = [
|
86
|
+
"|",
|
87
|
+
"<",
|
88
|
+
">",
|
89
|
+
",",
|
90
|
+
"=",
|
91
|
+
"^=",
|
92
|
+
"^",
|
93
|
+
"$=",
|
94
|
+
"[",
|
95
|
+
"]",
|
96
|
+
"*=",
|
97
|
+
"*",
|
98
|
+
"+",
|
99
|
+
"?",
|
100
|
+
"{",
|
101
|
+
"}"
|
102
|
+
]
|
103
|
+
|
104
|
+
COMPLEX_TOKENS = [
|
105
|
+
[:NIL, /^nil/],
|
106
|
+
[:TRUE, /^true/],
|
107
|
+
[:FALSE, /^false/],
|
108
|
+
# INTEGER needs to be before METHOD_NAME, otherwise e.g. "+1" would be
|
109
|
+
# recognized as two tokens.
|
110
|
+
[
|
111
|
+
:INTEGER,
|
112
|
+
/^
|
113
|
+
[+-]? # sign
|
114
|
+
(
|
115
|
+
0[bB][01]+(_[01]+)* # binary (prefixed)
|
116
|
+
|
|
117
|
+
0[oO][0-7]+(_[0-7]+)* # octal (prefixed)
|
118
|
+
|
|
119
|
+
0[dD]\d+(_\d+)* # decimal (prefixed)
|
120
|
+
|
|
121
|
+
0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)* # hexadecimal (prefixed)
|
122
|
+
|
|
123
|
+
0[0-7]*(_[0-7]+)* # octal (unprefixed)
|
124
|
+
|
|
125
|
+
[1-9]\d*(_\d+)* # decimal (unprefixed)
|
126
|
+
)
|
127
|
+
/x
|
128
|
+
],
|
129
|
+
[
|
130
|
+
:SYMBOL,
|
131
|
+
/^
|
132
|
+
:
|
133
|
+
(
|
134
|
+
# class name
|
135
|
+
[A-Z][a-zA-Z0-9_]*
|
136
|
+
|
|
137
|
+
# regular method name
|
138
|
+
[a-z_][a-zA-Z0-9_]*[?!=]?
|
139
|
+
|
|
140
|
+
# instance variable name
|
141
|
+
@[a-zA-Z_][a-zA-Z0-9_]*
|
142
|
+
|
|
143
|
+
# class variable name
|
144
|
+
@@[a-zA-Z_][a-zA-Z0-9_]*
|
145
|
+
|
|
146
|
+
# operator (sorted by length, then alphabetically)
|
147
|
+
(<=>|===|\[\]=|\*\*|\+@|-@|<<|<=|==|=~|>=|>>|\[\]|[%&*+\-\/<>^`|~])
|
148
|
+
)
|
149
|
+
/x
|
150
|
+
],
|
151
|
+
[
|
152
|
+
:STRING,
|
153
|
+
/^
|
154
|
+
(
|
155
|
+
' # sinqle-quoted string
|
156
|
+
(
|
157
|
+
\\[\\'] # escape
|
158
|
+
|
|
159
|
+
[^'] # regular character
|
160
|
+
)*
|
161
|
+
'
|
162
|
+
|
|
163
|
+
" # double-quoted string
|
164
|
+
(
|
165
|
+
\\ # escape
|
166
|
+
(
|
167
|
+
[\\"ntrfvaebs] # one-character escape
|
168
|
+
|
|
169
|
+
[0-7]{1,3} # octal number escape
|
170
|
+
|
|
171
|
+
x[0-9a-fA-F]{1,2} # hexadecimal number escape
|
172
|
+
)
|
173
|
+
|
|
174
|
+
[^"] # regular character
|
175
|
+
)*
|
176
|
+
"
|
177
|
+
)
|
178
|
+
/x
|
179
|
+
],
|
180
|
+
[
|
181
|
+
:REGEXP,
|
182
|
+
/^
|
183
|
+
\/
|
184
|
+
(
|
185
|
+
\\ # escape
|
186
|
+
(
|
187
|
+
[\\\/ntrfvaebs\(\)\[\]\{\}\-\.\?\*\+\|\^\$] # one-character escape
|
188
|
+
|
|
189
|
+
[0-7]{2,3} # octal number escape
|
190
|
+
|
|
191
|
+
x[0-9a-fA-F]{1,2} # hexadecimal number escape
|
192
|
+
)
|
193
|
+
|
|
194
|
+
[^\/] # regular character
|
195
|
+
)*
|
196
|
+
\/
|
197
|
+
[imx]*
|
198
|
+
/x
|
199
|
+
],
|
200
|
+
# ANY, EVEN and ODD need to be before METHOD_NAME, otherwise they would be
|
201
|
+
# recognized as method names.
|
202
|
+
[:ANY, /^any/],
|
203
|
+
[:EVEN, /^even/],
|
204
|
+
[:ODD, /^odd/],
|
205
|
+
# We exclude "*", "+", "<", ">", "^" and "|" from method names since they are
|
206
|
+
# lexed as simple tokens. This is because they have also other meanings in
|
207
|
+
# Machette patterns beside Ruby method names.
|
208
|
+
[
|
209
|
+
:METHOD_NAME,
|
210
|
+
/^
|
211
|
+
(
|
212
|
+
# regular name
|
213
|
+
[a-z_][a-zA-Z0-9_]*[?!=]?
|
214
|
+
|
|
215
|
+
# operator (sorted by length, then alphabetically)
|
216
|
+
(<=>|===|\[\]=|\*\*|\+@|-@|<<|<=|==|=~|>=|>>|\[\]|[%&\-\/`~])
|
217
|
+
)
|
218
|
+
/x
|
219
|
+
],
|
220
|
+
[:CLASS_NAME, /^[A-Z][a-zA-Z0-9_]*/]
|
221
|
+
]
|
222
|
+
|
223
|
+
def next_token
|
224
|
+
skip_whitespace
|
225
|
+
|
226
|
+
return false if remaining_input.empty?
|
227
|
+
|
228
|
+
# Complex tokens need to be before simple tokens, otherwise e.g. "<<" would be
|
229
|
+
# recognized as two tokens.
|
230
|
+
|
231
|
+
COMPLEX_TOKENS.each do |type, regexp|
|
232
|
+
if remaining_input =~ regexp
|
233
|
+
@pos += $&.length
|
234
|
+
return [type, $&]
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
SIMPLE_TOKENS.each do |token|
|
239
|
+
if remaining_input[0...token.length] == token
|
240
|
+
@pos += token.length
|
241
|
+
return [token, token]
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
raise SyntaxError, "Unexpected character: #{remaining_input[0..0].inspect}."
|
246
|
+
end
|
247
|
+
|
248
|
+
def skip_whitespace
|
249
|
+
if remaining_input =~ /\A^[ \t\r\n]+/
|
250
|
+
@pos += $&.length
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def remaining_input
|
255
|
+
@input[@pos..-1]
|
256
|
+
end
|
257
|
+
|
258
|
+
def on_error(error_token_id, error_value, value_stack)
|
259
|
+
raise SyntaxError, "Unexpected token: #{error_value.inspect}."
|
260
|
+
end
|
261
|
+
...end machete.y/module_eval...
|
262
|
+
##### State transition tables begin ###
|
263
|
+
|
264
|
+
racc_action_table = [
|
265
|
+
75, 24, 9, 10, 11, 12, 13, 14, 15, 16,
|
266
|
+
66, 67, 68, 7, 48, 9, 10, 11, 12, 13,
|
267
|
+
14, 15, 16, 17, 74, 8, 7, 76, 9, 10,
|
268
|
+
11, 12, 13, 14, 15, 16, 71, 18, 8, 7,
|
269
|
+
72, 9, 10, 11, 12, 13, 14, 15, 16, 73,
|
270
|
+
70, 8, 7, 19, 9, 10, 11, 12, 13, 14,
|
271
|
+
15, 16, 69, 18, 8, 7, 30, 31, 32, 51,
|
272
|
+
52, 53, 54, 33, 34, 35, 29, 8, 41, 38,
|
273
|
+
39, 77, 30, 31, 32, 47, 36, 37, 40, 33,
|
274
|
+
34, 35, 29, nil, 41, 38, 39, 18, 49, 50,
|
275
|
+
62, 63, 36, 37, 40, 43, 44, 55, 64, 65,
|
276
|
+
45, 46, 57, 58, nil, nil, nil, nil, nil, 56 ]
|
277
|
+
|
278
|
+
racc_action_check = [
|
279
|
+
70, 17, 0, 0, 0, 0, 0, 0, 0, 0,
|
280
|
+
54, 54, 54, 0, 22, 8, 8, 8, 8, 8,
|
281
|
+
8, 8, 8, 1, 70, 0, 8, 71, 18, 18,
|
282
|
+
18, 18, 18, 18, 18, 18, 56, 1, 8, 18,
|
283
|
+
57, 48, 48, 48, 48, 48, 48, 48, 48, 58,
|
284
|
+
55, 18, 48, 7, 51, 51, 51, 51, 51, 51,
|
285
|
+
51, 51, 55, 61, 48, 51, 19, 19, 19, 28,
|
286
|
+
28, 28, 28, 19, 19, 19, 19, 51, 19, 19,
|
287
|
+
19, 75, 50, 50, 50, 21, 19, 19, 19, 50,
|
288
|
+
50, 50, 50, nil, 50, 50, 50, 20, 26, 26,
|
289
|
+
52, 52, 50, 50, 50, 20, 20, 46, 53, 53,
|
290
|
+
20, 20, 46, 46, nil, nil, nil, nil, nil, 46 ]
|
291
|
+
|
292
|
+
racc_action_pointer = [
|
293
|
+
0, 23, nil, nil, nil, nil, nil, 38, 13, nil,
|
294
|
+
nil, nil, nil, nil, nil, nil, nil, 1, 26, 64,
|
295
|
+
83, 59, -3, nil, nil, nil, 82, nil, 51, nil,
|
296
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
297
|
+
nil, nil, nil, nil, nil, nil, 102, nil, 39, nil,
|
298
|
+
80, 52, 94, 102, 4, 33, 31, 11, 20, nil,
|
299
|
+
nil, 49, nil, nil, nil, nil, nil, nil, nil, nil,
|
300
|
+
-5, -2, nil, nil, nil, 52, nil, nil ]
|
301
|
+
|
302
|
+
racc_action_default = [
|
303
|
+
-56, -56, -1, -3, -4, -5, -6, -7, -33, -48,
|
304
|
+
-49, -50, -51, -52, -53, -54, -55, -56, -56, -56,
|
305
|
+
-37, -56, -34, -35, 78, -2, -56, -9, -56, -19,
|
306
|
+
-20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
|
307
|
+
-30, -31, -38, -39, -40, -41, -56, -32, -56, -8,
|
308
|
+
-56, -56, -56, -56, -56, -56, -56, -56, -56, -36,
|
309
|
+
-10, -11, -12, -15, -13, -16, -14, -17, -18, -42,
|
310
|
+
-56, -56, -46, -47, -43, -56, -44, -45 ]
|
311
|
+
|
312
|
+
racc_goto_table = [
|
313
|
+
1, 23, 27, 21, 22, 42, 25, 26, nil, nil,
|
314
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
315
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
316
|
+
nil, nil, nil, 60, nil, nil, nil, nil, nil, nil,
|
317
|
+
nil, 59, nil, nil, nil, nil, nil, nil, nil, nil,
|
318
|
+
nil, 61 ]
|
319
|
+
|
320
|
+
racc_goto_check = [
|
321
|
+
1, 12, 8, 10, 11, 13, 2, 7, nil, nil,
|
322
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
323
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
324
|
+
nil, nil, nil, 8, nil, nil, nil, nil, nil, nil,
|
325
|
+
nil, 12, nil, nil, nil, nil, nil, nil, nil, nil,
|
326
|
+
nil, 1 ]
|
327
|
+
|
328
|
+
racc_goto_pointer = [
|
329
|
+
nil, 0, -12, nil, nil, nil, nil, -12, -17, nil,
|
330
|
+
-5, -4, -7, -15 ]
|
331
|
+
|
332
|
+
racc_goto_default = [
|
333
|
+
nil, 20, 2, 3, 4, 5, 6, nil, nil, 28,
|
334
|
+
nil, nil, nil, nil ]
|
335
|
+
|
336
|
+
racc_reduce_table = [
|
337
|
+
0, 0, :racc_error,
|
338
|
+
1, 31, :_reduce_none,
|
339
|
+
3, 31, :_reduce_2,
|
340
|
+
1, 32, :_reduce_none,
|
341
|
+
1, 32, :_reduce_none,
|
342
|
+
1, 32, :_reduce_none,
|
343
|
+
1, 32, :_reduce_none,
|
344
|
+
1, 33, :_reduce_7,
|
345
|
+
4, 33, :_reduce_8,
|
346
|
+
1, 37, :_reduce_none,
|
347
|
+
3, 37, :_reduce_10,
|
348
|
+
3, 38, :_reduce_11,
|
349
|
+
3, 38, :_reduce_12,
|
350
|
+
3, 38, :_reduce_13,
|
351
|
+
3, 38, :_reduce_14,
|
352
|
+
3, 38, :_reduce_15,
|
353
|
+
3, 38, :_reduce_16,
|
354
|
+
3, 38, :_reduce_17,
|
355
|
+
3, 38, :_reduce_18,
|
356
|
+
1, 39, :_reduce_none,
|
357
|
+
1, 39, :_reduce_none,
|
358
|
+
1, 39, :_reduce_none,
|
359
|
+
1, 39, :_reduce_none,
|
360
|
+
1, 39, :_reduce_none,
|
361
|
+
1, 39, :_reduce_none,
|
362
|
+
1, 39, :_reduce_none,
|
363
|
+
1, 39, :_reduce_none,
|
364
|
+
1, 39, :_reduce_none,
|
365
|
+
1, 39, :_reduce_none,
|
366
|
+
1, 39, :_reduce_none,
|
367
|
+
1, 39, :_reduce_none,
|
368
|
+
1, 39, :_reduce_none,
|
369
|
+
3, 34, :_reduce_32,
|
370
|
+
0, 40, :_reduce_33,
|
371
|
+
1, 40, :_reduce_none,
|
372
|
+
1, 41, :_reduce_35,
|
373
|
+
3, 41, :_reduce_36,
|
374
|
+
1, 42, :_reduce_none,
|
375
|
+
2, 42, :_reduce_38,
|
376
|
+
1, 43, :_reduce_39,
|
377
|
+
1, 43, :_reduce_40,
|
378
|
+
1, 43, :_reduce_41,
|
379
|
+
3, 43, :_reduce_42,
|
380
|
+
4, 43, :_reduce_43,
|
381
|
+
4, 43, :_reduce_44,
|
382
|
+
5, 43, :_reduce_45,
|
383
|
+
3, 43, :_reduce_46,
|
384
|
+
3, 43, :_reduce_47,
|
385
|
+
1, 35, :_reduce_48,
|
386
|
+
1, 35, :_reduce_49,
|
387
|
+
1, 35, :_reduce_50,
|
388
|
+
1, 35, :_reduce_51,
|
389
|
+
1, 35, :_reduce_52,
|
390
|
+
1, 35, :_reduce_53,
|
391
|
+
1, 35, :_reduce_54,
|
392
|
+
1, 36, :_reduce_55 ]
|
393
|
+
|
394
|
+
racc_reduce_n = 56
|
395
|
+
|
396
|
+
racc_shift_n = 78
|
397
|
+
|
398
|
+
racc_token_table = {
|
399
|
+
false => 0,
|
400
|
+
:error => 1,
|
401
|
+
:NIL => 2,
|
402
|
+
:TRUE => 3,
|
403
|
+
:FALSE => 4,
|
404
|
+
:INTEGER => 5,
|
405
|
+
:SYMBOL => 6,
|
406
|
+
:STRING => 7,
|
407
|
+
:REGEXP => 8,
|
408
|
+
:ANY => 9,
|
409
|
+
:EVEN => 10,
|
410
|
+
:ODD => 11,
|
411
|
+
:METHOD_NAME => 12,
|
412
|
+
:CLASS_NAME => 13,
|
413
|
+
"|" => 14,
|
414
|
+
"<" => 15,
|
415
|
+
">" => 16,
|
416
|
+
"," => 17,
|
417
|
+
"=" => 18,
|
418
|
+
"^=" => 19,
|
419
|
+
"$=" => 20,
|
420
|
+
"*=" => 21,
|
421
|
+
"*" => 22,
|
422
|
+
"+" => 23,
|
423
|
+
"^" => 24,
|
424
|
+
"[" => 25,
|
425
|
+
"]" => 26,
|
426
|
+
"?" => 27,
|
427
|
+
"{" => 28,
|
428
|
+
"}" => 29 }
|
429
|
+
|
430
|
+
racc_nt_base = 30
|
431
|
+
|
432
|
+
racc_use_result_var = true
|
433
|
+
|
434
|
+
Racc_arg = [
|
435
|
+
racc_action_table,
|
436
|
+
racc_action_check,
|
437
|
+
racc_action_default,
|
438
|
+
racc_action_pointer,
|
439
|
+
racc_goto_table,
|
440
|
+
racc_goto_check,
|
441
|
+
racc_goto_default,
|
442
|
+
racc_goto_pointer,
|
443
|
+
racc_nt_base,
|
444
|
+
racc_reduce_table,
|
445
|
+
racc_token_table,
|
446
|
+
racc_shift_n,
|
447
|
+
racc_reduce_n,
|
448
|
+
racc_use_result_var ]
|
449
|
+
|
450
|
+
Racc_token_to_s_table = [
|
451
|
+
"$end",
|
452
|
+
"error",
|
453
|
+
"NIL",
|
454
|
+
"TRUE",
|
455
|
+
"FALSE",
|
456
|
+
"INTEGER",
|
457
|
+
"SYMBOL",
|
458
|
+
"STRING",
|
459
|
+
"REGEXP",
|
460
|
+
"ANY",
|
461
|
+
"EVEN",
|
462
|
+
"ODD",
|
463
|
+
"METHOD_NAME",
|
464
|
+
"CLASS_NAME",
|
465
|
+
"\"|\"",
|
466
|
+
"\"<\"",
|
467
|
+
"\">\"",
|
468
|
+
"\",\"",
|
469
|
+
"\"=\"",
|
470
|
+
"\"^=\"",
|
471
|
+
"\"$=\"",
|
472
|
+
"\"*=\"",
|
473
|
+
"\"*\"",
|
474
|
+
"\"+\"",
|
475
|
+
"\"^\"",
|
476
|
+
"\"[\"",
|
477
|
+
"\"]\"",
|
478
|
+
"\"?\"",
|
479
|
+
"\"{\"",
|
480
|
+
"\"}\"",
|
481
|
+
"$start",
|
482
|
+
"expression",
|
483
|
+
"primary",
|
484
|
+
"node",
|
485
|
+
"array",
|
486
|
+
"literal",
|
487
|
+
"any",
|
488
|
+
"attrs",
|
489
|
+
"attr",
|
490
|
+
"method_name",
|
491
|
+
"items_opt",
|
492
|
+
"items",
|
493
|
+
"item",
|
494
|
+
"quantifier" ]
|
495
|
+
|
496
|
+
Racc_debug_parser = false
|
497
|
+
|
498
|
+
##### State transition tables end #####
|
499
|
+
|
500
|
+
# reduce 0 omitted
|
501
|
+
|
502
|
+
# reduce 1 omitted
|
503
|
+
|
504
|
+
module_eval(<<'.,.,', 'machete.y', 44)
|
505
|
+
def _reduce_2(val, _values, result)
|
506
|
+
result = if val[0].is_a?(ChoiceMatcher)
|
507
|
+
ChoiceMatcher.new(val[0].alternatives << val[2])
|
508
|
+
else
|
509
|
+
ChoiceMatcher.new([val[0], val[2]])
|
510
|
+
end
|
511
|
+
|
512
|
+
result
|
513
|
+
end
|
514
|
+
.,.,
|
515
|
+
|
516
|
+
# reduce 3 omitted
|
517
|
+
|
518
|
+
# reduce 4 omitted
|
519
|
+
|
520
|
+
# reduce 5 omitted
|
521
|
+
|
522
|
+
# reduce 6 omitted
|
523
|
+
|
524
|
+
module_eval(<<'.,.,', 'machete.y', 57)
|
525
|
+
def _reduce_7(val, _values, result)
|
526
|
+
result = NodeMatcher.new(val[0].to_sym)
|
527
|
+
|
528
|
+
result
|
529
|
+
end
|
530
|
+
.,.,
|
531
|
+
|
532
|
+
module_eval(<<'.,.,', 'machete.y', 60)
|
533
|
+
def _reduce_8(val, _values, result)
|
534
|
+
result = NodeMatcher.new(val[0].to_sym, val[2])
|
535
|
+
|
536
|
+
result
|
537
|
+
end
|
538
|
+
.,.,
|
539
|
+
|
540
|
+
# reduce 9 omitted
|
541
|
+
|
542
|
+
module_eval(<<'.,.,', 'machete.y', 64)
|
543
|
+
def _reduce_10(val, _values, result)
|
544
|
+
result = val[0].merge(val[2])
|
545
|
+
result
|
546
|
+
end
|
547
|
+
.,.,
|
548
|
+
|
549
|
+
module_eval(<<'.,.,', 'machete.y', 66)
|
550
|
+
def _reduce_11(val, _values, result)
|
551
|
+
result = { val[0].to_sym => val[2] }
|
552
|
+
result
|
553
|
+
end
|
554
|
+
.,.,
|
555
|
+
|
556
|
+
module_eval(<<'.,.,', 'machete.y', 68)
|
557
|
+
def _reduce_12(val, _values, result)
|
558
|
+
result = {
|
559
|
+
val[0].to_sym => SymbolRegexpMatcher.new(
|
560
|
+
Regexp.new("^" + Regexp.escape(symbol_value(val[2]).to_s))
|
561
|
+
)
|
562
|
+
}
|
563
|
+
|
564
|
+
result
|
565
|
+
end
|
566
|
+
.,.,
|
567
|
+
|
568
|
+
module_eval(<<'.,.,', 'machete.y', 75)
|
569
|
+
def _reduce_13(val, _values, result)
|
570
|
+
result = {
|
571
|
+
val[0].to_sym => SymbolRegexpMatcher.new(
|
572
|
+
Regexp.new(Regexp.escape(symbol_value(val[2]).to_s) + "$")
|
573
|
+
)
|
574
|
+
}
|
575
|
+
|
576
|
+
result
|
577
|
+
end
|
578
|
+
.,.,
|
579
|
+
|
580
|
+
module_eval(<<'.,.,', 'machete.y', 82)
|
581
|
+
def _reduce_14(val, _values, result)
|
582
|
+
result = {
|
583
|
+
val[0].to_sym => SymbolRegexpMatcher.new(
|
584
|
+
Regexp.new(Regexp.escape(symbol_value(val[2]).to_s))
|
585
|
+
)
|
586
|
+
}
|
587
|
+
|
588
|
+
result
|
589
|
+
end
|
590
|
+
.,.,
|
591
|
+
|
592
|
+
module_eval(<<'.,.,', 'machete.y', 89)
|
593
|
+
def _reduce_15(val, _values, result)
|
594
|
+
result = {
|
595
|
+
val[0].to_sym => StringRegexpMatcher.new(
|
596
|
+
Regexp.new("^" + Regexp.escape(string_value(val[2])))
|
597
|
+
)
|
598
|
+
}
|
599
|
+
|
600
|
+
result
|
601
|
+
end
|
602
|
+
.,.,
|
603
|
+
|
604
|
+
module_eval(<<'.,.,', 'machete.y', 96)
|
605
|
+
def _reduce_16(val, _values, result)
|
606
|
+
result = {
|
607
|
+
val[0].to_sym => StringRegexpMatcher.new(
|
608
|
+
Regexp.new(Regexp.escape(string_value(val[2])) + "$")
|
609
|
+
)
|
610
|
+
}
|
611
|
+
|
612
|
+
result
|
613
|
+
end
|
614
|
+
.,.,
|
615
|
+
|
616
|
+
module_eval(<<'.,.,', 'machete.y', 103)
|
617
|
+
def _reduce_17(val, _values, result)
|
618
|
+
result = {
|
619
|
+
val[0].to_sym => StringRegexpMatcher.new(
|
620
|
+
Regexp.new(Regexp.escape(string_value(val[2])))
|
621
|
+
)
|
622
|
+
}
|
623
|
+
|
624
|
+
result
|
625
|
+
end
|
626
|
+
.,.,
|
627
|
+
|
628
|
+
module_eval(<<'.,.,', 'machete.y', 110)
|
629
|
+
def _reduce_18(val, _values, result)
|
630
|
+
result = {
|
631
|
+
val[0].to_sym => IndifferentRegexpMatcher.new(
|
632
|
+
Regexp.new(regexp_value(val[2]))
|
633
|
+
)
|
634
|
+
}
|
635
|
+
|
636
|
+
result
|
637
|
+
end
|
638
|
+
.,.,
|
639
|
+
|
640
|
+
# reduce 19 omitted
|
641
|
+
|
642
|
+
# reduce 20 omitted
|
643
|
+
|
644
|
+
# reduce 21 omitted
|
645
|
+
|
646
|
+
# reduce 22 omitted
|
647
|
+
|
648
|
+
# reduce 23 omitted
|
649
|
+
|
650
|
+
# reduce 24 omitted
|
651
|
+
|
652
|
+
# reduce 25 omitted
|
653
|
+
|
654
|
+
# reduce 26 omitted
|
655
|
+
|
656
|
+
# reduce 27 omitted
|
657
|
+
|
658
|
+
# reduce 28 omitted
|
659
|
+
|
660
|
+
# reduce 29 omitted
|
661
|
+
|
662
|
+
# reduce 30 omitted
|
663
|
+
|
664
|
+
# reduce 31 omitted
|
665
|
+
|
666
|
+
module_eval(<<'.,.,', 'machete.y', 134)
|
667
|
+
def _reduce_32(val, _values, result)
|
668
|
+
result = ArrayMatcher.new(val[1])
|
669
|
+
result
|
670
|
+
end
|
671
|
+
.,.,
|
672
|
+
|
673
|
+
module_eval(<<'.,.,', 'machete.y', 136)
|
674
|
+
def _reduce_33(val, _values, result)
|
675
|
+
result = []
|
676
|
+
result
|
677
|
+
end
|
678
|
+
.,.,
|
679
|
+
|
680
|
+
# reduce 34 omitted
|
681
|
+
|
682
|
+
module_eval(<<'.,.,', 'machete.y', 139)
|
683
|
+
def _reduce_35(val, _values, result)
|
684
|
+
result = [val[0]]
|
685
|
+
result
|
686
|
+
end
|
687
|
+
.,.,
|
688
|
+
|
689
|
+
module_eval(<<'.,.,', 'machete.y', 140)
|
690
|
+
def _reduce_36(val, _values, result)
|
691
|
+
result = val[0] << val[2]
|
692
|
+
result
|
693
|
+
end
|
694
|
+
.,.,
|
695
|
+
|
696
|
+
# reduce 37 omitted
|
697
|
+
|
698
|
+
module_eval(<<'.,.,', 'machete.y', 143)
|
699
|
+
def _reduce_38(val, _values, result)
|
700
|
+
result = Quantifier.new(val[0], *val[1])
|
701
|
+
result
|
702
|
+
end
|
703
|
+
.,.,
|
704
|
+
|
705
|
+
module_eval(<<'.,.,', 'machete.y', 145)
|
706
|
+
def _reduce_39(val, _values, result)
|
707
|
+
result = [0, nil, 1]
|
708
|
+
result
|
709
|
+
end
|
710
|
+
.,.,
|
711
|
+
|
712
|
+
module_eval(<<'.,.,', 'machete.y', 146)
|
713
|
+
def _reduce_40(val, _values, result)
|
714
|
+
result = [1, nil, 1]
|
715
|
+
result
|
716
|
+
end
|
717
|
+
.,.,
|
718
|
+
|
719
|
+
module_eval(<<'.,.,', 'machete.y', 147)
|
720
|
+
def _reduce_41(val, _values, result)
|
721
|
+
result = [0, 1, 1]
|
722
|
+
result
|
723
|
+
end
|
724
|
+
.,.,
|
725
|
+
|
726
|
+
module_eval(<<'.,.,', 'machete.y', 149)
|
727
|
+
def _reduce_42(val, _values, result)
|
728
|
+
result = [integer_value(val[1]), integer_value(val[1]), 1]
|
729
|
+
|
730
|
+
result
|
731
|
+
end
|
732
|
+
.,.,
|
733
|
+
|
734
|
+
module_eval(<<'.,.,', 'machete.y', 152)
|
735
|
+
def _reduce_43(val, _values, result)
|
736
|
+
result = [integer_value(val[1]), nil, 1]
|
737
|
+
|
738
|
+
result
|
739
|
+
end
|
740
|
+
.,.,
|
741
|
+
|
742
|
+
module_eval(<<'.,.,', 'machete.y', 155)
|
743
|
+
def _reduce_44(val, _values, result)
|
744
|
+
result = [0, integer_value(val[2]), 1]
|
745
|
+
|
746
|
+
result
|
747
|
+
end
|
748
|
+
.,.,
|
749
|
+
|
750
|
+
module_eval(<<'.,.,', 'machete.y', 158)
|
751
|
+
def _reduce_45(val, _values, result)
|
752
|
+
result = [integer_value(val[1]), integer_value(val[3]), 1]
|
753
|
+
|
754
|
+
result
|
755
|
+
end
|
756
|
+
.,.,
|
757
|
+
|
758
|
+
module_eval(<<'.,.,', 'machete.y', 160)
|
759
|
+
def _reduce_46(val, _values, result)
|
760
|
+
result = [0, nil, 2]
|
761
|
+
result
|
762
|
+
end
|
763
|
+
.,.,
|
764
|
+
|
765
|
+
module_eval(<<'.,.,', 'machete.y', 161)
|
766
|
+
def _reduce_47(val, _values, result)
|
767
|
+
result = [1, nil, 2]
|
768
|
+
result
|
769
|
+
end
|
770
|
+
.,.,
|
771
|
+
|
772
|
+
module_eval(<<'.,.,', 'machete.y', 163)
|
773
|
+
def _reduce_48(val, _values, result)
|
774
|
+
result = LiteralMatcher.new(nil)
|
775
|
+
result
|
776
|
+
end
|
777
|
+
.,.,
|
778
|
+
|
779
|
+
module_eval(<<'.,.,', 'machete.y', 164)
|
780
|
+
def _reduce_49(val, _values, result)
|
781
|
+
result = LiteralMatcher.new(true)
|
782
|
+
result
|
783
|
+
end
|
784
|
+
.,.,
|
785
|
+
|
786
|
+
module_eval(<<'.,.,', 'machete.y', 165)
|
787
|
+
def _reduce_50(val, _values, result)
|
788
|
+
result = LiteralMatcher.new(false)
|
789
|
+
result
|
790
|
+
end
|
791
|
+
.,.,
|
792
|
+
|
793
|
+
module_eval(<<'.,.,', 'machete.y', 166)
|
794
|
+
def _reduce_51(val, _values, result)
|
795
|
+
result = LiteralMatcher.new(integer_value(val[0]))
|
796
|
+
result
|
797
|
+
end
|
798
|
+
.,.,
|
799
|
+
|
800
|
+
module_eval(<<'.,.,', 'machete.y', 167)
|
801
|
+
def _reduce_52(val, _values, result)
|
802
|
+
result = LiteralMatcher.new(symbol_value(val[0]))
|
803
|
+
result
|
804
|
+
end
|
805
|
+
.,.,
|
806
|
+
|
807
|
+
module_eval(<<'.,.,', 'machete.y', 168)
|
808
|
+
def _reduce_53(val, _values, result)
|
809
|
+
result = LiteralMatcher.new(string_value(val[0]))
|
810
|
+
result
|
811
|
+
end
|
812
|
+
.,.,
|
813
|
+
|
814
|
+
module_eval(<<'.,.,', 'machete.y', 169)
|
815
|
+
def _reduce_54(val, _values, result)
|
816
|
+
result = LiteralMatcher.new(regexp_value(val[0]))
|
817
|
+
result
|
818
|
+
end
|
819
|
+
.,.,
|
820
|
+
|
821
|
+
module_eval(<<'.,.,', 'machete.y', 171)
|
822
|
+
def _reduce_55(val, _values, result)
|
823
|
+
result = AnyMatcher.new
|
824
|
+
result
|
825
|
+
end
|
826
|
+
.,.,
|
827
|
+
|
828
|
+
def _reduce_none(val, _values, result)
|
829
|
+
val[0]
|
830
|
+
end
|
831
|
+
|
832
|
+
end # class Parser
|
833
|
+
end # module Machete
|