treetop 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/doc/contributing_and_planned_features.markdown +4 -0
- data/doc/site/contribute.html +7 -2
- data/doc/site/index.html +1 -1
- data/doc/site/pitfalls_and_advanced_techniques.html +1 -1
- data/doc/site/semantic_interpretation.html +1 -1
- data/doc/site/syntactic_recognition.html +1 -1
- data/doc/site/using_in_ruby.html +1 -1
- data/lib/treetop/compiler/metagrammar.rb +466 -404
- data/lib/treetop/compiler/metagrammar.treetop +1 -1
- data/lib/treetop/compiler/node_classes/atomic_expression.rb +3 -2
- data/lib/treetop/compiler/node_classes/character_class.rb +2 -6
- data/lib/treetop/runtime.rb +0 -2
- metadata +3 -5
- data/lib/treetop/runtime/node_cache.rb +0 -27
- data/lib/treetop/runtime/parse_cache.rb +0 -19
@@ -2,39 +2,39 @@ module Treetop
|
|
2
2
|
module Compiler
|
3
3
|
module Metagrammar
|
4
4
|
include Treetop::Runtime
|
5
|
-
|
5
|
+
|
6
6
|
def root
|
7
7
|
@root || :treetop_file
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
module TreetopFile0
|
11
11
|
def prefix
|
12
12
|
elements[0]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def module_or_grammar
|
16
16
|
elements[1]
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def suffix
|
20
20
|
elements[2]
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
module TreetopFile1
|
25
25
|
def compile
|
26
26
|
prefix.text_value + module_or_grammar.compile + suffix.text_value
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def _nt_treetop_file
|
31
31
|
start_index = index
|
32
|
-
|
33
|
-
|
34
|
-
@index = cached.interval.end
|
32
|
+
if node_cache[:treetop_file].has_key?(index)
|
33
|
+
cached = node_cache[:treetop_file][index]
|
34
|
+
@index = cached.interval.end if cached
|
35
35
|
return cached
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
i0, s0 = index, []
|
39
39
|
r2 = _nt_space
|
40
40
|
if r2
|
@@ -76,57 +76,57 @@ module Treetop
|
|
76
76
|
self.index = i0
|
77
77
|
r0 = nil
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
node_cache[:treetop_file][start_index] = r0
|
81
|
-
|
81
|
+
|
82
82
|
return r0
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
module ModuleDeclaration0
|
86
86
|
def space
|
87
87
|
elements[1]
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
def space
|
91
91
|
elements[4]
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
94
|
+
|
95
95
|
module ModuleDeclaration1
|
96
96
|
def space
|
97
97
|
elements[0]
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
module ModuleDeclaration2
|
103
103
|
def prefix
|
104
104
|
elements[0]
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
def module_contents
|
108
108
|
elements[1]
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def suffix
|
112
112
|
elements[2]
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
module ModuleDeclaration3
|
117
117
|
def compile
|
118
118
|
prefix.text_value + module_contents.compile + suffix.text_value
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
def _nt_module_declaration
|
123
123
|
start_index = index
|
124
|
-
|
125
|
-
|
126
|
-
@index = cached.interval.end
|
124
|
+
if node_cache[:module_declaration].has_key?(index)
|
125
|
+
cached = node_cache[:module_declaration][index]
|
126
|
+
@index = cached.interval.end if cached
|
127
127
|
return cached
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
i0, s0 = index, []
|
131
131
|
i1, s1 = index, []
|
132
132
|
if input.index('module', index) == index
|
@@ -222,39 +222,39 @@ module Treetop
|
|
222
222
|
self.index = i0
|
223
223
|
r0 = nil
|
224
224
|
end
|
225
|
-
|
225
|
+
|
226
226
|
node_cache[:module_declaration][start_index] = r0
|
227
|
-
|
227
|
+
|
228
228
|
return r0
|
229
229
|
end
|
230
|
-
|
230
|
+
|
231
231
|
module Grammar0
|
232
232
|
def space
|
233
233
|
elements[1]
|
234
234
|
end
|
235
|
-
|
235
|
+
|
236
236
|
def grammar_name
|
237
237
|
elements[2]
|
238
238
|
end
|
239
|
-
|
239
|
+
|
240
240
|
def space
|
241
241
|
elements[3]
|
242
242
|
end
|
243
|
-
|
243
|
+
|
244
244
|
def declaration_sequence
|
245
245
|
elements[4]
|
246
246
|
end
|
247
|
-
|
247
|
+
|
248
248
|
end
|
249
|
-
|
249
|
+
|
250
250
|
def _nt_grammar
|
251
251
|
start_index = index
|
252
|
-
|
253
|
-
|
254
|
-
@index = cached.interval.end
|
252
|
+
if node_cache[:grammar].has_key?(index)
|
253
|
+
cached = node_cache[:grammar][index]
|
254
|
+
@index = cached.interval.end if cached
|
255
255
|
return cached
|
256
256
|
end
|
257
|
-
|
257
|
+
|
258
258
|
i0, s0 = index, []
|
259
259
|
if input.index('grammar', index) == index
|
260
260
|
r1 = (SyntaxNode).new(input, index...(index + 7))
|
@@ -306,23 +306,23 @@ module Treetop
|
|
306
306
|
self.index = i0
|
307
307
|
r0 = nil
|
308
308
|
end
|
309
|
-
|
309
|
+
|
310
310
|
node_cache[:grammar][start_index] = r0
|
311
|
-
|
311
|
+
|
312
312
|
return r0
|
313
313
|
end
|
314
|
-
|
314
|
+
|
315
315
|
module GrammarName0
|
316
316
|
end
|
317
|
-
|
317
|
+
|
318
318
|
def _nt_grammar_name
|
319
319
|
start_index = index
|
320
|
-
|
321
|
-
|
322
|
-
@index = cached.interval.end
|
320
|
+
if node_cache[:grammar_name].has_key?(index)
|
321
|
+
cached = node_cache[:grammar_name][index]
|
322
|
+
@index = cached.interval.end if cached
|
323
323
|
return cached
|
324
324
|
end
|
325
|
-
|
325
|
+
|
326
326
|
i0, s0 = index, []
|
327
327
|
if input.index(/[A-Z]/, index) == index
|
328
328
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -351,32 +351,32 @@ module Treetop
|
|
351
351
|
self.index = i0
|
352
352
|
r0 = nil
|
353
353
|
end
|
354
|
-
|
354
|
+
|
355
355
|
node_cache[:grammar_name][start_index] = r0
|
356
|
-
|
356
|
+
|
357
357
|
return r0
|
358
358
|
end
|
359
|
-
|
359
|
+
|
360
360
|
module DeclarationSequence0
|
361
361
|
def space
|
362
362
|
elements[0]
|
363
363
|
end
|
364
|
-
|
364
|
+
|
365
365
|
def declaration
|
366
366
|
elements[1]
|
367
367
|
end
|
368
368
|
end
|
369
|
-
|
369
|
+
|
370
370
|
module DeclarationSequence1
|
371
371
|
def head
|
372
372
|
elements[0]
|
373
373
|
end
|
374
|
-
|
374
|
+
|
375
375
|
def tail
|
376
376
|
elements[1]
|
377
377
|
end
|
378
378
|
end
|
379
|
-
|
379
|
+
|
380
380
|
module DeclarationSequence2
|
381
381
|
def declarations
|
382
382
|
[head] + tail
|
@@ -386,20 +386,20 @@ module Treetop
|
|
386
386
|
super.elements.map { |elt| elt.declaration }
|
387
387
|
end
|
388
388
|
end
|
389
|
-
|
389
|
+
|
390
390
|
module DeclarationSequence3
|
391
391
|
def compile(builder)
|
392
392
|
end
|
393
393
|
end
|
394
|
-
|
394
|
+
|
395
395
|
def _nt_declaration_sequence
|
396
396
|
start_index = index
|
397
|
-
|
398
|
-
|
399
|
-
@index = cached.interval.end
|
397
|
+
if node_cache[:declaration_sequence].has_key?(index)
|
398
|
+
cached = node_cache[:declaration_sequence][index]
|
399
|
+
@index = cached.interval.end if cached
|
400
400
|
return cached
|
401
401
|
end
|
402
|
-
|
402
|
+
|
403
403
|
i0 = index
|
404
404
|
i1, s1 = index, []
|
405
405
|
r2 = _nt_declaration
|
@@ -456,20 +456,20 @@ module Treetop
|
|
456
456
|
r0 = nil
|
457
457
|
end
|
458
458
|
end
|
459
|
-
|
459
|
+
|
460
460
|
node_cache[:declaration_sequence][start_index] = r0
|
461
|
-
|
461
|
+
|
462
462
|
return r0
|
463
463
|
end
|
464
|
-
|
464
|
+
|
465
465
|
def _nt_declaration
|
466
466
|
start_index = index
|
467
|
-
|
468
|
-
|
469
|
-
@index = cached.interval.end
|
467
|
+
if node_cache[:declaration].has_key?(index)
|
468
|
+
cached = node_cache[:declaration][index]
|
469
|
+
@index = cached.interval.end if cached
|
470
470
|
return cached
|
471
471
|
end
|
472
|
-
|
472
|
+
|
473
473
|
i0 = index
|
474
474
|
r1 = _nt_parsing_rule
|
475
475
|
if r1
|
@@ -483,33 +483,33 @@ module Treetop
|
|
483
483
|
r0 = nil
|
484
484
|
end
|
485
485
|
end
|
486
|
-
|
486
|
+
|
487
487
|
node_cache[:declaration][start_index] = r0
|
488
|
-
|
488
|
+
|
489
489
|
return r0
|
490
490
|
end
|
491
|
-
|
491
|
+
|
492
492
|
module IncludeDeclaration0
|
493
493
|
def space
|
494
494
|
elements[1]
|
495
495
|
end
|
496
|
-
|
496
|
+
|
497
497
|
end
|
498
|
-
|
498
|
+
|
499
499
|
module IncludeDeclaration1
|
500
500
|
def compile(builder)
|
501
501
|
builder << text_value
|
502
502
|
end
|
503
503
|
end
|
504
|
-
|
504
|
+
|
505
505
|
def _nt_include_declaration
|
506
506
|
start_index = index
|
507
|
-
|
508
|
-
|
509
|
-
@index = cached.interval.end
|
507
|
+
if node_cache[:include_declaration].has_key?(index)
|
508
|
+
cached = node_cache[:include_declaration][index]
|
509
|
+
@index = cached.interval.end if cached
|
510
510
|
return cached
|
511
511
|
end
|
512
|
-
|
512
|
+
|
513
513
|
i0, s0 = index, []
|
514
514
|
if input.index('include', index) == index
|
515
515
|
r1 = (SyntaxNode).new(input, index...(index + 7))
|
@@ -571,43 +571,43 @@ module Treetop
|
|
571
571
|
self.index = i0
|
572
572
|
r0 = nil
|
573
573
|
end
|
574
|
-
|
574
|
+
|
575
575
|
node_cache[:include_declaration][start_index] = r0
|
576
|
-
|
576
|
+
|
577
577
|
return r0
|
578
578
|
end
|
579
|
-
|
579
|
+
|
580
580
|
module ParsingRule0
|
581
581
|
def space
|
582
582
|
elements[1]
|
583
583
|
end
|
584
|
-
|
584
|
+
|
585
585
|
def nonterminal
|
586
586
|
elements[2]
|
587
587
|
end
|
588
|
-
|
588
|
+
|
589
589
|
def space
|
590
590
|
elements[3]
|
591
591
|
end
|
592
|
-
|
592
|
+
|
593
593
|
def parsing_expression
|
594
594
|
elements[4]
|
595
595
|
end
|
596
|
-
|
596
|
+
|
597
597
|
def space
|
598
598
|
elements[5]
|
599
599
|
end
|
600
|
-
|
600
|
+
|
601
601
|
end
|
602
|
-
|
602
|
+
|
603
603
|
def _nt_parsing_rule
|
604
604
|
start_index = index
|
605
|
-
|
606
|
-
|
607
|
-
@index = cached.interval.end
|
605
|
+
if node_cache[:parsing_rule].has_key?(index)
|
606
|
+
cached = node_cache[:parsing_rule][index]
|
607
|
+
@index = cached.interval.end if cached
|
608
608
|
return cached
|
609
609
|
end
|
610
|
-
|
610
|
+
|
611
611
|
i0, s0 = index, []
|
612
612
|
if input.index('rule', index) == index
|
613
613
|
r1 = (SyntaxNode).new(input, index...(index + 4))
|
@@ -654,20 +654,20 @@ module Treetop
|
|
654
654
|
self.index = i0
|
655
655
|
r0 = nil
|
656
656
|
end
|
657
|
-
|
657
|
+
|
658
658
|
node_cache[:parsing_rule][start_index] = r0
|
659
|
-
|
659
|
+
|
660
660
|
return r0
|
661
661
|
end
|
662
|
-
|
662
|
+
|
663
663
|
def _nt_parsing_expression
|
664
664
|
start_index = index
|
665
|
-
|
666
|
-
|
667
|
-
@index = cached.interval.end
|
665
|
+
if node_cache[:parsing_expression].has_key?(index)
|
666
|
+
cached = node_cache[:parsing_expression][index]
|
667
|
+
@index = cached.interval.end if cached
|
668
668
|
return cached
|
669
669
|
end
|
670
|
-
|
670
|
+
|
671
671
|
i0 = index
|
672
672
|
r1 = _nt_choice
|
673
673
|
if r1
|
@@ -686,28 +686,28 @@ module Treetop
|
|
686
686
|
end
|
687
687
|
end
|
688
688
|
end
|
689
|
-
|
689
|
+
|
690
690
|
node_cache[:parsing_expression][start_index] = r0
|
691
|
-
|
691
|
+
|
692
692
|
return r0
|
693
693
|
end
|
694
|
-
|
694
|
+
|
695
695
|
module Choice0
|
696
696
|
def alternative
|
697
697
|
elements[3]
|
698
698
|
end
|
699
699
|
end
|
700
|
-
|
700
|
+
|
701
701
|
module Choice1
|
702
702
|
def head
|
703
703
|
elements[0]
|
704
704
|
end
|
705
|
-
|
705
|
+
|
706
706
|
def tail
|
707
707
|
elements[1]
|
708
708
|
end
|
709
709
|
end
|
710
|
-
|
710
|
+
|
711
711
|
module Choice2
|
712
712
|
def alternatives
|
713
713
|
[head] + tail
|
@@ -721,15 +721,15 @@ module Treetop
|
|
721
721
|
(alternatives.map {|alt| alt.inline_modules }).flatten
|
722
722
|
end
|
723
723
|
end
|
724
|
-
|
724
|
+
|
725
725
|
def _nt_choice
|
726
726
|
start_index = index
|
727
|
-
|
728
|
-
|
729
|
-
@index = cached.interval.end
|
727
|
+
if node_cache[:choice].has_key?(index)
|
728
|
+
cached = node_cache[:choice][index]
|
729
|
+
@index = cached.interval.end if cached
|
730
730
|
return cached
|
731
731
|
end
|
732
|
-
|
732
|
+
|
733
733
|
i0, s0 = index, []
|
734
734
|
r1 = _nt_alternative
|
735
735
|
s0 << r1
|
@@ -796,36 +796,36 @@ module Treetop
|
|
796
796
|
self.index = i0
|
797
797
|
r0 = nil
|
798
798
|
end
|
799
|
-
|
799
|
+
|
800
800
|
node_cache[:choice][start_index] = r0
|
801
|
-
|
801
|
+
|
802
802
|
return r0
|
803
803
|
end
|
804
|
-
|
804
|
+
|
805
805
|
module Sequence0
|
806
806
|
def space
|
807
807
|
elements[0]
|
808
808
|
end
|
809
|
-
|
809
|
+
|
810
810
|
def labeled_sequence_primary
|
811
811
|
elements[1]
|
812
812
|
end
|
813
813
|
end
|
814
|
-
|
814
|
+
|
815
815
|
module Sequence1
|
816
816
|
def head
|
817
817
|
elements[0]
|
818
818
|
end
|
819
|
-
|
819
|
+
|
820
820
|
def tail
|
821
821
|
elements[1]
|
822
822
|
end
|
823
|
-
|
823
|
+
|
824
824
|
def node_class_declarations
|
825
825
|
elements[2]
|
826
826
|
end
|
827
827
|
end
|
828
|
-
|
828
|
+
|
829
829
|
module Sequence2
|
830
830
|
def sequence_elements
|
831
831
|
[head] + tail
|
@@ -845,15 +845,15 @@ module Treetop
|
|
845
845
|
node_class_declarations.inline_module_name
|
846
846
|
end
|
847
847
|
end
|
848
|
-
|
848
|
+
|
849
849
|
def _nt_sequence
|
850
850
|
start_index = index
|
851
|
-
|
852
|
-
|
853
|
-
@index = cached.interval.end
|
851
|
+
if node_cache[:sequence].has_key?(index)
|
852
|
+
cached = node_cache[:sequence][index]
|
853
|
+
@index = cached.interval.end if cached
|
854
854
|
return cached
|
855
855
|
end
|
856
|
-
|
856
|
+
|
857
857
|
i0, s0 = index, []
|
858
858
|
r1 = _nt_labeled_sequence_primary
|
859
859
|
s0 << r1
|
@@ -900,20 +900,20 @@ module Treetop
|
|
900
900
|
self.index = i0
|
901
901
|
r0 = nil
|
902
902
|
end
|
903
|
-
|
903
|
+
|
904
904
|
node_cache[:sequence][start_index] = r0
|
905
|
-
|
905
|
+
|
906
906
|
return r0
|
907
907
|
end
|
908
|
-
|
908
|
+
|
909
909
|
def _nt_alternative
|
910
910
|
start_index = index
|
911
|
-
|
912
|
-
|
913
|
-
@index = cached.interval.end
|
911
|
+
if node_cache[:alternative].has_key?(index)
|
912
|
+
cached = node_cache[:alternative][index]
|
913
|
+
@index = cached.interval.end if cached
|
914
914
|
return cached
|
915
915
|
end
|
916
|
-
|
916
|
+
|
917
917
|
i0 = index
|
918
918
|
r1 = _nt_sequence
|
919
919
|
if r1
|
@@ -927,22 +927,22 @@ module Treetop
|
|
927
927
|
r0 = nil
|
928
928
|
end
|
929
929
|
end
|
930
|
-
|
930
|
+
|
931
931
|
node_cache[:alternative][start_index] = r0
|
932
|
-
|
932
|
+
|
933
933
|
return r0
|
934
934
|
end
|
935
|
-
|
935
|
+
|
936
936
|
module Primary0
|
937
937
|
def prefix
|
938
938
|
elements[0]
|
939
939
|
end
|
940
|
-
|
940
|
+
|
941
941
|
def atomic
|
942
942
|
elements[1]
|
943
943
|
end
|
944
944
|
end
|
945
|
-
|
945
|
+
|
946
946
|
module Primary1
|
947
947
|
def compile(address, builder, parent_expression=nil)
|
948
948
|
prefix.compile(address, builder, self)
|
@@ -960,21 +960,21 @@ module Treetop
|
|
960
960
|
nil
|
961
961
|
end
|
962
962
|
end
|
963
|
-
|
963
|
+
|
964
964
|
module Primary2
|
965
965
|
def atomic
|
966
966
|
elements[0]
|
967
967
|
end
|
968
|
-
|
968
|
+
|
969
969
|
def suffix
|
970
970
|
elements[1]
|
971
971
|
end
|
972
|
-
|
972
|
+
|
973
973
|
def node_class_declarations
|
974
974
|
elements[2]
|
975
975
|
end
|
976
976
|
end
|
977
|
-
|
977
|
+
|
978
978
|
module Primary3
|
979
979
|
def compile(address, builder, parent_expression=nil)
|
980
980
|
suffix.compile(address, builder, self)
|
@@ -996,17 +996,17 @@ module Treetop
|
|
996
996
|
node_class_declarations.inline_module_name
|
997
997
|
end
|
998
998
|
end
|
999
|
-
|
999
|
+
|
1000
1000
|
module Primary4
|
1001
1001
|
def atomic
|
1002
1002
|
elements[0]
|
1003
1003
|
end
|
1004
|
-
|
1004
|
+
|
1005
1005
|
def node_class_declarations
|
1006
1006
|
elements[1]
|
1007
1007
|
end
|
1008
1008
|
end
|
1009
|
-
|
1009
|
+
|
1010
1010
|
module Primary5
|
1011
1011
|
def compile(address, builder, parent_expression=nil)
|
1012
1012
|
atomic.compile(address, builder, self)
|
@@ -1024,15 +1024,15 @@ module Treetop
|
|
1024
1024
|
node_class_declarations.inline_module_name
|
1025
1025
|
end
|
1026
1026
|
end
|
1027
|
-
|
1027
|
+
|
1028
1028
|
def _nt_primary
|
1029
1029
|
start_index = index
|
1030
|
-
|
1031
|
-
|
1032
|
-
@index = cached.interval.end
|
1030
|
+
if node_cache[:primary].has_key?(index)
|
1031
|
+
cached = node_cache[:primary][index]
|
1032
|
+
@index = cached.interval.end if cached
|
1033
1033
|
return cached
|
1034
1034
|
end
|
1035
|
-
|
1035
|
+
|
1036
1036
|
i0 = index
|
1037
1037
|
i1, s1 = index, []
|
1038
1038
|
r2 = _nt_prefix
|
@@ -1097,22 +1097,22 @@ module Treetop
|
|
1097
1097
|
end
|
1098
1098
|
end
|
1099
1099
|
end
|
1100
|
-
|
1100
|
+
|
1101
1101
|
node_cache[:primary][start_index] = r0
|
1102
|
-
|
1102
|
+
|
1103
1103
|
return r0
|
1104
1104
|
end
|
1105
|
-
|
1105
|
+
|
1106
1106
|
module LabeledSequencePrimary0
|
1107
1107
|
def label
|
1108
1108
|
elements[0]
|
1109
1109
|
end
|
1110
|
-
|
1110
|
+
|
1111
1111
|
def sequence_primary
|
1112
1112
|
elements[1]
|
1113
1113
|
end
|
1114
1114
|
end
|
1115
|
-
|
1115
|
+
|
1116
1116
|
module LabeledSequencePrimary1
|
1117
1117
|
def compile(lexical_address, builder)
|
1118
1118
|
sequence_primary.compile(lexical_address, builder)
|
@@ -1132,15 +1132,15 @@ module Treetop
|
|
1132
1132
|
end
|
1133
1133
|
end
|
1134
1134
|
end
|
1135
|
-
|
1135
|
+
|
1136
1136
|
def _nt_labeled_sequence_primary
|
1137
1137
|
start_index = index
|
1138
|
-
|
1139
|
-
|
1140
|
-
@index = cached.interval.end
|
1138
|
+
if node_cache[:labeled_sequence_primary].has_key?(index)
|
1139
|
+
cached = node_cache[:labeled_sequence_primary][index]
|
1140
|
+
@index = cached.interval.end if cached
|
1141
1141
|
return cached
|
1142
1142
|
end
|
1143
|
-
|
1143
|
+
|
1144
1144
|
i0, s0 = index, []
|
1145
1145
|
r1 = _nt_label
|
1146
1146
|
s0 << r1
|
@@ -1156,42 +1156,42 @@ module Treetop
|
|
1156
1156
|
self.index = i0
|
1157
1157
|
r0 = nil
|
1158
1158
|
end
|
1159
|
-
|
1159
|
+
|
1160
1160
|
node_cache[:labeled_sequence_primary][start_index] = r0
|
1161
|
-
|
1161
|
+
|
1162
1162
|
return r0
|
1163
1163
|
end
|
1164
|
-
|
1164
|
+
|
1165
1165
|
module Label0
|
1166
1166
|
def alpha_char
|
1167
1167
|
elements[0]
|
1168
1168
|
end
|
1169
|
-
|
1169
|
+
|
1170
1170
|
end
|
1171
|
-
|
1171
|
+
|
1172
1172
|
module Label1
|
1173
1173
|
end
|
1174
|
-
|
1174
|
+
|
1175
1175
|
module Label2
|
1176
1176
|
def name
|
1177
1177
|
elements[0].text_value
|
1178
1178
|
end
|
1179
1179
|
end
|
1180
|
-
|
1180
|
+
|
1181
1181
|
module Label3
|
1182
1182
|
def name
|
1183
1183
|
nil
|
1184
1184
|
end
|
1185
1185
|
end
|
1186
|
-
|
1186
|
+
|
1187
1187
|
def _nt_label
|
1188
1188
|
start_index = index
|
1189
|
-
|
1190
|
-
|
1191
|
-
@index = cached.interval.end
|
1189
|
+
if node_cache[:label].has_key?(index)
|
1190
|
+
cached = node_cache[:label][index]
|
1191
|
+
@index = cached.interval.end if cached
|
1192
1192
|
return cached
|
1193
1193
|
end
|
1194
|
-
|
1194
|
+
|
1195
1195
|
i0 = index
|
1196
1196
|
i1, s1 = index, []
|
1197
1197
|
i2, s2 = index, []
|
@@ -1254,22 +1254,22 @@ module Treetop
|
|
1254
1254
|
r0 = nil
|
1255
1255
|
end
|
1256
1256
|
end
|
1257
|
-
|
1257
|
+
|
1258
1258
|
node_cache[:label][start_index] = r0
|
1259
|
-
|
1259
|
+
|
1260
1260
|
return r0
|
1261
1261
|
end
|
1262
|
-
|
1262
|
+
|
1263
1263
|
module SequencePrimary0
|
1264
1264
|
def prefix
|
1265
1265
|
elements[0]
|
1266
1266
|
end
|
1267
|
-
|
1267
|
+
|
1268
1268
|
def atomic
|
1269
1269
|
elements[1]
|
1270
1270
|
end
|
1271
1271
|
end
|
1272
|
-
|
1272
|
+
|
1273
1273
|
module SequencePrimary1
|
1274
1274
|
def compile(lexical_address, builder)
|
1275
1275
|
prefix.compile(lexical_address, builder, self)
|
@@ -1287,17 +1287,17 @@ module Treetop
|
|
1287
1287
|
nil
|
1288
1288
|
end
|
1289
1289
|
end
|
1290
|
-
|
1290
|
+
|
1291
1291
|
module SequencePrimary2
|
1292
1292
|
def atomic
|
1293
1293
|
elements[0]
|
1294
1294
|
end
|
1295
|
-
|
1295
|
+
|
1296
1296
|
def suffix
|
1297
1297
|
elements[1]
|
1298
1298
|
end
|
1299
1299
|
end
|
1300
|
-
|
1300
|
+
|
1301
1301
|
module SequencePrimary3
|
1302
1302
|
def compile(lexical_address, builder)
|
1303
1303
|
suffix.compile(lexical_address, builder, self)
|
@@ -1315,15 +1315,15 @@ module Treetop
|
|
1315
1315
|
nil
|
1316
1316
|
end
|
1317
1317
|
end
|
1318
|
-
|
1318
|
+
|
1319
1319
|
def _nt_sequence_primary
|
1320
1320
|
start_index = index
|
1321
|
-
|
1322
|
-
|
1323
|
-
@index = cached.interval.end
|
1321
|
+
if node_cache[:sequence_primary].has_key?(index)
|
1322
|
+
cached = node_cache[:sequence_primary][index]
|
1323
|
+
@index = cached.interval.end if cached
|
1324
1324
|
return cached
|
1325
1325
|
end
|
1326
|
-
|
1326
|
+
|
1327
1327
|
i0 = index
|
1328
1328
|
i1, s1 = index, []
|
1329
1329
|
r2 = _nt_prefix
|
@@ -1370,20 +1370,20 @@ module Treetop
|
|
1370
1370
|
end
|
1371
1371
|
end
|
1372
1372
|
end
|
1373
|
-
|
1373
|
+
|
1374
1374
|
node_cache[:sequence_primary][start_index] = r0
|
1375
|
-
|
1375
|
+
|
1376
1376
|
return r0
|
1377
1377
|
end
|
1378
|
-
|
1378
|
+
|
1379
1379
|
def _nt_suffix
|
1380
1380
|
start_index = index
|
1381
|
-
|
1382
|
-
|
1383
|
-
@index = cached.interval.end
|
1381
|
+
if node_cache[:suffix].has_key?(index)
|
1382
|
+
cached = node_cache[:suffix][index]
|
1383
|
+
@index = cached.interval.end if cached
|
1384
1384
|
return cached
|
1385
1385
|
end
|
1386
|
-
|
1386
|
+
|
1387
1387
|
i0 = index
|
1388
1388
|
r1 = _nt_repetition_suffix
|
1389
1389
|
if r1
|
@@ -1397,20 +1397,20 @@ module Treetop
|
|
1397
1397
|
r0 = nil
|
1398
1398
|
end
|
1399
1399
|
end
|
1400
|
-
|
1400
|
+
|
1401
1401
|
node_cache[:suffix][start_index] = r0
|
1402
|
-
|
1402
|
+
|
1403
1403
|
return r0
|
1404
1404
|
end
|
1405
|
-
|
1405
|
+
|
1406
1406
|
def _nt_optional_suffix
|
1407
1407
|
start_index = index
|
1408
|
-
|
1409
|
-
|
1410
|
-
@index = cached.interval.end
|
1408
|
+
if node_cache[:optional_suffix].has_key?(index)
|
1409
|
+
cached = node_cache[:optional_suffix][index]
|
1410
|
+
@index = cached.interval.end if cached
|
1411
1411
|
return cached
|
1412
1412
|
end
|
1413
|
-
|
1413
|
+
|
1414
1414
|
if input.index('?', index) == index
|
1415
1415
|
r0 = (Optional).new(input, index...(index + 1))
|
1416
1416
|
@index += 1
|
@@ -1418,22 +1418,22 @@ module Treetop
|
|
1418
1418
|
terminal_parse_failure('?')
|
1419
1419
|
r0 = nil
|
1420
1420
|
end
|
1421
|
-
|
1421
|
+
|
1422
1422
|
node_cache[:optional_suffix][start_index] = r0
|
1423
|
-
|
1423
|
+
|
1424
1424
|
return r0
|
1425
1425
|
end
|
1426
|
-
|
1426
|
+
|
1427
1427
|
module NodeClassDeclarations0
|
1428
1428
|
def node_class_expression
|
1429
1429
|
elements[0]
|
1430
1430
|
end
|
1431
|
-
|
1431
|
+
|
1432
1432
|
def trailing_inline_module
|
1433
1433
|
elements[1]
|
1434
1434
|
end
|
1435
1435
|
end
|
1436
|
-
|
1436
|
+
|
1437
1437
|
module NodeClassDeclarations1
|
1438
1438
|
def node_class_name
|
1439
1439
|
node_class_expression.node_class_name
|
@@ -1451,15 +1451,15 @@ module Treetop
|
|
1451
1451
|
inline_module.module_name if inline_module
|
1452
1452
|
end
|
1453
1453
|
end
|
1454
|
-
|
1454
|
+
|
1455
1455
|
def _nt_node_class_declarations
|
1456
1456
|
start_index = index
|
1457
|
-
|
1458
|
-
|
1459
|
-
@index = cached.interval.end
|
1457
|
+
if node_cache[:node_class_declarations].has_key?(index)
|
1458
|
+
cached = node_cache[:node_class_declarations][index]
|
1459
|
+
@index = cached.interval.end if cached
|
1460
1460
|
return cached
|
1461
1461
|
end
|
1462
|
-
|
1462
|
+
|
1463
1463
|
i0, s0 = index, []
|
1464
1464
|
r1 = _nt_node_class_expression
|
1465
1465
|
s0 << r1
|
@@ -1475,20 +1475,20 @@ module Treetop
|
|
1475
1475
|
self.index = i0
|
1476
1476
|
r0 = nil
|
1477
1477
|
end
|
1478
|
-
|
1478
|
+
|
1479
1479
|
node_cache[:node_class_declarations][start_index] = r0
|
1480
|
-
|
1480
|
+
|
1481
1481
|
return r0
|
1482
1482
|
end
|
1483
|
-
|
1483
|
+
|
1484
1484
|
def _nt_repetition_suffix
|
1485
1485
|
start_index = index
|
1486
|
-
|
1487
|
-
|
1488
|
-
@index = cached.interval.end
|
1486
|
+
if node_cache[:repetition_suffix].has_key?(index)
|
1487
|
+
cached = node_cache[:repetition_suffix][index]
|
1488
|
+
@index = cached.interval.end if cached
|
1489
1489
|
return cached
|
1490
1490
|
end
|
1491
|
-
|
1491
|
+
|
1492
1492
|
i0 = index
|
1493
1493
|
if input.index('+', index) == index
|
1494
1494
|
r1 = (OneOrMore).new(input, index...(index + 1))
|
@@ -1514,20 +1514,20 @@ module Treetop
|
|
1514
1514
|
r0 = nil
|
1515
1515
|
end
|
1516
1516
|
end
|
1517
|
-
|
1517
|
+
|
1518
1518
|
node_cache[:repetition_suffix][start_index] = r0
|
1519
|
-
|
1519
|
+
|
1520
1520
|
return r0
|
1521
1521
|
end
|
1522
|
-
|
1522
|
+
|
1523
1523
|
def _nt_prefix
|
1524
1524
|
start_index = index
|
1525
|
-
|
1526
|
-
|
1527
|
-
@index = cached.interval.end
|
1525
|
+
if node_cache[:prefix].has_key?(index)
|
1526
|
+
cached = node_cache[:prefix][index]
|
1527
|
+
@index = cached.interval.end if cached
|
1528
1528
|
return cached
|
1529
1529
|
end
|
1530
|
-
|
1530
|
+
|
1531
1531
|
i0 = index
|
1532
1532
|
if input.index('&', index) == index
|
1533
1533
|
r1 = (AndPredicate).new(input, index...(index + 1))
|
@@ -1549,24 +1549,35 @@ module Treetop
|
|
1549
1549
|
if r2
|
1550
1550
|
r0 = r2
|
1551
1551
|
else
|
1552
|
-
|
1553
|
-
|
1552
|
+
if input.index('~', index) == index
|
1553
|
+
r3 = (TransientPrefix).new(input, index...(index + 1))
|
1554
|
+
@index += 1
|
1555
|
+
else
|
1556
|
+
terminal_parse_failure('~')
|
1557
|
+
r3 = nil
|
1558
|
+
end
|
1559
|
+
if r3
|
1560
|
+
r0 = r3
|
1561
|
+
else
|
1562
|
+
self.index = i0
|
1563
|
+
r0 = nil
|
1564
|
+
end
|
1554
1565
|
end
|
1555
1566
|
end
|
1556
|
-
|
1567
|
+
|
1557
1568
|
node_cache[:prefix][start_index] = r0
|
1558
|
-
|
1569
|
+
|
1559
1570
|
return r0
|
1560
1571
|
end
|
1561
|
-
|
1572
|
+
|
1562
1573
|
def _nt_atomic
|
1563
1574
|
start_index = index
|
1564
|
-
|
1565
|
-
|
1566
|
-
@index = cached.interval.end
|
1575
|
+
if node_cache[:atomic].has_key?(index)
|
1576
|
+
cached = node_cache[:atomic][index]
|
1577
|
+
@index = cached.interval.end if cached
|
1567
1578
|
return cached
|
1568
1579
|
end
|
1569
|
-
|
1580
|
+
|
1570
1581
|
i0 = index
|
1571
1582
|
r1 = _nt_terminal
|
1572
1583
|
if r1
|
@@ -1585,33 +1596,33 @@ module Treetop
|
|
1585
1596
|
end
|
1586
1597
|
end
|
1587
1598
|
end
|
1588
|
-
|
1599
|
+
|
1589
1600
|
node_cache[:atomic][start_index] = r0
|
1590
|
-
|
1601
|
+
|
1591
1602
|
return r0
|
1592
1603
|
end
|
1593
|
-
|
1604
|
+
|
1594
1605
|
module ParenthesizedExpression0
|
1595
1606
|
def parsing_expression
|
1596
1607
|
elements[2]
|
1597
1608
|
end
|
1598
|
-
|
1609
|
+
|
1599
1610
|
end
|
1600
|
-
|
1611
|
+
|
1601
1612
|
module ParenthesizedExpression1
|
1602
1613
|
def inline_modules
|
1603
1614
|
parsing_expression.inline_modules
|
1604
1615
|
end
|
1605
1616
|
end
|
1606
|
-
|
1617
|
+
|
1607
1618
|
def _nt_parenthesized_expression
|
1608
1619
|
start_index = index
|
1609
|
-
|
1610
|
-
|
1611
|
-
@index = cached.interval.end
|
1620
|
+
if node_cache[:parenthesized_expression].has_key?(index)
|
1621
|
+
cached = node_cache[:parenthesized_expression][index]
|
1622
|
+
@index = cached.interval.end if cached
|
1612
1623
|
return cached
|
1613
1624
|
end
|
1614
|
-
|
1625
|
+
|
1615
1626
|
i0, s0 = index, []
|
1616
1627
|
if input.index('(', index) == index
|
1617
1628
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -1661,30 +1672,30 @@ module Treetop
|
|
1661
1672
|
self.index = i0
|
1662
1673
|
r0 = nil
|
1663
1674
|
end
|
1664
|
-
|
1675
|
+
|
1665
1676
|
node_cache[:parenthesized_expression][start_index] = r0
|
1666
|
-
|
1677
|
+
|
1667
1678
|
return r0
|
1668
1679
|
end
|
1669
|
-
|
1680
|
+
|
1670
1681
|
module Nonterminal0
|
1671
1682
|
def alpha_char
|
1672
1683
|
elements[0]
|
1673
1684
|
end
|
1674
|
-
|
1685
|
+
|
1675
1686
|
end
|
1676
|
-
|
1687
|
+
|
1677
1688
|
module Nonterminal1
|
1678
1689
|
end
|
1679
|
-
|
1690
|
+
|
1680
1691
|
def _nt_nonterminal
|
1681
1692
|
start_index = index
|
1682
|
-
|
1683
|
-
|
1684
|
-
@index = cached.interval.end
|
1693
|
+
if node_cache[:nonterminal].has_key?(index)
|
1694
|
+
cached = node_cache[:nonterminal][index]
|
1695
|
+
@index = cached.interval.end if cached
|
1685
1696
|
return cached
|
1686
1697
|
end
|
1687
|
-
|
1698
|
+
|
1688
1699
|
i0, s0 = index, []
|
1689
1700
|
i1 = index
|
1690
1701
|
r2 = _nt_keyword_inside_grammar
|
@@ -1728,20 +1739,20 @@ module Treetop
|
|
1728
1739
|
self.index = i0
|
1729
1740
|
r0 = nil
|
1730
1741
|
end
|
1731
|
-
|
1742
|
+
|
1732
1743
|
node_cache[:nonterminal][start_index] = r0
|
1733
|
-
|
1744
|
+
|
1734
1745
|
return r0
|
1735
1746
|
end
|
1736
|
-
|
1747
|
+
|
1737
1748
|
def _nt_terminal
|
1738
1749
|
start_index = index
|
1739
|
-
|
1740
|
-
|
1741
|
-
@index = cached.interval.end
|
1750
|
+
if node_cache[:terminal].has_key?(index)
|
1751
|
+
cached = node_cache[:terminal][index]
|
1752
|
+
@index = cached.interval.end if cached
|
1742
1753
|
return cached
|
1743
1754
|
end
|
1744
|
-
|
1755
|
+
|
1745
1756
|
i0 = index
|
1746
1757
|
r1 = _nt_quoted_string
|
1747
1758
|
if r1
|
@@ -1760,26 +1771,26 @@ module Treetop
|
|
1760
1771
|
end
|
1761
1772
|
end
|
1762
1773
|
end
|
1763
|
-
|
1774
|
+
|
1764
1775
|
node_cache[:terminal][start_index] = r0
|
1765
|
-
|
1776
|
+
|
1766
1777
|
return r0
|
1767
1778
|
end
|
1768
|
-
|
1779
|
+
|
1769
1780
|
module QuotedString0
|
1770
1781
|
def string
|
1771
1782
|
super.text_value
|
1772
1783
|
end
|
1773
1784
|
end
|
1774
|
-
|
1785
|
+
|
1775
1786
|
def _nt_quoted_string
|
1776
1787
|
start_index = index
|
1777
|
-
|
1778
|
-
|
1779
|
-
@index = cached.interval.end
|
1788
|
+
if node_cache[:quoted_string].has_key?(index)
|
1789
|
+
cached = node_cache[:quoted_string][index]
|
1790
|
+
@index = cached.interval.end if cached
|
1780
1791
|
return cached
|
1781
1792
|
end
|
1782
|
-
|
1793
|
+
|
1783
1794
|
i0 = index
|
1784
1795
|
r1 = _nt_single_quoted_string
|
1785
1796
|
if r1
|
@@ -1795,30 +1806,30 @@ module Treetop
|
|
1795
1806
|
r0 = nil
|
1796
1807
|
end
|
1797
1808
|
end
|
1798
|
-
|
1809
|
+
|
1799
1810
|
node_cache[:quoted_string][start_index] = r0
|
1800
|
-
|
1811
|
+
|
1801
1812
|
return r0
|
1802
1813
|
end
|
1803
|
-
|
1814
|
+
|
1804
1815
|
module DoubleQuotedString0
|
1805
1816
|
end
|
1806
|
-
|
1817
|
+
|
1807
1818
|
module DoubleQuotedString1
|
1808
1819
|
def string
|
1809
1820
|
elements[1]
|
1810
1821
|
end
|
1811
|
-
|
1822
|
+
|
1812
1823
|
end
|
1813
|
-
|
1824
|
+
|
1814
1825
|
def _nt_double_quoted_string
|
1815
1826
|
start_index = index
|
1816
|
-
|
1817
|
-
|
1818
|
-
@index = cached.interval.end
|
1827
|
+
if node_cache[:double_quoted_string].has_key?(index)
|
1828
|
+
cached = node_cache[:double_quoted_string][index]
|
1829
|
+
@index = cached.interval.end if cached
|
1819
1830
|
return cached
|
1820
1831
|
end
|
1821
|
-
|
1832
|
+
|
1822
1833
|
i0, s0 = index, []
|
1823
1834
|
if input.index('"', index) == index
|
1824
1835
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -1919,30 +1930,30 @@ module Treetop
|
|
1919
1930
|
self.index = i0
|
1920
1931
|
r0 = nil
|
1921
1932
|
end
|
1922
|
-
|
1933
|
+
|
1923
1934
|
node_cache[:double_quoted_string][start_index] = r0
|
1924
|
-
|
1935
|
+
|
1925
1936
|
return r0
|
1926
1937
|
end
|
1927
|
-
|
1938
|
+
|
1928
1939
|
module SingleQuotedString0
|
1929
1940
|
end
|
1930
|
-
|
1941
|
+
|
1931
1942
|
module SingleQuotedString1
|
1932
1943
|
def string
|
1933
1944
|
elements[1]
|
1934
1945
|
end
|
1935
|
-
|
1946
|
+
|
1936
1947
|
end
|
1937
|
-
|
1948
|
+
|
1938
1949
|
def _nt_single_quoted_string
|
1939
1950
|
start_index = index
|
1940
|
-
|
1941
|
-
|
1942
|
-
@index = cached.interval.end
|
1951
|
+
if node_cache[:single_quoted_string].has_key?(index)
|
1952
|
+
cached = node_cache[:single_quoted_string][index]
|
1953
|
+
@index = cached.interval.end if cached
|
1943
1954
|
return cached
|
1944
1955
|
end
|
1945
|
-
|
1956
|
+
|
1946
1957
|
i0, s0 = index, []
|
1947
1958
|
if input.index("'", index) == index
|
1948
1959
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -2043,36 +2054,42 @@ module Treetop
|
|
2043
2054
|
self.index = i0
|
2044
2055
|
r0 = nil
|
2045
2056
|
end
|
2046
|
-
|
2057
|
+
|
2047
2058
|
node_cache[:single_quoted_string][start_index] = r0
|
2048
|
-
|
2059
|
+
|
2049
2060
|
return r0
|
2050
2061
|
end
|
2051
|
-
|
2062
|
+
|
2052
2063
|
module CharacterClass0
|
2053
2064
|
end
|
2054
|
-
|
2065
|
+
|
2055
2066
|
module CharacterClass1
|
2067
|
+
end
|
2068
|
+
|
2069
|
+
module CharacterClass2
|
2070
|
+
end
|
2071
|
+
|
2072
|
+
module CharacterClass3
|
2056
2073
|
def characters
|
2057
2074
|
elements[1]
|
2058
2075
|
end
|
2059
|
-
|
2076
|
+
|
2060
2077
|
end
|
2061
|
-
|
2062
|
-
module
|
2078
|
+
|
2079
|
+
module CharacterClass4
|
2063
2080
|
def characters
|
2064
2081
|
super.text_value
|
2065
2082
|
end
|
2066
2083
|
end
|
2067
|
-
|
2084
|
+
|
2068
2085
|
def _nt_character_class
|
2069
2086
|
start_index = index
|
2070
|
-
|
2071
|
-
|
2072
|
-
@index = cached.interval.end
|
2087
|
+
if node_cache[:character_class].has_key?(index)
|
2088
|
+
cached = node_cache[:character_class][index]
|
2089
|
+
@index = cached.interval.end if cached
|
2073
2090
|
return cached
|
2074
2091
|
end
|
2075
|
-
|
2092
|
+
|
2076
2093
|
i0, s0 = index, []
|
2077
2094
|
if input.index('[', index) == index
|
2078
2095
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -2103,25 +2120,70 @@ module Treetop
|
|
2103
2120
|
s3 << r4
|
2104
2121
|
if r4
|
2105
2122
|
i6 = index
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2123
|
+
i7, s7 = index, []
|
2124
|
+
if input.index('\\', index) == index
|
2125
|
+
r8 = (SyntaxNode).new(input, index...(index + 1))
|
2126
|
+
@index += 1
|
2127
|
+
else
|
2128
|
+
terminal_parse_failure('\\')
|
2129
|
+
r8 = nil
|
2130
|
+
end
|
2131
|
+
s7 << r8
|
2132
|
+
if r8
|
2133
|
+
if index < input_length
|
2134
|
+
r9 = (SyntaxNode).new(input, index...(index + 1))
|
2135
|
+
@index += 1
|
2136
|
+
else
|
2137
|
+
terminal_parse_failure("any character")
|
2138
|
+
r9 = nil
|
2139
|
+
end
|
2140
|
+
s7 << r9
|
2141
|
+
end
|
2142
|
+
if s7.last
|
2143
|
+
r7 = (SyntaxNode).new(input, i7...index, s7)
|
2144
|
+
r7.extend(CharacterClass0)
|
2109
2145
|
else
|
2110
|
-
|
2146
|
+
self.index = i7
|
2111
2147
|
r7 = nil
|
2112
2148
|
end
|
2113
2149
|
if r7
|
2114
2150
|
r6 = r7
|
2115
2151
|
else
|
2116
|
-
|
2117
|
-
|
2152
|
+
i10, s10 = index, []
|
2153
|
+
i11 = index
|
2154
|
+
if input.index('\\', index) == index
|
2155
|
+
r12 = (SyntaxNode).new(input, index...(index + 1))
|
2118
2156
|
@index += 1
|
2119
2157
|
else
|
2120
|
-
terminal_parse_failure(
|
2121
|
-
|
2158
|
+
terminal_parse_failure('\\')
|
2159
|
+
r12 = nil
|
2122
2160
|
end
|
2123
|
-
if
|
2124
|
-
|
2161
|
+
if r12
|
2162
|
+
r11 = nil
|
2163
|
+
else
|
2164
|
+
self.index = i11
|
2165
|
+
r11 = SyntaxNode.new(input, index...index)
|
2166
|
+
end
|
2167
|
+
s10 << r11
|
2168
|
+
if r11
|
2169
|
+
if index < input_length
|
2170
|
+
r13 = (SyntaxNode).new(input, index...(index + 1))
|
2171
|
+
@index += 1
|
2172
|
+
else
|
2173
|
+
terminal_parse_failure("any character")
|
2174
|
+
r13 = nil
|
2175
|
+
end
|
2176
|
+
s10 << r13
|
2177
|
+
end
|
2178
|
+
if s10.last
|
2179
|
+
r10 = (SyntaxNode).new(input, i10...index, s10)
|
2180
|
+
r10.extend(CharacterClass1)
|
2181
|
+
else
|
2182
|
+
self.index = i10
|
2183
|
+
r10 = nil
|
2184
|
+
end
|
2185
|
+
if r10
|
2186
|
+
r6 = r10
|
2125
2187
|
else
|
2126
2188
|
self.index = i6
|
2127
2189
|
r6 = nil
|
@@ -2131,7 +2193,7 @@ module Treetop
|
|
2131
2193
|
end
|
2132
2194
|
if s3.last
|
2133
2195
|
r3 = (SyntaxNode).new(input, i3...index, s3)
|
2134
|
-
r3.extend(
|
2196
|
+
r3.extend(CharacterClass2)
|
2135
2197
|
else
|
2136
2198
|
self.index = i3
|
2137
2199
|
r3 = nil
|
@@ -2151,37 +2213,37 @@ module Treetop
|
|
2151
2213
|
s0 << r2
|
2152
2214
|
if r2
|
2153
2215
|
if input.index(']', index) == index
|
2154
|
-
|
2216
|
+
r14 = (SyntaxNode).new(input, index...(index + 1))
|
2155
2217
|
@index += 1
|
2156
2218
|
else
|
2157
2219
|
terminal_parse_failure(']')
|
2158
|
-
|
2220
|
+
r14 = nil
|
2159
2221
|
end
|
2160
|
-
s0 <<
|
2222
|
+
s0 << r14
|
2161
2223
|
end
|
2162
2224
|
end
|
2163
2225
|
if s0.last
|
2164
2226
|
r0 = (CharacterClass).new(input, i0...index, s0)
|
2165
|
-
r0.extend(
|
2166
|
-
r0.extend(
|
2227
|
+
r0.extend(CharacterClass3)
|
2228
|
+
r0.extend(CharacterClass4)
|
2167
2229
|
else
|
2168
2230
|
self.index = i0
|
2169
2231
|
r0 = nil
|
2170
2232
|
end
|
2171
|
-
|
2233
|
+
|
2172
2234
|
node_cache[:character_class][start_index] = r0
|
2173
|
-
|
2235
|
+
|
2174
2236
|
return r0
|
2175
2237
|
end
|
2176
|
-
|
2238
|
+
|
2177
2239
|
def _nt_anything_symbol
|
2178
2240
|
start_index = index
|
2179
|
-
|
2180
|
-
|
2181
|
-
@index = cached.interval.end
|
2241
|
+
if node_cache[:anything_symbol].has_key?(index)
|
2242
|
+
cached = node_cache[:anything_symbol][index]
|
2243
|
+
@index = cached.interval.end if cached
|
2182
2244
|
return cached
|
2183
2245
|
end
|
2184
|
-
|
2246
|
+
|
2185
2247
|
if input.index('.', index) == index
|
2186
2248
|
r0 = (AnythingSymbol).new(input, index...(index + 1))
|
2187
2249
|
@index += 1
|
@@ -2189,42 +2251,42 @@ module Treetop
|
|
2189
2251
|
terminal_parse_failure('.')
|
2190
2252
|
r0 = nil
|
2191
2253
|
end
|
2192
|
-
|
2254
|
+
|
2193
2255
|
node_cache[:anything_symbol][start_index] = r0
|
2194
|
-
|
2256
|
+
|
2195
2257
|
return r0
|
2196
2258
|
end
|
2197
|
-
|
2259
|
+
|
2198
2260
|
module NodeClassExpression0
|
2199
2261
|
end
|
2200
|
-
|
2262
|
+
|
2201
2263
|
module NodeClassExpression1
|
2202
2264
|
def space
|
2203
2265
|
elements[0]
|
2204
2266
|
end
|
2205
|
-
|
2267
|
+
|
2206
2268
|
end
|
2207
|
-
|
2269
|
+
|
2208
2270
|
module NodeClassExpression2
|
2209
2271
|
def node_class_name
|
2210
2272
|
elements[2].text_value
|
2211
2273
|
end
|
2212
2274
|
end
|
2213
|
-
|
2275
|
+
|
2214
2276
|
module NodeClassExpression3
|
2215
2277
|
def node_class_name
|
2216
2278
|
nil
|
2217
2279
|
end
|
2218
2280
|
end
|
2219
|
-
|
2281
|
+
|
2220
2282
|
def _nt_node_class_expression
|
2221
2283
|
start_index = index
|
2222
|
-
|
2223
|
-
|
2224
|
-
@index = cached.interval.end
|
2284
|
+
if node_cache[:node_class_expression].has_key?(index)
|
2285
|
+
cached = node_cache[:node_class_expression][index]
|
2286
|
+
@index = cached.interval.end if cached
|
2225
2287
|
return cached
|
2226
2288
|
end
|
2227
|
-
|
2289
|
+
|
2228
2290
|
i0 = index
|
2229
2291
|
i1, s1 = index, []
|
2230
2292
|
r2 = _nt_space
|
@@ -2325,22 +2387,22 @@ module Treetop
|
|
2325
2387
|
r0 = nil
|
2326
2388
|
end
|
2327
2389
|
end
|
2328
|
-
|
2390
|
+
|
2329
2391
|
node_cache[:node_class_expression][start_index] = r0
|
2330
|
-
|
2392
|
+
|
2331
2393
|
return r0
|
2332
2394
|
end
|
2333
|
-
|
2395
|
+
|
2334
2396
|
module TrailingInlineModule0
|
2335
2397
|
def space
|
2336
2398
|
elements[0]
|
2337
2399
|
end
|
2338
|
-
|
2400
|
+
|
2339
2401
|
def inline_module
|
2340
2402
|
elements[1]
|
2341
2403
|
end
|
2342
2404
|
end
|
2343
|
-
|
2405
|
+
|
2344
2406
|
module TrailingInlineModule1
|
2345
2407
|
def inline_modules
|
2346
2408
|
[inline_module]
|
@@ -2350,7 +2412,7 @@ module Treetop
|
|
2350
2412
|
inline_module.module_name
|
2351
2413
|
end
|
2352
2414
|
end
|
2353
|
-
|
2415
|
+
|
2354
2416
|
module TrailingInlineModule2
|
2355
2417
|
def inline_modules
|
2356
2418
|
[]
|
@@ -2364,15 +2426,15 @@ module Treetop
|
|
2364
2426
|
nil
|
2365
2427
|
end
|
2366
2428
|
end
|
2367
|
-
|
2429
|
+
|
2368
2430
|
def _nt_trailing_inline_module
|
2369
2431
|
start_index = index
|
2370
|
-
|
2371
|
-
|
2372
|
-
@index = cached.interval.end
|
2432
|
+
if node_cache[:trailing_inline_module].has_key?(index)
|
2433
|
+
cached = node_cache[:trailing_inline_module][index]
|
2434
|
+
@index = cached.interval.end if cached
|
2373
2435
|
return cached
|
2374
2436
|
end
|
2375
|
-
|
2437
|
+
|
2376
2438
|
i0 = index
|
2377
2439
|
i1, s1 = index, []
|
2378
2440
|
r2 = _nt_space
|
@@ -2407,26 +2469,26 @@ module Treetop
|
|
2407
2469
|
r0 = nil
|
2408
2470
|
end
|
2409
2471
|
end
|
2410
|
-
|
2472
|
+
|
2411
2473
|
node_cache[:trailing_inline_module][start_index] = r0
|
2412
|
-
|
2474
|
+
|
2413
2475
|
return r0
|
2414
2476
|
end
|
2415
|
-
|
2477
|
+
|
2416
2478
|
module InlineModule0
|
2417
2479
|
end
|
2418
|
-
|
2480
|
+
|
2419
2481
|
module InlineModule1
|
2420
2482
|
end
|
2421
|
-
|
2483
|
+
|
2422
2484
|
def _nt_inline_module
|
2423
2485
|
start_index = index
|
2424
|
-
|
2425
|
-
|
2426
|
-
@index = cached.interval.end
|
2486
|
+
if node_cache[:inline_module].has_key?(index)
|
2487
|
+
cached = node_cache[:inline_module][index]
|
2488
|
+
@index = cached.interval.end if cached
|
2427
2489
|
return cached
|
2428
2490
|
end
|
2429
|
-
|
2491
|
+
|
2430
2492
|
i0, s0 = index, []
|
2431
2493
|
if input.index('{', index) == index
|
2432
2494
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -2509,23 +2571,23 @@ module Treetop
|
|
2509
2571
|
self.index = i0
|
2510
2572
|
r0 = nil
|
2511
2573
|
end
|
2512
|
-
|
2574
|
+
|
2513
2575
|
node_cache[:inline_module][start_index] = r0
|
2514
|
-
|
2576
|
+
|
2515
2577
|
return r0
|
2516
2578
|
end
|
2517
|
-
|
2579
|
+
|
2518
2580
|
module KeywordInsideGrammar0
|
2519
2581
|
end
|
2520
|
-
|
2582
|
+
|
2521
2583
|
def _nt_keyword_inside_grammar
|
2522
2584
|
start_index = index
|
2523
|
-
|
2524
|
-
|
2525
|
-
@index = cached.interval.end
|
2585
|
+
if node_cache[:keyword_inside_grammar].has_key?(index)
|
2586
|
+
cached = node_cache[:keyword_inside_grammar][index]
|
2587
|
+
@index = cached.interval.end if cached
|
2526
2588
|
return cached
|
2527
2589
|
end
|
2528
|
-
|
2590
|
+
|
2529
2591
|
i0, s0 = index, []
|
2530
2592
|
i1 = index
|
2531
2593
|
if input.index('rule', index) == index
|
@@ -2571,23 +2633,23 @@ module Treetop
|
|
2571
2633
|
self.index = i0
|
2572
2634
|
r0 = nil
|
2573
2635
|
end
|
2574
|
-
|
2636
|
+
|
2575
2637
|
node_cache[:keyword_inside_grammar][start_index] = r0
|
2576
|
-
|
2638
|
+
|
2577
2639
|
return r0
|
2578
2640
|
end
|
2579
|
-
|
2641
|
+
|
2580
2642
|
module NonSpaceChar0
|
2581
2643
|
end
|
2582
|
-
|
2644
|
+
|
2583
2645
|
def _nt_non_space_char
|
2584
2646
|
start_index = index
|
2585
|
-
|
2586
|
-
|
2587
|
-
@index = cached.interval.end
|
2647
|
+
if node_cache[:non_space_char].has_key?(index)
|
2648
|
+
cached = node_cache[:non_space_char][index]
|
2649
|
+
@index = cached.interval.end if cached
|
2588
2650
|
return cached
|
2589
2651
|
end
|
2590
|
-
|
2652
|
+
|
2591
2653
|
i0, s0 = index, []
|
2592
2654
|
i1 = index
|
2593
2655
|
r2 = _nt_space
|
@@ -2615,40 +2677,40 @@ module Treetop
|
|
2615
2677
|
self.index = i0
|
2616
2678
|
r0 = nil
|
2617
2679
|
end
|
2618
|
-
|
2680
|
+
|
2619
2681
|
node_cache[:non_space_char][start_index] = r0
|
2620
|
-
|
2682
|
+
|
2621
2683
|
return r0
|
2622
2684
|
end
|
2623
|
-
|
2685
|
+
|
2624
2686
|
def _nt_alpha_char
|
2625
2687
|
start_index = index
|
2626
|
-
|
2627
|
-
|
2628
|
-
@index = cached.interval.end
|
2688
|
+
if node_cache[:alpha_char].has_key?(index)
|
2689
|
+
cached = node_cache[:alpha_char][index]
|
2690
|
+
@index = cached.interval.end if cached
|
2629
2691
|
return cached
|
2630
2692
|
end
|
2631
|
-
|
2693
|
+
|
2632
2694
|
if input.index(/[A-Za-z_]/, index) == index
|
2633
2695
|
r0 = (SyntaxNode).new(input, index...(index + 1))
|
2634
2696
|
@index += 1
|
2635
2697
|
else
|
2636
2698
|
r0 = nil
|
2637
2699
|
end
|
2638
|
-
|
2700
|
+
|
2639
2701
|
node_cache[:alpha_char][start_index] = r0
|
2640
|
-
|
2702
|
+
|
2641
2703
|
return r0
|
2642
2704
|
end
|
2643
|
-
|
2705
|
+
|
2644
2706
|
def _nt_alphanumeric_char
|
2645
2707
|
start_index = index
|
2646
|
-
|
2647
|
-
|
2648
|
-
@index = cached.interval.end
|
2708
|
+
if node_cache[:alphanumeric_char].has_key?(index)
|
2709
|
+
cached = node_cache[:alphanumeric_char][index]
|
2710
|
+
@index = cached.interval.end if cached
|
2649
2711
|
return cached
|
2650
2712
|
end
|
2651
|
-
|
2713
|
+
|
2652
2714
|
i0 = index
|
2653
2715
|
r1 = _nt_alpha_char
|
2654
2716
|
if r1
|
@@ -2667,20 +2729,20 @@ module Treetop
|
|
2667
2729
|
r0 = nil
|
2668
2730
|
end
|
2669
2731
|
end
|
2670
|
-
|
2732
|
+
|
2671
2733
|
node_cache[:alphanumeric_char][start_index] = r0
|
2672
|
-
|
2734
|
+
|
2673
2735
|
return r0
|
2674
2736
|
end
|
2675
|
-
|
2737
|
+
|
2676
2738
|
def _nt_space
|
2677
2739
|
start_index = index
|
2678
|
-
|
2679
|
-
|
2680
|
-
@index = cached.interval.end
|
2740
|
+
if node_cache[:space].has_key?(index)
|
2741
|
+
cached = node_cache[:space][index]
|
2742
|
+
@index = cached.interval.end if cached
|
2681
2743
|
return cached
|
2682
2744
|
end
|
2683
|
-
|
2745
|
+
|
2684
2746
|
s0, i0 = [], index
|
2685
2747
|
loop do
|
2686
2748
|
i1 = index
|
@@ -2708,26 +2770,26 @@ module Treetop
|
|
2708
2770
|
else
|
2709
2771
|
r0 = SyntaxNode.new(input, i0...index, s0)
|
2710
2772
|
end
|
2711
|
-
|
2773
|
+
|
2712
2774
|
node_cache[:space][start_index] = r0
|
2713
|
-
|
2775
|
+
|
2714
2776
|
return r0
|
2715
2777
|
end
|
2716
|
-
|
2778
|
+
|
2717
2779
|
module CommentToEol0
|
2718
2780
|
end
|
2719
|
-
|
2781
|
+
|
2720
2782
|
module CommentToEol1
|
2721
2783
|
end
|
2722
|
-
|
2784
|
+
|
2723
2785
|
def _nt_comment_to_eol
|
2724
2786
|
start_index = index
|
2725
|
-
|
2726
|
-
|
2727
|
-
@index = cached.interval.end
|
2787
|
+
if node_cache[:comment_to_eol].has_key?(index)
|
2788
|
+
cached = node_cache[:comment_to_eol][index]
|
2789
|
+
@index = cached.interval.end if cached
|
2728
2790
|
return cached
|
2729
2791
|
end
|
2730
|
-
|
2792
|
+
|
2731
2793
|
i0, s0 = index, []
|
2732
2794
|
if input.index('#', index) == index
|
2733
2795
|
r1 = (SyntaxNode).new(input, index...(index + 1))
|
@@ -2794,34 +2856,34 @@ module Treetop
|
|
2794
2856
|
self.index = i0
|
2795
2857
|
r0 = nil
|
2796
2858
|
end
|
2797
|
-
|
2859
|
+
|
2798
2860
|
node_cache[:comment_to_eol][start_index] = r0
|
2799
|
-
|
2861
|
+
|
2800
2862
|
return r0
|
2801
2863
|
end
|
2802
|
-
|
2864
|
+
|
2803
2865
|
def _nt_white
|
2804
2866
|
start_index = index
|
2805
|
-
|
2806
|
-
|
2807
|
-
@index = cached.interval.end
|
2867
|
+
if node_cache[:white].has_key?(index)
|
2868
|
+
cached = node_cache[:white][index]
|
2869
|
+
@index = cached.interval.end if cached
|
2808
2870
|
return cached
|
2809
2871
|
end
|
2810
|
-
|
2872
|
+
|
2811
2873
|
if input.index(/[ \t\n\r]/, index) == index
|
2812
2874
|
r0 = (SyntaxNode).new(input, index...(index + 1))
|
2813
2875
|
@index += 1
|
2814
2876
|
else
|
2815
2877
|
r0 = nil
|
2816
2878
|
end
|
2817
|
-
|
2879
|
+
|
2818
2880
|
node_cache[:white][start_index] = r0
|
2819
|
-
|
2881
|
+
|
2820
2882
|
return r0
|
2821
2883
|
end
|
2822
|
-
|
2884
|
+
|
2823
2885
|
end
|
2824
|
-
|
2886
|
+
|
2825
2887
|
class MetagrammarParser < Treetop::Runtime::CompiledParser
|
2826
2888
|
include Metagrammar
|
2827
2889
|
end
|