treetop 1.3.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.md} +0 -0
- data/bin/tt +96 -12
- data/doc/semantic_interpretation.markdown +2 -2
- data/doc/site.rb +2 -0
- data/doc/sitegen.rb +6 -1
- data/doc/using_in_ruby.markdown +126 -0
- data/examples/ruby_syntax/syntax_test.rb +105 -0
- data/examples/ruby_syntax/test_helper.rb +28 -0
- data/lib/treetop/compiler/grammar_compiler.rb +2 -0
- data/lib/treetop/compiler/metagrammar.rb +422 -261
- data/lib/treetop/compiler/metagrammar.treetop +29 -1
- data/lib/treetop/compiler/node_classes/anything_symbol.rb +3 -2
- data/lib/treetop/compiler/node_classes/character_class.rb +9 -4
- data/lib/treetop/compiler/node_classes/parsing_expression.rb +8 -0
- data/lib/treetop/compiler/node_classes/predicate_block.rb +16 -0
- data/lib/treetop/compiler/node_classes/sequence.rb +4 -1
- data/lib/treetop/compiler/node_classes.rb +1 -0
- data/lib/treetop/compiler.rb +1 -1
- data/lib/treetop/ruby_extensions/array.rb +22 -0
- data/lib/treetop/ruby_extensions/nil.rb +5 -0
- data/lib/treetop/ruby_extensions/object.rb +57 -0
- data/lib/treetop/ruby_extensions/regexp.rb +5 -0
- data/lib/treetop/ruby_extensions/string.rb +28 -2
- data/lib/treetop/ruby_extensions/symbol.rb +5 -0
- data/lib/treetop/ruby_extensions.rb +3 -1
- data/lib/treetop/runtime/compiled_parser.rb +16 -12
- data/lib/treetop/runtime/syntax_node.rb +47 -5
- data/lib/treetop/syntax.rb +39 -0
- data/lib/treetop/version.rb +2 -2
- data/lib/treetop.rb +7 -1
- metadata +13 -4
@@ -1,3 +1,6 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
1
4
|
module Treetop
|
2
5
|
module Compiler
|
3
6
|
module Metagrammar
|
@@ -64,7 +67,7 @@ module Treetop
|
|
64
67
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
65
68
|
r2.extend(TreetopFile0)
|
66
69
|
else
|
67
|
-
|
70
|
+
@index = i2
|
68
71
|
r2 = nil
|
69
72
|
end
|
70
73
|
if r2
|
@@ -93,7 +96,7 @@ module Treetop
|
|
93
96
|
if r10
|
94
97
|
r8 = r10
|
95
98
|
else
|
96
|
-
|
99
|
+
@index = i8
|
97
100
|
r8 = nil
|
98
101
|
end
|
99
102
|
end
|
@@ -114,13 +117,13 @@ module Treetop
|
|
114
117
|
r0.extend(TreetopFile1)
|
115
118
|
r0.extend(TreetopFile2)
|
116
119
|
else
|
117
|
-
|
120
|
+
@index = i0
|
118
121
|
r0 = nil
|
119
122
|
end
|
120
123
|
|
121
124
|
node_cache[:treetop_file][start_index] = r0
|
122
125
|
|
123
|
-
|
126
|
+
r0
|
124
127
|
end
|
125
128
|
|
126
129
|
module RequireStatement0
|
@@ -147,7 +150,7 @@ module Treetop
|
|
147
150
|
end
|
148
151
|
s0 << r1
|
149
152
|
if r1
|
150
|
-
if
|
153
|
+
if has_terminal?("require", false, index)
|
151
154
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
152
155
|
@index += 7
|
153
156
|
else
|
@@ -158,9 +161,10 @@ module Treetop
|
|
158
161
|
if r3
|
159
162
|
s4, i4 = [], index
|
160
163
|
loop do
|
161
|
-
if
|
162
|
-
|
163
|
-
|
164
|
+
if has_terminal?('\G[ \\t]', true, index)
|
165
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
166
|
+
r5 = true
|
167
|
+
@index = next_character
|
164
168
|
else
|
165
169
|
r5 = nil
|
166
170
|
end
|
@@ -171,7 +175,7 @@ module Treetop
|
|
171
175
|
end
|
172
176
|
end
|
173
177
|
if s4.empty?
|
174
|
-
|
178
|
+
@index = i4
|
175
179
|
r4 = nil
|
176
180
|
else
|
177
181
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
@@ -180,9 +184,10 @@ module Treetop
|
|
180
184
|
if r4
|
181
185
|
s6, i6 = [], index
|
182
186
|
loop do
|
183
|
-
if
|
184
|
-
|
185
|
-
|
187
|
+
if has_terminal?('\G[^\\n\\r]', true, index)
|
188
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
189
|
+
r7 = true
|
190
|
+
@index = next_character
|
186
191
|
else
|
187
192
|
r7 = nil
|
188
193
|
end
|
@@ -193,16 +198,17 @@ module Treetop
|
|
193
198
|
end
|
194
199
|
end
|
195
200
|
if s6.empty?
|
196
|
-
|
201
|
+
@index = i6
|
197
202
|
r6 = nil
|
198
203
|
else
|
199
204
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
200
205
|
end
|
201
206
|
s0 << r6
|
202
207
|
if r6
|
203
|
-
if
|
204
|
-
|
205
|
-
|
208
|
+
if has_terminal?('\G[\\n\\r]', true, index)
|
209
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
210
|
+
r8 = true
|
211
|
+
@index = next_character
|
206
212
|
else
|
207
213
|
r8 = nil
|
208
214
|
end
|
@@ -215,21 +221,21 @@ module Treetop
|
|
215
221
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
216
222
|
r0.extend(RequireStatement0)
|
217
223
|
else
|
218
|
-
|
224
|
+
@index = i0
|
219
225
|
r0 = nil
|
220
226
|
end
|
221
227
|
|
222
228
|
node_cache[:require_statement][start_index] = r0
|
223
229
|
|
224
|
-
|
230
|
+
r0
|
225
231
|
end
|
226
232
|
|
227
233
|
module ModuleDeclaration0
|
228
|
-
def
|
234
|
+
def space1
|
229
235
|
elements[1]
|
230
236
|
end
|
231
237
|
|
232
|
-
def
|
238
|
+
def space2
|
233
239
|
elements[4]
|
234
240
|
end
|
235
241
|
end
|
@@ -271,7 +277,7 @@ module Treetop
|
|
271
277
|
|
272
278
|
i0, s0 = index, []
|
273
279
|
i1, s1 = index, []
|
274
|
-
if
|
280
|
+
if has_terminal?('module', false, index)
|
275
281
|
r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
276
282
|
@index += 6
|
277
283
|
else
|
@@ -283,9 +289,10 @@ module Treetop
|
|
283
289
|
r3 = _nt_space
|
284
290
|
s1 << r3
|
285
291
|
if r3
|
286
|
-
if
|
287
|
-
|
288
|
-
|
292
|
+
if has_terminal?('\G[A-Z]', true, index)
|
293
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
294
|
+
r4 = true
|
295
|
+
@index = next_character
|
289
296
|
else
|
290
297
|
r4 = nil
|
291
298
|
end
|
@@ -313,7 +320,7 @@ module Treetop
|
|
313
320
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
314
321
|
r1.extend(ModuleDeclaration0)
|
315
322
|
else
|
316
|
-
|
323
|
+
@index = i1
|
317
324
|
r1 = nil
|
318
325
|
end
|
319
326
|
s0 << r1
|
@@ -327,7 +334,7 @@ module Treetop
|
|
327
334
|
if r10
|
328
335
|
r8 = r10
|
329
336
|
else
|
330
|
-
|
337
|
+
@index = i8
|
331
338
|
r8 = nil
|
332
339
|
end
|
333
340
|
end
|
@@ -337,7 +344,7 @@ module Treetop
|
|
337
344
|
r12 = _nt_space
|
338
345
|
s11 << r12
|
339
346
|
if r12
|
340
|
-
if
|
347
|
+
if has_terminal?('end', false, index)
|
341
348
|
r13 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
342
349
|
@index += 3
|
343
350
|
else
|
@@ -350,7 +357,7 @@ module Treetop
|
|
350
357
|
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
351
358
|
r11.extend(ModuleDeclaration1)
|
352
359
|
else
|
353
|
-
|
360
|
+
@index = i11
|
354
361
|
r11 = nil
|
355
362
|
end
|
356
363
|
s0 << r11
|
@@ -361,13 +368,13 @@ module Treetop
|
|
361
368
|
r0.extend(ModuleDeclaration2)
|
362
369
|
r0.extend(ModuleDeclaration3)
|
363
370
|
else
|
364
|
-
|
371
|
+
@index = i0
|
365
372
|
r0 = nil
|
366
373
|
end
|
367
374
|
|
368
375
|
node_cache[:module_declaration][start_index] = r0
|
369
376
|
|
370
|
-
|
377
|
+
r0
|
371
378
|
end
|
372
379
|
|
373
380
|
module Grammar0
|
@@ -377,7 +384,7 @@ module Treetop
|
|
377
384
|
end
|
378
385
|
|
379
386
|
module Grammar1
|
380
|
-
def
|
387
|
+
def space1
|
381
388
|
elements[1]
|
382
389
|
end
|
383
390
|
|
@@ -385,7 +392,7 @@ module Treetop
|
|
385
392
|
elements[2]
|
386
393
|
end
|
387
394
|
|
388
|
-
def
|
395
|
+
def space2
|
389
396
|
elements[3]
|
390
397
|
end
|
391
398
|
|
@@ -404,7 +411,7 @@ module Treetop
|
|
404
411
|
end
|
405
412
|
|
406
413
|
i0, s0 = index, []
|
407
|
-
if
|
414
|
+
if has_terminal?('grammar', false, index)
|
408
415
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
409
416
|
@index += 7
|
410
417
|
else
|
@@ -423,7 +430,7 @@ module Treetop
|
|
423
430
|
s0 << r4
|
424
431
|
if r4
|
425
432
|
i6, s6 = index, []
|
426
|
-
if
|
433
|
+
if has_terminal?('do', false, index)
|
427
434
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
428
435
|
@index += 2
|
429
436
|
else
|
@@ -439,7 +446,7 @@ module Treetop
|
|
439
446
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
440
447
|
r6.extend(Grammar0)
|
441
448
|
else
|
442
|
-
|
449
|
+
@index = i6
|
443
450
|
r6 = nil
|
444
451
|
end
|
445
452
|
if r6
|
@@ -460,7 +467,7 @@ module Treetop
|
|
460
467
|
end
|
461
468
|
s0 << r10
|
462
469
|
if r10
|
463
|
-
if
|
470
|
+
if has_terminal?('end', false, index)
|
464
471
|
r12 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
465
472
|
@index += 3
|
466
473
|
else
|
@@ -479,13 +486,13 @@ module Treetop
|
|
479
486
|
r0 = instantiate_node(Grammar,input, i0...index, s0)
|
480
487
|
r0.extend(Grammar1)
|
481
488
|
else
|
482
|
-
|
489
|
+
@index = i0
|
483
490
|
r0 = nil
|
484
491
|
end
|
485
492
|
|
486
493
|
node_cache[:grammar][start_index] = r0
|
487
494
|
|
488
|
-
|
495
|
+
r0
|
489
496
|
end
|
490
497
|
|
491
498
|
module GrammarName0
|
@@ -500,9 +507,10 @@ module Treetop
|
|
500
507
|
end
|
501
508
|
|
502
509
|
i0, s0 = index, []
|
503
|
-
if
|
504
|
-
|
505
|
-
|
510
|
+
if has_terminal?('\G[A-Z]', true, index)
|
511
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
512
|
+
r1 = true
|
513
|
+
@index = next_character
|
506
514
|
else
|
507
515
|
r1 = nil
|
508
516
|
end
|
@@ -524,13 +532,13 @@ module Treetop
|
|
524
532
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
525
533
|
r0.extend(GrammarName0)
|
526
534
|
else
|
527
|
-
|
535
|
+
@index = i0
|
528
536
|
r0 = nil
|
529
537
|
end
|
530
538
|
|
531
539
|
node_cache[:grammar_name][start_index] = r0
|
532
540
|
|
533
|
-
|
541
|
+
r0
|
534
542
|
end
|
535
543
|
|
536
544
|
module DeclarationSequence0
|
@@ -594,7 +602,7 @@ module Treetop
|
|
594
602
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
595
603
|
r4.extend(DeclarationSequence0)
|
596
604
|
else
|
597
|
-
|
605
|
+
@index = i4
|
598
606
|
r4 = nil
|
599
607
|
end
|
600
608
|
if r4
|
@@ -611,13 +619,13 @@ module Treetop
|
|
611
619
|
r1.extend(DeclarationSequence1)
|
612
620
|
r1.extend(DeclarationSequence2)
|
613
621
|
else
|
614
|
-
|
622
|
+
@index = i1
|
615
623
|
r1 = nil
|
616
624
|
end
|
617
625
|
if r1
|
618
626
|
r0 = r1
|
619
627
|
else
|
620
|
-
if
|
628
|
+
if has_terminal?('', false, index)
|
621
629
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
622
630
|
r7.extend(DeclarationSequence3)
|
623
631
|
@index += 0
|
@@ -628,14 +636,14 @@ module Treetop
|
|
628
636
|
if r7
|
629
637
|
r0 = r7
|
630
638
|
else
|
631
|
-
|
639
|
+
@index = i0
|
632
640
|
r0 = nil
|
633
641
|
end
|
634
642
|
end
|
635
643
|
|
636
644
|
node_cache[:declaration_sequence][start_index] = r0
|
637
645
|
|
638
|
-
|
646
|
+
r0
|
639
647
|
end
|
640
648
|
|
641
649
|
def _nt_declaration
|
@@ -655,14 +663,14 @@ module Treetop
|
|
655
663
|
if r2
|
656
664
|
r0 = r2
|
657
665
|
else
|
658
|
-
|
666
|
+
@index = i0
|
659
667
|
r0 = nil
|
660
668
|
end
|
661
669
|
end
|
662
670
|
|
663
671
|
node_cache[:declaration][start_index] = r0
|
664
672
|
|
665
|
-
|
673
|
+
r0
|
666
674
|
end
|
667
675
|
|
668
676
|
module IncludeDeclaration0
|
@@ -687,7 +695,7 @@ module Treetop
|
|
687
695
|
end
|
688
696
|
|
689
697
|
i0, s0 = index, []
|
690
|
-
if
|
698
|
+
if has_terminal?('include', false, index)
|
691
699
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
692
700
|
@index += 7
|
693
701
|
else
|
@@ -699,9 +707,10 @@ module Treetop
|
|
699
707
|
r2 = _nt_space
|
700
708
|
s0 << r2
|
701
709
|
if r2
|
702
|
-
if
|
703
|
-
|
704
|
-
|
710
|
+
if has_terminal?('\G[A-Z]', true, index)
|
711
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
712
|
+
r3 = true
|
713
|
+
@index = next_character
|
705
714
|
else
|
706
715
|
r3 = nil
|
707
716
|
end
|
@@ -714,7 +723,7 @@ module Treetop
|
|
714
723
|
if r6
|
715
724
|
r5 = r6
|
716
725
|
else
|
717
|
-
if
|
726
|
+
if has_terminal?('::', false, index)
|
718
727
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
719
728
|
@index += 2
|
720
729
|
else
|
@@ -724,7 +733,7 @@ module Treetop
|
|
724
733
|
if r7
|
725
734
|
r5 = r7
|
726
735
|
else
|
727
|
-
|
736
|
+
@index = i5
|
728
737
|
r5 = nil
|
729
738
|
end
|
730
739
|
end
|
@@ -744,13 +753,13 @@ module Treetop
|
|
744
753
|
r0.extend(IncludeDeclaration0)
|
745
754
|
r0.extend(IncludeDeclaration1)
|
746
755
|
else
|
747
|
-
|
756
|
+
@index = i0
|
748
757
|
r0 = nil
|
749
758
|
end
|
750
759
|
|
751
760
|
node_cache[:include_declaration][start_index] = r0
|
752
761
|
|
753
|
-
|
762
|
+
r0
|
754
763
|
end
|
755
764
|
|
756
765
|
module ParsingRule0
|
@@ -760,7 +769,7 @@ module Treetop
|
|
760
769
|
end
|
761
770
|
|
762
771
|
module ParsingRule1
|
763
|
-
def
|
772
|
+
def space1
|
764
773
|
elements[1]
|
765
774
|
end
|
766
775
|
|
@@ -768,7 +777,7 @@ module Treetop
|
|
768
777
|
elements[2]
|
769
778
|
end
|
770
779
|
|
771
|
-
def
|
780
|
+
def space2
|
772
781
|
elements[3]
|
773
782
|
end
|
774
783
|
|
@@ -776,7 +785,7 @@ module Treetop
|
|
776
785
|
elements[5]
|
777
786
|
end
|
778
787
|
|
779
|
-
def
|
788
|
+
def space3
|
780
789
|
elements[6]
|
781
790
|
end
|
782
791
|
|
@@ -791,7 +800,7 @@ module Treetop
|
|
791
800
|
end
|
792
801
|
|
793
802
|
i0, s0 = index, []
|
794
|
-
if
|
803
|
+
if has_terminal?('rule', false, index)
|
795
804
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
796
805
|
@index += 4
|
797
806
|
else
|
@@ -810,7 +819,7 @@ module Treetop
|
|
810
819
|
s0 << r4
|
811
820
|
if r4
|
812
821
|
i6, s6 = index, []
|
813
|
-
if
|
822
|
+
if has_terminal?('do', false, index)
|
814
823
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
815
824
|
@index += 2
|
816
825
|
else
|
@@ -826,7 +835,7 @@ module Treetop
|
|
826
835
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
827
836
|
r6.extend(ParsingRule0)
|
828
837
|
else
|
829
|
-
|
838
|
+
@index = i6
|
830
839
|
r6 = nil
|
831
840
|
end
|
832
841
|
if r6
|
@@ -842,7 +851,7 @@ module Treetop
|
|
842
851
|
r10 = _nt_space
|
843
852
|
s0 << r10
|
844
853
|
if r10
|
845
|
-
if
|
854
|
+
if has_terminal?('end', false, index)
|
846
855
|
r11 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
847
856
|
@index += 3
|
848
857
|
else
|
@@ -861,13 +870,13 @@ module Treetop
|
|
861
870
|
r0 = instantiate_node(ParsingRule,input, i0...index, s0)
|
862
871
|
r0.extend(ParsingRule1)
|
863
872
|
else
|
864
|
-
|
873
|
+
@index = i0
|
865
874
|
r0 = nil
|
866
875
|
end
|
867
876
|
|
868
877
|
node_cache[:parsing_rule][start_index] = r0
|
869
878
|
|
870
|
-
|
879
|
+
r0
|
871
880
|
end
|
872
881
|
|
873
882
|
def _nt_parsing_expression
|
@@ -891,7 +900,7 @@ module Treetop
|
|
891
900
|
if r3
|
892
901
|
r0 = r3
|
893
902
|
else
|
894
|
-
|
903
|
+
@index = i0
|
895
904
|
r0 = nil
|
896
905
|
end
|
897
906
|
end
|
@@ -899,7 +908,7 @@ module Treetop
|
|
899
908
|
|
900
909
|
node_cache[:parsing_expression][start_index] = r0
|
901
910
|
|
902
|
-
|
911
|
+
r0
|
903
912
|
end
|
904
913
|
|
905
914
|
module Choice0
|
@@ -955,7 +964,7 @@ module Treetop
|
|
955
964
|
end
|
956
965
|
s3 << r4
|
957
966
|
if r4
|
958
|
-
if
|
967
|
+
if has_terminal?('/', false, index)
|
959
968
|
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
960
969
|
@index += 1
|
961
970
|
else
|
@@ -981,7 +990,7 @@ module Treetop
|
|
981
990
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
982
991
|
r3.extend(Choice0)
|
983
992
|
else
|
984
|
-
|
993
|
+
@index = i3
|
985
994
|
r3 = nil
|
986
995
|
end
|
987
996
|
if r3
|
@@ -991,7 +1000,7 @@ module Treetop
|
|
991
1000
|
end
|
992
1001
|
end
|
993
1002
|
if s2.empty?
|
994
|
-
|
1003
|
+
@index = i2
|
995
1004
|
r2 = nil
|
996
1005
|
else
|
997
1006
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
@@ -1003,13 +1012,13 @@ module Treetop
|
|
1003
1012
|
r0.extend(Choice1)
|
1004
1013
|
r0.extend(Choice2)
|
1005
1014
|
else
|
1006
|
-
|
1015
|
+
@index = i0
|
1007
1016
|
r0 = nil
|
1008
1017
|
end
|
1009
1018
|
|
1010
1019
|
node_cache[:choice][start_index] = r0
|
1011
1020
|
|
1012
|
-
|
1021
|
+
r0
|
1013
1022
|
end
|
1014
1023
|
|
1015
1024
|
module Sequence0
|
@@ -1081,7 +1090,7 @@ module Treetop
|
|
1081
1090
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1082
1091
|
r3.extend(Sequence0)
|
1083
1092
|
else
|
1084
|
-
|
1093
|
+
@index = i3
|
1085
1094
|
r3 = nil
|
1086
1095
|
end
|
1087
1096
|
if r3
|
@@ -1091,7 +1100,7 @@ module Treetop
|
|
1091
1100
|
end
|
1092
1101
|
end
|
1093
1102
|
if s2.empty?
|
1094
|
-
|
1103
|
+
@index = i2
|
1095
1104
|
r2 = nil
|
1096
1105
|
else
|
1097
1106
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
@@ -1107,13 +1116,13 @@ module Treetop
|
|
1107
1116
|
r0.extend(Sequence1)
|
1108
1117
|
r0.extend(Sequence2)
|
1109
1118
|
else
|
1110
|
-
|
1119
|
+
@index = i0
|
1111
1120
|
r0 = nil
|
1112
1121
|
end
|
1113
1122
|
|
1114
1123
|
node_cache[:sequence][start_index] = r0
|
1115
1124
|
|
1116
|
-
|
1125
|
+
r0
|
1117
1126
|
end
|
1118
1127
|
|
1119
1128
|
def _nt_alternative
|
@@ -1133,14 +1142,14 @@ module Treetop
|
|
1133
1142
|
if r2
|
1134
1143
|
r0 = r2
|
1135
1144
|
else
|
1136
|
-
|
1145
|
+
@index = i0
|
1137
1146
|
r0 = nil
|
1138
1147
|
end
|
1139
1148
|
end
|
1140
1149
|
|
1141
1150
|
node_cache[:alternative][start_index] = r0
|
1142
1151
|
|
1143
|
-
|
1152
|
+
r0
|
1144
1153
|
end
|
1145
1154
|
|
1146
1155
|
module Primary0
|
@@ -1172,6 +1181,28 @@ module Treetop
|
|
1172
1181
|
end
|
1173
1182
|
|
1174
1183
|
module Primary2
|
1184
|
+
def prefix
|
1185
|
+
elements[0]
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
def predicate_block
|
1189
|
+
elements[2]
|
1190
|
+
end
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
module Primary3
|
1194
|
+
def compile(address, builder, parent_expression=nil)
|
1195
|
+
prefix.compile(address, builder, self)
|
1196
|
+
end
|
1197
|
+
def prefixed_expression
|
1198
|
+
predicate_block
|
1199
|
+
end
|
1200
|
+
def inline_modules
|
1201
|
+
[]
|
1202
|
+
end
|
1203
|
+
end
|
1204
|
+
|
1205
|
+
module Primary4
|
1175
1206
|
def atomic
|
1176
1207
|
elements[0]
|
1177
1208
|
end
|
@@ -1185,7 +1216,7 @@ module Treetop
|
|
1185
1216
|
end
|
1186
1217
|
end
|
1187
1218
|
|
1188
|
-
module
|
1219
|
+
module Primary5
|
1189
1220
|
def compile(address, builder, parent_expression=nil)
|
1190
1221
|
suffix.compile(address, builder, self)
|
1191
1222
|
end
|
@@ -1207,7 +1238,7 @@ module Treetop
|
|
1207
1238
|
end
|
1208
1239
|
end
|
1209
1240
|
|
1210
|
-
module
|
1241
|
+
module Primary6
|
1211
1242
|
def atomic
|
1212
1243
|
elements[0]
|
1213
1244
|
end
|
@@ -1217,7 +1248,7 @@ module Treetop
|
|
1217
1248
|
end
|
1218
1249
|
end
|
1219
1250
|
|
1220
|
-
module
|
1251
|
+
module Primary7
|
1221
1252
|
def compile(address, builder, parent_expression=nil)
|
1222
1253
|
atomic.compile(address, builder, self)
|
1223
1254
|
end
|
@@ -1256,21 +1287,26 @@ module Treetop
|
|
1256
1287
|
r1.extend(Primary0)
|
1257
1288
|
r1.extend(Primary1)
|
1258
1289
|
else
|
1259
|
-
|
1290
|
+
@index = i1
|
1260
1291
|
r1 = nil
|
1261
1292
|
end
|
1262
1293
|
if r1
|
1263
1294
|
r0 = r1
|
1264
1295
|
else
|
1265
1296
|
i4, s4 = index, []
|
1266
|
-
r5 =
|
1297
|
+
r5 = _nt_prefix
|
1267
1298
|
s4 << r5
|
1268
1299
|
if r5
|
1269
|
-
|
1300
|
+
r7 = _nt_space
|
1301
|
+
if r7
|
1302
|
+
r6 = r7
|
1303
|
+
else
|
1304
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
1305
|
+
end
|
1270
1306
|
s4 << r6
|
1271
1307
|
if r6
|
1272
|
-
|
1273
|
-
s4 <<
|
1308
|
+
r8 = _nt_predicate_block
|
1309
|
+
s4 << r8
|
1274
1310
|
end
|
1275
1311
|
end
|
1276
1312
|
if s4.last
|
@@ -1278,39 +1314,62 @@ module Treetop
|
|
1278
1314
|
r4.extend(Primary2)
|
1279
1315
|
r4.extend(Primary3)
|
1280
1316
|
else
|
1281
|
-
|
1317
|
+
@index = i4
|
1282
1318
|
r4 = nil
|
1283
1319
|
end
|
1284
1320
|
if r4
|
1285
1321
|
r0 = r4
|
1286
1322
|
else
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
if
|
1291
|
-
|
1292
|
-
|
1323
|
+
i9, s9 = index, []
|
1324
|
+
r10 = _nt_atomic
|
1325
|
+
s9 << r10
|
1326
|
+
if r10
|
1327
|
+
r11 = _nt_suffix
|
1328
|
+
s9 << r11
|
1329
|
+
if r11
|
1330
|
+
r12 = _nt_node_class_declarations
|
1331
|
+
s9 << r12
|
1332
|
+
end
|
1293
1333
|
end
|
1294
|
-
if
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1334
|
+
if s9.last
|
1335
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
1336
|
+
r9.extend(Primary4)
|
1337
|
+
r9.extend(Primary5)
|
1298
1338
|
else
|
1299
|
-
|
1300
|
-
|
1339
|
+
@index = i9
|
1340
|
+
r9 = nil
|
1301
1341
|
end
|
1302
|
-
if
|
1303
|
-
r0 =
|
1342
|
+
if r9
|
1343
|
+
r0 = r9
|
1304
1344
|
else
|
1305
|
-
|
1306
|
-
|
1345
|
+
i13, s13 = index, []
|
1346
|
+
r14 = _nt_atomic
|
1347
|
+
s13 << r14
|
1348
|
+
if r14
|
1349
|
+
r15 = _nt_node_class_declarations
|
1350
|
+
s13 << r15
|
1351
|
+
end
|
1352
|
+
if s13.last
|
1353
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
1354
|
+
r13.extend(Primary6)
|
1355
|
+
r13.extend(Primary7)
|
1356
|
+
else
|
1357
|
+
@index = i13
|
1358
|
+
r13 = nil
|
1359
|
+
end
|
1360
|
+
if r13
|
1361
|
+
r0 = r13
|
1362
|
+
else
|
1363
|
+
@index = i0
|
1364
|
+
r0 = nil
|
1365
|
+
end
|
1307
1366
|
end
|
1308
1367
|
end
|
1309
1368
|
end
|
1310
1369
|
|
1311
1370
|
node_cache[:primary][start_index] = r0
|
1312
1371
|
|
1313
|
-
|
1372
|
+
r0
|
1314
1373
|
end
|
1315
1374
|
|
1316
1375
|
module LabeledSequencePrimary0
|
@@ -1363,13 +1422,13 @@ module Treetop
|
|
1363
1422
|
r0.extend(LabeledSequencePrimary0)
|
1364
1423
|
r0.extend(LabeledSequencePrimary1)
|
1365
1424
|
else
|
1366
|
-
|
1425
|
+
@index = i0
|
1367
1426
|
r0 = nil
|
1368
1427
|
end
|
1369
1428
|
|
1370
1429
|
node_cache[:labeled_sequence_primary][start_index] = r0
|
1371
1430
|
|
1372
|
-
|
1431
|
+
r0
|
1373
1432
|
end
|
1374
1433
|
|
1375
1434
|
module Label0
|
@@ -1424,12 +1483,12 @@ module Treetop
|
|
1424
1483
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1425
1484
|
r2.extend(Label0)
|
1426
1485
|
else
|
1427
|
-
|
1486
|
+
@index = i2
|
1428
1487
|
r2 = nil
|
1429
1488
|
end
|
1430
1489
|
s1 << r2
|
1431
1490
|
if r2
|
1432
|
-
if
|
1491
|
+
if has_terminal?(':', false, index)
|
1433
1492
|
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1434
1493
|
@index += 1
|
1435
1494
|
else
|
@@ -1443,13 +1502,13 @@ module Treetop
|
|
1443
1502
|
r1.extend(Label1)
|
1444
1503
|
r1.extend(Label2)
|
1445
1504
|
else
|
1446
|
-
|
1505
|
+
@index = i1
|
1447
1506
|
r1 = nil
|
1448
1507
|
end
|
1449
1508
|
if r1
|
1450
1509
|
r0 = r1
|
1451
1510
|
else
|
1452
|
-
if
|
1511
|
+
if has_terminal?('', false, index)
|
1453
1512
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
1454
1513
|
r7.extend(Label3)
|
1455
1514
|
@index += 0
|
@@ -1460,14 +1519,14 @@ module Treetop
|
|
1460
1519
|
if r7
|
1461
1520
|
r0 = r7
|
1462
1521
|
else
|
1463
|
-
|
1522
|
+
@index = i0
|
1464
1523
|
r0 = nil
|
1465
1524
|
end
|
1466
1525
|
end
|
1467
1526
|
|
1468
1527
|
node_cache[:label][start_index] = r0
|
1469
1528
|
|
1470
|
-
|
1529
|
+
r0
|
1471
1530
|
end
|
1472
1531
|
|
1473
1532
|
module SequencePrimary0
|
@@ -1499,6 +1558,28 @@ module Treetop
|
|
1499
1558
|
end
|
1500
1559
|
|
1501
1560
|
module SequencePrimary2
|
1561
|
+
def prefix
|
1562
|
+
elements[0]
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
def predicate_block
|
1566
|
+
elements[2]
|
1567
|
+
end
|
1568
|
+
end
|
1569
|
+
|
1570
|
+
module SequencePrimary3
|
1571
|
+
def compile(address, builder, parent_expression=nil)
|
1572
|
+
prefix.compile(address, builder, self)
|
1573
|
+
end
|
1574
|
+
def prefixed_expression
|
1575
|
+
predicate_block
|
1576
|
+
end
|
1577
|
+
def inline_modules
|
1578
|
+
[]
|
1579
|
+
end
|
1580
|
+
end
|
1581
|
+
|
1582
|
+
module SequencePrimary4
|
1502
1583
|
def atomic
|
1503
1584
|
elements[0]
|
1504
1585
|
end
|
@@ -1508,7 +1589,7 @@ module Treetop
|
|
1508
1589
|
end
|
1509
1590
|
end
|
1510
1591
|
|
1511
|
-
module
|
1592
|
+
module SequencePrimary5
|
1512
1593
|
def compile(lexical_address, builder)
|
1513
1594
|
suffix.compile(lexical_address, builder, self)
|
1514
1595
|
end
|
@@ -1547,43 +1628,71 @@ module Treetop
|
|
1547
1628
|
r1.extend(SequencePrimary0)
|
1548
1629
|
r1.extend(SequencePrimary1)
|
1549
1630
|
else
|
1550
|
-
|
1631
|
+
@index = i1
|
1551
1632
|
r1 = nil
|
1552
1633
|
end
|
1553
1634
|
if r1
|
1554
1635
|
r0 = r1
|
1555
1636
|
else
|
1556
1637
|
i4, s4 = index, []
|
1557
|
-
r5 =
|
1638
|
+
r5 = _nt_prefix
|
1558
1639
|
s4 << r5
|
1559
1640
|
if r5
|
1560
|
-
|
1641
|
+
r7 = _nt_space
|
1642
|
+
if r7
|
1643
|
+
r6 = r7
|
1644
|
+
else
|
1645
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
1646
|
+
end
|
1561
1647
|
s4 << r6
|
1648
|
+
if r6
|
1649
|
+
r8 = _nt_predicate_block
|
1650
|
+
s4 << r8
|
1651
|
+
end
|
1562
1652
|
end
|
1563
1653
|
if s4.last
|
1564
1654
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1565
1655
|
r4.extend(SequencePrimary2)
|
1566
1656
|
r4.extend(SequencePrimary3)
|
1567
1657
|
else
|
1568
|
-
|
1658
|
+
@index = i4
|
1569
1659
|
r4 = nil
|
1570
1660
|
end
|
1571
1661
|
if r4
|
1572
1662
|
r0 = r4
|
1573
1663
|
else
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1664
|
+
i9, s9 = index, []
|
1665
|
+
r10 = _nt_atomic
|
1666
|
+
s9 << r10
|
1667
|
+
if r10
|
1668
|
+
r11 = _nt_suffix
|
1669
|
+
s9 << r11
|
1670
|
+
end
|
1671
|
+
if s9.last
|
1672
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
1673
|
+
r9.extend(SequencePrimary4)
|
1674
|
+
r9.extend(SequencePrimary5)
|
1577
1675
|
else
|
1578
|
-
|
1579
|
-
|
1676
|
+
@index = i9
|
1677
|
+
r9 = nil
|
1678
|
+
end
|
1679
|
+
if r9
|
1680
|
+
r0 = r9
|
1681
|
+
else
|
1682
|
+
r12 = _nt_atomic
|
1683
|
+
if r12
|
1684
|
+
r0 = r12
|
1685
|
+
else
|
1686
|
+
@index = i0
|
1687
|
+
r0 = nil
|
1688
|
+
end
|
1580
1689
|
end
|
1581
1690
|
end
|
1582
1691
|
end
|
1583
1692
|
|
1584
1693
|
node_cache[:sequence_primary][start_index] = r0
|
1585
1694
|
|
1586
|
-
|
1695
|
+
r0
|
1587
1696
|
end
|
1588
1697
|
|
1589
1698
|
def _nt_suffix
|
@@ -1603,14 +1712,14 @@ module Treetop
|
|
1603
1712
|
if r2
|
1604
1713
|
r0 = r2
|
1605
1714
|
else
|
1606
|
-
|
1715
|
+
@index = i0
|
1607
1716
|
r0 = nil
|
1608
1717
|
end
|
1609
1718
|
end
|
1610
1719
|
|
1611
1720
|
node_cache[:suffix][start_index] = r0
|
1612
1721
|
|
1613
|
-
|
1722
|
+
r0
|
1614
1723
|
end
|
1615
1724
|
|
1616
1725
|
def _nt_optional_suffix
|
@@ -1621,7 +1730,7 @@ module Treetop
|
|
1621
1730
|
return cached
|
1622
1731
|
end
|
1623
1732
|
|
1624
|
-
if
|
1733
|
+
if has_terminal?('?', false, index)
|
1625
1734
|
r0 = instantiate_node(Optional,input, index...(index + 1))
|
1626
1735
|
@index += 1
|
1627
1736
|
else
|
@@ -1631,7 +1740,7 @@ module Treetop
|
|
1631
1740
|
|
1632
1741
|
node_cache[:optional_suffix][start_index] = r0
|
1633
1742
|
|
1634
|
-
|
1743
|
+
r0
|
1635
1744
|
end
|
1636
1745
|
|
1637
1746
|
module NodeClassDeclarations0
|
@@ -1682,13 +1791,13 @@ module Treetop
|
|
1682
1791
|
r0.extend(NodeClassDeclarations0)
|
1683
1792
|
r0.extend(NodeClassDeclarations1)
|
1684
1793
|
else
|
1685
|
-
|
1794
|
+
@index = i0
|
1686
1795
|
r0 = nil
|
1687
1796
|
end
|
1688
1797
|
|
1689
1798
|
node_cache[:node_class_declarations][start_index] = r0
|
1690
1799
|
|
1691
|
-
|
1800
|
+
r0
|
1692
1801
|
end
|
1693
1802
|
|
1694
1803
|
def _nt_repetition_suffix
|
@@ -1700,7 +1809,7 @@ module Treetop
|
|
1700
1809
|
end
|
1701
1810
|
|
1702
1811
|
i0 = index
|
1703
|
-
if
|
1812
|
+
if has_terminal?('+', false, index)
|
1704
1813
|
r1 = instantiate_node(OneOrMore,input, index...(index + 1))
|
1705
1814
|
@index += 1
|
1706
1815
|
else
|
@@ -1710,7 +1819,7 @@ module Treetop
|
|
1710
1819
|
if r1
|
1711
1820
|
r0 = r1
|
1712
1821
|
else
|
1713
|
-
if
|
1822
|
+
if has_terminal?('*', false, index)
|
1714
1823
|
r2 = instantiate_node(ZeroOrMore,input, index...(index + 1))
|
1715
1824
|
@index += 1
|
1716
1825
|
else
|
@@ -1720,14 +1829,14 @@ module Treetop
|
|
1720
1829
|
if r2
|
1721
1830
|
r0 = r2
|
1722
1831
|
else
|
1723
|
-
|
1832
|
+
@index = i0
|
1724
1833
|
r0 = nil
|
1725
1834
|
end
|
1726
1835
|
end
|
1727
1836
|
|
1728
1837
|
node_cache[:repetition_suffix][start_index] = r0
|
1729
1838
|
|
1730
|
-
|
1839
|
+
r0
|
1731
1840
|
end
|
1732
1841
|
|
1733
1842
|
def _nt_prefix
|
@@ -1739,7 +1848,7 @@ module Treetop
|
|
1739
1848
|
end
|
1740
1849
|
|
1741
1850
|
i0 = index
|
1742
|
-
if
|
1851
|
+
if has_terminal?('&', false, index)
|
1743
1852
|
r1 = instantiate_node(AndPredicate,input, index...(index + 1))
|
1744
1853
|
@index += 1
|
1745
1854
|
else
|
@@ -1749,7 +1858,7 @@ module Treetop
|
|
1749
1858
|
if r1
|
1750
1859
|
r0 = r1
|
1751
1860
|
else
|
1752
|
-
if
|
1861
|
+
if has_terminal?('!', false, index)
|
1753
1862
|
r2 = instantiate_node(NotPredicate,input, index...(index + 1))
|
1754
1863
|
@index += 1
|
1755
1864
|
else
|
@@ -1759,7 +1868,7 @@ module Treetop
|
|
1759
1868
|
if r2
|
1760
1869
|
r0 = r2
|
1761
1870
|
else
|
1762
|
-
if
|
1871
|
+
if has_terminal?('~', false, index)
|
1763
1872
|
r3 = instantiate_node(TransientPrefix,input, index...(index + 1))
|
1764
1873
|
@index += 1
|
1765
1874
|
else
|
@@ -1769,7 +1878,7 @@ module Treetop
|
|
1769
1878
|
if r3
|
1770
1879
|
r0 = r3
|
1771
1880
|
else
|
1772
|
-
|
1881
|
+
@index = i0
|
1773
1882
|
r0 = nil
|
1774
1883
|
end
|
1775
1884
|
end
|
@@ -1777,7 +1886,7 @@ module Treetop
|
|
1777
1886
|
|
1778
1887
|
node_cache[:prefix][start_index] = r0
|
1779
1888
|
|
1780
|
-
|
1889
|
+
r0
|
1781
1890
|
end
|
1782
1891
|
|
1783
1892
|
def _nt_atomic
|
@@ -1801,7 +1910,7 @@ module Treetop
|
|
1801
1910
|
if r3
|
1802
1911
|
r0 = r3
|
1803
1912
|
else
|
1804
|
-
|
1913
|
+
@index = i0
|
1805
1914
|
r0 = nil
|
1806
1915
|
end
|
1807
1916
|
end
|
@@ -1809,7 +1918,7 @@ module Treetop
|
|
1809
1918
|
|
1810
1919
|
node_cache[:atomic][start_index] = r0
|
1811
1920
|
|
1812
|
-
|
1921
|
+
r0
|
1813
1922
|
end
|
1814
1923
|
|
1815
1924
|
module ParenthesizedExpression0
|
@@ -1834,7 +1943,7 @@ module Treetop
|
|
1834
1943
|
end
|
1835
1944
|
|
1836
1945
|
i0, s0 = index, []
|
1837
|
-
if
|
1946
|
+
if has_terminal?('(', false, index)
|
1838
1947
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1839
1948
|
@index += 1
|
1840
1949
|
else
|
@@ -1862,7 +1971,7 @@ module Treetop
|
|
1862
1971
|
end
|
1863
1972
|
s0 << r5
|
1864
1973
|
if r5
|
1865
|
-
if
|
1974
|
+
if has_terminal?(')', false, index)
|
1866
1975
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1867
1976
|
@index += 1
|
1868
1977
|
else
|
@@ -1879,13 +1988,13 @@ module Treetop
|
|
1879
1988
|
r0.extend(ParenthesizedExpression0)
|
1880
1989
|
r0.extend(ParenthesizedExpression1)
|
1881
1990
|
else
|
1882
|
-
|
1991
|
+
@index = i0
|
1883
1992
|
r0 = nil
|
1884
1993
|
end
|
1885
1994
|
|
1886
1995
|
node_cache[:parenthesized_expression][start_index] = r0
|
1887
1996
|
|
1888
|
-
|
1997
|
+
r0
|
1889
1998
|
end
|
1890
1999
|
|
1891
2000
|
module Nonterminal0
|
@@ -1912,7 +2021,7 @@ module Treetop
|
|
1912
2021
|
if r2
|
1913
2022
|
r1 = nil
|
1914
2023
|
else
|
1915
|
-
|
2024
|
+
@index = i1
|
1916
2025
|
r1 = instantiate_node(SyntaxNode,input, index...index)
|
1917
2026
|
end
|
1918
2027
|
s0 << r1
|
@@ -1937,7 +2046,7 @@ module Treetop
|
|
1937
2046
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1938
2047
|
r3.extend(Nonterminal0)
|
1939
2048
|
else
|
1940
|
-
|
2049
|
+
@index = i3
|
1941
2050
|
r3 = nil
|
1942
2051
|
end
|
1943
2052
|
s0 << r3
|
@@ -1946,13 +2055,13 @@ module Treetop
|
|
1946
2055
|
r0 = instantiate_node(Nonterminal,input, i0...index, s0)
|
1947
2056
|
r0.extend(Nonterminal1)
|
1948
2057
|
else
|
1949
|
-
|
2058
|
+
@index = i0
|
1950
2059
|
r0 = nil
|
1951
2060
|
end
|
1952
2061
|
|
1953
2062
|
node_cache[:nonterminal][start_index] = r0
|
1954
2063
|
|
1955
|
-
|
2064
|
+
r0
|
1956
2065
|
end
|
1957
2066
|
|
1958
2067
|
def _nt_terminal
|
@@ -1976,7 +2085,7 @@ module Treetop
|
|
1976
2085
|
if r3
|
1977
2086
|
r0 = r3
|
1978
2087
|
else
|
1979
|
-
|
2088
|
+
@index = i0
|
1980
2089
|
r0 = nil
|
1981
2090
|
end
|
1982
2091
|
end
|
@@ -1984,7 +2093,7 @@ module Treetop
|
|
1984
2093
|
|
1985
2094
|
node_cache[:terminal][start_index] = r0
|
1986
2095
|
|
1987
|
-
|
2096
|
+
r0
|
1988
2097
|
end
|
1989
2098
|
|
1990
2099
|
module QuotedString0
|
@@ -2012,14 +2121,14 @@ module Treetop
|
|
2012
2121
|
r0 = r2
|
2013
2122
|
r0.extend(QuotedString0)
|
2014
2123
|
else
|
2015
|
-
|
2124
|
+
@index = i0
|
2016
2125
|
r0 = nil
|
2017
2126
|
end
|
2018
2127
|
end
|
2019
2128
|
|
2020
2129
|
node_cache[:quoted_string][start_index] = r0
|
2021
2130
|
|
2022
|
-
|
2131
|
+
r0
|
2023
2132
|
end
|
2024
2133
|
|
2025
2134
|
module DoubleQuotedString0
|
@@ -2041,7 +2150,7 @@ module Treetop
|
|
2041
2150
|
end
|
2042
2151
|
|
2043
2152
|
i0, s0 = index, []
|
2044
|
-
if
|
2153
|
+
if has_terminal?('"', false, index)
|
2045
2154
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2046
2155
|
@index += 1
|
2047
2156
|
else
|
@@ -2054,7 +2163,7 @@ module Treetop
|
|
2054
2163
|
loop do
|
2055
2164
|
i3, s3 = index, []
|
2056
2165
|
i4 = index
|
2057
|
-
if
|
2166
|
+
if has_terminal?('"', false, index)
|
2058
2167
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2059
2168
|
@index += 1
|
2060
2169
|
else
|
@@ -2064,13 +2173,13 @@ module Treetop
|
|
2064
2173
|
if r5
|
2065
2174
|
r4 = nil
|
2066
2175
|
else
|
2067
|
-
|
2176
|
+
@index = i4
|
2068
2177
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2069
2178
|
end
|
2070
2179
|
s3 << r4
|
2071
2180
|
if r4
|
2072
2181
|
i6 = index
|
2073
|
-
if
|
2182
|
+
if has_terminal?("\\\\", false, index)
|
2074
2183
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2075
2184
|
@index += 2
|
2076
2185
|
else
|
@@ -2080,7 +2189,7 @@ module Treetop
|
|
2080
2189
|
if r7
|
2081
2190
|
r6 = r7
|
2082
2191
|
else
|
2083
|
-
if
|
2192
|
+
if has_terminal?('\"', false, index)
|
2084
2193
|
r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2085
2194
|
@index += 2
|
2086
2195
|
else
|
@@ -2091,8 +2200,9 @@ module Treetop
|
|
2091
2200
|
r6 = r8
|
2092
2201
|
else
|
2093
2202
|
if index < input_length
|
2094
|
-
|
2095
|
-
|
2203
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2204
|
+
r9 = instantiate_node(SyntaxNode,input, index...next_character)
|
2205
|
+
@index = next_character
|
2096
2206
|
else
|
2097
2207
|
terminal_parse_failure("any character")
|
2098
2208
|
r9 = nil
|
@@ -2100,7 +2210,7 @@ module Treetop
|
|
2100
2210
|
if r9
|
2101
2211
|
r6 = r9
|
2102
2212
|
else
|
2103
|
-
|
2213
|
+
@index = i6
|
2104
2214
|
r6 = nil
|
2105
2215
|
end
|
2106
2216
|
end
|
@@ -2111,7 +2221,7 @@ module Treetop
|
|
2111
2221
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2112
2222
|
r3.extend(DoubleQuotedString0)
|
2113
2223
|
else
|
2114
|
-
|
2224
|
+
@index = i3
|
2115
2225
|
r3 = nil
|
2116
2226
|
end
|
2117
2227
|
if r3
|
@@ -2123,7 +2233,7 @@ module Treetop
|
|
2123
2233
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2124
2234
|
s0 << r2
|
2125
2235
|
if r2
|
2126
|
-
if
|
2236
|
+
if has_terminal?('"', false, index)
|
2127
2237
|
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2128
2238
|
@index += 1
|
2129
2239
|
else
|
@@ -2137,13 +2247,13 @@ module Treetop
|
|
2137
2247
|
r0 = instantiate_node(Terminal,input, i0...index, s0)
|
2138
2248
|
r0.extend(DoubleQuotedString1)
|
2139
2249
|
else
|
2140
|
-
|
2250
|
+
@index = i0
|
2141
2251
|
r0 = nil
|
2142
2252
|
end
|
2143
2253
|
|
2144
2254
|
node_cache[:double_quoted_string][start_index] = r0
|
2145
2255
|
|
2146
|
-
|
2256
|
+
r0
|
2147
2257
|
end
|
2148
2258
|
|
2149
2259
|
module SingleQuotedString0
|
@@ -2165,7 +2275,7 @@ module Treetop
|
|
2165
2275
|
end
|
2166
2276
|
|
2167
2277
|
i0, s0 = index, []
|
2168
|
-
if
|
2278
|
+
if has_terminal?("'", false, index)
|
2169
2279
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2170
2280
|
@index += 1
|
2171
2281
|
else
|
@@ -2178,7 +2288,7 @@ module Treetop
|
|
2178
2288
|
loop do
|
2179
2289
|
i3, s3 = index, []
|
2180
2290
|
i4 = index
|
2181
|
-
if
|
2291
|
+
if has_terminal?("'", false, index)
|
2182
2292
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2183
2293
|
@index += 1
|
2184
2294
|
else
|
@@ -2188,13 +2298,13 @@ module Treetop
|
|
2188
2298
|
if r5
|
2189
2299
|
r4 = nil
|
2190
2300
|
else
|
2191
|
-
|
2301
|
+
@index = i4
|
2192
2302
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2193
2303
|
end
|
2194
2304
|
s3 << r4
|
2195
2305
|
if r4
|
2196
2306
|
i6 = index
|
2197
|
-
if
|
2307
|
+
if has_terminal?("\\\\", false, index)
|
2198
2308
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2199
2309
|
@index += 2
|
2200
2310
|
else
|
@@ -2204,7 +2314,7 @@ module Treetop
|
|
2204
2314
|
if r7
|
2205
2315
|
r6 = r7
|
2206
2316
|
else
|
2207
|
-
if
|
2317
|
+
if has_terminal?("\\'", false, index)
|
2208
2318
|
r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2209
2319
|
@index += 2
|
2210
2320
|
else
|
@@ -2215,8 +2325,9 @@ module Treetop
|
|
2215
2325
|
r6 = r8
|
2216
2326
|
else
|
2217
2327
|
if index < input_length
|
2218
|
-
|
2219
|
-
|
2328
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2329
|
+
r9 = instantiate_node(SyntaxNode,input, index...next_character)
|
2330
|
+
@index = next_character
|
2220
2331
|
else
|
2221
2332
|
terminal_parse_failure("any character")
|
2222
2333
|
r9 = nil
|
@@ -2224,7 +2335,7 @@ module Treetop
|
|
2224
2335
|
if r9
|
2225
2336
|
r6 = r9
|
2226
2337
|
else
|
2227
|
-
|
2338
|
+
@index = i6
|
2228
2339
|
r6 = nil
|
2229
2340
|
end
|
2230
2341
|
end
|
@@ -2235,7 +2346,7 @@ module Treetop
|
|
2235
2346
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2236
2347
|
r3.extend(SingleQuotedString0)
|
2237
2348
|
else
|
2238
|
-
|
2349
|
+
@index = i3
|
2239
2350
|
r3 = nil
|
2240
2351
|
end
|
2241
2352
|
if r3
|
@@ -2247,7 +2358,7 @@ module Treetop
|
|
2247
2358
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2248
2359
|
s0 << r2
|
2249
2360
|
if r2
|
2250
|
-
if
|
2361
|
+
if has_terminal?("'", false, index)
|
2251
2362
|
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2252
2363
|
@index += 1
|
2253
2364
|
else
|
@@ -2261,13 +2372,13 @@ module Treetop
|
|
2261
2372
|
r0 = instantiate_node(Terminal,input, i0...index, s0)
|
2262
2373
|
r0.extend(SingleQuotedString1)
|
2263
2374
|
else
|
2264
|
-
|
2375
|
+
@index = i0
|
2265
2376
|
r0 = nil
|
2266
2377
|
end
|
2267
2378
|
|
2268
2379
|
node_cache[:single_quoted_string][start_index] = r0
|
2269
2380
|
|
2270
|
-
|
2381
|
+
r0
|
2271
2382
|
end
|
2272
2383
|
|
2273
2384
|
module CharacterClass0
|
@@ -2301,7 +2412,7 @@ module Treetop
|
|
2301
2412
|
end
|
2302
2413
|
|
2303
2414
|
i0, s0 = index, []
|
2304
|
-
if
|
2415
|
+
if has_terminal?('[', false, index)
|
2305
2416
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2306
2417
|
@index += 1
|
2307
2418
|
else
|
@@ -2314,7 +2425,7 @@ module Treetop
|
|
2314
2425
|
loop do
|
2315
2426
|
i3, s3 = index, []
|
2316
2427
|
i4 = index
|
2317
|
-
if
|
2428
|
+
if has_terminal?(']', false, index)
|
2318
2429
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2319
2430
|
@index += 1
|
2320
2431
|
else
|
@@ -2324,14 +2435,14 @@ module Treetop
|
|
2324
2435
|
if r5
|
2325
2436
|
r4 = nil
|
2326
2437
|
else
|
2327
|
-
|
2438
|
+
@index = i4
|
2328
2439
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2329
2440
|
end
|
2330
2441
|
s3 << r4
|
2331
2442
|
if r4
|
2332
2443
|
i6 = index
|
2333
2444
|
i7, s7 = index, []
|
2334
|
-
if
|
2445
|
+
if has_terminal?('\\', false, index)
|
2335
2446
|
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2336
2447
|
@index += 1
|
2337
2448
|
else
|
@@ -2341,8 +2452,9 @@ module Treetop
|
|
2341
2452
|
s7 << r8
|
2342
2453
|
if r8
|
2343
2454
|
if index < input_length
|
2344
|
-
|
2345
|
-
|
2455
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2456
|
+
r9 = instantiate_node(SyntaxNode,input, index...next_character)
|
2457
|
+
@index = next_character
|
2346
2458
|
else
|
2347
2459
|
terminal_parse_failure("any character")
|
2348
2460
|
r9 = nil
|
@@ -2353,7 +2465,7 @@ module Treetop
|
|
2353
2465
|
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
2354
2466
|
r7.extend(CharacterClass0)
|
2355
2467
|
else
|
2356
|
-
|
2468
|
+
@index = i7
|
2357
2469
|
r7 = nil
|
2358
2470
|
end
|
2359
2471
|
if r7
|
@@ -2361,7 +2473,7 @@ module Treetop
|
|
2361
2473
|
else
|
2362
2474
|
i10, s10 = index, []
|
2363
2475
|
i11 = index
|
2364
|
-
if
|
2476
|
+
if has_terminal?('\\', false, index)
|
2365
2477
|
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2366
2478
|
@index += 1
|
2367
2479
|
else
|
@@ -2371,14 +2483,15 @@ module Treetop
|
|
2371
2483
|
if r12
|
2372
2484
|
r11 = nil
|
2373
2485
|
else
|
2374
|
-
|
2486
|
+
@index = i11
|
2375
2487
|
r11 = instantiate_node(SyntaxNode,input, index...index)
|
2376
2488
|
end
|
2377
2489
|
s10 << r11
|
2378
2490
|
if r11
|
2379
2491
|
if index < input_length
|
2380
|
-
|
2381
|
-
|
2492
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2493
|
+
r13 = instantiate_node(SyntaxNode,input, index...next_character)
|
2494
|
+
@index = next_character
|
2382
2495
|
else
|
2383
2496
|
terminal_parse_failure("any character")
|
2384
2497
|
r13 = nil
|
@@ -2389,13 +2502,13 @@ module Treetop
|
|
2389
2502
|
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
2390
2503
|
r10.extend(CharacterClass1)
|
2391
2504
|
else
|
2392
|
-
|
2505
|
+
@index = i10
|
2393
2506
|
r10 = nil
|
2394
2507
|
end
|
2395
2508
|
if r10
|
2396
2509
|
r6 = r10
|
2397
2510
|
else
|
2398
|
-
|
2511
|
+
@index = i6
|
2399
2512
|
r6 = nil
|
2400
2513
|
end
|
2401
2514
|
end
|
@@ -2405,7 +2518,7 @@ module Treetop
|
|
2405
2518
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2406
2519
|
r3.extend(CharacterClass2)
|
2407
2520
|
else
|
2408
|
-
|
2521
|
+
@index = i3
|
2409
2522
|
r3 = nil
|
2410
2523
|
end
|
2411
2524
|
if r3
|
@@ -2415,14 +2528,14 @@ module Treetop
|
|
2415
2528
|
end
|
2416
2529
|
end
|
2417
2530
|
if s2.empty?
|
2418
|
-
|
2531
|
+
@index = i2
|
2419
2532
|
r2 = nil
|
2420
2533
|
else
|
2421
2534
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2422
2535
|
end
|
2423
2536
|
s0 << r2
|
2424
2537
|
if r2
|
2425
|
-
if
|
2538
|
+
if has_terminal?(']', false, index)
|
2426
2539
|
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2427
2540
|
@index += 1
|
2428
2541
|
else
|
@@ -2437,13 +2550,13 @@ module Treetop
|
|
2437
2550
|
r0.extend(CharacterClass3)
|
2438
2551
|
r0.extend(CharacterClass4)
|
2439
2552
|
else
|
2440
|
-
|
2553
|
+
@index = i0
|
2441
2554
|
r0 = nil
|
2442
2555
|
end
|
2443
2556
|
|
2444
2557
|
node_cache[:character_class][start_index] = r0
|
2445
2558
|
|
2446
|
-
|
2559
|
+
r0
|
2447
2560
|
end
|
2448
2561
|
|
2449
2562
|
def _nt_anything_symbol
|
@@ -2454,7 +2567,7 @@ module Treetop
|
|
2454
2567
|
return cached
|
2455
2568
|
end
|
2456
2569
|
|
2457
|
-
if
|
2570
|
+
if has_terminal?('.', false, index)
|
2458
2571
|
r0 = instantiate_node(AnythingSymbol,input, index...(index + 1))
|
2459
2572
|
@index += 1
|
2460
2573
|
else
|
@@ -2464,7 +2577,7 @@ module Treetop
|
|
2464
2577
|
|
2465
2578
|
node_cache[:anything_symbol][start_index] = r0
|
2466
2579
|
|
2467
|
-
|
2580
|
+
r0
|
2468
2581
|
end
|
2469
2582
|
|
2470
2583
|
module NodeClassExpression0
|
@@ -2502,7 +2615,7 @@ module Treetop
|
|
2502
2615
|
r2 = _nt_space
|
2503
2616
|
s1 << r2
|
2504
2617
|
if r2
|
2505
|
-
if
|
2618
|
+
if has_terminal?('<', false, index)
|
2506
2619
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2507
2620
|
@index += 1
|
2508
2621
|
else
|
@@ -2515,7 +2628,7 @@ module Treetop
|
|
2515
2628
|
loop do
|
2516
2629
|
i5, s5 = index, []
|
2517
2630
|
i6 = index
|
2518
|
-
if
|
2631
|
+
if has_terminal?('>', false, index)
|
2519
2632
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2520
2633
|
@index += 1
|
2521
2634
|
else
|
@@ -2525,14 +2638,15 @@ module Treetop
|
|
2525
2638
|
if r7
|
2526
2639
|
r6 = nil
|
2527
2640
|
else
|
2528
|
-
|
2641
|
+
@index = i6
|
2529
2642
|
r6 = instantiate_node(SyntaxNode,input, index...index)
|
2530
2643
|
end
|
2531
2644
|
s5 << r6
|
2532
2645
|
if r6
|
2533
2646
|
if index < input_length
|
2534
|
-
|
2535
|
-
|
2647
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2648
|
+
r8 = instantiate_node(SyntaxNode,input, index...next_character)
|
2649
|
+
@index = next_character
|
2536
2650
|
else
|
2537
2651
|
terminal_parse_failure("any character")
|
2538
2652
|
r8 = nil
|
@@ -2543,7 +2657,7 @@ module Treetop
|
|
2543
2657
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
2544
2658
|
r5.extend(NodeClassExpression0)
|
2545
2659
|
else
|
2546
|
-
|
2660
|
+
@index = i5
|
2547
2661
|
r5 = nil
|
2548
2662
|
end
|
2549
2663
|
if r5
|
@@ -2553,14 +2667,14 @@ module Treetop
|
|
2553
2667
|
end
|
2554
2668
|
end
|
2555
2669
|
if s4.empty?
|
2556
|
-
|
2670
|
+
@index = i4
|
2557
2671
|
r4 = nil
|
2558
2672
|
else
|
2559
2673
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
2560
2674
|
end
|
2561
2675
|
s1 << r4
|
2562
2676
|
if r4
|
2563
|
-
if
|
2677
|
+
if has_terminal?('>', false, index)
|
2564
2678
|
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2565
2679
|
@index += 1
|
2566
2680
|
else
|
@@ -2576,13 +2690,13 @@ module Treetop
|
|
2576
2690
|
r1.extend(NodeClassExpression1)
|
2577
2691
|
r1.extend(NodeClassExpression2)
|
2578
2692
|
else
|
2579
|
-
|
2693
|
+
@index = i1
|
2580
2694
|
r1 = nil
|
2581
2695
|
end
|
2582
2696
|
if r1
|
2583
2697
|
r0 = r1
|
2584
2698
|
else
|
2585
|
-
if
|
2699
|
+
if has_terminal?('', false, index)
|
2586
2700
|
r10 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
2587
2701
|
r10.extend(NodeClassExpression3)
|
2588
2702
|
@index += 0
|
@@ -2593,14 +2707,14 @@ module Treetop
|
|
2593
2707
|
if r10
|
2594
2708
|
r0 = r10
|
2595
2709
|
else
|
2596
|
-
|
2710
|
+
@index = i0
|
2597
2711
|
r0 = nil
|
2598
2712
|
end
|
2599
2713
|
end
|
2600
2714
|
|
2601
2715
|
node_cache[:node_class_expression][start_index] = r0
|
2602
2716
|
|
2603
|
-
|
2717
|
+
r0
|
2604
2718
|
end
|
2605
2719
|
|
2606
2720
|
module TrailingInlineModule0
|
@@ -2658,13 +2772,13 @@ module Treetop
|
|
2658
2772
|
r1.extend(TrailingInlineModule0)
|
2659
2773
|
r1.extend(TrailingInlineModule1)
|
2660
2774
|
else
|
2661
|
-
|
2775
|
+
@index = i1
|
2662
2776
|
r1 = nil
|
2663
2777
|
end
|
2664
2778
|
if r1
|
2665
2779
|
r0 = r1
|
2666
2780
|
else
|
2667
|
-
if
|
2781
|
+
if has_terminal?('', false, index)
|
2668
2782
|
r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
2669
2783
|
r4.extend(TrailingInlineModule2)
|
2670
2784
|
@index += 0
|
@@ -2675,14 +2789,54 @@ module Treetop
|
|
2675
2789
|
if r4
|
2676
2790
|
r0 = r4
|
2677
2791
|
else
|
2678
|
-
|
2792
|
+
@index = i0
|
2679
2793
|
r0 = nil
|
2680
2794
|
end
|
2681
2795
|
end
|
2682
2796
|
|
2683
2797
|
node_cache[:trailing_inline_module][start_index] = r0
|
2684
2798
|
|
2685
|
-
|
2799
|
+
r0
|
2800
|
+
end
|
2801
|
+
|
2802
|
+
module PredicateBlock0
|
2803
|
+
def inline_module
|
2804
|
+
elements[1]
|
2805
|
+
end
|
2806
|
+
end
|
2807
|
+
|
2808
|
+
def _nt_predicate_block
|
2809
|
+
start_index = index
|
2810
|
+
if node_cache[:predicate_block].has_key?(index)
|
2811
|
+
cached = node_cache[:predicate_block][index]
|
2812
|
+
@index = cached.interval.end if cached
|
2813
|
+
return cached
|
2814
|
+
end
|
2815
|
+
|
2816
|
+
i0, s0 = index, []
|
2817
|
+
if has_terminal?('', false, index)
|
2818
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
2819
|
+
@index += 0
|
2820
|
+
else
|
2821
|
+
terminal_parse_failure('')
|
2822
|
+
r1 = nil
|
2823
|
+
end
|
2824
|
+
s0 << r1
|
2825
|
+
if r1
|
2826
|
+
r2 = _nt_inline_module
|
2827
|
+
s0 << r2
|
2828
|
+
end
|
2829
|
+
if s0.last
|
2830
|
+
r0 = instantiate_node(PredicateBlock,input, i0...index, s0)
|
2831
|
+
r0.extend(PredicateBlock0)
|
2832
|
+
else
|
2833
|
+
@index = i0
|
2834
|
+
r0 = nil
|
2835
|
+
end
|
2836
|
+
|
2837
|
+
node_cache[:predicate_block][start_index] = r0
|
2838
|
+
|
2839
|
+
r0
|
2686
2840
|
end
|
2687
2841
|
|
2688
2842
|
module InlineModule0
|
@@ -2700,7 +2854,7 @@ module Treetop
|
|
2700
2854
|
end
|
2701
2855
|
|
2702
2856
|
i0, s0 = index, []
|
2703
|
-
if
|
2857
|
+
if has_terminal?('{', false, index)
|
2704
2858
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2705
2859
|
@index += 1
|
2706
2860
|
else
|
@@ -2718,23 +2872,25 @@ module Treetop
|
|
2718
2872
|
else
|
2719
2873
|
i5, s5 = index, []
|
2720
2874
|
i6 = index
|
2721
|
-
if
|
2722
|
-
|
2723
|
-
|
2875
|
+
if has_terminal?('\G[{}]', true, index)
|
2876
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2877
|
+
r7 = true
|
2878
|
+
@index = next_character
|
2724
2879
|
else
|
2725
2880
|
r7 = nil
|
2726
2881
|
end
|
2727
2882
|
if r7
|
2728
2883
|
r6 = nil
|
2729
2884
|
else
|
2730
|
-
|
2885
|
+
@index = i6
|
2731
2886
|
r6 = instantiate_node(SyntaxNode,input, index...index)
|
2732
2887
|
end
|
2733
2888
|
s5 << r6
|
2734
2889
|
if r6
|
2735
2890
|
if index < input_length
|
2736
|
-
|
2737
|
-
|
2891
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
2892
|
+
r8 = instantiate_node(SyntaxNode,input, index...next_character)
|
2893
|
+
@index = next_character
|
2738
2894
|
else
|
2739
2895
|
terminal_parse_failure("any character")
|
2740
2896
|
r8 = nil
|
@@ -2745,13 +2901,13 @@ module Treetop
|
|
2745
2901
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
2746
2902
|
r5.extend(InlineModule0)
|
2747
2903
|
else
|
2748
|
-
|
2904
|
+
@index = i5
|
2749
2905
|
r5 = nil
|
2750
2906
|
end
|
2751
2907
|
if r5
|
2752
2908
|
r3 = r5
|
2753
2909
|
else
|
2754
|
-
|
2910
|
+
@index = i3
|
2755
2911
|
r3 = nil
|
2756
2912
|
end
|
2757
2913
|
end
|
@@ -2764,7 +2920,7 @@ module Treetop
|
|
2764
2920
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2765
2921
|
s0 << r2
|
2766
2922
|
if r2
|
2767
|
-
if
|
2923
|
+
if has_terminal?('}', false, index)
|
2768
2924
|
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2769
2925
|
@index += 1
|
2770
2926
|
else
|
@@ -2778,13 +2934,13 @@ module Treetop
|
|
2778
2934
|
r0 = instantiate_node(InlineModule,input, i0...index, s0)
|
2779
2935
|
r0.extend(InlineModule1)
|
2780
2936
|
else
|
2781
|
-
|
2937
|
+
@index = i0
|
2782
2938
|
r0 = nil
|
2783
2939
|
end
|
2784
2940
|
|
2785
2941
|
node_cache[:inline_module][start_index] = r0
|
2786
2942
|
|
2787
|
-
|
2943
|
+
r0
|
2788
2944
|
end
|
2789
2945
|
|
2790
2946
|
module KeywordInsideGrammar0
|
@@ -2800,7 +2956,7 @@ module Treetop
|
|
2800
2956
|
|
2801
2957
|
i0, s0 = index, []
|
2802
2958
|
i1 = index
|
2803
|
-
if
|
2959
|
+
if has_terminal?('rule', false, index)
|
2804
2960
|
r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2805
2961
|
@index += 4
|
2806
2962
|
else
|
@@ -2810,7 +2966,7 @@ module Treetop
|
|
2810
2966
|
if r2
|
2811
2967
|
r1 = r2
|
2812
2968
|
else
|
2813
|
-
if
|
2969
|
+
if has_terminal?('end', false, index)
|
2814
2970
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
2815
2971
|
@index += 3
|
2816
2972
|
else
|
@@ -2820,7 +2976,7 @@ module Treetop
|
|
2820
2976
|
if r3
|
2821
2977
|
r1 = r3
|
2822
2978
|
else
|
2823
|
-
|
2979
|
+
@index = i1
|
2824
2980
|
r1 = nil
|
2825
2981
|
end
|
2826
2982
|
end
|
@@ -2831,7 +2987,7 @@ module Treetop
|
|
2831
2987
|
if r5
|
2832
2988
|
r4 = nil
|
2833
2989
|
else
|
2834
|
-
|
2990
|
+
@index = i4
|
2835
2991
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2836
2992
|
end
|
2837
2993
|
s0 << r4
|
@@ -2840,13 +2996,13 @@ module Treetop
|
|
2840
2996
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2841
2997
|
r0.extend(KeywordInsideGrammar0)
|
2842
2998
|
else
|
2843
|
-
|
2999
|
+
@index = i0
|
2844
3000
|
r0 = nil
|
2845
3001
|
end
|
2846
3002
|
|
2847
3003
|
node_cache[:keyword_inside_grammar][start_index] = r0
|
2848
3004
|
|
2849
|
-
|
3005
|
+
r0
|
2850
3006
|
end
|
2851
3007
|
|
2852
3008
|
module NonSpaceChar0
|
@@ -2866,14 +3022,15 @@ module Treetop
|
|
2866
3022
|
if r2
|
2867
3023
|
r1 = nil
|
2868
3024
|
else
|
2869
|
-
|
3025
|
+
@index = i1
|
2870
3026
|
r1 = instantiate_node(SyntaxNode,input, index...index)
|
2871
3027
|
end
|
2872
3028
|
s0 << r1
|
2873
3029
|
if r1
|
2874
3030
|
if index < input_length
|
2875
|
-
|
2876
|
-
|
3031
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
3032
|
+
r3 = instantiate_node(SyntaxNode,input, index...next_character)
|
3033
|
+
@index = next_character
|
2877
3034
|
else
|
2878
3035
|
terminal_parse_failure("any character")
|
2879
3036
|
r3 = nil
|
@@ -2884,13 +3041,13 @@ module Treetop
|
|
2884
3041
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2885
3042
|
r0.extend(NonSpaceChar0)
|
2886
3043
|
else
|
2887
|
-
|
3044
|
+
@index = i0
|
2888
3045
|
r0 = nil
|
2889
3046
|
end
|
2890
3047
|
|
2891
3048
|
node_cache[:non_space_char][start_index] = r0
|
2892
3049
|
|
2893
|
-
|
3050
|
+
r0
|
2894
3051
|
end
|
2895
3052
|
|
2896
3053
|
def _nt_alpha_char
|
@@ -2901,16 +3058,17 @@ module Treetop
|
|
2901
3058
|
return cached
|
2902
3059
|
end
|
2903
3060
|
|
2904
|
-
if
|
2905
|
-
|
2906
|
-
|
3061
|
+
if has_terminal?('\G[A-Za-z_]', true, index)
|
3062
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
3063
|
+
r0 = instantiate_node(SyntaxNode, input, index...next_character)
|
3064
|
+
@index = next_character
|
2907
3065
|
else
|
2908
3066
|
r0 = nil
|
2909
3067
|
end
|
2910
3068
|
|
2911
3069
|
node_cache[:alpha_char][start_index] = r0
|
2912
3070
|
|
2913
|
-
|
3071
|
+
r0
|
2914
3072
|
end
|
2915
3073
|
|
2916
3074
|
def _nt_alphanumeric_char
|
@@ -2926,23 +3084,24 @@ module Treetop
|
|
2926
3084
|
if r1
|
2927
3085
|
r0 = r1
|
2928
3086
|
else
|
2929
|
-
if
|
2930
|
-
|
2931
|
-
|
3087
|
+
if has_terminal?('\G[0-9]', true, index)
|
3088
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
3089
|
+
r2 = true
|
3090
|
+
@index = next_character
|
2932
3091
|
else
|
2933
3092
|
r2 = nil
|
2934
3093
|
end
|
2935
3094
|
if r2
|
2936
3095
|
r0 = r2
|
2937
3096
|
else
|
2938
|
-
|
3097
|
+
@index = i0
|
2939
3098
|
r0 = nil
|
2940
3099
|
end
|
2941
3100
|
end
|
2942
3101
|
|
2943
3102
|
node_cache[:alphanumeric_char][start_index] = r0
|
2944
3103
|
|
2945
|
-
|
3104
|
+
r0
|
2946
3105
|
end
|
2947
3106
|
|
2948
3107
|
def _nt_space
|
@@ -2964,7 +3123,7 @@ module Treetop
|
|
2964
3123
|
if r3
|
2965
3124
|
r1 = r3
|
2966
3125
|
else
|
2967
|
-
|
3126
|
+
@index = i1
|
2968
3127
|
r1 = nil
|
2969
3128
|
end
|
2970
3129
|
end
|
@@ -2975,7 +3134,7 @@ module Treetop
|
|
2975
3134
|
end
|
2976
3135
|
end
|
2977
3136
|
if s0.empty?
|
2978
|
-
|
3137
|
+
@index = i0
|
2979
3138
|
r0 = nil
|
2980
3139
|
else
|
2981
3140
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
@@ -2983,7 +3142,7 @@ module Treetop
|
|
2983
3142
|
|
2984
3143
|
node_cache[:space][start_index] = r0
|
2985
3144
|
|
2986
|
-
|
3145
|
+
r0
|
2987
3146
|
end
|
2988
3147
|
|
2989
3148
|
module CommentToEol0
|
@@ -3001,7 +3160,7 @@ module Treetop
|
|
3001
3160
|
end
|
3002
3161
|
|
3003
3162
|
i0, s0 = index, []
|
3004
|
-
if
|
3163
|
+
if has_terminal?('#', false, index)
|
3005
3164
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3006
3165
|
@index += 1
|
3007
3166
|
else
|
@@ -3014,7 +3173,7 @@ module Treetop
|
|
3014
3173
|
loop do
|
3015
3174
|
i3, s3 = index, []
|
3016
3175
|
i4 = index
|
3017
|
-
if
|
3176
|
+
if has_terminal?("\n", false, index)
|
3018
3177
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3019
3178
|
@index += 1
|
3020
3179
|
else
|
@@ -3024,14 +3183,15 @@ module Treetop
|
|
3024
3183
|
if r5
|
3025
3184
|
r4 = nil
|
3026
3185
|
else
|
3027
|
-
|
3186
|
+
@index = i4
|
3028
3187
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3029
3188
|
end
|
3030
3189
|
s3 << r4
|
3031
3190
|
if r4
|
3032
3191
|
if index < input_length
|
3033
|
-
|
3034
|
-
|
3192
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
3193
|
+
r6 = instantiate_node(SyntaxNode,input, index...next_character)
|
3194
|
+
@index = next_character
|
3035
3195
|
else
|
3036
3196
|
terminal_parse_failure("any character")
|
3037
3197
|
r6 = nil
|
@@ -3042,7 +3202,7 @@ module Treetop
|
|
3042
3202
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
3043
3203
|
r3.extend(CommentToEol0)
|
3044
3204
|
else
|
3045
|
-
|
3205
|
+
@index = i3
|
3046
3206
|
r3 = nil
|
3047
3207
|
end
|
3048
3208
|
if r3
|
@@ -3058,13 +3218,13 @@ module Treetop
|
|
3058
3218
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3059
3219
|
r0.extend(CommentToEol1)
|
3060
3220
|
else
|
3061
|
-
|
3221
|
+
@index = i0
|
3062
3222
|
r0 = nil
|
3063
3223
|
end
|
3064
3224
|
|
3065
3225
|
node_cache[:comment_to_eol][start_index] = r0
|
3066
3226
|
|
3067
|
-
|
3227
|
+
r0
|
3068
3228
|
end
|
3069
3229
|
|
3070
3230
|
def _nt_white
|
@@ -3075,16 +3235,17 @@ module Treetop
|
|
3075
3235
|
return cached
|
3076
3236
|
end
|
3077
3237
|
|
3078
|
-
if
|
3079
|
-
|
3080
|
-
|
3238
|
+
if has_terminal?('\G[ \\t\\n\\r]', true, index)
|
3239
|
+
next_character = index + input[index..-1].match(/\A(.)/um).end(1)
|
3240
|
+
r0 = instantiate_node(SyntaxNode, input, index...next_character)
|
3241
|
+
@index = next_character
|
3081
3242
|
else
|
3082
3243
|
r0 = nil
|
3083
3244
|
end
|
3084
3245
|
|
3085
3246
|
node_cache[:white][start_index] = r0
|
3086
3247
|
|
3087
|
-
|
3248
|
+
r0
|
3088
3249
|
end
|
3089
3250
|
|
3090
3251
|
end
|