bakkdoor-blocktalk 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +165 -0
- data/README.markdown +114 -0
- data/TODO +9 -0
- data/benchmark.bt +18 -0
- data/evaluator.rb +19 -0
- data/examples/chained_method_call.bt +15 -0
- data/examples/classes_modules.bt +68 -0
- data/examples/exceptions.bt +28 -0
- data/examples/fac.bt +23 -0
- data/examples/inline_ruby.bt +20 -0
- data/examples/linecounter.bt +8 -0
- data/examples/multiple_methodcall.bt +1 -0
- data/examples/portscan.bt +39 -0
- data/examples/require.bt +8 -0
- data/examples/ruby_methods.bt +20 -0
- data/examples/string_interpol.bt +10 -0
- data/examples/string_test.bt +13 -0
- data/examples/test.bt +45 -0
- data/examples/test2.bt +125 -0
- data/examples/test3.bt +9 -0
- data/grammar/blocktalk.rb +5030 -0
- data/grammar/blocktalk.tt +463 -0
- data/language-spec/blocktalk-example.bt +38 -0
- data/language-spec/blocktalk-lang-spec.bt +232 -0
- data/lib/blocktalk/array.bt +60 -0
- data/lib/blocktalk/string.bt +9 -0
- data/lib/blocktalk.bt +3 -0
- data/lib/core.rb +12 -0
- data/lib/kernel/array.rb +9 -0
- data/lib/kernel/class.rb +46 -0
- data/lib/kernel/codeblock.rb +57 -0
- data/lib/kernel/console.rb +40 -0
- data/lib/kernel/error.rb +11 -0
- data/lib/kernel/module.rb +18 -0
- data/lib/kernel/object.rb +66 -0
- data/lib/kernel/string.rb +5 -0
- data/lib/kernel/system.rb +5 -0
- data/parser/helpers/method_definitions.rb +31 -0
- data/parser/helpers/methodcalls.rb +56 -0
- data/parser/nodes/block_literal.rb +42 -0
- data/parser/nodes/catch.rb +22 -0
- data/parser/nodes/class_method_definition.rb +15 -0
- data/parser/nodes/comment.rb +7 -0
- data/parser/nodes/ensure.rb +7 -0
- data/parser/nodes/expression.rb +7 -0
- data/parser/nodes/identifier.rb +7 -0
- data/parser/nodes/integer_literal.rb +7 -0
- data/parser/nodes/message_receiver.rb +7 -0
- data/parser/nodes/message_with_params.rb +8 -0
- data/parser/nodes/message_without_params.rb +10 -0
- data/parser/nodes/method_definition.rb +31 -0
- data/parser/nodes/methodcall.rb +37 -0
- data/parser/nodes/multiple_methodcall.rb +28 -0
- data/parser/nodes/operator_message.rb +8 -0
- data/parser/nodes/require.rb +25 -0
- data/parser/nodes/return.rb +7 -0
- data/parser/nodes/root.rb +15 -0
- data/parser/nodes/string.rb +7 -0
- data/parser/nodes/subexpression.rb +7 -0
- data/parser/nodes/super_call.rb +12 -0
- data/parser/nodes/try.rb +7 -0
- data/parser/nodes/yield.rb +18 -0
- data/parser/nodes.rb +29 -0
- metadata +70 -3
@@ -0,0 +1,5030 @@
|
|
1
|
+
module Blocktalk
|
2
|
+
include Treetop::Runtime
|
3
|
+
|
4
|
+
def root
|
5
|
+
@root || :blocktalk_programm
|
6
|
+
end
|
7
|
+
|
8
|
+
module BlocktalkProgramm0
|
9
|
+
def exprs
|
10
|
+
elements[1]
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def _nt_blocktalk_programm
|
16
|
+
start_index = index
|
17
|
+
if node_cache[:blocktalk_programm].has_key?(index)
|
18
|
+
cached = node_cache[:blocktalk_programm][index]
|
19
|
+
@index = cached.interval.end if cached
|
20
|
+
return cached
|
21
|
+
end
|
22
|
+
|
23
|
+
i0, s0 = index, []
|
24
|
+
s1, i1 = [], index
|
25
|
+
loop do
|
26
|
+
r2 = _nt_ws
|
27
|
+
if r2
|
28
|
+
s1 << r2
|
29
|
+
else
|
30
|
+
break
|
31
|
+
end
|
32
|
+
end
|
33
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
34
|
+
s0 << r1
|
35
|
+
if r1
|
36
|
+
s3, i3 = [], index
|
37
|
+
loop do
|
38
|
+
r4 = _nt_expression
|
39
|
+
if r4
|
40
|
+
s3 << r4
|
41
|
+
else
|
42
|
+
break
|
43
|
+
end
|
44
|
+
end
|
45
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
46
|
+
s0 << r3
|
47
|
+
if r3
|
48
|
+
s5, i5 = [], index
|
49
|
+
loop do
|
50
|
+
r6 = _nt_ws
|
51
|
+
if r6
|
52
|
+
s5 << r6
|
53
|
+
else
|
54
|
+
break
|
55
|
+
end
|
56
|
+
end
|
57
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
58
|
+
s0 << r5
|
59
|
+
end
|
60
|
+
end
|
61
|
+
if s0.last
|
62
|
+
r0 = instantiate_node(RootNode,input, i0...index, s0)
|
63
|
+
r0.extend(BlocktalkProgramm0)
|
64
|
+
else
|
65
|
+
self.index = i0
|
66
|
+
r0 = nil
|
67
|
+
end
|
68
|
+
|
69
|
+
node_cache[:blocktalk_programm][start_index] = r0
|
70
|
+
|
71
|
+
return r0
|
72
|
+
end
|
73
|
+
|
74
|
+
module Comment0
|
75
|
+
end
|
76
|
+
|
77
|
+
module Comment1
|
78
|
+
end
|
79
|
+
|
80
|
+
def _nt_comment
|
81
|
+
start_index = index
|
82
|
+
if node_cache[:comment].has_key?(index)
|
83
|
+
cached = node_cache[:comment][index]
|
84
|
+
@index = cached.interval.end if cached
|
85
|
+
return cached
|
86
|
+
end
|
87
|
+
|
88
|
+
i0, s0 = index, []
|
89
|
+
if input.index('#', index) == index
|
90
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
91
|
+
@index += 1
|
92
|
+
else
|
93
|
+
terminal_parse_failure('#')
|
94
|
+
r1 = nil
|
95
|
+
end
|
96
|
+
s0 << r1
|
97
|
+
if r1
|
98
|
+
s2, i2 = [], index
|
99
|
+
loop do
|
100
|
+
i3, s3 = index, []
|
101
|
+
i4 = index
|
102
|
+
if input.index(Regexp.new('[\\n]'), index) == index
|
103
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
104
|
+
@index += 1
|
105
|
+
else
|
106
|
+
r5 = nil
|
107
|
+
end
|
108
|
+
if r5
|
109
|
+
r4 = nil
|
110
|
+
else
|
111
|
+
self.index = i4
|
112
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
113
|
+
end
|
114
|
+
s3 << r4
|
115
|
+
if r4
|
116
|
+
if index < input_length
|
117
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
118
|
+
@index += 1
|
119
|
+
else
|
120
|
+
terminal_parse_failure("any character")
|
121
|
+
r6 = nil
|
122
|
+
end
|
123
|
+
s3 << r6
|
124
|
+
end
|
125
|
+
if s3.last
|
126
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
127
|
+
r3.extend(Comment0)
|
128
|
+
else
|
129
|
+
self.index = i3
|
130
|
+
r3 = nil
|
131
|
+
end
|
132
|
+
if r3
|
133
|
+
s2 << r3
|
134
|
+
else
|
135
|
+
break
|
136
|
+
end
|
137
|
+
end
|
138
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
139
|
+
s0 << r2
|
140
|
+
if r2
|
141
|
+
if input.index(Regexp.new('[\\n]'), index) == index
|
142
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
143
|
+
@index += 1
|
144
|
+
else
|
145
|
+
r8 = nil
|
146
|
+
end
|
147
|
+
if r8
|
148
|
+
r7 = r8
|
149
|
+
else
|
150
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
151
|
+
end
|
152
|
+
s0 << r7
|
153
|
+
end
|
154
|
+
end
|
155
|
+
if s0.last
|
156
|
+
r0 = instantiate_node(CommentNode,input, i0...index, s0)
|
157
|
+
r0.extend(Comment1)
|
158
|
+
else
|
159
|
+
self.index = i0
|
160
|
+
r0 = nil
|
161
|
+
end
|
162
|
+
|
163
|
+
node_cache[:comment][start_index] = r0
|
164
|
+
|
165
|
+
return r0
|
166
|
+
end
|
167
|
+
|
168
|
+
module Expression0
|
169
|
+
end
|
170
|
+
|
171
|
+
module Expression1
|
172
|
+
def subexpr
|
173
|
+
elements[0]
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
def _nt_expression
|
179
|
+
start_index = index
|
180
|
+
if node_cache[:expression].has_key?(index)
|
181
|
+
cached = node_cache[:expression][index]
|
182
|
+
@index = cached.interval.end if cached
|
183
|
+
return cached
|
184
|
+
end
|
185
|
+
|
186
|
+
i0, s0 = index, []
|
187
|
+
i1 = index
|
188
|
+
r2 = _nt_method_definition
|
189
|
+
if r2
|
190
|
+
r1 = r2
|
191
|
+
else
|
192
|
+
r3 = _nt_require_statement
|
193
|
+
if r3
|
194
|
+
r1 = r3
|
195
|
+
else
|
196
|
+
r4 = _nt_return_statement
|
197
|
+
if r4
|
198
|
+
r1 = r4
|
199
|
+
else
|
200
|
+
r5 = _nt_yield_statement
|
201
|
+
if r5
|
202
|
+
r1 = r5
|
203
|
+
else
|
204
|
+
r6 = _nt_try_expression
|
205
|
+
if r6
|
206
|
+
r1 = r6
|
207
|
+
else
|
208
|
+
r7 = _nt_catch_expression
|
209
|
+
if r7
|
210
|
+
r1 = r7
|
211
|
+
else
|
212
|
+
r8 = _nt_ensure_expression
|
213
|
+
if r8
|
214
|
+
r1 = r8
|
215
|
+
else
|
216
|
+
r9 = _nt_super_call
|
217
|
+
if r9
|
218
|
+
r1 = r9
|
219
|
+
else
|
220
|
+
r10 = _nt_multiple_method_call
|
221
|
+
if r10
|
222
|
+
r1 = r10
|
223
|
+
else
|
224
|
+
r11 = _nt_method_call
|
225
|
+
if r11
|
226
|
+
r1 = r11
|
227
|
+
else
|
228
|
+
r12 = _nt_assignment
|
229
|
+
if r12
|
230
|
+
r1 = r12
|
231
|
+
else
|
232
|
+
r13 = _nt_literal
|
233
|
+
if r13
|
234
|
+
r1 = r13
|
235
|
+
else
|
236
|
+
r14 = _nt_subexpression
|
237
|
+
if r14
|
238
|
+
r1 = r14
|
239
|
+
else
|
240
|
+
r15 = _nt_inline_ruby
|
241
|
+
if r15
|
242
|
+
r1 = r15
|
243
|
+
else
|
244
|
+
r16 = _nt_comment
|
245
|
+
if r16
|
246
|
+
r1 = r16
|
247
|
+
else
|
248
|
+
self.index = i1
|
249
|
+
r1 = nil
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
s0 << r1
|
266
|
+
if r1
|
267
|
+
i17 = index
|
268
|
+
if input.index('$', index) == index
|
269
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
270
|
+
@index += 1
|
271
|
+
else
|
272
|
+
terminal_parse_failure('$')
|
273
|
+
r18 = nil
|
274
|
+
end
|
275
|
+
if r18
|
276
|
+
r17 = r18
|
277
|
+
else
|
278
|
+
i19, s19 = index, []
|
279
|
+
s20, i20 = [], index
|
280
|
+
loop do
|
281
|
+
r21 = _nt_ws
|
282
|
+
if r21
|
283
|
+
s20 << r21
|
284
|
+
else
|
285
|
+
break
|
286
|
+
end
|
287
|
+
end
|
288
|
+
r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
|
289
|
+
s19 << r20
|
290
|
+
if r20
|
291
|
+
r23 = _nt_newline
|
292
|
+
if r23
|
293
|
+
r22 = r23
|
294
|
+
else
|
295
|
+
r22 = instantiate_node(SyntaxNode,input, index...index)
|
296
|
+
end
|
297
|
+
s19 << r22
|
298
|
+
end
|
299
|
+
if s19.last
|
300
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
301
|
+
r19.extend(Expression0)
|
302
|
+
else
|
303
|
+
self.index = i19
|
304
|
+
r19 = nil
|
305
|
+
end
|
306
|
+
if r19
|
307
|
+
r17 = r19
|
308
|
+
else
|
309
|
+
self.index = i17
|
310
|
+
r17 = nil
|
311
|
+
end
|
312
|
+
end
|
313
|
+
s0 << r17
|
314
|
+
end
|
315
|
+
if s0.last
|
316
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
317
|
+
r0.extend(Expression1)
|
318
|
+
else
|
319
|
+
self.index = i0
|
320
|
+
r0 = nil
|
321
|
+
end
|
322
|
+
|
323
|
+
node_cache[:expression][start_index] = r0
|
324
|
+
|
325
|
+
return r0
|
326
|
+
end
|
327
|
+
|
328
|
+
module MethodDefinition0
|
329
|
+
def method_name
|
330
|
+
elements[3]
|
331
|
+
end
|
332
|
+
|
333
|
+
def method_body
|
334
|
+
elements[7]
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
module MethodDefinition1
|
339
|
+
def method_name
|
340
|
+
elements[4]
|
341
|
+
end
|
342
|
+
|
343
|
+
def method_body
|
344
|
+
elements[8]
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def _nt_method_definition
|
349
|
+
start_index = index
|
350
|
+
if node_cache[:method_definition].has_key?(index)
|
351
|
+
cached = node_cache[:method_definition][index]
|
352
|
+
@index = cached.interval.end if cached
|
353
|
+
return cached
|
354
|
+
end
|
355
|
+
|
356
|
+
i0 = index
|
357
|
+
i1, s1 = index, []
|
358
|
+
s2, i2 = [], index
|
359
|
+
loop do
|
360
|
+
r3 = _nt_spaces
|
361
|
+
if r3
|
362
|
+
s2 << r3
|
363
|
+
else
|
364
|
+
break
|
365
|
+
end
|
366
|
+
end
|
367
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
368
|
+
s1 << r2
|
369
|
+
if r2
|
370
|
+
if input.index('def', index) == index
|
371
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
372
|
+
@index += 3
|
373
|
+
else
|
374
|
+
terminal_parse_failure('def')
|
375
|
+
r4 = nil
|
376
|
+
end
|
377
|
+
s1 << r4
|
378
|
+
if r4
|
379
|
+
s5, i5 = [], index
|
380
|
+
loop do
|
381
|
+
r6 = _nt_spaces
|
382
|
+
if r6
|
383
|
+
s5 << r6
|
384
|
+
else
|
385
|
+
break
|
386
|
+
end
|
387
|
+
end
|
388
|
+
if s5.empty?
|
389
|
+
self.index = i5
|
390
|
+
r5 = nil
|
391
|
+
else
|
392
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
393
|
+
end
|
394
|
+
s1 << r5
|
395
|
+
if r5
|
396
|
+
r7 = _nt_message_name
|
397
|
+
s1 << r7
|
398
|
+
if r7
|
399
|
+
s8, i8 = [], index
|
400
|
+
loop do
|
401
|
+
r9 = _nt_ws
|
402
|
+
if r9
|
403
|
+
s8 << r9
|
404
|
+
else
|
405
|
+
break
|
406
|
+
end
|
407
|
+
end
|
408
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
409
|
+
s1 << r8
|
410
|
+
if r8
|
411
|
+
if input.index('=', index) == index
|
412
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
413
|
+
@index += 1
|
414
|
+
else
|
415
|
+
terminal_parse_failure('=')
|
416
|
+
r10 = nil
|
417
|
+
end
|
418
|
+
s1 << r10
|
419
|
+
if r10
|
420
|
+
s11, i11 = [], index
|
421
|
+
loop do
|
422
|
+
r12 = _nt_ws
|
423
|
+
if r12
|
424
|
+
s11 << r12
|
425
|
+
else
|
426
|
+
break
|
427
|
+
end
|
428
|
+
end
|
429
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
430
|
+
s1 << r11
|
431
|
+
if r11
|
432
|
+
r13 = _nt_block_literal
|
433
|
+
s1 << r13
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
if s1.last
|
442
|
+
r1 = instantiate_node(MethodDefinitionNode,input, i1...index, s1)
|
443
|
+
r1.extend(MethodDefinition0)
|
444
|
+
else
|
445
|
+
self.index = i1
|
446
|
+
r1 = nil
|
447
|
+
end
|
448
|
+
if r1
|
449
|
+
r0 = r1
|
450
|
+
else
|
451
|
+
i14, s14 = index, []
|
452
|
+
s15, i15 = [], index
|
453
|
+
loop do
|
454
|
+
r16 = _nt_spaces
|
455
|
+
if r16
|
456
|
+
s15 << r16
|
457
|
+
else
|
458
|
+
break
|
459
|
+
end
|
460
|
+
end
|
461
|
+
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
462
|
+
s14 << r15
|
463
|
+
if r15
|
464
|
+
if input.index('def', index) == index
|
465
|
+
r17 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
466
|
+
@index += 3
|
467
|
+
else
|
468
|
+
terminal_parse_failure('def')
|
469
|
+
r17 = nil
|
470
|
+
end
|
471
|
+
s14 << r17
|
472
|
+
if r17
|
473
|
+
s18, i18 = [], index
|
474
|
+
loop do
|
475
|
+
r19 = _nt_spaces
|
476
|
+
if r19
|
477
|
+
s18 << r19
|
478
|
+
else
|
479
|
+
break
|
480
|
+
end
|
481
|
+
end
|
482
|
+
if s18.empty?
|
483
|
+
self.index = i18
|
484
|
+
r18 = nil
|
485
|
+
else
|
486
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
487
|
+
end
|
488
|
+
s14 << r18
|
489
|
+
if r18
|
490
|
+
if input.index('self ', index) == index
|
491
|
+
r20 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
492
|
+
@index += 5
|
493
|
+
else
|
494
|
+
terminal_parse_failure('self ')
|
495
|
+
r20 = nil
|
496
|
+
end
|
497
|
+
s14 << r20
|
498
|
+
if r20
|
499
|
+
r21 = _nt_message_name
|
500
|
+
s14 << r21
|
501
|
+
if r21
|
502
|
+
s22, i22 = [], index
|
503
|
+
loop do
|
504
|
+
r23 = _nt_ws
|
505
|
+
if r23
|
506
|
+
s22 << r23
|
507
|
+
else
|
508
|
+
break
|
509
|
+
end
|
510
|
+
end
|
511
|
+
r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
|
512
|
+
s14 << r22
|
513
|
+
if r22
|
514
|
+
if input.index('=', index) == index
|
515
|
+
r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
516
|
+
@index += 1
|
517
|
+
else
|
518
|
+
terminal_parse_failure('=')
|
519
|
+
r24 = nil
|
520
|
+
end
|
521
|
+
s14 << r24
|
522
|
+
if r24
|
523
|
+
s25, i25 = [], index
|
524
|
+
loop do
|
525
|
+
r26 = _nt_ws
|
526
|
+
if r26
|
527
|
+
s25 << r26
|
528
|
+
else
|
529
|
+
break
|
530
|
+
end
|
531
|
+
end
|
532
|
+
r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
|
533
|
+
s14 << r25
|
534
|
+
if r25
|
535
|
+
r27 = _nt_block_literal
|
536
|
+
s14 << r27
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
544
|
+
end
|
545
|
+
if s14.last
|
546
|
+
r14 = instantiate_node(ClassMethodDefinitionNode,input, i14...index, s14)
|
547
|
+
r14.extend(MethodDefinition1)
|
548
|
+
else
|
549
|
+
self.index = i14
|
550
|
+
r14 = nil
|
551
|
+
end
|
552
|
+
if r14
|
553
|
+
r0 = r14
|
554
|
+
else
|
555
|
+
self.index = i0
|
556
|
+
r0 = nil
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
node_cache[:method_definition][start_index] = r0
|
561
|
+
|
562
|
+
return r0
|
563
|
+
end
|
564
|
+
|
565
|
+
module RequireStatement0
|
566
|
+
def parse_file
|
567
|
+
elements[2]
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
def _nt_require_statement
|
572
|
+
start_index = index
|
573
|
+
if node_cache[:require_statement].has_key?(index)
|
574
|
+
cached = node_cache[:require_statement][index]
|
575
|
+
@index = cached.interval.end if cached
|
576
|
+
return cached
|
577
|
+
end
|
578
|
+
|
579
|
+
i0, s0 = index, []
|
580
|
+
if input.index('require:', index) == index
|
581
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
582
|
+
@index += 8
|
583
|
+
else
|
584
|
+
terminal_parse_failure('require:')
|
585
|
+
r1 = nil
|
586
|
+
end
|
587
|
+
s0 << r1
|
588
|
+
if r1
|
589
|
+
s2, i2 = [], index
|
590
|
+
loop do
|
591
|
+
r3 = _nt_spaces
|
592
|
+
if r3
|
593
|
+
s2 << r3
|
594
|
+
else
|
595
|
+
break
|
596
|
+
end
|
597
|
+
end
|
598
|
+
if s2.empty?
|
599
|
+
self.index = i2
|
600
|
+
r2 = nil
|
601
|
+
else
|
602
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
603
|
+
end
|
604
|
+
s0 << r2
|
605
|
+
if r2
|
606
|
+
r4 = _nt_string_literal
|
607
|
+
s0 << r4
|
608
|
+
end
|
609
|
+
end
|
610
|
+
if s0.last
|
611
|
+
r0 = instantiate_node(RequireNode,input, i0...index, s0)
|
612
|
+
r0.extend(RequireStatement0)
|
613
|
+
else
|
614
|
+
self.index = i0
|
615
|
+
r0 = nil
|
616
|
+
end
|
617
|
+
|
618
|
+
node_cache[:require_statement][start_index] = r0
|
619
|
+
|
620
|
+
return r0
|
621
|
+
end
|
622
|
+
|
623
|
+
module ReturnStatement0
|
624
|
+
def ret_val
|
625
|
+
elements[3]
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
def _nt_return_statement
|
630
|
+
start_index = index
|
631
|
+
if node_cache[:return_statement].has_key?(index)
|
632
|
+
cached = node_cache[:return_statement][index]
|
633
|
+
@index = cached.interval.end if cached
|
634
|
+
return cached
|
635
|
+
end
|
636
|
+
|
637
|
+
i0, s0 = index, []
|
638
|
+
if input.index('return', index) == index
|
639
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
640
|
+
@index += 6
|
641
|
+
else
|
642
|
+
terminal_parse_failure('return')
|
643
|
+
r1 = nil
|
644
|
+
end
|
645
|
+
s0 << r1
|
646
|
+
if r1
|
647
|
+
if input.index(':', index) == index
|
648
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
649
|
+
@index += 1
|
650
|
+
else
|
651
|
+
terminal_parse_failure(':')
|
652
|
+
r3 = nil
|
653
|
+
end
|
654
|
+
if r3
|
655
|
+
r2 = r3
|
656
|
+
else
|
657
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
658
|
+
end
|
659
|
+
s0 << r2
|
660
|
+
if r2
|
661
|
+
if input.index(' ', index) == index
|
662
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
663
|
+
@index += 1
|
664
|
+
else
|
665
|
+
terminal_parse_failure(' ')
|
666
|
+
r4 = nil
|
667
|
+
end
|
668
|
+
s0 << r4
|
669
|
+
if r4
|
670
|
+
i5 = index
|
671
|
+
r6 = _nt_subexpression
|
672
|
+
if r6
|
673
|
+
r5 = r6
|
674
|
+
else
|
675
|
+
r7 = _nt_identifier
|
676
|
+
if r7
|
677
|
+
r5 = r7
|
678
|
+
else
|
679
|
+
r8 = _nt_literal
|
680
|
+
if r8
|
681
|
+
r5 = r8
|
682
|
+
else
|
683
|
+
self.index = i5
|
684
|
+
r5 = nil
|
685
|
+
end
|
686
|
+
end
|
687
|
+
end
|
688
|
+
s0 << r5
|
689
|
+
end
|
690
|
+
end
|
691
|
+
end
|
692
|
+
if s0.last
|
693
|
+
r0 = instantiate_node(ReturnNode,input, i0...index, s0)
|
694
|
+
r0.extend(ReturnStatement0)
|
695
|
+
else
|
696
|
+
self.index = i0
|
697
|
+
r0 = nil
|
698
|
+
end
|
699
|
+
|
700
|
+
node_cache[:return_statement][start_index] = r0
|
701
|
+
|
702
|
+
return r0
|
703
|
+
end
|
704
|
+
|
705
|
+
module YieldStatement0
|
706
|
+
def yieldval
|
707
|
+
elements[3]
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
def _nt_yield_statement
|
712
|
+
start_index = index
|
713
|
+
if node_cache[:yield_statement].has_key?(index)
|
714
|
+
cached = node_cache[:yield_statement][index]
|
715
|
+
@index = cached.interval.end if cached
|
716
|
+
return cached
|
717
|
+
end
|
718
|
+
|
719
|
+
i0, s0 = index, []
|
720
|
+
if input.index('yield', index) == index
|
721
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
722
|
+
@index += 5
|
723
|
+
else
|
724
|
+
terminal_parse_failure('yield')
|
725
|
+
r1 = nil
|
726
|
+
end
|
727
|
+
s0 << r1
|
728
|
+
if r1
|
729
|
+
if input.index(':', index) == index
|
730
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
731
|
+
@index += 1
|
732
|
+
else
|
733
|
+
terminal_parse_failure(':')
|
734
|
+
r3 = nil
|
735
|
+
end
|
736
|
+
if r3
|
737
|
+
r2 = r3
|
738
|
+
else
|
739
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
740
|
+
end
|
741
|
+
s0 << r2
|
742
|
+
if r2
|
743
|
+
if input.index(' ', index) == index
|
744
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
745
|
+
@index += 1
|
746
|
+
else
|
747
|
+
terminal_parse_failure(' ')
|
748
|
+
r4 = nil
|
749
|
+
end
|
750
|
+
s0 << r4
|
751
|
+
if r4
|
752
|
+
r5 = _nt_array_literal
|
753
|
+
s0 << r5
|
754
|
+
end
|
755
|
+
end
|
756
|
+
end
|
757
|
+
if s0.last
|
758
|
+
r0 = instantiate_node(YieldNode,input, i0...index, s0)
|
759
|
+
r0.extend(YieldStatement0)
|
760
|
+
else
|
761
|
+
self.index = i0
|
762
|
+
r0 = nil
|
763
|
+
end
|
764
|
+
|
765
|
+
node_cache[:yield_statement][start_index] = r0
|
766
|
+
|
767
|
+
return r0
|
768
|
+
end
|
769
|
+
|
770
|
+
module TryExpression0
|
771
|
+
def try_block
|
772
|
+
elements[2]
|
773
|
+
end
|
774
|
+
end
|
775
|
+
|
776
|
+
def _nt_try_expression
|
777
|
+
start_index = index
|
778
|
+
if node_cache[:try_expression].has_key?(index)
|
779
|
+
cached = node_cache[:try_expression][index]
|
780
|
+
@index = cached.interval.end if cached
|
781
|
+
return cached
|
782
|
+
end
|
783
|
+
|
784
|
+
i0, s0 = index, []
|
785
|
+
if input.index('try', index) == index
|
786
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
787
|
+
@index += 3
|
788
|
+
else
|
789
|
+
terminal_parse_failure('try')
|
790
|
+
r1 = nil
|
791
|
+
end
|
792
|
+
s0 << r1
|
793
|
+
if r1
|
794
|
+
if input.index(' ', index) == index
|
795
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
796
|
+
@index += 1
|
797
|
+
else
|
798
|
+
terminal_parse_failure(' ')
|
799
|
+
r3 = nil
|
800
|
+
end
|
801
|
+
if r3
|
802
|
+
r2 = r3
|
803
|
+
else
|
804
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
805
|
+
end
|
806
|
+
s0 << r2
|
807
|
+
if r2
|
808
|
+
r4 = _nt_block_literal
|
809
|
+
s0 << r4
|
810
|
+
end
|
811
|
+
end
|
812
|
+
if s0.last
|
813
|
+
r0 = instantiate_node(TryNode,input, i0...index, s0)
|
814
|
+
r0.extend(TryExpression0)
|
815
|
+
else
|
816
|
+
self.index = i0
|
817
|
+
r0 = nil
|
818
|
+
end
|
819
|
+
|
820
|
+
node_cache[:try_expression][start_index] = r0
|
821
|
+
|
822
|
+
return r0
|
823
|
+
end
|
824
|
+
|
825
|
+
module CatchExpression0
|
826
|
+
def identifier
|
827
|
+
elements[1]
|
828
|
+
end
|
829
|
+
|
830
|
+
end
|
831
|
+
|
832
|
+
module CatchExpression1
|
833
|
+
def error_class
|
834
|
+
elements[1]
|
835
|
+
end
|
836
|
+
|
837
|
+
def catch_block
|
838
|
+
elements[3]
|
839
|
+
end
|
840
|
+
end
|
841
|
+
|
842
|
+
def _nt_catch_expression
|
843
|
+
start_index = index
|
844
|
+
if node_cache[:catch_expression].has_key?(index)
|
845
|
+
cached = node_cache[:catch_expression][index]
|
846
|
+
@index = cached.interval.end if cached
|
847
|
+
return cached
|
848
|
+
end
|
849
|
+
|
850
|
+
i0, s0 = index, []
|
851
|
+
if input.index('catch', index) == index
|
852
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
853
|
+
@index += 5
|
854
|
+
else
|
855
|
+
terminal_parse_failure('catch')
|
856
|
+
r1 = nil
|
857
|
+
end
|
858
|
+
s0 << r1
|
859
|
+
if r1
|
860
|
+
i3, s3 = index, []
|
861
|
+
if input.index(': ', index) == index
|
862
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
863
|
+
@index += 2
|
864
|
+
else
|
865
|
+
terminal_parse_failure(': ')
|
866
|
+
r4 = nil
|
867
|
+
end
|
868
|
+
s3 << r4
|
869
|
+
if r4
|
870
|
+
r5 = _nt_identifier
|
871
|
+
s3 << r5
|
872
|
+
if r5
|
873
|
+
if input.index(' ', index) == index
|
874
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
875
|
+
@index += 1
|
876
|
+
else
|
877
|
+
terminal_parse_failure(' ')
|
878
|
+
r6 = nil
|
879
|
+
end
|
880
|
+
s3 << r6
|
881
|
+
end
|
882
|
+
end
|
883
|
+
if s3.last
|
884
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
885
|
+
r3.extend(CatchExpression0)
|
886
|
+
else
|
887
|
+
self.index = i3
|
888
|
+
r3 = nil
|
889
|
+
end
|
890
|
+
if r3
|
891
|
+
r2 = r3
|
892
|
+
else
|
893
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
894
|
+
end
|
895
|
+
s0 << r2
|
896
|
+
if r2
|
897
|
+
if input.index(' ', index) == index
|
898
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
899
|
+
@index += 1
|
900
|
+
else
|
901
|
+
terminal_parse_failure(' ')
|
902
|
+
r8 = nil
|
903
|
+
end
|
904
|
+
if r8
|
905
|
+
r7 = r8
|
906
|
+
else
|
907
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
908
|
+
end
|
909
|
+
s0 << r7
|
910
|
+
if r7
|
911
|
+
r9 = _nt_block_literal
|
912
|
+
s0 << r9
|
913
|
+
end
|
914
|
+
end
|
915
|
+
end
|
916
|
+
if s0.last
|
917
|
+
r0 = instantiate_node(CatchNode,input, i0...index, s0)
|
918
|
+
r0.extend(CatchExpression1)
|
919
|
+
else
|
920
|
+
self.index = i0
|
921
|
+
r0 = nil
|
922
|
+
end
|
923
|
+
|
924
|
+
node_cache[:catch_expression][start_index] = r0
|
925
|
+
|
926
|
+
return r0
|
927
|
+
end
|
928
|
+
|
929
|
+
module EnsureExpression0
|
930
|
+
def ensure_block
|
931
|
+
elements[2]
|
932
|
+
end
|
933
|
+
end
|
934
|
+
|
935
|
+
def _nt_ensure_expression
|
936
|
+
start_index = index
|
937
|
+
if node_cache[:ensure_expression].has_key?(index)
|
938
|
+
cached = node_cache[:ensure_expression][index]
|
939
|
+
@index = cached.interval.end if cached
|
940
|
+
return cached
|
941
|
+
end
|
942
|
+
|
943
|
+
i0, s0 = index, []
|
944
|
+
if input.index('ensure', index) == index
|
945
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
946
|
+
@index += 6
|
947
|
+
else
|
948
|
+
terminal_parse_failure('ensure')
|
949
|
+
r1 = nil
|
950
|
+
end
|
951
|
+
s0 << r1
|
952
|
+
if r1
|
953
|
+
if input.index(' ', index) == index
|
954
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
955
|
+
@index += 1
|
956
|
+
else
|
957
|
+
terminal_parse_failure(' ')
|
958
|
+
r3 = nil
|
959
|
+
end
|
960
|
+
if r3
|
961
|
+
r2 = r3
|
962
|
+
else
|
963
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
964
|
+
end
|
965
|
+
s0 << r2
|
966
|
+
if r2
|
967
|
+
r4 = _nt_block_literal
|
968
|
+
s0 << r4
|
969
|
+
end
|
970
|
+
end
|
971
|
+
if s0.last
|
972
|
+
r0 = instantiate_node(EnsureNode,input, i0...index, s0)
|
973
|
+
r0.extend(EnsureExpression0)
|
974
|
+
else
|
975
|
+
self.index = i0
|
976
|
+
r0 = nil
|
977
|
+
end
|
978
|
+
|
979
|
+
node_cache[:ensure_expression][start_index] = r0
|
980
|
+
|
981
|
+
return r0
|
982
|
+
end
|
983
|
+
|
984
|
+
module Subexpression0
|
985
|
+
def subexpr
|
986
|
+
elements[2]
|
987
|
+
end
|
988
|
+
|
989
|
+
end
|
990
|
+
|
991
|
+
def _nt_subexpression
|
992
|
+
start_index = index
|
993
|
+
if node_cache[:subexpression].has_key?(index)
|
994
|
+
cached = node_cache[:subexpression][index]
|
995
|
+
@index = cached.interval.end if cached
|
996
|
+
return cached
|
997
|
+
end
|
998
|
+
|
999
|
+
i0, s0 = index, []
|
1000
|
+
if input.index('(', index) == index
|
1001
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1002
|
+
@index += 1
|
1003
|
+
else
|
1004
|
+
terminal_parse_failure('(')
|
1005
|
+
r1 = nil
|
1006
|
+
end
|
1007
|
+
s0 << r1
|
1008
|
+
if r1
|
1009
|
+
s2, i2 = [], index
|
1010
|
+
loop do
|
1011
|
+
r3 = _nt_ws
|
1012
|
+
if r3
|
1013
|
+
s2 << r3
|
1014
|
+
else
|
1015
|
+
break
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1019
|
+
s0 << r2
|
1020
|
+
if r2
|
1021
|
+
r4 = _nt_expression
|
1022
|
+
s0 << r4
|
1023
|
+
if r4
|
1024
|
+
s5, i5 = [], index
|
1025
|
+
loop do
|
1026
|
+
r6 = _nt_ws
|
1027
|
+
if r6
|
1028
|
+
s5 << r6
|
1029
|
+
else
|
1030
|
+
break
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1034
|
+
s0 << r5
|
1035
|
+
if r5
|
1036
|
+
if input.index(')', index) == index
|
1037
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1038
|
+
@index += 1
|
1039
|
+
else
|
1040
|
+
terminal_parse_failure(')')
|
1041
|
+
r7 = nil
|
1042
|
+
end
|
1043
|
+
s0 << r7
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
if s0.last
|
1049
|
+
r0 = instantiate_node(ExpressionNode,input, i0...index, s0)
|
1050
|
+
r0.extend(Subexpression0)
|
1051
|
+
else
|
1052
|
+
self.index = i0
|
1053
|
+
r0 = nil
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
node_cache[:subexpression][start_index] = r0
|
1057
|
+
|
1058
|
+
return r0
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
module Assignment0
|
1062
|
+
def target
|
1063
|
+
elements[0]
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
def val
|
1067
|
+
elements[4]
|
1068
|
+
end
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
module Assignment1
|
1072
|
+
def value
|
1073
|
+
if val.respond_to?(:subexpr)
|
1074
|
+
"#{target.value} = #{val.subexpr.value}"
|
1075
|
+
else
|
1076
|
+
"#{target.value} = #{val.value}"
|
1077
|
+
end
|
1078
|
+
end
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
def _nt_assignment
|
1082
|
+
start_index = index
|
1083
|
+
if node_cache[:assignment].has_key?(index)
|
1084
|
+
cached = node_cache[:assignment][index]
|
1085
|
+
@index = cached.interval.end if cached
|
1086
|
+
return cached
|
1087
|
+
end
|
1088
|
+
|
1089
|
+
i0, s0 = index, []
|
1090
|
+
r1 = _nt_identifier
|
1091
|
+
s0 << r1
|
1092
|
+
if r1
|
1093
|
+
s2, i2 = [], index
|
1094
|
+
loop do
|
1095
|
+
r3 = _nt_ws
|
1096
|
+
if r3
|
1097
|
+
s2 << r3
|
1098
|
+
else
|
1099
|
+
break
|
1100
|
+
end
|
1101
|
+
end
|
1102
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1103
|
+
s0 << r2
|
1104
|
+
if r2
|
1105
|
+
if input.index('=', index) == index
|
1106
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1107
|
+
@index += 1
|
1108
|
+
else
|
1109
|
+
terminal_parse_failure('=')
|
1110
|
+
r4 = nil
|
1111
|
+
end
|
1112
|
+
s0 << r4
|
1113
|
+
if r4
|
1114
|
+
s5, i5 = [], index
|
1115
|
+
loop do
|
1116
|
+
r6 = _nt_ws
|
1117
|
+
if r6
|
1118
|
+
s5 << r6
|
1119
|
+
else
|
1120
|
+
break
|
1121
|
+
end
|
1122
|
+
end
|
1123
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1124
|
+
s0 << r5
|
1125
|
+
if r5
|
1126
|
+
i7 = index
|
1127
|
+
r8 = _nt_expression
|
1128
|
+
if r8
|
1129
|
+
r7 = r8
|
1130
|
+
else
|
1131
|
+
r9 = _nt_identifier
|
1132
|
+
if r9
|
1133
|
+
r7 = r9
|
1134
|
+
else
|
1135
|
+
r10 = _nt_literal
|
1136
|
+
if r10
|
1137
|
+
r7 = r10
|
1138
|
+
else
|
1139
|
+
self.index = i7
|
1140
|
+
r7 = nil
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
end
|
1144
|
+
s0 << r7
|
1145
|
+
end
|
1146
|
+
end
|
1147
|
+
end
|
1148
|
+
end
|
1149
|
+
if s0.last
|
1150
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1151
|
+
r0.extend(Assignment0)
|
1152
|
+
r0.extend(Assignment1)
|
1153
|
+
else
|
1154
|
+
self.index = i0
|
1155
|
+
r0 = nil
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
node_cache[:assignment][start_index] = r0
|
1159
|
+
|
1160
|
+
return r0
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
module SuperCall0
|
1164
|
+
def params
|
1165
|
+
elements[1]
|
1166
|
+
end
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
def _nt_super_call
|
1170
|
+
start_index = index
|
1171
|
+
if node_cache[:super_call].has_key?(index)
|
1172
|
+
cached = node_cache[:super_call][index]
|
1173
|
+
@index = cached.interval.end if cached
|
1174
|
+
return cached
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
i0, s0 = index, []
|
1178
|
+
if input.index('super', index) == index
|
1179
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
1180
|
+
@index += 5
|
1181
|
+
else
|
1182
|
+
terminal_parse_failure('super')
|
1183
|
+
r1 = nil
|
1184
|
+
end
|
1185
|
+
s0 << r1
|
1186
|
+
if r1
|
1187
|
+
r3 = _nt_message_params
|
1188
|
+
if r3
|
1189
|
+
r2 = r3
|
1190
|
+
else
|
1191
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1192
|
+
end
|
1193
|
+
s0 << r2
|
1194
|
+
end
|
1195
|
+
if s0.last
|
1196
|
+
r0 = instantiate_node(SuperCallNode,input, i0...index, s0)
|
1197
|
+
r0.extend(SuperCall0)
|
1198
|
+
else
|
1199
|
+
self.index = i0
|
1200
|
+
r0 = nil
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
node_cache[:super_call][start_index] = r0
|
1204
|
+
|
1205
|
+
return r0
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
module MultipleMethodCall0
|
1209
|
+
def message
|
1210
|
+
elements[0]
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
module MultipleMethodCall1
|
1216
|
+
def receiver
|
1217
|
+
elements[0]
|
1218
|
+
end
|
1219
|
+
|
1220
|
+
def messages
|
1221
|
+
elements[2]
|
1222
|
+
end
|
1223
|
+
|
1224
|
+
def final_message
|
1225
|
+
elements[3]
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
def _nt_multiple_method_call
|
1231
|
+
start_index = index
|
1232
|
+
if node_cache[:multiple_method_call].has_key?(index)
|
1233
|
+
cached = node_cache[:multiple_method_call][index]
|
1234
|
+
@index = cached.interval.end if cached
|
1235
|
+
return cached
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
i0, s0 = index, []
|
1239
|
+
r1 = _nt_message_receiver
|
1240
|
+
s0 << r1
|
1241
|
+
if r1
|
1242
|
+
if input.index(' ', index) == index
|
1243
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1244
|
+
@index += 1
|
1245
|
+
else
|
1246
|
+
terminal_parse_failure(' ')
|
1247
|
+
r2 = nil
|
1248
|
+
end
|
1249
|
+
s0 << r2
|
1250
|
+
if r2
|
1251
|
+
s3, i3 = [], index
|
1252
|
+
loop do
|
1253
|
+
i4, s4 = index, []
|
1254
|
+
i5 = index
|
1255
|
+
r6 = _nt_message_with_params
|
1256
|
+
if r6
|
1257
|
+
r5 = r6
|
1258
|
+
else
|
1259
|
+
r7 = _nt_message_without_params
|
1260
|
+
if r7
|
1261
|
+
r5 = r7
|
1262
|
+
else
|
1263
|
+
self.index = i5
|
1264
|
+
r5 = nil
|
1265
|
+
end
|
1266
|
+
end
|
1267
|
+
s4 << r5
|
1268
|
+
if r5
|
1269
|
+
s8, i8 = [], index
|
1270
|
+
loop do
|
1271
|
+
r9 = _nt_spaces
|
1272
|
+
if r9
|
1273
|
+
s8 << r9
|
1274
|
+
else
|
1275
|
+
break
|
1276
|
+
end
|
1277
|
+
end
|
1278
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
1279
|
+
s4 << r8
|
1280
|
+
if r8
|
1281
|
+
if input.index(';', index) == index
|
1282
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1283
|
+
@index += 1
|
1284
|
+
else
|
1285
|
+
terminal_parse_failure(';')
|
1286
|
+
r10 = nil
|
1287
|
+
end
|
1288
|
+
s4 << r10
|
1289
|
+
if r10
|
1290
|
+
s11, i11 = [], index
|
1291
|
+
loop do
|
1292
|
+
r12 = _nt_ws
|
1293
|
+
if r12
|
1294
|
+
s11 << r12
|
1295
|
+
else
|
1296
|
+
break
|
1297
|
+
end
|
1298
|
+
end
|
1299
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
1300
|
+
s4 << r11
|
1301
|
+
end
|
1302
|
+
end
|
1303
|
+
end
|
1304
|
+
if s4.last
|
1305
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1306
|
+
r4.extend(MultipleMethodCall0)
|
1307
|
+
else
|
1308
|
+
self.index = i4
|
1309
|
+
r4 = nil
|
1310
|
+
end
|
1311
|
+
if r4
|
1312
|
+
s3 << r4
|
1313
|
+
else
|
1314
|
+
break
|
1315
|
+
end
|
1316
|
+
end
|
1317
|
+
if s3.empty?
|
1318
|
+
self.index = i3
|
1319
|
+
r3 = nil
|
1320
|
+
else
|
1321
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1322
|
+
end
|
1323
|
+
s0 << r3
|
1324
|
+
if r3
|
1325
|
+
i13 = index
|
1326
|
+
r14 = _nt_message_with_params
|
1327
|
+
if r14
|
1328
|
+
r13 = r14
|
1329
|
+
else
|
1330
|
+
r15 = _nt_message_without_params
|
1331
|
+
if r15
|
1332
|
+
r13 = r15
|
1333
|
+
else
|
1334
|
+
self.index = i13
|
1335
|
+
r13 = nil
|
1336
|
+
end
|
1337
|
+
end
|
1338
|
+
s0 << r13
|
1339
|
+
if r13
|
1340
|
+
s16, i16 = [], index
|
1341
|
+
loop do
|
1342
|
+
r17 = _nt_ws
|
1343
|
+
if r17
|
1344
|
+
s16 << r17
|
1345
|
+
else
|
1346
|
+
break
|
1347
|
+
end
|
1348
|
+
end
|
1349
|
+
r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
|
1350
|
+
s0 << r16
|
1351
|
+
end
|
1352
|
+
end
|
1353
|
+
end
|
1354
|
+
end
|
1355
|
+
if s0.last
|
1356
|
+
r0 = instantiate_node(MultipleMethodcallNode,input, i0...index, s0)
|
1357
|
+
r0.extend(MultipleMethodCall1)
|
1358
|
+
else
|
1359
|
+
self.index = i0
|
1360
|
+
r0 = nil
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
node_cache[:multiple_method_call][start_index] = r0
|
1364
|
+
|
1365
|
+
return r0
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
module MethodCall0
|
1369
|
+
def block_var_name
|
1370
|
+
elements[1]
|
1371
|
+
end
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
module MethodCall1
|
1375
|
+
def passed_block
|
1376
|
+
elements[1]
|
1377
|
+
end
|
1378
|
+
end
|
1379
|
+
|
1380
|
+
module MethodCall2
|
1381
|
+
def block_var_name
|
1382
|
+
elements[1]
|
1383
|
+
end
|
1384
|
+
end
|
1385
|
+
|
1386
|
+
module MethodCall3
|
1387
|
+
def passed_block
|
1388
|
+
elements[1]
|
1389
|
+
end
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
module MethodCall4
|
1393
|
+
def message
|
1394
|
+
elements[1]
|
1395
|
+
end
|
1396
|
+
|
1397
|
+
def passed_block_with_ws
|
1398
|
+
elements[2]
|
1399
|
+
end
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
module MethodCall5
|
1403
|
+
def receiver
|
1404
|
+
elements[0]
|
1405
|
+
end
|
1406
|
+
|
1407
|
+
def first_message
|
1408
|
+
elements[2]
|
1409
|
+
end
|
1410
|
+
|
1411
|
+
def first_passed_block_with_ws
|
1412
|
+
elements[3]
|
1413
|
+
end
|
1414
|
+
|
1415
|
+
def messages
|
1416
|
+
elements[4]
|
1417
|
+
end
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
def _nt_method_call
|
1421
|
+
start_index = index
|
1422
|
+
if node_cache[:method_call].has_key?(index)
|
1423
|
+
cached = node_cache[:method_call][index]
|
1424
|
+
@index = cached.interval.end if cached
|
1425
|
+
return cached
|
1426
|
+
end
|
1427
|
+
|
1428
|
+
i0, s0 = index, []
|
1429
|
+
r1 = _nt_message_receiver
|
1430
|
+
s0 << r1
|
1431
|
+
if r1
|
1432
|
+
if input.index(' ', index) == index
|
1433
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1434
|
+
@index += 1
|
1435
|
+
else
|
1436
|
+
terminal_parse_failure(' ')
|
1437
|
+
r2 = nil
|
1438
|
+
end
|
1439
|
+
s0 << r2
|
1440
|
+
if r2
|
1441
|
+
i3 = index
|
1442
|
+
r4 = _nt_operator_message
|
1443
|
+
if r4
|
1444
|
+
r3 = r4
|
1445
|
+
else
|
1446
|
+
r5 = _nt_message_with_params
|
1447
|
+
if r5
|
1448
|
+
r3 = r5
|
1449
|
+
else
|
1450
|
+
r6 = _nt_message_without_params
|
1451
|
+
if r6
|
1452
|
+
r3 = r6
|
1453
|
+
else
|
1454
|
+
self.index = i3
|
1455
|
+
r3 = nil
|
1456
|
+
end
|
1457
|
+
end
|
1458
|
+
end
|
1459
|
+
s0 << r3
|
1460
|
+
if r3
|
1461
|
+
i8, s8 = index, []
|
1462
|
+
if input.index(' ', index) == index
|
1463
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1464
|
+
@index += 1
|
1465
|
+
else
|
1466
|
+
terminal_parse_failure(' ')
|
1467
|
+
r10 = nil
|
1468
|
+
end
|
1469
|
+
if r10
|
1470
|
+
r9 = r10
|
1471
|
+
else
|
1472
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
1473
|
+
end
|
1474
|
+
s8 << r9
|
1475
|
+
if r9
|
1476
|
+
i11 = index
|
1477
|
+
r12 = _nt_block_literal_do_end
|
1478
|
+
if r12
|
1479
|
+
r11 = r12
|
1480
|
+
else
|
1481
|
+
r13 = _nt_block_literal_curly_braces
|
1482
|
+
if r13
|
1483
|
+
r11 = r13
|
1484
|
+
else
|
1485
|
+
i14, s14 = index, []
|
1486
|
+
if input.index('&', index) == index
|
1487
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1488
|
+
@index += 1
|
1489
|
+
else
|
1490
|
+
terminal_parse_failure('&')
|
1491
|
+
r15 = nil
|
1492
|
+
end
|
1493
|
+
s14 << r15
|
1494
|
+
if r15
|
1495
|
+
r16 = _nt_identifier
|
1496
|
+
s14 << r16
|
1497
|
+
end
|
1498
|
+
if s14.last
|
1499
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
1500
|
+
r14.extend(MethodCall0)
|
1501
|
+
else
|
1502
|
+
self.index = i14
|
1503
|
+
r14 = nil
|
1504
|
+
end
|
1505
|
+
if r14
|
1506
|
+
r11 = r14
|
1507
|
+
else
|
1508
|
+
self.index = i11
|
1509
|
+
r11 = nil
|
1510
|
+
end
|
1511
|
+
end
|
1512
|
+
end
|
1513
|
+
s8 << r11
|
1514
|
+
end
|
1515
|
+
if s8.last
|
1516
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
1517
|
+
r8.extend(MethodCall1)
|
1518
|
+
else
|
1519
|
+
self.index = i8
|
1520
|
+
r8 = nil
|
1521
|
+
end
|
1522
|
+
if r8
|
1523
|
+
r7 = r8
|
1524
|
+
else
|
1525
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
1526
|
+
end
|
1527
|
+
s0 << r7
|
1528
|
+
if r7
|
1529
|
+
s17, i17 = [], index
|
1530
|
+
loop do
|
1531
|
+
i18, s18 = index, []
|
1532
|
+
if input.index(' ', index) == index
|
1533
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1534
|
+
@index += 1
|
1535
|
+
else
|
1536
|
+
terminal_parse_failure(' ')
|
1537
|
+
r19 = nil
|
1538
|
+
end
|
1539
|
+
s18 << r19
|
1540
|
+
if r19
|
1541
|
+
i20 = index
|
1542
|
+
r21 = _nt_message_with_params
|
1543
|
+
if r21
|
1544
|
+
r20 = r21
|
1545
|
+
else
|
1546
|
+
r22 = _nt_message_without_params
|
1547
|
+
if r22
|
1548
|
+
r20 = r22
|
1549
|
+
else
|
1550
|
+
self.index = i20
|
1551
|
+
r20 = nil
|
1552
|
+
end
|
1553
|
+
end
|
1554
|
+
s18 << r20
|
1555
|
+
if r20
|
1556
|
+
i24, s24 = index, []
|
1557
|
+
if input.index(' ', index) == index
|
1558
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1559
|
+
@index += 1
|
1560
|
+
else
|
1561
|
+
terminal_parse_failure(' ')
|
1562
|
+
r26 = nil
|
1563
|
+
end
|
1564
|
+
if r26
|
1565
|
+
r25 = r26
|
1566
|
+
else
|
1567
|
+
r25 = instantiate_node(SyntaxNode,input, index...index)
|
1568
|
+
end
|
1569
|
+
s24 << r25
|
1570
|
+
if r25
|
1571
|
+
i27 = index
|
1572
|
+
r28 = _nt_block_literal_do_end
|
1573
|
+
if r28
|
1574
|
+
r27 = r28
|
1575
|
+
else
|
1576
|
+
r29 = _nt_block_literal_curly_braces
|
1577
|
+
if r29
|
1578
|
+
r27 = r29
|
1579
|
+
else
|
1580
|
+
i30, s30 = index, []
|
1581
|
+
if input.index('&', index) == index
|
1582
|
+
r31 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1583
|
+
@index += 1
|
1584
|
+
else
|
1585
|
+
terminal_parse_failure('&')
|
1586
|
+
r31 = nil
|
1587
|
+
end
|
1588
|
+
s30 << r31
|
1589
|
+
if r31
|
1590
|
+
r32 = _nt_identifier
|
1591
|
+
s30 << r32
|
1592
|
+
end
|
1593
|
+
if s30.last
|
1594
|
+
r30 = instantiate_node(SyntaxNode,input, i30...index, s30)
|
1595
|
+
r30.extend(MethodCall2)
|
1596
|
+
else
|
1597
|
+
self.index = i30
|
1598
|
+
r30 = nil
|
1599
|
+
end
|
1600
|
+
if r30
|
1601
|
+
r27 = r30
|
1602
|
+
else
|
1603
|
+
self.index = i27
|
1604
|
+
r27 = nil
|
1605
|
+
end
|
1606
|
+
end
|
1607
|
+
end
|
1608
|
+
s24 << r27
|
1609
|
+
end
|
1610
|
+
if s24.last
|
1611
|
+
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
1612
|
+
r24.extend(MethodCall3)
|
1613
|
+
else
|
1614
|
+
self.index = i24
|
1615
|
+
r24 = nil
|
1616
|
+
end
|
1617
|
+
if r24
|
1618
|
+
r23 = r24
|
1619
|
+
else
|
1620
|
+
r23 = instantiate_node(SyntaxNode,input, index...index)
|
1621
|
+
end
|
1622
|
+
s18 << r23
|
1623
|
+
end
|
1624
|
+
end
|
1625
|
+
if s18.last
|
1626
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
1627
|
+
r18.extend(MethodCall4)
|
1628
|
+
else
|
1629
|
+
self.index = i18
|
1630
|
+
r18 = nil
|
1631
|
+
end
|
1632
|
+
if r18
|
1633
|
+
s17 << r18
|
1634
|
+
else
|
1635
|
+
break
|
1636
|
+
end
|
1637
|
+
end
|
1638
|
+
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
1639
|
+
s0 << r17
|
1640
|
+
end
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
if s0.last
|
1645
|
+
r0 = instantiate_node(MethodcallNode,input, i0...index, s0)
|
1646
|
+
r0.extend(MethodCall5)
|
1647
|
+
else
|
1648
|
+
self.index = i0
|
1649
|
+
r0 = nil
|
1650
|
+
end
|
1651
|
+
|
1652
|
+
node_cache[:method_call][start_index] = r0
|
1653
|
+
|
1654
|
+
return r0
|
1655
|
+
end
|
1656
|
+
|
1657
|
+
def _nt_message_receiver
|
1658
|
+
start_index = index
|
1659
|
+
if node_cache[:message_receiver].has_key?(index)
|
1660
|
+
cached = node_cache[:message_receiver][index]
|
1661
|
+
@index = cached.interval.end if cached
|
1662
|
+
return cached
|
1663
|
+
end
|
1664
|
+
|
1665
|
+
i0 = index
|
1666
|
+
i1 = index
|
1667
|
+
r2 = _nt_literal
|
1668
|
+
if r2
|
1669
|
+
r1 = r2
|
1670
|
+
else
|
1671
|
+
r3 = _nt_identifier
|
1672
|
+
if r3
|
1673
|
+
r1 = r3
|
1674
|
+
else
|
1675
|
+
self.index = i1
|
1676
|
+
r1 = nil
|
1677
|
+
end
|
1678
|
+
end
|
1679
|
+
if r1
|
1680
|
+
r0 = r1
|
1681
|
+
else
|
1682
|
+
r4 = _nt_subexpression
|
1683
|
+
if r4
|
1684
|
+
r0 = r4
|
1685
|
+
else
|
1686
|
+
self.index = i0
|
1687
|
+
r0 = nil
|
1688
|
+
end
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
node_cache[:message_receiver][start_index] = r0
|
1692
|
+
|
1693
|
+
return r0
|
1694
|
+
end
|
1695
|
+
|
1696
|
+
module MessageWithParams0
|
1697
|
+
def message
|
1698
|
+
elements[0]
|
1699
|
+
end
|
1700
|
+
|
1701
|
+
def params
|
1702
|
+
elements[1]
|
1703
|
+
end
|
1704
|
+
end
|
1705
|
+
|
1706
|
+
def _nt_message_with_params
|
1707
|
+
start_index = index
|
1708
|
+
if node_cache[:message_with_params].has_key?(index)
|
1709
|
+
cached = node_cache[:message_with_params][index]
|
1710
|
+
@index = cached.interval.end if cached
|
1711
|
+
return cached
|
1712
|
+
end
|
1713
|
+
|
1714
|
+
i0, s0 = index, []
|
1715
|
+
r1 = _nt_message_name
|
1716
|
+
s0 << r1
|
1717
|
+
if r1
|
1718
|
+
r2 = _nt_message_params
|
1719
|
+
s0 << r2
|
1720
|
+
end
|
1721
|
+
if s0.last
|
1722
|
+
r0 = instantiate_node(MessageWithParamsNode,input, i0...index, s0)
|
1723
|
+
r0.extend(MessageWithParams0)
|
1724
|
+
else
|
1725
|
+
self.index = i0
|
1726
|
+
r0 = nil
|
1727
|
+
end
|
1728
|
+
|
1729
|
+
node_cache[:message_with_params][start_index] = r0
|
1730
|
+
|
1731
|
+
return r0
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
module MessageWithoutParams0
|
1735
|
+
def message
|
1736
|
+
elements[0]
|
1737
|
+
end
|
1738
|
+
|
1739
|
+
end
|
1740
|
+
|
1741
|
+
def _nt_message_without_params
|
1742
|
+
start_index = index
|
1743
|
+
if node_cache[:message_without_params].has_key?(index)
|
1744
|
+
cached = node_cache[:message_without_params][index]
|
1745
|
+
@index = cached.interval.end if cached
|
1746
|
+
return cached
|
1747
|
+
end
|
1748
|
+
|
1749
|
+
i0, s0 = index, []
|
1750
|
+
r1 = _nt_message_name
|
1751
|
+
s0 << r1
|
1752
|
+
if r1
|
1753
|
+
i2 = index
|
1754
|
+
r3 = _nt_message_params
|
1755
|
+
if r3
|
1756
|
+
r2 = nil
|
1757
|
+
else
|
1758
|
+
self.index = i2
|
1759
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1760
|
+
end
|
1761
|
+
s0 << r2
|
1762
|
+
end
|
1763
|
+
if s0.last
|
1764
|
+
r0 = instantiate_node(MessageWithoutParamsNode,input, i0...index, s0)
|
1765
|
+
r0.extend(MessageWithoutParams0)
|
1766
|
+
else
|
1767
|
+
self.index = i0
|
1768
|
+
r0 = nil
|
1769
|
+
end
|
1770
|
+
|
1771
|
+
node_cache[:message_without_params][start_index] = r0
|
1772
|
+
|
1773
|
+
return r0
|
1774
|
+
end
|
1775
|
+
|
1776
|
+
module OperatorMessage0
|
1777
|
+
def operator_name
|
1778
|
+
elements[0]
|
1779
|
+
end
|
1780
|
+
|
1781
|
+
def param_value
|
1782
|
+
elements[2]
|
1783
|
+
end
|
1784
|
+
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
def _nt_operator_message
|
1788
|
+
start_index = index
|
1789
|
+
if node_cache[:operator_message].has_key?(index)
|
1790
|
+
cached = node_cache[:operator_message][index]
|
1791
|
+
@index = cached.interval.end if cached
|
1792
|
+
return cached
|
1793
|
+
end
|
1794
|
+
|
1795
|
+
i0, s0 = index, []
|
1796
|
+
r1 = _nt_operator
|
1797
|
+
s0 << r1
|
1798
|
+
if r1
|
1799
|
+
if input.index(' ', index) == index
|
1800
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1801
|
+
@index += 1
|
1802
|
+
else
|
1803
|
+
terminal_parse_failure(' ')
|
1804
|
+
r2 = nil
|
1805
|
+
end
|
1806
|
+
s0 << r2
|
1807
|
+
if r2
|
1808
|
+
r3 = _nt_param_value
|
1809
|
+
s0 << r3
|
1810
|
+
if r3
|
1811
|
+
i4 = index
|
1812
|
+
r5 = _nt_message_params
|
1813
|
+
if r5
|
1814
|
+
r4 = nil
|
1815
|
+
else
|
1816
|
+
self.index = i4
|
1817
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
1818
|
+
end
|
1819
|
+
s0 << r4
|
1820
|
+
end
|
1821
|
+
end
|
1822
|
+
end
|
1823
|
+
if s0.last
|
1824
|
+
r0 = instantiate_node(OperatorMessageNode,input, i0...index, s0)
|
1825
|
+
r0.extend(OperatorMessage0)
|
1826
|
+
else
|
1827
|
+
self.index = i0
|
1828
|
+
r0 = nil
|
1829
|
+
end
|
1830
|
+
|
1831
|
+
node_cache[:operator_message][start_index] = r0
|
1832
|
+
|
1833
|
+
return r0
|
1834
|
+
end
|
1835
|
+
|
1836
|
+
module MessageParams0
|
1837
|
+
def parameter
|
1838
|
+
elements[1]
|
1839
|
+
end
|
1840
|
+
end
|
1841
|
+
|
1842
|
+
module MessageParams1
|
1843
|
+
def first_param
|
1844
|
+
elements[0]
|
1845
|
+
end
|
1846
|
+
|
1847
|
+
def rest_params
|
1848
|
+
elements[1]
|
1849
|
+
end
|
1850
|
+
end
|
1851
|
+
|
1852
|
+
module MessageParams2
|
1853
|
+
def value
|
1854
|
+
[first_param.value] + rest_params.elements.map do |space_and_param|
|
1855
|
+
space_and_param.parameter.value
|
1856
|
+
end
|
1857
|
+
end
|
1858
|
+
end
|
1859
|
+
|
1860
|
+
def _nt_message_params
|
1861
|
+
start_index = index
|
1862
|
+
if node_cache[:message_params].has_key?(index)
|
1863
|
+
cached = node_cache[:message_params][index]
|
1864
|
+
@index = cached.interval.end if cached
|
1865
|
+
return cached
|
1866
|
+
end
|
1867
|
+
|
1868
|
+
i0, s0 = index, []
|
1869
|
+
r1 = _nt_first_param
|
1870
|
+
s0 << r1
|
1871
|
+
if r1
|
1872
|
+
s2, i2 = [], index
|
1873
|
+
loop do
|
1874
|
+
i3, s3 = index, []
|
1875
|
+
if input.index(' ', index) == index
|
1876
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1877
|
+
@index += 1
|
1878
|
+
else
|
1879
|
+
terminal_parse_failure(' ')
|
1880
|
+
r4 = nil
|
1881
|
+
end
|
1882
|
+
s3 << r4
|
1883
|
+
if r4
|
1884
|
+
r5 = _nt_param
|
1885
|
+
s3 << r5
|
1886
|
+
end
|
1887
|
+
if s3.last
|
1888
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1889
|
+
r3.extend(MessageParams0)
|
1890
|
+
else
|
1891
|
+
self.index = i3
|
1892
|
+
r3 = nil
|
1893
|
+
end
|
1894
|
+
if r3
|
1895
|
+
s2 << r3
|
1896
|
+
else
|
1897
|
+
break
|
1898
|
+
end
|
1899
|
+
end
|
1900
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1901
|
+
s0 << r2
|
1902
|
+
end
|
1903
|
+
if s0.last
|
1904
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1905
|
+
r0.extend(MessageParams1)
|
1906
|
+
r0.extend(MessageParams2)
|
1907
|
+
else
|
1908
|
+
self.index = i0
|
1909
|
+
r0 = nil
|
1910
|
+
end
|
1911
|
+
|
1912
|
+
node_cache[:message_params][start_index] = r0
|
1913
|
+
|
1914
|
+
return r0
|
1915
|
+
end
|
1916
|
+
|
1917
|
+
module FirstParam0
|
1918
|
+
def first_param_value
|
1919
|
+
elements[2]
|
1920
|
+
end
|
1921
|
+
end
|
1922
|
+
|
1923
|
+
module FirstParam1
|
1924
|
+
def value
|
1925
|
+
{:name => nil, :value => first_param_value.value}
|
1926
|
+
end
|
1927
|
+
end
|
1928
|
+
|
1929
|
+
def _nt_first_param
|
1930
|
+
start_index = index
|
1931
|
+
if node_cache[:first_param].has_key?(index)
|
1932
|
+
cached = node_cache[:first_param][index]
|
1933
|
+
@index = cached.interval.end if cached
|
1934
|
+
return cached
|
1935
|
+
end
|
1936
|
+
|
1937
|
+
i0, s0 = index, []
|
1938
|
+
if input.index(':', index) == index
|
1939
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1940
|
+
@index += 1
|
1941
|
+
else
|
1942
|
+
terminal_parse_failure(':')
|
1943
|
+
r1 = nil
|
1944
|
+
end
|
1945
|
+
s0 << r1
|
1946
|
+
if r1
|
1947
|
+
if input.index(' ', index) == index
|
1948
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1949
|
+
@index += 1
|
1950
|
+
else
|
1951
|
+
terminal_parse_failure(' ')
|
1952
|
+
r2 = nil
|
1953
|
+
end
|
1954
|
+
s0 << r2
|
1955
|
+
if r2
|
1956
|
+
r3 = _nt_param_value
|
1957
|
+
s0 << r3
|
1958
|
+
end
|
1959
|
+
end
|
1960
|
+
if s0.last
|
1961
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1962
|
+
r0.extend(FirstParam0)
|
1963
|
+
r0.extend(FirstParam1)
|
1964
|
+
else
|
1965
|
+
self.index = i0
|
1966
|
+
r0 = nil
|
1967
|
+
end
|
1968
|
+
|
1969
|
+
node_cache[:first_param][start_index] = r0
|
1970
|
+
|
1971
|
+
return r0
|
1972
|
+
end
|
1973
|
+
|
1974
|
+
module Param0
|
1975
|
+
def param_name
|
1976
|
+
elements[0]
|
1977
|
+
end
|
1978
|
+
|
1979
|
+
def param_value
|
1980
|
+
elements[2]
|
1981
|
+
end
|
1982
|
+
end
|
1983
|
+
|
1984
|
+
module Param1
|
1985
|
+
def value
|
1986
|
+
#[param_name.value, param_value.value]
|
1987
|
+
#param_value
|
1988
|
+
{:name => param_name.value, :value => param_value.value}
|
1989
|
+
end
|
1990
|
+
end
|
1991
|
+
|
1992
|
+
def _nt_param
|
1993
|
+
start_index = index
|
1994
|
+
if node_cache[:param].has_key?(index)
|
1995
|
+
cached = node_cache[:param][index]
|
1996
|
+
@index = cached.interval.end if cached
|
1997
|
+
return cached
|
1998
|
+
end
|
1999
|
+
|
2000
|
+
i0, s0 = index, []
|
2001
|
+
r1 = _nt_param_name
|
2002
|
+
s0 << r1
|
2003
|
+
if r1
|
2004
|
+
if input.index(' ', index) == index
|
2005
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2006
|
+
@index += 1
|
2007
|
+
else
|
2008
|
+
terminal_parse_failure(' ')
|
2009
|
+
r2 = nil
|
2010
|
+
end
|
2011
|
+
s0 << r2
|
2012
|
+
if r2
|
2013
|
+
r3 = _nt_param_value
|
2014
|
+
s0 << r3
|
2015
|
+
end
|
2016
|
+
end
|
2017
|
+
if s0.last
|
2018
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2019
|
+
r0.extend(Param0)
|
2020
|
+
r0.extend(Param1)
|
2021
|
+
else
|
2022
|
+
self.index = i0
|
2023
|
+
r0 = nil
|
2024
|
+
end
|
2025
|
+
|
2026
|
+
node_cache[:param][start_index] = r0
|
2027
|
+
|
2028
|
+
return r0
|
2029
|
+
end
|
2030
|
+
|
2031
|
+
module ParamName0
|
2032
|
+
def identifier
|
2033
|
+
elements[0]
|
2034
|
+
end
|
2035
|
+
|
2036
|
+
end
|
2037
|
+
|
2038
|
+
module ParamName1
|
2039
|
+
def value
|
2040
|
+
identifier.value
|
2041
|
+
end
|
2042
|
+
end
|
2043
|
+
|
2044
|
+
def _nt_param_name
|
2045
|
+
start_index = index
|
2046
|
+
if node_cache[:param_name].has_key?(index)
|
2047
|
+
cached = node_cache[:param_name][index]
|
2048
|
+
@index = cached.interval.end if cached
|
2049
|
+
return cached
|
2050
|
+
end
|
2051
|
+
|
2052
|
+
i0, s0 = index, []
|
2053
|
+
r1 = _nt_identifier
|
2054
|
+
s0 << r1
|
2055
|
+
if r1
|
2056
|
+
if input.index(':', index) == index
|
2057
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2058
|
+
@index += 1
|
2059
|
+
else
|
2060
|
+
terminal_parse_failure(':')
|
2061
|
+
r2 = nil
|
2062
|
+
end
|
2063
|
+
s0 << r2
|
2064
|
+
end
|
2065
|
+
if s0.last
|
2066
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2067
|
+
r0.extend(ParamName0)
|
2068
|
+
r0.extend(ParamName1)
|
2069
|
+
else
|
2070
|
+
self.index = i0
|
2071
|
+
r0 = nil
|
2072
|
+
end
|
2073
|
+
|
2074
|
+
node_cache[:param_name][start_index] = r0
|
2075
|
+
|
2076
|
+
return r0
|
2077
|
+
end
|
2078
|
+
|
2079
|
+
def _nt_param_value
|
2080
|
+
start_index = index
|
2081
|
+
if node_cache[:param_value].has_key?(index)
|
2082
|
+
cached = node_cache[:param_value][index]
|
2083
|
+
@index = cached.interval.end if cached
|
2084
|
+
return cached
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
i0 = index
|
2088
|
+
r1 = _nt_literal
|
2089
|
+
if r1
|
2090
|
+
r0 = r1
|
2091
|
+
else
|
2092
|
+
r2 = _nt_identifier
|
2093
|
+
if r2
|
2094
|
+
r0 = r2
|
2095
|
+
else
|
2096
|
+
r3 = _nt_subexpression
|
2097
|
+
if r3
|
2098
|
+
r0 = r3
|
2099
|
+
else
|
2100
|
+
self.index = i0
|
2101
|
+
r0 = nil
|
2102
|
+
end
|
2103
|
+
end
|
2104
|
+
end
|
2105
|
+
|
2106
|
+
node_cache[:param_value][start_index] = r0
|
2107
|
+
|
2108
|
+
return r0
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
def _nt_literal
|
2112
|
+
start_index = index
|
2113
|
+
if node_cache[:literal].has_key?(index)
|
2114
|
+
cached = node_cache[:literal][index]
|
2115
|
+
@index = cached.interval.end if cached
|
2116
|
+
return cached
|
2117
|
+
end
|
2118
|
+
|
2119
|
+
i0 = index
|
2120
|
+
r1 = _nt_string_literal
|
2121
|
+
if r1
|
2122
|
+
r0 = r1
|
2123
|
+
else
|
2124
|
+
r2 = _nt_symbol_literal
|
2125
|
+
if r2
|
2126
|
+
r0 = r2
|
2127
|
+
else
|
2128
|
+
r3 = _nt_float_literal
|
2129
|
+
if r3
|
2130
|
+
r0 = r3
|
2131
|
+
else
|
2132
|
+
r4 = _nt_int_literal
|
2133
|
+
if r4
|
2134
|
+
r0 = r4
|
2135
|
+
else
|
2136
|
+
r5 = _nt_char_literal
|
2137
|
+
if r5
|
2138
|
+
r0 = r5
|
2139
|
+
else
|
2140
|
+
r6 = _nt_array_literal
|
2141
|
+
if r6
|
2142
|
+
r0 = r6
|
2143
|
+
else
|
2144
|
+
r7 = _nt_hash_literal
|
2145
|
+
if r7
|
2146
|
+
r0 = r7
|
2147
|
+
else
|
2148
|
+
r8 = _nt_block_literal
|
2149
|
+
if r8
|
2150
|
+
r0 = r8
|
2151
|
+
else
|
2152
|
+
r9 = _nt_regex_literal
|
2153
|
+
if r9
|
2154
|
+
r0 = r9
|
2155
|
+
else
|
2156
|
+
self.index = i0
|
2157
|
+
r0 = nil
|
2158
|
+
end
|
2159
|
+
end
|
2160
|
+
end
|
2161
|
+
end
|
2162
|
+
end
|
2163
|
+
end
|
2164
|
+
end
|
2165
|
+
end
|
2166
|
+
end
|
2167
|
+
|
2168
|
+
node_cache[:literal][start_index] = r0
|
2169
|
+
|
2170
|
+
return r0
|
2171
|
+
end
|
2172
|
+
|
2173
|
+
module StringLiteral0
|
2174
|
+
def string_val
|
2175
|
+
elements[1]
|
2176
|
+
end
|
2177
|
+
|
2178
|
+
end
|
2179
|
+
|
2180
|
+
module StringLiteral1
|
2181
|
+
def string_val
|
2182
|
+
elements[1]
|
2183
|
+
end
|
2184
|
+
|
2185
|
+
end
|
2186
|
+
|
2187
|
+
def _nt_string_literal
|
2188
|
+
start_index = index
|
2189
|
+
if node_cache[:string_literal].has_key?(index)
|
2190
|
+
cached = node_cache[:string_literal][index]
|
2191
|
+
@index = cached.interval.end if cached
|
2192
|
+
return cached
|
2193
|
+
end
|
2194
|
+
|
2195
|
+
i0 = index
|
2196
|
+
i1, s1 = index, []
|
2197
|
+
if input.index('"', index) == index
|
2198
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2199
|
+
@index += 1
|
2200
|
+
else
|
2201
|
+
terminal_parse_failure('"')
|
2202
|
+
r2 = nil
|
2203
|
+
end
|
2204
|
+
s1 << r2
|
2205
|
+
if r2
|
2206
|
+
s3, i3 = [], index
|
2207
|
+
loop do
|
2208
|
+
i4 = index
|
2209
|
+
r5 = _nt_string_interpolation
|
2210
|
+
if r5
|
2211
|
+
r4 = r5
|
2212
|
+
else
|
2213
|
+
r6 = _nt_string_char
|
2214
|
+
if r6
|
2215
|
+
r4 = r6
|
2216
|
+
else
|
2217
|
+
self.index = i4
|
2218
|
+
r4 = nil
|
2219
|
+
end
|
2220
|
+
end
|
2221
|
+
if r4
|
2222
|
+
s3 << r4
|
2223
|
+
else
|
2224
|
+
break
|
2225
|
+
end
|
2226
|
+
end
|
2227
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2228
|
+
s1 << r3
|
2229
|
+
if r3
|
2230
|
+
if input.index('"', index) == index
|
2231
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2232
|
+
@index += 1
|
2233
|
+
else
|
2234
|
+
terminal_parse_failure('"')
|
2235
|
+
r7 = nil
|
2236
|
+
end
|
2237
|
+
s1 << r7
|
2238
|
+
end
|
2239
|
+
end
|
2240
|
+
if s1.last
|
2241
|
+
r1 = instantiate_node(StringLiteralNode,input, i1...index, s1)
|
2242
|
+
r1.extend(StringLiteral0)
|
2243
|
+
else
|
2244
|
+
self.index = i1
|
2245
|
+
r1 = nil
|
2246
|
+
end
|
2247
|
+
if r1
|
2248
|
+
r0 = r1
|
2249
|
+
else
|
2250
|
+
i8, s8 = index, []
|
2251
|
+
if input.index("'", index) == index
|
2252
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2253
|
+
@index += 1
|
2254
|
+
else
|
2255
|
+
terminal_parse_failure("'")
|
2256
|
+
r9 = nil
|
2257
|
+
end
|
2258
|
+
s8 << r9
|
2259
|
+
if r9
|
2260
|
+
s10, i10 = [], index
|
2261
|
+
loop do
|
2262
|
+
i11 = index
|
2263
|
+
r12 = _nt_string_interpolation
|
2264
|
+
if r12
|
2265
|
+
r11 = r12
|
2266
|
+
else
|
2267
|
+
r13 = _nt_string_char_single_quote
|
2268
|
+
if r13
|
2269
|
+
r11 = r13
|
2270
|
+
else
|
2271
|
+
self.index = i11
|
2272
|
+
r11 = nil
|
2273
|
+
end
|
2274
|
+
end
|
2275
|
+
if r11
|
2276
|
+
s10 << r11
|
2277
|
+
else
|
2278
|
+
break
|
2279
|
+
end
|
2280
|
+
end
|
2281
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
2282
|
+
s8 << r10
|
2283
|
+
if r10
|
2284
|
+
if input.index("'", index) == index
|
2285
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2286
|
+
@index += 1
|
2287
|
+
else
|
2288
|
+
terminal_parse_failure("'")
|
2289
|
+
r14 = nil
|
2290
|
+
end
|
2291
|
+
s8 << r14
|
2292
|
+
end
|
2293
|
+
end
|
2294
|
+
if s8.last
|
2295
|
+
r8 = instantiate_node(StringLiteralNode,input, i8...index, s8)
|
2296
|
+
r8.extend(StringLiteral1)
|
2297
|
+
else
|
2298
|
+
self.index = i8
|
2299
|
+
r8 = nil
|
2300
|
+
end
|
2301
|
+
if r8
|
2302
|
+
r0 = r8
|
2303
|
+
else
|
2304
|
+
self.index = i0
|
2305
|
+
r0 = nil
|
2306
|
+
end
|
2307
|
+
end
|
2308
|
+
|
2309
|
+
node_cache[:string_literal][start_index] = r0
|
2310
|
+
|
2311
|
+
return r0
|
2312
|
+
end
|
2313
|
+
|
2314
|
+
module StringChar0
|
2315
|
+
def char
|
2316
|
+
elements[1]
|
2317
|
+
end
|
2318
|
+
end
|
2319
|
+
|
2320
|
+
module StringChar1
|
2321
|
+
def value
|
2322
|
+
self.char.text_value
|
2323
|
+
end
|
2324
|
+
end
|
2325
|
+
|
2326
|
+
def _nt_string_char
|
2327
|
+
start_index = index
|
2328
|
+
if node_cache[:string_char].has_key?(index)
|
2329
|
+
cached = node_cache[:string_char][index]
|
2330
|
+
@index = cached.interval.end if cached
|
2331
|
+
return cached
|
2332
|
+
end
|
2333
|
+
|
2334
|
+
i0, s0 = index, []
|
2335
|
+
i1 = index
|
2336
|
+
if input.index('"', index) == index
|
2337
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2338
|
+
@index += 1
|
2339
|
+
else
|
2340
|
+
terminal_parse_failure('"')
|
2341
|
+
r2 = nil
|
2342
|
+
end
|
2343
|
+
if r2
|
2344
|
+
r1 = nil
|
2345
|
+
else
|
2346
|
+
self.index = i1
|
2347
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
2348
|
+
end
|
2349
|
+
s0 << r1
|
2350
|
+
if r1
|
2351
|
+
if index < input_length
|
2352
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2353
|
+
@index += 1
|
2354
|
+
else
|
2355
|
+
terminal_parse_failure("any character")
|
2356
|
+
r3 = nil
|
2357
|
+
end
|
2358
|
+
s0 << r3
|
2359
|
+
end
|
2360
|
+
if s0.last
|
2361
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2362
|
+
r0.extend(StringChar0)
|
2363
|
+
r0.extend(StringChar1)
|
2364
|
+
else
|
2365
|
+
self.index = i0
|
2366
|
+
r0 = nil
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
node_cache[:string_char][start_index] = r0
|
2370
|
+
|
2371
|
+
return r0
|
2372
|
+
end
|
2373
|
+
|
2374
|
+
module StringCharSingleQuote0
|
2375
|
+
def char
|
2376
|
+
elements[1]
|
2377
|
+
end
|
2378
|
+
end
|
2379
|
+
|
2380
|
+
module StringCharSingleQuote1
|
2381
|
+
def value
|
2382
|
+
self.char.text_value
|
2383
|
+
end
|
2384
|
+
end
|
2385
|
+
|
2386
|
+
def _nt_string_char_single_quote
|
2387
|
+
start_index = index
|
2388
|
+
if node_cache[:string_char_single_quote].has_key?(index)
|
2389
|
+
cached = node_cache[:string_char_single_quote][index]
|
2390
|
+
@index = cached.interval.end if cached
|
2391
|
+
return cached
|
2392
|
+
end
|
2393
|
+
|
2394
|
+
i0, s0 = index, []
|
2395
|
+
i1 = index
|
2396
|
+
if input.index("'", index) == index
|
2397
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2398
|
+
@index += 1
|
2399
|
+
else
|
2400
|
+
terminal_parse_failure("'")
|
2401
|
+
r2 = nil
|
2402
|
+
end
|
2403
|
+
if r2
|
2404
|
+
r1 = nil
|
2405
|
+
else
|
2406
|
+
self.index = i1
|
2407
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
2408
|
+
end
|
2409
|
+
s0 << r1
|
2410
|
+
if r1
|
2411
|
+
if index < input_length
|
2412
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2413
|
+
@index += 1
|
2414
|
+
else
|
2415
|
+
terminal_parse_failure("any character")
|
2416
|
+
r3 = nil
|
2417
|
+
end
|
2418
|
+
s0 << r3
|
2419
|
+
end
|
2420
|
+
if s0.last
|
2421
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2422
|
+
r0.extend(StringCharSingleQuote0)
|
2423
|
+
r0.extend(StringCharSingleQuote1)
|
2424
|
+
else
|
2425
|
+
self.index = i0
|
2426
|
+
r0 = nil
|
2427
|
+
end
|
2428
|
+
|
2429
|
+
node_cache[:string_char_single_quote][start_index] = r0
|
2430
|
+
|
2431
|
+
return r0
|
2432
|
+
end
|
2433
|
+
|
2434
|
+
module StringInterpolation0
|
2435
|
+
def expr
|
2436
|
+
elements[2]
|
2437
|
+
end
|
2438
|
+
|
2439
|
+
end
|
2440
|
+
|
2441
|
+
module StringInterpolation1
|
2442
|
+
def value
|
2443
|
+
val = "\#\{"
|
2444
|
+
val += expr.respond_to?(:value) ? expr.value : expr.subexpr.value
|
2445
|
+
val += "\}"
|
2446
|
+
end
|
2447
|
+
end
|
2448
|
+
|
2449
|
+
def _nt_string_interpolation
|
2450
|
+
start_index = index
|
2451
|
+
if node_cache[:string_interpolation].has_key?(index)
|
2452
|
+
cached = node_cache[:string_interpolation][index]
|
2453
|
+
@index = cached.interval.end if cached
|
2454
|
+
return cached
|
2455
|
+
end
|
2456
|
+
|
2457
|
+
i0, s0 = index, []
|
2458
|
+
if input.index('#{', index) == index
|
2459
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2460
|
+
@index += 2
|
2461
|
+
else
|
2462
|
+
terminal_parse_failure('#{')
|
2463
|
+
r1 = nil
|
2464
|
+
end
|
2465
|
+
s0 << r1
|
2466
|
+
if r1
|
2467
|
+
s2, i2 = [], index
|
2468
|
+
loop do
|
2469
|
+
r3 = _nt_spaces
|
2470
|
+
if r3
|
2471
|
+
s2 << r3
|
2472
|
+
else
|
2473
|
+
break
|
2474
|
+
end
|
2475
|
+
end
|
2476
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2477
|
+
s0 << r2
|
2478
|
+
if r2
|
2479
|
+
i4 = index
|
2480
|
+
r5 = _nt_expression
|
2481
|
+
if r5
|
2482
|
+
r4 = r5
|
2483
|
+
else
|
2484
|
+
r6 = _nt_identifier
|
2485
|
+
if r6
|
2486
|
+
r4 = r6
|
2487
|
+
else
|
2488
|
+
r7 = _nt_literal
|
2489
|
+
if r7
|
2490
|
+
r4 = r7
|
2491
|
+
else
|
2492
|
+
self.index = i4
|
2493
|
+
r4 = nil
|
2494
|
+
end
|
2495
|
+
end
|
2496
|
+
end
|
2497
|
+
s0 << r4
|
2498
|
+
if r4
|
2499
|
+
s8, i8 = [], index
|
2500
|
+
loop do
|
2501
|
+
r9 = _nt_spaces
|
2502
|
+
if r9
|
2503
|
+
s8 << r9
|
2504
|
+
else
|
2505
|
+
break
|
2506
|
+
end
|
2507
|
+
end
|
2508
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
2509
|
+
s0 << r8
|
2510
|
+
if r8
|
2511
|
+
if input.index('}', index) == index
|
2512
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2513
|
+
@index += 1
|
2514
|
+
else
|
2515
|
+
terminal_parse_failure('}')
|
2516
|
+
r10 = nil
|
2517
|
+
end
|
2518
|
+
s0 << r10
|
2519
|
+
end
|
2520
|
+
end
|
2521
|
+
end
|
2522
|
+
end
|
2523
|
+
if s0.last
|
2524
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2525
|
+
r0.extend(StringInterpolation0)
|
2526
|
+
r0.extend(StringInterpolation1)
|
2527
|
+
else
|
2528
|
+
self.index = i0
|
2529
|
+
r0 = nil
|
2530
|
+
end
|
2531
|
+
|
2532
|
+
node_cache[:string_interpolation][start_index] = r0
|
2533
|
+
|
2534
|
+
return r0
|
2535
|
+
end
|
2536
|
+
|
2537
|
+
module SymbolLiteral0
|
2538
|
+
def identifier
|
2539
|
+
elements[1]
|
2540
|
+
end
|
2541
|
+
end
|
2542
|
+
|
2543
|
+
module SymbolLiteral1
|
2544
|
+
def symbol_name
|
2545
|
+
elements[1]
|
2546
|
+
end
|
2547
|
+
end
|
2548
|
+
|
2549
|
+
module SymbolLiteral2
|
2550
|
+
def value
|
2551
|
+
(':' + symbol_name.text_value).to_sym
|
2552
|
+
end
|
2553
|
+
end
|
2554
|
+
|
2555
|
+
def _nt_symbol_literal
|
2556
|
+
start_index = index
|
2557
|
+
if node_cache[:symbol_literal].has_key?(index)
|
2558
|
+
cached = node_cache[:symbol_literal][index]
|
2559
|
+
@index = cached.interval.end if cached
|
2560
|
+
return cached
|
2561
|
+
end
|
2562
|
+
|
2563
|
+
i0, s0 = index, []
|
2564
|
+
if input.index(':', index) == index
|
2565
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2566
|
+
@index += 1
|
2567
|
+
else
|
2568
|
+
terminal_parse_failure(':')
|
2569
|
+
r1 = nil
|
2570
|
+
end
|
2571
|
+
s0 << r1
|
2572
|
+
if r1
|
2573
|
+
i2, s2 = index, []
|
2574
|
+
i3 = index
|
2575
|
+
if input.index(':', index) == index
|
2576
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2577
|
+
@index += 1
|
2578
|
+
else
|
2579
|
+
terminal_parse_failure(':')
|
2580
|
+
r4 = nil
|
2581
|
+
end
|
2582
|
+
if r4
|
2583
|
+
r3 = nil
|
2584
|
+
else
|
2585
|
+
self.index = i3
|
2586
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
2587
|
+
end
|
2588
|
+
s2 << r3
|
2589
|
+
if r3
|
2590
|
+
r5 = _nt_identifier
|
2591
|
+
s2 << r5
|
2592
|
+
end
|
2593
|
+
if s2.last
|
2594
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2595
|
+
r2.extend(SymbolLiteral0)
|
2596
|
+
else
|
2597
|
+
self.index = i2
|
2598
|
+
r2 = nil
|
2599
|
+
end
|
2600
|
+
s0 << r2
|
2601
|
+
end
|
2602
|
+
if s0.last
|
2603
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2604
|
+
r0.extend(SymbolLiteral1)
|
2605
|
+
r0.extend(SymbolLiteral2)
|
2606
|
+
else
|
2607
|
+
self.index = i0
|
2608
|
+
r0 = nil
|
2609
|
+
end
|
2610
|
+
|
2611
|
+
node_cache[:symbol_literal][start_index] = r0
|
2612
|
+
|
2613
|
+
return r0
|
2614
|
+
end
|
2615
|
+
|
2616
|
+
module IntLiteral0
|
2617
|
+
def non_zero_digit
|
2618
|
+
elements[1]
|
2619
|
+
end
|
2620
|
+
|
2621
|
+
end
|
2622
|
+
|
2623
|
+
def _nt_int_literal
|
2624
|
+
start_index = index
|
2625
|
+
if node_cache[:int_literal].has_key?(index)
|
2626
|
+
cached = node_cache[:int_literal][index]
|
2627
|
+
@index = cached.interval.end if cached
|
2628
|
+
return cached
|
2629
|
+
end
|
2630
|
+
|
2631
|
+
i0 = index
|
2632
|
+
i1, s1 = index, []
|
2633
|
+
r3 = _nt_sign
|
2634
|
+
if r3
|
2635
|
+
r2 = r3
|
2636
|
+
else
|
2637
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
2638
|
+
end
|
2639
|
+
s1 << r2
|
2640
|
+
if r2
|
2641
|
+
r4 = _nt_non_zero_digit
|
2642
|
+
s1 << r4
|
2643
|
+
if r4
|
2644
|
+
s5, i5 = [], index
|
2645
|
+
loop do
|
2646
|
+
r6 = _nt_digit
|
2647
|
+
if r6
|
2648
|
+
s5 << r6
|
2649
|
+
else
|
2650
|
+
break
|
2651
|
+
end
|
2652
|
+
end
|
2653
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
2654
|
+
s1 << r5
|
2655
|
+
end
|
2656
|
+
end
|
2657
|
+
if s1.last
|
2658
|
+
r1 = instantiate_node(IntegerLiteralNode,input, i1...index, s1)
|
2659
|
+
r1.extend(IntLiteral0)
|
2660
|
+
else
|
2661
|
+
self.index = i1
|
2662
|
+
r1 = nil
|
2663
|
+
end
|
2664
|
+
if r1
|
2665
|
+
r0 = r1
|
2666
|
+
else
|
2667
|
+
if input.index(Regexp.new('[0]'), index) == index
|
2668
|
+
r7 = instantiate_node(IntegerLiteralNode,input, index...(index + 1))
|
2669
|
+
@index += 1
|
2670
|
+
else
|
2671
|
+
r7 = nil
|
2672
|
+
end
|
2673
|
+
if r7
|
2674
|
+
r0 = r7
|
2675
|
+
else
|
2676
|
+
self.index = i0
|
2677
|
+
r0 = nil
|
2678
|
+
end
|
2679
|
+
end
|
2680
|
+
|
2681
|
+
node_cache[:int_literal][start_index] = r0
|
2682
|
+
|
2683
|
+
return r0
|
2684
|
+
end
|
2685
|
+
|
2686
|
+
module FloatLiteral0
|
2687
|
+
end
|
2688
|
+
|
2689
|
+
module FloatLiteral1
|
2690
|
+
def value
|
2691
|
+
self.text_value.to_f
|
2692
|
+
end
|
2693
|
+
end
|
2694
|
+
|
2695
|
+
def _nt_float_literal
|
2696
|
+
start_index = index
|
2697
|
+
if node_cache[:float_literal].has_key?(index)
|
2698
|
+
cached = node_cache[:float_literal][index]
|
2699
|
+
@index = cached.interval.end if cached
|
2700
|
+
return cached
|
2701
|
+
end
|
2702
|
+
|
2703
|
+
i0, s0 = index, []
|
2704
|
+
r2 = _nt_sign
|
2705
|
+
if r2
|
2706
|
+
r1 = r2
|
2707
|
+
else
|
2708
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
2709
|
+
end
|
2710
|
+
s0 << r1
|
2711
|
+
if r1
|
2712
|
+
s3, i3 = [], index
|
2713
|
+
loop do
|
2714
|
+
r4 = _nt_digit
|
2715
|
+
if r4
|
2716
|
+
s3 << r4
|
2717
|
+
else
|
2718
|
+
break
|
2719
|
+
end
|
2720
|
+
end
|
2721
|
+
if s3.empty?
|
2722
|
+
self.index = i3
|
2723
|
+
r3 = nil
|
2724
|
+
else
|
2725
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2726
|
+
end
|
2727
|
+
s0 << r3
|
2728
|
+
if r3
|
2729
|
+
if input.index('.', index) == index
|
2730
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2731
|
+
@index += 1
|
2732
|
+
else
|
2733
|
+
terminal_parse_failure('.')
|
2734
|
+
r5 = nil
|
2735
|
+
end
|
2736
|
+
s0 << r5
|
2737
|
+
if r5
|
2738
|
+
s6, i6 = [], index
|
2739
|
+
loop do
|
2740
|
+
r7 = _nt_digit
|
2741
|
+
if r7
|
2742
|
+
s6 << r7
|
2743
|
+
else
|
2744
|
+
break
|
2745
|
+
end
|
2746
|
+
end
|
2747
|
+
if s6.empty?
|
2748
|
+
self.index = i6
|
2749
|
+
r6 = nil
|
2750
|
+
else
|
2751
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
2752
|
+
end
|
2753
|
+
s0 << r6
|
2754
|
+
end
|
2755
|
+
end
|
2756
|
+
end
|
2757
|
+
if s0.last
|
2758
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2759
|
+
r0.extend(FloatLiteral0)
|
2760
|
+
r0.extend(FloatLiteral1)
|
2761
|
+
else
|
2762
|
+
self.index = i0
|
2763
|
+
r0 = nil
|
2764
|
+
end
|
2765
|
+
|
2766
|
+
node_cache[:float_literal][start_index] = r0
|
2767
|
+
|
2768
|
+
return r0
|
2769
|
+
end
|
2770
|
+
|
2771
|
+
module CharLiteral0
|
2772
|
+
def val
|
2773
|
+
elements[1]
|
2774
|
+
end
|
2775
|
+
end
|
2776
|
+
|
2777
|
+
module CharLiteral1
|
2778
|
+
def value
|
2779
|
+
val.each_byte{|b| b}
|
2780
|
+
end
|
2781
|
+
end
|
2782
|
+
|
2783
|
+
def _nt_char_literal
|
2784
|
+
start_index = index
|
2785
|
+
if node_cache[:char_literal].has_key?(index)
|
2786
|
+
cached = node_cache[:char_literal][index]
|
2787
|
+
@index = cached.interval.end if cached
|
2788
|
+
return cached
|
2789
|
+
end
|
2790
|
+
|
2791
|
+
i0, s0 = index, []
|
2792
|
+
if input.index('?', index) == index
|
2793
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2794
|
+
@index += 1
|
2795
|
+
else
|
2796
|
+
terminal_parse_failure('?')
|
2797
|
+
r1 = nil
|
2798
|
+
end
|
2799
|
+
s0 << r1
|
2800
|
+
if r1
|
2801
|
+
if input.index(Regexp.new('[a-zA-Z0-9_]'), index) == index
|
2802
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2803
|
+
@index += 1
|
2804
|
+
else
|
2805
|
+
r2 = nil
|
2806
|
+
end
|
2807
|
+
s0 << r2
|
2808
|
+
end
|
2809
|
+
if s0.last
|
2810
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2811
|
+
r0.extend(CharLiteral0)
|
2812
|
+
r0.extend(CharLiteral1)
|
2813
|
+
else
|
2814
|
+
self.index = i0
|
2815
|
+
r0 = nil
|
2816
|
+
end
|
2817
|
+
|
2818
|
+
node_cache[:char_literal][start_index] = r0
|
2819
|
+
|
2820
|
+
return r0
|
2821
|
+
end
|
2822
|
+
|
2823
|
+
module ArrayLiteral0
|
2824
|
+
def item
|
2825
|
+
elements[2]
|
2826
|
+
end
|
2827
|
+
end
|
2828
|
+
|
2829
|
+
module ArrayLiteral1
|
2830
|
+
def first_item
|
2831
|
+
elements[2]
|
2832
|
+
end
|
2833
|
+
|
2834
|
+
def rest_items
|
2835
|
+
elements[4]
|
2836
|
+
end
|
2837
|
+
|
2838
|
+
end
|
2839
|
+
|
2840
|
+
module ArrayLiteral2
|
2841
|
+
def value
|
2842
|
+
if self.text_value =~ /\[\s*\]/
|
2843
|
+
"[]"
|
2844
|
+
else
|
2845
|
+
#[first_item.value] + rest_items.elements.collect{ |ws_and_items| ws_and_items.item.value }
|
2846
|
+
array_str = "[#{first_item.value},"
|
2847
|
+
rest_items.elements.each do |ws_and_items|
|
2848
|
+
array_str += "#{ws_and_items.item.value},"
|
2849
|
+
end
|
2850
|
+
array_str += "]"
|
2851
|
+
return array_str
|
2852
|
+
end
|
2853
|
+
end
|
2854
|
+
end
|
2855
|
+
|
2856
|
+
def _nt_array_literal
|
2857
|
+
start_index = index
|
2858
|
+
if node_cache[:array_literal].has_key?(index)
|
2859
|
+
cached = node_cache[:array_literal][index]
|
2860
|
+
@index = cached.interval.end if cached
|
2861
|
+
return cached
|
2862
|
+
end
|
2863
|
+
|
2864
|
+
i0, s0 = index, []
|
2865
|
+
if input.index('[', index) == index
|
2866
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2867
|
+
@index += 1
|
2868
|
+
else
|
2869
|
+
terminal_parse_failure('[')
|
2870
|
+
r1 = nil
|
2871
|
+
end
|
2872
|
+
s0 << r1
|
2873
|
+
if r1
|
2874
|
+
s2, i2 = [], index
|
2875
|
+
loop do
|
2876
|
+
r3 = _nt_ws
|
2877
|
+
if r3
|
2878
|
+
s2 << r3
|
2879
|
+
else
|
2880
|
+
break
|
2881
|
+
end
|
2882
|
+
end
|
2883
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2884
|
+
s0 << r2
|
2885
|
+
if r2
|
2886
|
+
i5 = index
|
2887
|
+
r6 = _nt_literal
|
2888
|
+
if r6
|
2889
|
+
r5 = r6
|
2890
|
+
else
|
2891
|
+
r7 = _nt_identifier
|
2892
|
+
if r7
|
2893
|
+
r5 = r7
|
2894
|
+
else
|
2895
|
+
self.index = i5
|
2896
|
+
r5 = nil
|
2897
|
+
end
|
2898
|
+
end
|
2899
|
+
if r5
|
2900
|
+
r4 = r5
|
2901
|
+
else
|
2902
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2903
|
+
end
|
2904
|
+
s0 << r4
|
2905
|
+
if r4
|
2906
|
+
s8, i8 = [], index
|
2907
|
+
loop do
|
2908
|
+
r9 = _nt_ws
|
2909
|
+
if r9
|
2910
|
+
s8 << r9
|
2911
|
+
else
|
2912
|
+
break
|
2913
|
+
end
|
2914
|
+
end
|
2915
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
2916
|
+
s0 << r8
|
2917
|
+
if r8
|
2918
|
+
s10, i10 = [], index
|
2919
|
+
loop do
|
2920
|
+
i11, s11 = index, []
|
2921
|
+
if input.index(',', index) == index
|
2922
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2923
|
+
@index += 1
|
2924
|
+
else
|
2925
|
+
terminal_parse_failure(',')
|
2926
|
+
r12 = nil
|
2927
|
+
end
|
2928
|
+
s11 << r12
|
2929
|
+
if r12
|
2930
|
+
s13, i13 = [], index
|
2931
|
+
loop do
|
2932
|
+
r14 = _nt_ws
|
2933
|
+
if r14
|
2934
|
+
s13 << r14
|
2935
|
+
else
|
2936
|
+
break
|
2937
|
+
end
|
2938
|
+
end
|
2939
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
2940
|
+
s11 << r13
|
2941
|
+
if r13
|
2942
|
+
i15 = index
|
2943
|
+
r16 = _nt_literal
|
2944
|
+
if r16
|
2945
|
+
r15 = r16
|
2946
|
+
else
|
2947
|
+
r17 = _nt_identifier
|
2948
|
+
if r17
|
2949
|
+
r15 = r17
|
2950
|
+
else
|
2951
|
+
self.index = i15
|
2952
|
+
r15 = nil
|
2953
|
+
end
|
2954
|
+
end
|
2955
|
+
s11 << r15
|
2956
|
+
end
|
2957
|
+
end
|
2958
|
+
if s11.last
|
2959
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
2960
|
+
r11.extend(ArrayLiteral0)
|
2961
|
+
else
|
2962
|
+
self.index = i11
|
2963
|
+
r11 = nil
|
2964
|
+
end
|
2965
|
+
if r11
|
2966
|
+
s10 << r11
|
2967
|
+
else
|
2968
|
+
break
|
2969
|
+
end
|
2970
|
+
end
|
2971
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
2972
|
+
s0 << r10
|
2973
|
+
if r10
|
2974
|
+
s18, i18 = [], index
|
2975
|
+
loop do
|
2976
|
+
r19 = _nt_ws
|
2977
|
+
if r19
|
2978
|
+
s18 << r19
|
2979
|
+
else
|
2980
|
+
break
|
2981
|
+
end
|
2982
|
+
end
|
2983
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
2984
|
+
s0 << r18
|
2985
|
+
if r18
|
2986
|
+
if input.index(']', index) == index
|
2987
|
+
r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2988
|
+
@index += 1
|
2989
|
+
else
|
2990
|
+
terminal_parse_failure(']')
|
2991
|
+
r20 = nil
|
2992
|
+
end
|
2993
|
+
s0 << r20
|
2994
|
+
end
|
2995
|
+
end
|
2996
|
+
end
|
2997
|
+
end
|
2998
|
+
end
|
2999
|
+
end
|
3000
|
+
if s0.last
|
3001
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3002
|
+
r0.extend(ArrayLiteral1)
|
3003
|
+
r0.extend(ArrayLiteral2)
|
3004
|
+
else
|
3005
|
+
self.index = i0
|
3006
|
+
r0 = nil
|
3007
|
+
end
|
3008
|
+
|
3009
|
+
node_cache[:array_literal][start_index] = r0
|
3010
|
+
|
3011
|
+
return r0
|
3012
|
+
end
|
3013
|
+
|
3014
|
+
module HashLiteral0
|
3015
|
+
def pair
|
3016
|
+
elements[2]
|
3017
|
+
end
|
3018
|
+
end
|
3019
|
+
|
3020
|
+
module HashLiteral1
|
3021
|
+
def first_entry
|
3022
|
+
elements[2]
|
3023
|
+
end
|
3024
|
+
|
3025
|
+
def rest_pairs
|
3026
|
+
elements[4]
|
3027
|
+
end
|
3028
|
+
|
3029
|
+
end
|
3030
|
+
|
3031
|
+
module HashLiteral2
|
3032
|
+
def value
|
3033
|
+
if self.text_value =~ /\{\s*\}/
|
3034
|
+
return "{}"
|
3035
|
+
else
|
3036
|
+
hash_str = "{"
|
3037
|
+
first_pair = first_entry.value
|
3038
|
+
hash_str += "#{first_pair[0]} => #{first_pair[1]},"
|
3039
|
+
rest_pairs.elements.each do |ws_and_pair|
|
3040
|
+
pair = ws_and_pair.pair
|
3041
|
+
hash_str += "#{pair[0]} => #{pair[1]},"
|
3042
|
+
end
|
3043
|
+
hash_str += "}"
|
3044
|
+
|
3045
|
+
return hash_str
|
3046
|
+
end
|
3047
|
+
end
|
3048
|
+
end
|
3049
|
+
|
3050
|
+
def _nt_hash_literal
|
3051
|
+
start_index = index
|
3052
|
+
if node_cache[:hash_literal].has_key?(index)
|
3053
|
+
cached = node_cache[:hash_literal][index]
|
3054
|
+
@index = cached.interval.end if cached
|
3055
|
+
return cached
|
3056
|
+
end
|
3057
|
+
|
3058
|
+
i0, s0 = index, []
|
3059
|
+
if input.index('{', index) == index
|
3060
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3061
|
+
@index += 1
|
3062
|
+
else
|
3063
|
+
terminal_parse_failure('{')
|
3064
|
+
r1 = nil
|
3065
|
+
end
|
3066
|
+
s0 << r1
|
3067
|
+
if r1
|
3068
|
+
s2, i2 = [], index
|
3069
|
+
loop do
|
3070
|
+
r3 = _nt_ws
|
3071
|
+
if r3
|
3072
|
+
s2 << r3
|
3073
|
+
else
|
3074
|
+
break
|
3075
|
+
end
|
3076
|
+
end
|
3077
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3078
|
+
s0 << r2
|
3079
|
+
if r2
|
3080
|
+
r5 = _nt_hash_entry
|
3081
|
+
if r5
|
3082
|
+
r4 = r5
|
3083
|
+
else
|
3084
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3085
|
+
end
|
3086
|
+
s0 << r4
|
3087
|
+
if r4
|
3088
|
+
s6, i6 = [], index
|
3089
|
+
loop do
|
3090
|
+
r7 = _nt_ws
|
3091
|
+
if r7
|
3092
|
+
s6 << r7
|
3093
|
+
else
|
3094
|
+
break
|
3095
|
+
end
|
3096
|
+
end
|
3097
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
3098
|
+
s0 << r6
|
3099
|
+
if r6
|
3100
|
+
s8, i8 = [], index
|
3101
|
+
loop do
|
3102
|
+
i9, s9 = index, []
|
3103
|
+
if input.index(',', index) == index
|
3104
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3105
|
+
@index += 1
|
3106
|
+
else
|
3107
|
+
terminal_parse_failure(',')
|
3108
|
+
r10 = nil
|
3109
|
+
end
|
3110
|
+
s9 << r10
|
3111
|
+
if r10
|
3112
|
+
s11, i11 = [], index
|
3113
|
+
loop do
|
3114
|
+
r12 = _nt_ws
|
3115
|
+
if r12
|
3116
|
+
s11 << r12
|
3117
|
+
else
|
3118
|
+
break
|
3119
|
+
end
|
3120
|
+
end
|
3121
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
3122
|
+
s9 << r11
|
3123
|
+
if r11
|
3124
|
+
r13 = _nt_hash_entry
|
3125
|
+
s9 << r13
|
3126
|
+
end
|
3127
|
+
end
|
3128
|
+
if s9.last
|
3129
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
3130
|
+
r9.extend(HashLiteral0)
|
3131
|
+
else
|
3132
|
+
self.index = i9
|
3133
|
+
r9 = nil
|
3134
|
+
end
|
3135
|
+
if r9
|
3136
|
+
s8 << r9
|
3137
|
+
else
|
3138
|
+
break
|
3139
|
+
end
|
3140
|
+
end
|
3141
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
3142
|
+
s0 << r8
|
3143
|
+
if r8
|
3144
|
+
s14, i14 = [], index
|
3145
|
+
loop do
|
3146
|
+
r15 = _nt_ws
|
3147
|
+
if r15
|
3148
|
+
s14 << r15
|
3149
|
+
else
|
3150
|
+
break
|
3151
|
+
end
|
3152
|
+
end
|
3153
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
3154
|
+
s0 << r14
|
3155
|
+
if r14
|
3156
|
+
if input.index('}', index) == index
|
3157
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3158
|
+
@index += 1
|
3159
|
+
else
|
3160
|
+
terminal_parse_failure('}')
|
3161
|
+
r16 = nil
|
3162
|
+
end
|
3163
|
+
s0 << r16
|
3164
|
+
end
|
3165
|
+
end
|
3166
|
+
end
|
3167
|
+
end
|
3168
|
+
end
|
3169
|
+
end
|
3170
|
+
if s0.last
|
3171
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3172
|
+
r0.extend(HashLiteral1)
|
3173
|
+
r0.extend(HashLiteral2)
|
3174
|
+
else
|
3175
|
+
self.index = i0
|
3176
|
+
r0 = nil
|
3177
|
+
end
|
3178
|
+
|
3179
|
+
node_cache[:hash_literal][start_index] = r0
|
3180
|
+
|
3181
|
+
return r0
|
3182
|
+
end
|
3183
|
+
|
3184
|
+
module HashEntry0
|
3185
|
+
def key
|
3186
|
+
elements[0]
|
3187
|
+
end
|
3188
|
+
|
3189
|
+
def val
|
3190
|
+
elements[4]
|
3191
|
+
end
|
3192
|
+
end
|
3193
|
+
|
3194
|
+
module HashEntry1
|
3195
|
+
def value
|
3196
|
+
[key.value, val.value]
|
3197
|
+
end
|
3198
|
+
end
|
3199
|
+
|
3200
|
+
def _nt_hash_entry
|
3201
|
+
start_index = index
|
3202
|
+
if node_cache[:hash_entry].has_key?(index)
|
3203
|
+
cached = node_cache[:hash_entry][index]
|
3204
|
+
@index = cached.interval.end if cached
|
3205
|
+
return cached
|
3206
|
+
end
|
3207
|
+
|
3208
|
+
i0, s0 = index, []
|
3209
|
+
i1 = index
|
3210
|
+
r2 = _nt_literal
|
3211
|
+
if r2
|
3212
|
+
r1 = r2
|
3213
|
+
else
|
3214
|
+
r3 = _nt_identifier
|
3215
|
+
if r3
|
3216
|
+
r1 = r3
|
3217
|
+
else
|
3218
|
+
self.index = i1
|
3219
|
+
r1 = nil
|
3220
|
+
end
|
3221
|
+
end
|
3222
|
+
s0 << r1
|
3223
|
+
if r1
|
3224
|
+
s4, i4 = [], index
|
3225
|
+
loop do
|
3226
|
+
r5 = _nt_ws
|
3227
|
+
if r5
|
3228
|
+
s4 << r5
|
3229
|
+
else
|
3230
|
+
break
|
3231
|
+
end
|
3232
|
+
end
|
3233
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
3234
|
+
s0 << r4
|
3235
|
+
if r4
|
3236
|
+
if input.index('=>', index) == index
|
3237
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
3238
|
+
@index += 2
|
3239
|
+
else
|
3240
|
+
terminal_parse_failure('=>')
|
3241
|
+
r6 = nil
|
3242
|
+
end
|
3243
|
+
s0 << r6
|
3244
|
+
if r6
|
3245
|
+
s7, i7 = [], index
|
3246
|
+
loop do
|
3247
|
+
r8 = _nt_ws
|
3248
|
+
if r8
|
3249
|
+
s7 << r8
|
3250
|
+
else
|
3251
|
+
break
|
3252
|
+
end
|
3253
|
+
end
|
3254
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
3255
|
+
s0 << r7
|
3256
|
+
if r7
|
3257
|
+
i9 = index
|
3258
|
+
r10 = _nt_literal
|
3259
|
+
if r10
|
3260
|
+
r9 = r10
|
3261
|
+
else
|
3262
|
+
r11 = _nt_identifier
|
3263
|
+
if r11
|
3264
|
+
r9 = r11
|
3265
|
+
else
|
3266
|
+
self.index = i9
|
3267
|
+
r9 = nil
|
3268
|
+
end
|
3269
|
+
end
|
3270
|
+
s0 << r9
|
3271
|
+
end
|
3272
|
+
end
|
3273
|
+
end
|
3274
|
+
end
|
3275
|
+
if s0.last
|
3276
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3277
|
+
r0.extend(HashEntry0)
|
3278
|
+
r0.extend(HashEntry1)
|
3279
|
+
else
|
3280
|
+
self.index = i0
|
3281
|
+
r0 = nil
|
3282
|
+
end
|
3283
|
+
|
3284
|
+
node_cache[:hash_entry][start_index] = r0
|
3285
|
+
|
3286
|
+
return r0
|
3287
|
+
end
|
3288
|
+
|
3289
|
+
def _nt_block_literal
|
3290
|
+
start_index = index
|
3291
|
+
if node_cache[:block_literal].has_key?(index)
|
3292
|
+
cached = node_cache[:block_literal][index]
|
3293
|
+
@index = cached.interval.end if cached
|
3294
|
+
return cached
|
3295
|
+
end
|
3296
|
+
|
3297
|
+
i0 = index
|
3298
|
+
r1 = _nt_block_literal_do_end
|
3299
|
+
if r1
|
3300
|
+
r0 = r1
|
3301
|
+
else
|
3302
|
+
r2 = _nt_block_literal_curly_braces
|
3303
|
+
if r2
|
3304
|
+
r0 = r2
|
3305
|
+
else
|
3306
|
+
self.index = i0
|
3307
|
+
r0 = nil
|
3308
|
+
end
|
3309
|
+
end
|
3310
|
+
|
3311
|
+
node_cache[:block_literal][start_index] = r0
|
3312
|
+
|
3313
|
+
return r0
|
3314
|
+
end
|
3315
|
+
|
3316
|
+
module BlockLiteralDoEnd0
|
3317
|
+
def do_keyword
|
3318
|
+
elements[0]
|
3319
|
+
end
|
3320
|
+
|
3321
|
+
def params
|
3322
|
+
elements[4]
|
3323
|
+
end
|
3324
|
+
|
3325
|
+
def body
|
3326
|
+
elements[6]
|
3327
|
+
end
|
3328
|
+
|
3329
|
+
def end_keyword
|
3330
|
+
elements[8]
|
3331
|
+
end
|
3332
|
+
end
|
3333
|
+
|
3334
|
+
def _nt_block_literal_do_end
|
3335
|
+
start_index = index
|
3336
|
+
if node_cache[:block_literal_do_end].has_key?(index)
|
3337
|
+
cached = node_cache[:block_literal_do_end][index]
|
3338
|
+
@index = cached.interval.end if cached
|
3339
|
+
return cached
|
3340
|
+
end
|
3341
|
+
|
3342
|
+
i0, s0 = index, []
|
3343
|
+
r1 = _nt_do_keyword
|
3344
|
+
s0 << r1
|
3345
|
+
if r1
|
3346
|
+
s2, i2 = [], index
|
3347
|
+
loop do
|
3348
|
+
r3 = _nt_ws
|
3349
|
+
if r3
|
3350
|
+
s2 << r3
|
3351
|
+
else
|
3352
|
+
break
|
3353
|
+
end
|
3354
|
+
end
|
3355
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3356
|
+
s0 << r2
|
3357
|
+
if r2
|
3358
|
+
i4 = index
|
3359
|
+
r5 = _nt_hash_entry
|
3360
|
+
if r5
|
3361
|
+
r4 = nil
|
3362
|
+
else
|
3363
|
+
self.index = i4
|
3364
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3365
|
+
end
|
3366
|
+
s0 << r4
|
3367
|
+
if r4
|
3368
|
+
s6, i6 = [], index
|
3369
|
+
loop do
|
3370
|
+
r7 = _nt_ws
|
3371
|
+
if r7
|
3372
|
+
s6 << r7
|
3373
|
+
else
|
3374
|
+
break
|
3375
|
+
end
|
3376
|
+
end
|
3377
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
3378
|
+
s0 << r6
|
3379
|
+
if r6
|
3380
|
+
r9 = _nt_block_params
|
3381
|
+
if r9
|
3382
|
+
r8 = r9
|
3383
|
+
else
|
3384
|
+
r8 = instantiate_node(SyntaxNode,input, index...index)
|
3385
|
+
end
|
3386
|
+
s0 << r8
|
3387
|
+
if r8
|
3388
|
+
s10, i10 = [], index
|
3389
|
+
loop do
|
3390
|
+
r11 = _nt_ws
|
3391
|
+
if r11
|
3392
|
+
s10 << r11
|
3393
|
+
else
|
3394
|
+
break
|
3395
|
+
end
|
3396
|
+
end
|
3397
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
3398
|
+
s0 << r10
|
3399
|
+
if r10
|
3400
|
+
r12 = _nt_block_body
|
3401
|
+
s0 << r12
|
3402
|
+
if r12
|
3403
|
+
s13, i13 = [], index
|
3404
|
+
loop do
|
3405
|
+
r14 = _nt_ws
|
3406
|
+
if r14
|
3407
|
+
s13 << r14
|
3408
|
+
else
|
3409
|
+
break
|
3410
|
+
end
|
3411
|
+
end
|
3412
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
3413
|
+
s0 << r13
|
3414
|
+
if r13
|
3415
|
+
r15 = _nt_end_keyword
|
3416
|
+
s0 << r15
|
3417
|
+
end
|
3418
|
+
end
|
3419
|
+
end
|
3420
|
+
end
|
3421
|
+
end
|
3422
|
+
end
|
3423
|
+
end
|
3424
|
+
end
|
3425
|
+
if s0.last
|
3426
|
+
r0 = instantiate_node(BlockLiteralNode,input, i0...index, s0)
|
3427
|
+
r0.extend(BlockLiteralDoEnd0)
|
3428
|
+
else
|
3429
|
+
self.index = i0
|
3430
|
+
r0 = nil
|
3431
|
+
end
|
3432
|
+
|
3433
|
+
node_cache[:block_literal_do_end][start_index] = r0
|
3434
|
+
|
3435
|
+
return r0
|
3436
|
+
end
|
3437
|
+
|
3438
|
+
module BlockLiteralCurlyBraces0
|
3439
|
+
def params
|
3440
|
+
elements[4]
|
3441
|
+
end
|
3442
|
+
|
3443
|
+
def body
|
3444
|
+
elements[6]
|
3445
|
+
end
|
3446
|
+
|
3447
|
+
end
|
3448
|
+
|
3449
|
+
def _nt_block_literal_curly_braces
|
3450
|
+
start_index = index
|
3451
|
+
if node_cache[:block_literal_curly_braces].has_key?(index)
|
3452
|
+
cached = node_cache[:block_literal_curly_braces][index]
|
3453
|
+
@index = cached.interval.end if cached
|
3454
|
+
return cached
|
3455
|
+
end
|
3456
|
+
|
3457
|
+
i0, s0 = index, []
|
3458
|
+
if input.index('{', index) == index
|
3459
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3460
|
+
@index += 1
|
3461
|
+
else
|
3462
|
+
terminal_parse_failure('{')
|
3463
|
+
r1 = nil
|
3464
|
+
end
|
3465
|
+
s0 << r1
|
3466
|
+
if r1
|
3467
|
+
s2, i2 = [], index
|
3468
|
+
loop do
|
3469
|
+
r3 = _nt_ws
|
3470
|
+
if r3
|
3471
|
+
s2 << r3
|
3472
|
+
else
|
3473
|
+
break
|
3474
|
+
end
|
3475
|
+
end
|
3476
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3477
|
+
s0 << r2
|
3478
|
+
if r2
|
3479
|
+
i4 = index
|
3480
|
+
r5 = _nt_hash_entry
|
3481
|
+
if r5
|
3482
|
+
r4 = nil
|
3483
|
+
else
|
3484
|
+
self.index = i4
|
3485
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3486
|
+
end
|
3487
|
+
s0 << r4
|
3488
|
+
if r4
|
3489
|
+
s6, i6 = [], index
|
3490
|
+
loop do
|
3491
|
+
r7 = _nt_ws
|
3492
|
+
if r7
|
3493
|
+
s6 << r7
|
3494
|
+
else
|
3495
|
+
break
|
3496
|
+
end
|
3497
|
+
end
|
3498
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
3499
|
+
s0 << r6
|
3500
|
+
if r6
|
3501
|
+
r9 = _nt_block_params
|
3502
|
+
if r9
|
3503
|
+
r8 = r9
|
3504
|
+
else
|
3505
|
+
r8 = instantiate_node(SyntaxNode,input, index...index)
|
3506
|
+
end
|
3507
|
+
s0 << r8
|
3508
|
+
if r8
|
3509
|
+
s10, i10 = [], index
|
3510
|
+
loop do
|
3511
|
+
r11 = _nt_ws
|
3512
|
+
if r11
|
3513
|
+
s10 << r11
|
3514
|
+
else
|
3515
|
+
break
|
3516
|
+
end
|
3517
|
+
end
|
3518
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
3519
|
+
s0 << r10
|
3520
|
+
if r10
|
3521
|
+
r12 = _nt_block_body
|
3522
|
+
s0 << r12
|
3523
|
+
if r12
|
3524
|
+
s13, i13 = [], index
|
3525
|
+
loop do
|
3526
|
+
r14 = _nt_ws
|
3527
|
+
if r14
|
3528
|
+
s13 << r14
|
3529
|
+
else
|
3530
|
+
break
|
3531
|
+
end
|
3532
|
+
end
|
3533
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
3534
|
+
s0 << r13
|
3535
|
+
if r13
|
3536
|
+
if input.index('}', index) == index
|
3537
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3538
|
+
@index += 1
|
3539
|
+
else
|
3540
|
+
terminal_parse_failure('}')
|
3541
|
+
r15 = nil
|
3542
|
+
end
|
3543
|
+
s0 << r15
|
3544
|
+
end
|
3545
|
+
end
|
3546
|
+
end
|
3547
|
+
end
|
3548
|
+
end
|
3549
|
+
end
|
3550
|
+
end
|
3551
|
+
end
|
3552
|
+
if s0.last
|
3553
|
+
r0 = instantiate_node(BlockLiteralNode,input, i0...index, s0)
|
3554
|
+
r0.extend(BlockLiteralCurlyBraces0)
|
3555
|
+
else
|
3556
|
+
self.index = i0
|
3557
|
+
r0 = nil
|
3558
|
+
end
|
3559
|
+
|
3560
|
+
node_cache[:block_literal_curly_braces][start_index] = r0
|
3561
|
+
|
3562
|
+
return r0
|
3563
|
+
end
|
3564
|
+
|
3565
|
+
module BlockBody0
|
3566
|
+
def exprs
|
3567
|
+
elements[1]
|
3568
|
+
end
|
3569
|
+
|
3570
|
+
end
|
3571
|
+
|
3572
|
+
module BlockBody1
|
3573
|
+
def value
|
3574
|
+
body_str = ""
|
3575
|
+
body_str += exprs.elements.collect{|e| e.elements[0].value}.join(";")
|
3576
|
+
return body_str
|
3577
|
+
end
|
3578
|
+
end
|
3579
|
+
|
3580
|
+
def _nt_block_body
|
3581
|
+
start_index = index
|
3582
|
+
if node_cache[:block_body].has_key?(index)
|
3583
|
+
cached = node_cache[:block_body][index]
|
3584
|
+
@index = cached.interval.end if cached
|
3585
|
+
return cached
|
3586
|
+
end
|
3587
|
+
|
3588
|
+
i0, s0 = index, []
|
3589
|
+
s1, i1 = [], index
|
3590
|
+
loop do
|
3591
|
+
r2 = _nt_ws
|
3592
|
+
if r2
|
3593
|
+
s1 << r2
|
3594
|
+
else
|
3595
|
+
break
|
3596
|
+
end
|
3597
|
+
end
|
3598
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
3599
|
+
s0 << r1
|
3600
|
+
if r1
|
3601
|
+
s3, i3 = [], index
|
3602
|
+
loop do
|
3603
|
+
r4 = _nt_expression
|
3604
|
+
if r4
|
3605
|
+
s3 << r4
|
3606
|
+
else
|
3607
|
+
break
|
3608
|
+
end
|
3609
|
+
end
|
3610
|
+
if s3.empty?
|
3611
|
+
self.index = i3
|
3612
|
+
r3 = nil
|
3613
|
+
else
|
3614
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
3615
|
+
end
|
3616
|
+
s0 << r3
|
3617
|
+
if r3
|
3618
|
+
s5, i5 = [], index
|
3619
|
+
loop do
|
3620
|
+
r6 = _nt_ws
|
3621
|
+
if r6
|
3622
|
+
s5 << r6
|
3623
|
+
else
|
3624
|
+
break
|
3625
|
+
end
|
3626
|
+
end
|
3627
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
3628
|
+
s0 << r5
|
3629
|
+
end
|
3630
|
+
end
|
3631
|
+
if s0.last
|
3632
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3633
|
+
r0.extend(BlockBody0)
|
3634
|
+
r0.extend(BlockBody1)
|
3635
|
+
else
|
3636
|
+
self.index = i0
|
3637
|
+
r0 = nil
|
3638
|
+
end
|
3639
|
+
|
3640
|
+
node_cache[:block_body][start_index] = r0
|
3641
|
+
|
3642
|
+
return r0
|
3643
|
+
end
|
3644
|
+
|
3645
|
+
module BlockParams0
|
3646
|
+
def params
|
3647
|
+
elements[1]
|
3648
|
+
end
|
3649
|
+
|
3650
|
+
end
|
3651
|
+
|
3652
|
+
module BlockParams1
|
3653
|
+
def value
|
3654
|
+
# block_param_str = "|"
|
3655
|
+
# block_param_str += params.elements.collect{|param| param.value}.join(",")
|
3656
|
+
# block_param_str += "| "
|
3657
|
+
# return block_param_str
|
3658
|
+
params.elements.collect{|param| param.value}
|
3659
|
+
end
|
3660
|
+
end
|
3661
|
+
|
3662
|
+
def _nt_block_params
|
3663
|
+
start_index = index
|
3664
|
+
if node_cache[:block_params].has_key?(index)
|
3665
|
+
cached = node_cache[:block_params][index]
|
3666
|
+
@index = cached.interval.end if cached
|
3667
|
+
return cached
|
3668
|
+
end
|
3669
|
+
|
3670
|
+
i0, s0 = index, []
|
3671
|
+
if input.index('|', index) == index
|
3672
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3673
|
+
@index += 1
|
3674
|
+
else
|
3675
|
+
terminal_parse_failure('|')
|
3676
|
+
r1 = nil
|
3677
|
+
end
|
3678
|
+
s0 << r1
|
3679
|
+
if r1
|
3680
|
+
s2, i2 = [], index
|
3681
|
+
loop do
|
3682
|
+
r3 = _nt_block_param
|
3683
|
+
if r3
|
3684
|
+
s2 << r3
|
3685
|
+
else
|
3686
|
+
break
|
3687
|
+
end
|
3688
|
+
end
|
3689
|
+
if s2.empty?
|
3690
|
+
self.index = i2
|
3691
|
+
r2 = nil
|
3692
|
+
else
|
3693
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3694
|
+
end
|
3695
|
+
s0 << r2
|
3696
|
+
if r2
|
3697
|
+
if input.index('|', index) == index
|
3698
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3699
|
+
@index += 1
|
3700
|
+
else
|
3701
|
+
terminal_parse_failure('|')
|
3702
|
+
r4 = nil
|
3703
|
+
end
|
3704
|
+
s0 << r4
|
3705
|
+
end
|
3706
|
+
end
|
3707
|
+
if s0.last
|
3708
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3709
|
+
r0.extend(BlockParams0)
|
3710
|
+
r0.extend(BlockParams1)
|
3711
|
+
else
|
3712
|
+
self.index = i0
|
3713
|
+
r0 = nil
|
3714
|
+
end
|
3715
|
+
|
3716
|
+
node_cache[:block_params][start_index] = r0
|
3717
|
+
|
3718
|
+
return r0
|
3719
|
+
end
|
3720
|
+
|
3721
|
+
module BlockParam0
|
3722
|
+
def identifier
|
3723
|
+
elements[0]
|
3724
|
+
end
|
3725
|
+
|
3726
|
+
end
|
3727
|
+
|
3728
|
+
module BlockParam1
|
3729
|
+
def param_name
|
3730
|
+
elements[1]
|
3731
|
+
end
|
3732
|
+
|
3733
|
+
def param_name_val
|
3734
|
+
elements[3]
|
3735
|
+
end
|
3736
|
+
|
3737
|
+
end
|
3738
|
+
|
3739
|
+
module BlockParam2
|
3740
|
+
def param_name_val
|
3741
|
+
elements[1]
|
3742
|
+
end
|
3743
|
+
end
|
3744
|
+
|
3745
|
+
module BlockParam3
|
3746
|
+
def value
|
3747
|
+
# holds param name (if given) with param value (the identifier in the body of the block)
|
3748
|
+
name_identifier_pair = {}
|
3749
|
+
if param_name.text_value =~ /\S+\:/
|
3750
|
+
# return the param-name as a symbol (start with a colon)
|
3751
|
+
# without the final colon & space, since it's not part of the name
|
3752
|
+
name_identifier_pair[:name] = ":#{param_name.text_value[0..-2]}"
|
3753
|
+
end
|
3754
|
+
name_identifier_pair[:identifier] = param_name_val.value
|
3755
|
+
return name_identifier_pair
|
3756
|
+
end
|
3757
|
+
end
|
3758
|
+
|
3759
|
+
def _nt_block_param
|
3760
|
+
start_index = index
|
3761
|
+
if node_cache[:block_param].has_key?(index)
|
3762
|
+
cached = node_cache[:block_param][index]
|
3763
|
+
@index = cached.interval.end if cached
|
3764
|
+
return cached
|
3765
|
+
end
|
3766
|
+
|
3767
|
+
i0 = index
|
3768
|
+
i1, s1 = index, []
|
3769
|
+
s2, i2 = [], index
|
3770
|
+
loop do
|
3771
|
+
r3 = _nt_ws
|
3772
|
+
if r3
|
3773
|
+
s2 << r3
|
3774
|
+
else
|
3775
|
+
break
|
3776
|
+
end
|
3777
|
+
end
|
3778
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3779
|
+
s1 << r2
|
3780
|
+
if r2
|
3781
|
+
i5, s5 = index, []
|
3782
|
+
r6 = _nt_identifier
|
3783
|
+
s5 << r6
|
3784
|
+
if r6
|
3785
|
+
if input.index(':', index) == index
|
3786
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3787
|
+
@index += 1
|
3788
|
+
else
|
3789
|
+
terminal_parse_failure(':')
|
3790
|
+
r7 = nil
|
3791
|
+
end
|
3792
|
+
s5 << r7
|
3793
|
+
end
|
3794
|
+
if s5.last
|
3795
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
3796
|
+
r5.extend(BlockParam0)
|
3797
|
+
else
|
3798
|
+
self.index = i5
|
3799
|
+
r5 = nil
|
3800
|
+
end
|
3801
|
+
if r5
|
3802
|
+
r4 = r5
|
3803
|
+
else
|
3804
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3805
|
+
end
|
3806
|
+
s1 << r4
|
3807
|
+
if r4
|
3808
|
+
s8, i8 = [], index
|
3809
|
+
loop do
|
3810
|
+
if input.index(' ', index) == index
|
3811
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3812
|
+
@index += 1
|
3813
|
+
else
|
3814
|
+
terminal_parse_failure(' ')
|
3815
|
+
r9 = nil
|
3816
|
+
end
|
3817
|
+
if r9
|
3818
|
+
s8 << r9
|
3819
|
+
else
|
3820
|
+
break
|
3821
|
+
end
|
3822
|
+
end
|
3823
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
3824
|
+
s1 << r8
|
3825
|
+
if r8
|
3826
|
+
r10 = _nt_identifier
|
3827
|
+
s1 << r10
|
3828
|
+
if r10
|
3829
|
+
s11, i11 = [], index
|
3830
|
+
loop do
|
3831
|
+
r12 = _nt_ws
|
3832
|
+
if r12
|
3833
|
+
s11 << r12
|
3834
|
+
else
|
3835
|
+
break
|
3836
|
+
end
|
3837
|
+
end
|
3838
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
3839
|
+
s1 << r11
|
3840
|
+
end
|
3841
|
+
end
|
3842
|
+
end
|
3843
|
+
end
|
3844
|
+
if s1.last
|
3845
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
3846
|
+
r1.extend(BlockParam1)
|
3847
|
+
else
|
3848
|
+
self.index = i1
|
3849
|
+
r1 = nil
|
3850
|
+
end
|
3851
|
+
if r1
|
3852
|
+
r0 = r1
|
3853
|
+
r0.extend(BlockParam3)
|
3854
|
+
else
|
3855
|
+
i13, s13 = index, []
|
3856
|
+
s14, i14 = [], index
|
3857
|
+
loop do
|
3858
|
+
r15 = _nt_ws
|
3859
|
+
if r15
|
3860
|
+
s14 << r15
|
3861
|
+
else
|
3862
|
+
break
|
3863
|
+
end
|
3864
|
+
end
|
3865
|
+
if s14.empty?
|
3866
|
+
self.index = i14
|
3867
|
+
r14 = nil
|
3868
|
+
else
|
3869
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
3870
|
+
end
|
3871
|
+
s13 << r14
|
3872
|
+
if r14
|
3873
|
+
r16 = _nt_identifier
|
3874
|
+
s13 << r16
|
3875
|
+
end
|
3876
|
+
if s13.last
|
3877
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
3878
|
+
r13.extend(BlockParam2)
|
3879
|
+
else
|
3880
|
+
self.index = i13
|
3881
|
+
r13 = nil
|
3882
|
+
end
|
3883
|
+
if r13
|
3884
|
+
r0 = r13
|
3885
|
+
r0.extend(BlockParam3)
|
3886
|
+
else
|
3887
|
+
self.index = i0
|
3888
|
+
r0 = nil
|
3889
|
+
end
|
3890
|
+
end
|
3891
|
+
|
3892
|
+
node_cache[:block_param][start_index] = r0
|
3893
|
+
|
3894
|
+
return r0
|
3895
|
+
end
|
3896
|
+
|
3897
|
+
module RegexLiteral0
|
3898
|
+
end
|
3899
|
+
|
3900
|
+
module RegexLiteral1
|
3901
|
+
end
|
3902
|
+
|
3903
|
+
module RegexLiteral2
|
3904
|
+
def value
|
3905
|
+
self.text_value
|
3906
|
+
end
|
3907
|
+
end
|
3908
|
+
|
3909
|
+
def _nt_regex_literal
|
3910
|
+
start_index = index
|
3911
|
+
if node_cache[:regex_literal].has_key?(index)
|
3912
|
+
cached = node_cache[:regex_literal][index]
|
3913
|
+
@index = cached.interval.end if cached
|
3914
|
+
return cached
|
3915
|
+
end
|
3916
|
+
|
3917
|
+
i0, s0 = index, []
|
3918
|
+
if input.index('/', index) == index
|
3919
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3920
|
+
@index += 1
|
3921
|
+
else
|
3922
|
+
terminal_parse_failure('/')
|
3923
|
+
r1 = nil
|
3924
|
+
end
|
3925
|
+
s0 << r1
|
3926
|
+
if r1
|
3927
|
+
s2, i2 = [], index
|
3928
|
+
loop do
|
3929
|
+
i3, s3 = index, []
|
3930
|
+
i4 = index
|
3931
|
+
if input.index('/', index) == index
|
3932
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3933
|
+
@index += 1
|
3934
|
+
else
|
3935
|
+
terminal_parse_failure('/')
|
3936
|
+
r5 = nil
|
3937
|
+
end
|
3938
|
+
if r5
|
3939
|
+
r4 = nil
|
3940
|
+
else
|
3941
|
+
self.index = i4
|
3942
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3943
|
+
end
|
3944
|
+
s3 << r4
|
3945
|
+
if r4
|
3946
|
+
if index < input_length
|
3947
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3948
|
+
@index += 1
|
3949
|
+
else
|
3950
|
+
terminal_parse_failure("any character")
|
3951
|
+
r6 = nil
|
3952
|
+
end
|
3953
|
+
s3 << r6
|
3954
|
+
end
|
3955
|
+
if s3.last
|
3956
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
3957
|
+
r3.extend(RegexLiteral0)
|
3958
|
+
else
|
3959
|
+
self.index = i3
|
3960
|
+
r3 = nil
|
3961
|
+
end
|
3962
|
+
if r3
|
3963
|
+
s2 << r3
|
3964
|
+
else
|
3965
|
+
break
|
3966
|
+
end
|
3967
|
+
end
|
3968
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3969
|
+
s0 << r2
|
3970
|
+
if r2
|
3971
|
+
if input.index('/', index) == index
|
3972
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3973
|
+
@index += 1
|
3974
|
+
else
|
3975
|
+
terminal_parse_failure('/')
|
3976
|
+
r7 = nil
|
3977
|
+
end
|
3978
|
+
s0 << r7
|
3979
|
+
end
|
3980
|
+
end
|
3981
|
+
if s0.last
|
3982
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3983
|
+
r0.extend(RegexLiteral1)
|
3984
|
+
r0.extend(RegexLiteral2)
|
3985
|
+
else
|
3986
|
+
self.index = i0
|
3987
|
+
r0 = nil
|
3988
|
+
end
|
3989
|
+
|
3990
|
+
node_cache[:regex_literal][start_index] = r0
|
3991
|
+
|
3992
|
+
return r0
|
3993
|
+
end
|
3994
|
+
|
3995
|
+
module InlineRuby0
|
3996
|
+
end
|
3997
|
+
|
3998
|
+
module InlineRuby1
|
3999
|
+
def ruby_code
|
4000
|
+
elements[4]
|
4001
|
+
end
|
4002
|
+
|
4003
|
+
end
|
4004
|
+
|
4005
|
+
module InlineRuby2
|
4006
|
+
def value
|
4007
|
+
return_val = ""
|
4008
|
+
ruby_code.elements.each do |e|
|
4009
|
+
unless e.respond_to?(:value) # when NOT a comment
|
4010
|
+
return_val += e.text_value.gsub(/[\n\t]/, ";").gsub(/\s+/, " ")
|
4011
|
+
else
|
4012
|
+
# check if its actually a comment, or just a string
|
4013
|
+
# interpolation - I know, it's ugly :(
|
4014
|
+
if e.text_value =~ /#\{\S*\}/
|
4015
|
+
# if it's just a string interpolation, also return it
|
4016
|
+
return_val += e.text_value + ";"
|
4017
|
+
end
|
4018
|
+
end
|
4019
|
+
end
|
4020
|
+
return_val
|
4021
|
+
end
|
4022
|
+
end
|
4023
|
+
|
4024
|
+
def _nt_inline_ruby
|
4025
|
+
start_index = index
|
4026
|
+
if node_cache[:inline_ruby].has_key?(index)
|
4027
|
+
cached = node_cache[:inline_ruby][index]
|
4028
|
+
@index = cached.interval.end if cached
|
4029
|
+
return cached
|
4030
|
+
end
|
4031
|
+
|
4032
|
+
i0, s0 = index, []
|
4033
|
+
if input.index('%ruby', index) == index
|
4034
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
4035
|
+
@index += 5
|
4036
|
+
else
|
4037
|
+
terminal_parse_failure('%ruby')
|
4038
|
+
r1 = nil
|
4039
|
+
end
|
4040
|
+
s0 << r1
|
4041
|
+
if r1
|
4042
|
+
s2, i2 = [], index
|
4043
|
+
loop do
|
4044
|
+
r3 = _nt_ws
|
4045
|
+
if r3
|
4046
|
+
s2 << r3
|
4047
|
+
else
|
4048
|
+
break
|
4049
|
+
end
|
4050
|
+
end
|
4051
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
4052
|
+
s0 << r2
|
4053
|
+
if r2
|
4054
|
+
if input.index('{', index) == index
|
4055
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4056
|
+
@index += 1
|
4057
|
+
else
|
4058
|
+
terminal_parse_failure('{')
|
4059
|
+
r4 = nil
|
4060
|
+
end
|
4061
|
+
s0 << r4
|
4062
|
+
if r4
|
4063
|
+
s5, i5 = [], index
|
4064
|
+
loop do
|
4065
|
+
r6 = _nt_ws
|
4066
|
+
if r6
|
4067
|
+
s5 << r6
|
4068
|
+
else
|
4069
|
+
break
|
4070
|
+
end
|
4071
|
+
end
|
4072
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
4073
|
+
s0 << r5
|
4074
|
+
if r5
|
4075
|
+
s7, i7 = [], index
|
4076
|
+
loop do
|
4077
|
+
i8 = index
|
4078
|
+
r9 = _nt_comment
|
4079
|
+
if r9
|
4080
|
+
r8 = r9
|
4081
|
+
else
|
4082
|
+
i10, s10 = index, []
|
4083
|
+
i11 = index
|
4084
|
+
if input.index('}%', index) == index
|
4085
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4086
|
+
@index += 2
|
4087
|
+
else
|
4088
|
+
terminal_parse_failure('}%')
|
4089
|
+
r12 = nil
|
4090
|
+
end
|
4091
|
+
if r12
|
4092
|
+
r11 = nil
|
4093
|
+
else
|
4094
|
+
self.index = i11
|
4095
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
4096
|
+
end
|
4097
|
+
s10 << r11
|
4098
|
+
if r11
|
4099
|
+
if index < input_length
|
4100
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4101
|
+
@index += 1
|
4102
|
+
else
|
4103
|
+
terminal_parse_failure("any character")
|
4104
|
+
r13 = nil
|
4105
|
+
end
|
4106
|
+
s10 << r13
|
4107
|
+
end
|
4108
|
+
if s10.last
|
4109
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
4110
|
+
r10.extend(InlineRuby0)
|
4111
|
+
else
|
4112
|
+
self.index = i10
|
4113
|
+
r10 = nil
|
4114
|
+
end
|
4115
|
+
if r10
|
4116
|
+
r8 = r10
|
4117
|
+
else
|
4118
|
+
self.index = i8
|
4119
|
+
r8 = nil
|
4120
|
+
end
|
4121
|
+
end
|
4122
|
+
if r8
|
4123
|
+
s7 << r8
|
4124
|
+
else
|
4125
|
+
break
|
4126
|
+
end
|
4127
|
+
end
|
4128
|
+
if s7.empty?
|
4129
|
+
self.index = i7
|
4130
|
+
r7 = nil
|
4131
|
+
else
|
4132
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
4133
|
+
end
|
4134
|
+
s0 << r7
|
4135
|
+
if r7
|
4136
|
+
if input.index('}%', index) == index
|
4137
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4138
|
+
@index += 2
|
4139
|
+
else
|
4140
|
+
terminal_parse_failure('}%')
|
4141
|
+
r14 = nil
|
4142
|
+
end
|
4143
|
+
s0 << r14
|
4144
|
+
end
|
4145
|
+
end
|
4146
|
+
end
|
4147
|
+
end
|
4148
|
+
end
|
4149
|
+
if s0.last
|
4150
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4151
|
+
r0.extend(InlineRuby1)
|
4152
|
+
r0.extend(InlineRuby2)
|
4153
|
+
else
|
4154
|
+
self.index = i0
|
4155
|
+
r0 = nil
|
4156
|
+
end
|
4157
|
+
|
4158
|
+
node_cache[:inline_ruby][start_index] = r0
|
4159
|
+
|
4160
|
+
return r0
|
4161
|
+
end
|
4162
|
+
|
4163
|
+
module Identifier0
|
4164
|
+
end
|
4165
|
+
|
4166
|
+
module Identifier1
|
4167
|
+
end
|
4168
|
+
|
4169
|
+
def _nt_identifier
|
4170
|
+
start_index = index
|
4171
|
+
if node_cache[:identifier].has_key?(index)
|
4172
|
+
cached = node_cache[:identifier][index]
|
4173
|
+
@index = cached.interval.end if cached
|
4174
|
+
return cached
|
4175
|
+
end
|
4176
|
+
|
4177
|
+
i0, s0 = index, []
|
4178
|
+
i2 = index
|
4179
|
+
if input.index('@', index) == index
|
4180
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4181
|
+
@index += 1
|
4182
|
+
else
|
4183
|
+
terminal_parse_failure('@')
|
4184
|
+
r3 = nil
|
4185
|
+
end
|
4186
|
+
if r3
|
4187
|
+
r2 = r3
|
4188
|
+
else
|
4189
|
+
if input.index('@@', index) == index
|
4190
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4191
|
+
@index += 2
|
4192
|
+
else
|
4193
|
+
terminal_parse_failure('@@')
|
4194
|
+
r4 = nil
|
4195
|
+
end
|
4196
|
+
if r4
|
4197
|
+
r2 = r4
|
4198
|
+
else
|
4199
|
+
self.index = i2
|
4200
|
+
r2 = nil
|
4201
|
+
end
|
4202
|
+
end
|
4203
|
+
if r2
|
4204
|
+
r1 = r2
|
4205
|
+
else
|
4206
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
4207
|
+
end
|
4208
|
+
s0 << r1
|
4209
|
+
if r1
|
4210
|
+
i5 = index
|
4211
|
+
s6, i6 = [], index
|
4212
|
+
loop do
|
4213
|
+
if input.index(Regexp.new('[a-zA-Z]'), index) == index
|
4214
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4215
|
+
@index += 1
|
4216
|
+
else
|
4217
|
+
r7 = nil
|
4218
|
+
end
|
4219
|
+
if r7
|
4220
|
+
s6 << r7
|
4221
|
+
else
|
4222
|
+
break
|
4223
|
+
end
|
4224
|
+
end
|
4225
|
+
if s6.empty?
|
4226
|
+
self.index = i6
|
4227
|
+
r6 = nil
|
4228
|
+
else
|
4229
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
4230
|
+
end
|
4231
|
+
if r6
|
4232
|
+
r5 = r6
|
4233
|
+
else
|
4234
|
+
i8, s8 = index, []
|
4235
|
+
if input.index('$', index) == index
|
4236
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4237
|
+
@index += 1
|
4238
|
+
else
|
4239
|
+
terminal_parse_failure('$')
|
4240
|
+
r9 = nil
|
4241
|
+
end
|
4242
|
+
s8 << r9
|
4243
|
+
if r9
|
4244
|
+
if input.index(Regexp.new('[0-9]'), index) == index
|
4245
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4246
|
+
@index += 1
|
4247
|
+
else
|
4248
|
+
r10 = nil
|
4249
|
+
end
|
4250
|
+
s8 << r10
|
4251
|
+
end
|
4252
|
+
if s8.last
|
4253
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
4254
|
+
r8.extend(Identifier0)
|
4255
|
+
else
|
4256
|
+
self.index = i8
|
4257
|
+
r8 = nil
|
4258
|
+
end
|
4259
|
+
if r8
|
4260
|
+
r5 = r8
|
4261
|
+
else
|
4262
|
+
self.index = i5
|
4263
|
+
r5 = nil
|
4264
|
+
end
|
4265
|
+
end
|
4266
|
+
s0 << r5
|
4267
|
+
if r5
|
4268
|
+
s11, i11 = [], index
|
4269
|
+
loop do
|
4270
|
+
if input.index(Regexp.new('[a-zA-Z0-9_]'), index) == index
|
4271
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4272
|
+
@index += 1
|
4273
|
+
else
|
4274
|
+
r12 = nil
|
4275
|
+
end
|
4276
|
+
if r12
|
4277
|
+
s11 << r12
|
4278
|
+
else
|
4279
|
+
break
|
4280
|
+
end
|
4281
|
+
end
|
4282
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
4283
|
+
s0 << r11
|
4284
|
+
end
|
4285
|
+
end
|
4286
|
+
if s0.last
|
4287
|
+
r0 = instantiate_node(IdentifierNode,input, i0...index, s0)
|
4288
|
+
r0.extend(Identifier1)
|
4289
|
+
else
|
4290
|
+
self.index = i0
|
4291
|
+
r0 = nil
|
4292
|
+
end
|
4293
|
+
|
4294
|
+
node_cache[:identifier][start_index] = r0
|
4295
|
+
|
4296
|
+
return r0
|
4297
|
+
end
|
4298
|
+
|
4299
|
+
module MessageName0
|
4300
|
+
end
|
4301
|
+
|
4302
|
+
module MessageName1
|
4303
|
+
def value
|
4304
|
+
self.text_value
|
4305
|
+
end
|
4306
|
+
end
|
4307
|
+
|
4308
|
+
def _nt_message_name
|
4309
|
+
start_index = index
|
4310
|
+
if node_cache[:message_name].has_key?(index)
|
4311
|
+
cached = node_cache[:message_name][index]
|
4312
|
+
@index = cached.interval.end if cached
|
4313
|
+
return cached
|
4314
|
+
end
|
4315
|
+
|
4316
|
+
i0, s0 = index, []
|
4317
|
+
s1, i1 = [], index
|
4318
|
+
loop do
|
4319
|
+
if input.index(Regexp.new('[a-zA-Z]'), index) == index
|
4320
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4321
|
+
@index += 1
|
4322
|
+
else
|
4323
|
+
r2 = nil
|
4324
|
+
end
|
4325
|
+
if r2
|
4326
|
+
s1 << r2
|
4327
|
+
else
|
4328
|
+
break
|
4329
|
+
end
|
4330
|
+
end
|
4331
|
+
if s1.empty?
|
4332
|
+
self.index = i1
|
4333
|
+
r1 = nil
|
4334
|
+
else
|
4335
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
4336
|
+
end
|
4337
|
+
s0 << r1
|
4338
|
+
if r1
|
4339
|
+
s3, i3 = [], index
|
4340
|
+
loop do
|
4341
|
+
if input.index(Regexp.new('[a-zA-Z0-9_]'), index) == index
|
4342
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4343
|
+
@index += 1
|
4344
|
+
else
|
4345
|
+
r4 = nil
|
4346
|
+
end
|
4347
|
+
if r4
|
4348
|
+
s3 << r4
|
4349
|
+
else
|
4350
|
+
break
|
4351
|
+
end
|
4352
|
+
end
|
4353
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
4354
|
+
s0 << r3
|
4355
|
+
if r3
|
4356
|
+
i6 = index
|
4357
|
+
if input.index('?', index) == index
|
4358
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4359
|
+
@index += 1
|
4360
|
+
else
|
4361
|
+
terminal_parse_failure('?')
|
4362
|
+
r7 = nil
|
4363
|
+
end
|
4364
|
+
if r7
|
4365
|
+
r6 = r7
|
4366
|
+
else
|
4367
|
+
if input.index('!', index) == index
|
4368
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4369
|
+
@index += 1
|
4370
|
+
else
|
4371
|
+
terminal_parse_failure('!')
|
4372
|
+
r8 = nil
|
4373
|
+
end
|
4374
|
+
if r8
|
4375
|
+
r6 = r8
|
4376
|
+
else
|
4377
|
+
if input.index('=', index) == index
|
4378
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4379
|
+
@index += 1
|
4380
|
+
else
|
4381
|
+
terminal_parse_failure('=')
|
4382
|
+
r9 = nil
|
4383
|
+
end
|
4384
|
+
if r9
|
4385
|
+
r6 = r9
|
4386
|
+
else
|
4387
|
+
self.index = i6
|
4388
|
+
r6 = nil
|
4389
|
+
end
|
4390
|
+
end
|
4391
|
+
end
|
4392
|
+
if r6
|
4393
|
+
r5 = r6
|
4394
|
+
else
|
4395
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
4396
|
+
end
|
4397
|
+
s0 << r5
|
4398
|
+
end
|
4399
|
+
end
|
4400
|
+
if s0.last
|
4401
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4402
|
+
r0.extend(MessageName0)
|
4403
|
+
r0.extend(MessageName1)
|
4404
|
+
else
|
4405
|
+
self.index = i0
|
4406
|
+
r0 = nil
|
4407
|
+
end
|
4408
|
+
|
4409
|
+
node_cache[:message_name][start_index] = r0
|
4410
|
+
|
4411
|
+
return r0
|
4412
|
+
end
|
4413
|
+
|
4414
|
+
module Operator0
|
4415
|
+
end
|
4416
|
+
|
4417
|
+
module Operator1
|
4418
|
+
def operator_symbol
|
4419
|
+
elements[0]
|
4420
|
+
end
|
4421
|
+
|
4422
|
+
end
|
4423
|
+
|
4424
|
+
module Operator2
|
4425
|
+
def value
|
4426
|
+
self.text_value
|
4427
|
+
end
|
4428
|
+
end
|
4429
|
+
|
4430
|
+
def _nt_operator
|
4431
|
+
start_index = index
|
4432
|
+
if node_cache[:operator].has_key?(index)
|
4433
|
+
cached = node_cache[:operator][index]
|
4434
|
+
@index = cached.interval.end if cached
|
4435
|
+
return cached
|
4436
|
+
end
|
4437
|
+
|
4438
|
+
i0 = index
|
4439
|
+
i1, s1 = index, []
|
4440
|
+
if input.index('=', index) == index
|
4441
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4442
|
+
@index += 1
|
4443
|
+
else
|
4444
|
+
terminal_parse_failure('=')
|
4445
|
+
r2 = nil
|
4446
|
+
end
|
4447
|
+
s1 << r2
|
4448
|
+
if r2
|
4449
|
+
s3, i3 = [], index
|
4450
|
+
loop do
|
4451
|
+
r4 = _nt_operator_symbol
|
4452
|
+
if r4
|
4453
|
+
s3 << r4
|
4454
|
+
else
|
4455
|
+
break
|
4456
|
+
end
|
4457
|
+
end
|
4458
|
+
if s3.empty?
|
4459
|
+
self.index = i3
|
4460
|
+
r3 = nil
|
4461
|
+
else
|
4462
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
4463
|
+
end
|
4464
|
+
s1 << r3
|
4465
|
+
end
|
4466
|
+
if s1.last
|
4467
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
4468
|
+
r1.extend(Operator0)
|
4469
|
+
else
|
4470
|
+
self.index = i1
|
4471
|
+
r1 = nil
|
4472
|
+
end
|
4473
|
+
if r1
|
4474
|
+
r0 = r1
|
4475
|
+
else
|
4476
|
+
i5, s5 = index, []
|
4477
|
+
r6 = _nt_operator_symbol
|
4478
|
+
s5 << r6
|
4479
|
+
if r6
|
4480
|
+
if input.index('=', index) == index
|
4481
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4482
|
+
@index += 1
|
4483
|
+
else
|
4484
|
+
terminal_parse_failure('=')
|
4485
|
+
r7 = nil
|
4486
|
+
end
|
4487
|
+
s5 << r7
|
4488
|
+
if r7
|
4489
|
+
s8, i8 = [], index
|
4490
|
+
loop do
|
4491
|
+
r9 = _nt_operator_symbol
|
4492
|
+
if r9
|
4493
|
+
s8 << r9
|
4494
|
+
else
|
4495
|
+
break
|
4496
|
+
end
|
4497
|
+
end
|
4498
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
4499
|
+
s5 << r8
|
4500
|
+
end
|
4501
|
+
end
|
4502
|
+
if s5.last
|
4503
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
4504
|
+
r5.extend(Operator1)
|
4505
|
+
else
|
4506
|
+
self.index = i5
|
4507
|
+
r5 = nil
|
4508
|
+
end
|
4509
|
+
if r5
|
4510
|
+
r0 = r5
|
4511
|
+
else
|
4512
|
+
s10, i10 = [], index
|
4513
|
+
loop do
|
4514
|
+
r11 = _nt_operator_symbol
|
4515
|
+
if r11
|
4516
|
+
s10 << r11
|
4517
|
+
else
|
4518
|
+
break
|
4519
|
+
end
|
4520
|
+
end
|
4521
|
+
if s10.empty?
|
4522
|
+
self.index = i10
|
4523
|
+
r10 = nil
|
4524
|
+
else
|
4525
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
4526
|
+
r10.extend(Operator2)
|
4527
|
+
end
|
4528
|
+
if r10
|
4529
|
+
r0 = r10
|
4530
|
+
else
|
4531
|
+
self.index = i0
|
4532
|
+
r0 = nil
|
4533
|
+
end
|
4534
|
+
end
|
4535
|
+
end
|
4536
|
+
|
4537
|
+
node_cache[:operator][start_index] = r0
|
4538
|
+
|
4539
|
+
return r0
|
4540
|
+
end
|
4541
|
+
|
4542
|
+
def _nt_operator_symbol
|
4543
|
+
start_index = index
|
4544
|
+
if node_cache[:operator_symbol].has_key?(index)
|
4545
|
+
cached = node_cache[:operator_symbol][index]
|
4546
|
+
@index = cached.interval.end if cached
|
4547
|
+
return cached
|
4548
|
+
end
|
4549
|
+
|
4550
|
+
i0 = index
|
4551
|
+
if input.index('<=', index) == index
|
4552
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4553
|
+
@index += 2
|
4554
|
+
else
|
4555
|
+
terminal_parse_failure('<=')
|
4556
|
+
r1 = nil
|
4557
|
+
end
|
4558
|
+
if r1
|
4559
|
+
r0 = r1
|
4560
|
+
else
|
4561
|
+
if input.index('>=', index) == index
|
4562
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4563
|
+
@index += 2
|
4564
|
+
else
|
4565
|
+
terminal_parse_failure('>=')
|
4566
|
+
r2 = nil
|
4567
|
+
end
|
4568
|
+
if r2
|
4569
|
+
r0 = r2
|
4570
|
+
else
|
4571
|
+
if input.index('<', index) == index
|
4572
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4573
|
+
@index += 1
|
4574
|
+
else
|
4575
|
+
terminal_parse_failure('<')
|
4576
|
+
r3 = nil
|
4577
|
+
end
|
4578
|
+
if r3
|
4579
|
+
r0 = r3
|
4580
|
+
else
|
4581
|
+
if input.index('>', index) == index
|
4582
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4583
|
+
@index += 1
|
4584
|
+
else
|
4585
|
+
terminal_parse_failure('>')
|
4586
|
+
r4 = nil
|
4587
|
+
end
|
4588
|
+
if r4
|
4589
|
+
r0 = r4
|
4590
|
+
else
|
4591
|
+
if input.index('==', index) == index
|
4592
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4593
|
+
@index += 2
|
4594
|
+
else
|
4595
|
+
terminal_parse_failure('==')
|
4596
|
+
r5 = nil
|
4597
|
+
end
|
4598
|
+
if r5
|
4599
|
+
r0 = r5
|
4600
|
+
else
|
4601
|
+
if input.index('!=', index) == index
|
4602
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4603
|
+
@index += 2
|
4604
|
+
else
|
4605
|
+
terminal_parse_failure('!=')
|
4606
|
+
r6 = nil
|
4607
|
+
end
|
4608
|
+
if r6
|
4609
|
+
r0 = r6
|
4610
|
+
else
|
4611
|
+
if input.index('+=', index) == index
|
4612
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4613
|
+
@index += 2
|
4614
|
+
else
|
4615
|
+
terminal_parse_failure('+=')
|
4616
|
+
r7 = nil
|
4617
|
+
end
|
4618
|
+
if r7
|
4619
|
+
r0 = r7
|
4620
|
+
else
|
4621
|
+
if input.index('-=', index) == index
|
4622
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4623
|
+
@index += 2
|
4624
|
+
else
|
4625
|
+
terminal_parse_failure('-=')
|
4626
|
+
r8 = nil
|
4627
|
+
end
|
4628
|
+
if r8
|
4629
|
+
r0 = r8
|
4630
|
+
else
|
4631
|
+
if input.index('&', index) == index
|
4632
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4633
|
+
@index += 1
|
4634
|
+
else
|
4635
|
+
terminal_parse_failure('&')
|
4636
|
+
r9 = nil
|
4637
|
+
end
|
4638
|
+
if r9
|
4639
|
+
r0 = r9
|
4640
|
+
else
|
4641
|
+
if input.index('.', index) == index
|
4642
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4643
|
+
@index += 1
|
4644
|
+
else
|
4645
|
+
terminal_parse_failure('.')
|
4646
|
+
r10 = nil
|
4647
|
+
end
|
4648
|
+
if r10
|
4649
|
+
r0 = r10
|
4650
|
+
else
|
4651
|
+
if input.index('+', index) == index
|
4652
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4653
|
+
@index += 1
|
4654
|
+
else
|
4655
|
+
terminal_parse_failure('+')
|
4656
|
+
r11 = nil
|
4657
|
+
end
|
4658
|
+
if r11
|
4659
|
+
r0 = r11
|
4660
|
+
else
|
4661
|
+
if input.index('-', index) == index
|
4662
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4663
|
+
@index += 1
|
4664
|
+
else
|
4665
|
+
terminal_parse_failure('-')
|
4666
|
+
r12 = nil
|
4667
|
+
end
|
4668
|
+
if r12
|
4669
|
+
r0 = r12
|
4670
|
+
else
|
4671
|
+
if input.index('/', index) == index
|
4672
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4673
|
+
@index += 1
|
4674
|
+
else
|
4675
|
+
terminal_parse_failure('/')
|
4676
|
+
r13 = nil
|
4677
|
+
end
|
4678
|
+
if r13
|
4679
|
+
r0 = r13
|
4680
|
+
else
|
4681
|
+
if input.index('*', index) == index
|
4682
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4683
|
+
@index += 1
|
4684
|
+
else
|
4685
|
+
terminal_parse_failure('*')
|
4686
|
+
r14 = nil
|
4687
|
+
end
|
4688
|
+
if r14
|
4689
|
+
r0 = r14
|
4690
|
+
else
|
4691
|
+
if input.index('|', index) == index
|
4692
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4693
|
+
@index += 1
|
4694
|
+
else
|
4695
|
+
terminal_parse_failure('|')
|
4696
|
+
r15 = nil
|
4697
|
+
end
|
4698
|
+
if r15
|
4699
|
+
r0 = r15
|
4700
|
+
else
|
4701
|
+
if input.index('=~', index) == index
|
4702
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4703
|
+
@index += 2
|
4704
|
+
else
|
4705
|
+
terminal_parse_failure('=~')
|
4706
|
+
r16 = nil
|
4707
|
+
end
|
4708
|
+
if r16
|
4709
|
+
r0 = r16
|
4710
|
+
else
|
4711
|
+
self.index = i0
|
4712
|
+
r0 = nil
|
4713
|
+
end
|
4714
|
+
end
|
4715
|
+
end
|
4716
|
+
end
|
4717
|
+
end
|
4718
|
+
end
|
4719
|
+
end
|
4720
|
+
end
|
4721
|
+
end
|
4722
|
+
end
|
4723
|
+
end
|
4724
|
+
end
|
4725
|
+
end
|
4726
|
+
end
|
4727
|
+
end
|
4728
|
+
end
|
4729
|
+
|
4730
|
+
node_cache[:operator_symbol][start_index] = r0
|
4731
|
+
|
4732
|
+
return r0
|
4733
|
+
end
|
4734
|
+
|
4735
|
+
def _nt_ws
|
4736
|
+
start_index = index
|
4737
|
+
if node_cache[:ws].has_key?(index)
|
4738
|
+
cached = node_cache[:ws][index]
|
4739
|
+
@index = cached.interval.end if cached
|
4740
|
+
return cached
|
4741
|
+
end
|
4742
|
+
|
4743
|
+
s0, i0 = [], index
|
4744
|
+
loop do
|
4745
|
+
if input.index(Regexp.new('[\\n\\s\\t]'), index) == index
|
4746
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4747
|
+
@index += 1
|
4748
|
+
else
|
4749
|
+
r1 = nil
|
4750
|
+
end
|
4751
|
+
if r1
|
4752
|
+
s0 << r1
|
4753
|
+
else
|
4754
|
+
break
|
4755
|
+
end
|
4756
|
+
end
|
4757
|
+
if s0.empty?
|
4758
|
+
self.index = i0
|
4759
|
+
r0 = nil
|
4760
|
+
else
|
4761
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4762
|
+
end
|
4763
|
+
|
4764
|
+
node_cache[:ws][start_index] = r0
|
4765
|
+
|
4766
|
+
return r0
|
4767
|
+
end
|
4768
|
+
|
4769
|
+
def _nt_spaces
|
4770
|
+
start_index = index
|
4771
|
+
if node_cache[:spaces].has_key?(index)
|
4772
|
+
cached = node_cache[:spaces][index]
|
4773
|
+
@index = cached.interval.end if cached
|
4774
|
+
return cached
|
4775
|
+
end
|
4776
|
+
|
4777
|
+
s0, i0 = [], index
|
4778
|
+
loop do
|
4779
|
+
if input.index(Regexp.new('[\\s\\t]'), index) == index
|
4780
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4781
|
+
@index += 1
|
4782
|
+
else
|
4783
|
+
r1 = nil
|
4784
|
+
end
|
4785
|
+
if r1
|
4786
|
+
s0 << r1
|
4787
|
+
else
|
4788
|
+
break
|
4789
|
+
end
|
4790
|
+
end
|
4791
|
+
if s0.empty?
|
4792
|
+
self.index = i0
|
4793
|
+
r0 = nil
|
4794
|
+
else
|
4795
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4796
|
+
end
|
4797
|
+
|
4798
|
+
node_cache[:spaces][start_index] = r0
|
4799
|
+
|
4800
|
+
return r0
|
4801
|
+
end
|
4802
|
+
|
4803
|
+
def _nt_newline
|
4804
|
+
start_index = index
|
4805
|
+
if node_cache[:newline].has_key?(index)
|
4806
|
+
cached = node_cache[:newline][index]
|
4807
|
+
@index = cached.interval.end if cached
|
4808
|
+
return cached
|
4809
|
+
end
|
4810
|
+
|
4811
|
+
s0, i0 = [], index
|
4812
|
+
loop do
|
4813
|
+
if input.index(Regexp.new('[\\n]'), index) == index
|
4814
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4815
|
+
@index += 1
|
4816
|
+
else
|
4817
|
+
r1 = nil
|
4818
|
+
end
|
4819
|
+
if r1
|
4820
|
+
s0 << r1
|
4821
|
+
else
|
4822
|
+
break
|
4823
|
+
end
|
4824
|
+
end
|
4825
|
+
if s0.empty?
|
4826
|
+
self.index = i0
|
4827
|
+
r0 = nil
|
4828
|
+
else
|
4829
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4830
|
+
end
|
4831
|
+
|
4832
|
+
node_cache[:newline][start_index] = r0
|
4833
|
+
|
4834
|
+
return r0
|
4835
|
+
end
|
4836
|
+
|
4837
|
+
module DoKeyword0
|
4838
|
+
end
|
4839
|
+
|
4840
|
+
def _nt_do_keyword
|
4841
|
+
start_index = index
|
4842
|
+
if node_cache[:do_keyword].has_key?(index)
|
4843
|
+
cached = node_cache[:do_keyword][index]
|
4844
|
+
@index = cached.interval.end if cached
|
4845
|
+
return cached
|
4846
|
+
end
|
4847
|
+
|
4848
|
+
i0, s0 = index, []
|
4849
|
+
if input.index('do', index) == index
|
4850
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4851
|
+
@index += 2
|
4852
|
+
else
|
4853
|
+
terminal_parse_failure('do')
|
4854
|
+
r1 = nil
|
4855
|
+
end
|
4856
|
+
s0 << r1
|
4857
|
+
if r1
|
4858
|
+
i2 = index
|
4859
|
+
if input.index(Regexp.new('[a-zA-Z0-9_]'), index) == index
|
4860
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4861
|
+
@index += 1
|
4862
|
+
else
|
4863
|
+
r3 = nil
|
4864
|
+
end
|
4865
|
+
if r3
|
4866
|
+
r2 = nil
|
4867
|
+
else
|
4868
|
+
self.index = i2
|
4869
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
4870
|
+
end
|
4871
|
+
s0 << r2
|
4872
|
+
if r2
|
4873
|
+
i4 = index
|
4874
|
+
r5 = _nt_ws
|
4875
|
+
if r5
|
4876
|
+
self.index = i4
|
4877
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
4878
|
+
else
|
4879
|
+
r4 = nil
|
4880
|
+
end
|
4881
|
+
s0 << r4
|
4882
|
+
end
|
4883
|
+
end
|
4884
|
+
if s0.last
|
4885
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4886
|
+
r0.extend(DoKeyword0)
|
4887
|
+
else
|
4888
|
+
self.index = i0
|
4889
|
+
r0 = nil
|
4890
|
+
end
|
4891
|
+
|
4892
|
+
node_cache[:do_keyword][start_index] = r0
|
4893
|
+
|
4894
|
+
return r0
|
4895
|
+
end
|
4896
|
+
|
4897
|
+
module EndKeyword0
|
4898
|
+
end
|
4899
|
+
|
4900
|
+
def _nt_end_keyword
|
4901
|
+
start_index = index
|
4902
|
+
if node_cache[:end_keyword].has_key?(index)
|
4903
|
+
cached = node_cache[:end_keyword][index]
|
4904
|
+
@index = cached.interval.end if cached
|
4905
|
+
return cached
|
4906
|
+
end
|
4907
|
+
|
4908
|
+
i0, s0 = index, []
|
4909
|
+
if input.index('end', index) == index
|
4910
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
4911
|
+
@index += 3
|
4912
|
+
else
|
4913
|
+
terminal_parse_failure('end')
|
4914
|
+
r1 = nil
|
4915
|
+
end
|
4916
|
+
s0 << r1
|
4917
|
+
if r1
|
4918
|
+
i2 = index
|
4919
|
+
if input.index(Regexp.new('[a-zA-Z0-9_]'), index) == index
|
4920
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4921
|
+
@index += 1
|
4922
|
+
else
|
4923
|
+
r3 = nil
|
4924
|
+
end
|
4925
|
+
if r3
|
4926
|
+
r2 = nil
|
4927
|
+
else
|
4928
|
+
self.index = i2
|
4929
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
4930
|
+
end
|
4931
|
+
s0 << r2
|
4932
|
+
end
|
4933
|
+
if s0.last
|
4934
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4935
|
+
r0.extend(EndKeyword0)
|
4936
|
+
else
|
4937
|
+
self.index = i0
|
4938
|
+
r0 = nil
|
4939
|
+
end
|
4940
|
+
|
4941
|
+
node_cache[:end_keyword][start_index] = r0
|
4942
|
+
|
4943
|
+
return r0
|
4944
|
+
end
|
4945
|
+
|
4946
|
+
def _nt_non_zero_digit
|
4947
|
+
start_index = index
|
4948
|
+
if node_cache[:non_zero_digit].has_key?(index)
|
4949
|
+
cached = node_cache[:non_zero_digit][index]
|
4950
|
+
@index = cached.interval.end if cached
|
4951
|
+
return cached
|
4952
|
+
end
|
4953
|
+
|
4954
|
+
if input.index(Regexp.new('[1-9]'), index) == index
|
4955
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4956
|
+
@index += 1
|
4957
|
+
else
|
4958
|
+
r0 = nil
|
4959
|
+
end
|
4960
|
+
|
4961
|
+
node_cache[:non_zero_digit][start_index] = r0
|
4962
|
+
|
4963
|
+
return r0
|
4964
|
+
end
|
4965
|
+
|
4966
|
+
def _nt_digit
|
4967
|
+
start_index = index
|
4968
|
+
if node_cache[:digit].has_key?(index)
|
4969
|
+
cached = node_cache[:digit][index]
|
4970
|
+
@index = cached.interval.end if cached
|
4971
|
+
return cached
|
4972
|
+
end
|
4973
|
+
|
4974
|
+
if input.index(Regexp.new('[0-9]'), index) == index
|
4975
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4976
|
+
@index += 1
|
4977
|
+
else
|
4978
|
+
r0 = nil
|
4979
|
+
end
|
4980
|
+
|
4981
|
+
node_cache[:digit][start_index] = r0
|
4982
|
+
|
4983
|
+
return r0
|
4984
|
+
end
|
4985
|
+
|
4986
|
+
def _nt_sign
|
4987
|
+
start_index = index
|
4988
|
+
if node_cache[:sign].has_key?(index)
|
4989
|
+
cached = node_cache[:sign][index]
|
4990
|
+
@index = cached.interval.end if cached
|
4991
|
+
return cached
|
4992
|
+
end
|
4993
|
+
|
4994
|
+
i0 = index
|
4995
|
+
if input.index('+', index) == index
|
4996
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4997
|
+
@index += 1
|
4998
|
+
else
|
4999
|
+
terminal_parse_failure('+')
|
5000
|
+
r1 = nil
|
5001
|
+
end
|
5002
|
+
if r1
|
5003
|
+
r0 = r1
|
5004
|
+
else
|
5005
|
+
if input.index('-', index) == index
|
5006
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
5007
|
+
@index += 1
|
5008
|
+
else
|
5009
|
+
terminal_parse_failure('-')
|
5010
|
+
r2 = nil
|
5011
|
+
end
|
5012
|
+
if r2
|
5013
|
+
r0 = r2
|
5014
|
+
else
|
5015
|
+
self.index = i0
|
5016
|
+
r0 = nil
|
5017
|
+
end
|
5018
|
+
end
|
5019
|
+
|
5020
|
+
node_cache[:sign][start_index] = r0
|
5021
|
+
|
5022
|
+
return r0
|
5023
|
+
end
|
5024
|
+
|
5025
|
+
end
|
5026
|
+
|
5027
|
+
class BlocktalkParser < Treetop::Runtime::CompiledParser
|
5028
|
+
include Blocktalk
|
5029
|
+
end
|
5030
|
+
|