jpt 0.0.1

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