treetop 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,6 @@ require 'rake'
4
4
  $LOAD_PATH.unshift(File.join(dir, 'vendor', 'rspec', 'lib'))
5
5
  require 'spec/rake/spectask'
6
6
 
7
- Gem::manage_gems
8
7
  require 'rake/gempackagetask'
9
8
 
10
9
  task :default => :spec
@@ -28,7 +28,9 @@ module Treetop
28
28
  def self.load(path)
29
29
  adjusted_path = path =~ /\.(treetop|tt)\Z/ ? path : path + '.treetop'
30
30
  File.open(adjusted_path) do |source_file|
31
- load_from_string(source_file.read)
31
+ source = source_file.read
32
+ source.gsub!(/\b__FILE__\b/, %Q{"#{adjusted_path}"})
33
+ load_from_string(source)
32
34
  end
33
35
  end
34
36
 
@@ -8,22 +8,32 @@ module Treetop
8
8
  end
9
9
 
10
10
  module TreetopFile0
11
- def prefix
11
+ def require_statement
12
+ elements[1]
13
+ end
14
+ end
15
+
16
+ module TreetopFile1
17
+ def requires
12
18
  elements[0]
13
19
  end
14
20
 
15
- def module_or_grammar
21
+ def prefix
16
22
  elements[1]
17
23
  end
18
24
 
19
- def suffix
25
+ def module_or_grammar
20
26
  elements[2]
21
27
  end
28
+
29
+ def suffix
30
+ elements[3]
31
+ end
22
32
  end
23
33
 
24
- module TreetopFile1
34
+ module TreetopFile2
25
35
  def compile
26
- prefix.text_value + module_or_grammar.compile + suffix.text_value
36
+ requires.text_value + prefix.text_value + module_or_grammar.compile + suffix.text_value
27
37
  end
28
38
  end
29
39
 
@@ -35,49 +45,181 @@ module Treetop
35
45
  return cached
36
46
  end
37
47
 
48
+ i0, s0 = index, []
49
+ s1, i1 = [], index
50
+ loop do
51
+ i2, s2 = index, []
52
+ r4 = _nt_space
53
+ if r4
54
+ r3 = r4
55
+ else
56
+ r3 = instantiate_node(SyntaxNode,input, index...index)
57
+ end
58
+ s2 << r3
59
+ if r3
60
+ r5 = _nt_require_statement
61
+ s2 << r5
62
+ end
63
+ if s2.last
64
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
65
+ r2.extend(TreetopFile0)
66
+ else
67
+ self.index = i2
68
+ r2 = nil
69
+ end
70
+ if r2
71
+ s1 << r2
72
+ else
73
+ break
74
+ end
75
+ end
76
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
77
+ s0 << r1
78
+ if r1
79
+ r7 = _nt_space
80
+ if r7
81
+ r6 = r7
82
+ else
83
+ r6 = instantiate_node(SyntaxNode,input, index...index)
84
+ end
85
+ s0 << r6
86
+ if r6
87
+ i8 = index
88
+ r9 = _nt_module_declaration
89
+ if r9
90
+ r8 = r9
91
+ else
92
+ r10 = _nt_grammar
93
+ if r10
94
+ r8 = r10
95
+ else
96
+ self.index = i8
97
+ r8 = nil
98
+ end
99
+ end
100
+ s0 << r8
101
+ if r8
102
+ r12 = _nt_space
103
+ if r12
104
+ r11 = r12
105
+ else
106
+ r11 = instantiate_node(SyntaxNode,input, index...index)
107
+ end
108
+ s0 << r11
109
+ end
110
+ end
111
+ end
112
+ if s0.last
113
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
114
+ r0.extend(TreetopFile1)
115
+ r0.extend(TreetopFile2)
116
+ else
117
+ self.index = i0
118
+ r0 = nil
119
+ end
120
+
121
+ node_cache[:treetop_file][start_index] = r0
122
+
123
+ return r0
124
+ end
125
+
126
+ module RequireStatement0
127
+ def prefix
128
+ elements[0]
129
+ end
130
+
131
+ end
132
+
133
+ def _nt_require_statement
134
+ start_index = index
135
+ if node_cache[:require_statement].has_key?(index)
136
+ cached = node_cache[:require_statement][index]
137
+ @index = cached.interval.end if cached
138
+ return cached
139
+ end
140
+
38
141
  i0, s0 = index, []
39
142
  r2 = _nt_space
40
143
  if r2
41
144
  r1 = r2
42
145
  else
43
- r1 = SyntaxNode.new(input, index...index)
146
+ r1 = instantiate_node(SyntaxNode,input, index...index)
44
147
  end
45
148
  s0 << r1
46
149
  if r1
47
- i3 = index
48
- r4 = _nt_module_declaration
49
- if r4
50
- r3 = r4
150
+ if input.index("require", index) == index
151
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
152
+ @index += 7
51
153
  else
52
- r5 = _nt_grammar
53
- if r5
54
- r3 = r5
55
- else
56
- self.index = i3
57
- r3 = nil
58
- end
154
+ terminal_parse_failure("require")
155
+ r3 = nil
59
156
  end
60
157
  s0 << r3
61
158
  if r3
62
- r7 = _nt_space
63
- if r7
64
- r6 = r7
159
+ s4, i4 = [], index
160
+ loop do
161
+ if input.index(Regexp.new('[ \\t]'), index) == index
162
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
163
+ @index += 1
164
+ else
165
+ r5 = nil
166
+ end
167
+ if r5
168
+ s4 << r5
169
+ else
170
+ break
171
+ end
172
+ end
173
+ if s4.empty?
174
+ self.index = i4
175
+ r4 = nil
65
176
  else
66
- r6 = SyntaxNode.new(input, index...index)
177
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
178
+ end
179
+ s0 << r4
180
+ if r4
181
+ s6, i6 = [], index
182
+ loop do
183
+ if input.index(Regexp.new('[^\\n\\r]'), index) == index
184
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
185
+ @index += 1
186
+ else
187
+ r7 = nil
188
+ end
189
+ if r7
190
+ s6 << r7
191
+ else
192
+ break
193
+ end
194
+ end
195
+ if s6.empty?
196
+ self.index = i6
197
+ r6 = nil
198
+ else
199
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
200
+ end
201
+ s0 << r6
202
+ if r6
203
+ if input.index(Regexp.new('[\\n\\r]'), index) == index
204
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
205
+ @index += 1
206
+ else
207
+ r8 = nil
208
+ end
209
+ s0 << r8
210
+ end
67
211
  end
68
- s0 << r6
69
212
  end
70
213
  end
71
214
  if s0.last
72
- r0 = (SyntaxNode).new(input, i0...index, s0)
73
- r0.extend(TreetopFile0)
74
- r0.extend(TreetopFile1)
215
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
216
+ r0.extend(RequireStatement0)
75
217
  else
76
218
  self.index = i0
77
219
  r0 = nil
78
220
  end
79
221
 
80
- node_cache[:treetop_file][start_index] = r0
222
+ node_cache[:require_statement][start_index] = r0
81
223
 
82
224
  return r0
83
225
  end
@@ -130,7 +272,7 @@ module Treetop
130
272
  i0, s0 = index, []
131
273
  i1, s1 = index, []
132
274
  if input.index('module', index) == index
133
- r2 = (SyntaxNode).new(input, index...(index + 6))
275
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
134
276
  @index += 6
135
277
  else
136
278
  terminal_parse_failure('module')
@@ -142,7 +284,7 @@ module Treetop
142
284
  s1 << r3
143
285
  if r3
144
286
  if input.index(Regexp.new('[A-Z]'), index) == index
145
- r4 = (SyntaxNode).new(input, index...(index + 1))
287
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
146
288
  @index += 1
147
289
  else
148
290
  r4 = nil
@@ -158,7 +300,7 @@ module Treetop
158
300
  break
159
301
  end
160
302
  end
161
- r5 = SyntaxNode.new(input, i5...index, s5)
303
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
162
304
  s1 << r5
163
305
  if r5
164
306
  r7 = _nt_space
@@ -168,7 +310,7 @@ module Treetop
168
310
  end
169
311
  end
170
312
  if s1.last
171
- r1 = (SyntaxNode).new(input, i1...index, s1)
313
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
172
314
  r1.extend(ModuleDeclaration0)
173
315
  else
174
316
  self.index = i1
@@ -196,7 +338,7 @@ module Treetop
196
338
  s11 << r12
197
339
  if r12
198
340
  if input.index('end', index) == index
199
- r13 = (SyntaxNode).new(input, index...(index + 3))
341
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 3))
200
342
  @index += 3
201
343
  else
202
344
  terminal_parse_failure('end')
@@ -205,7 +347,7 @@ module Treetop
205
347
  s11 << r13
206
348
  end
207
349
  if s11.last
208
- r11 = (SyntaxNode).new(input, i11...index, s11)
350
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
209
351
  r11.extend(ModuleDeclaration1)
210
352
  else
211
353
  self.index = i11
@@ -215,7 +357,7 @@ module Treetop
215
357
  end
216
358
  end
217
359
  if s0.last
218
- r0 = (SyntaxNode).new(input, i0...index, s0)
360
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
219
361
  r0.extend(ModuleDeclaration2)
220
362
  r0.extend(ModuleDeclaration3)
221
363
  else
@@ -263,7 +405,7 @@ module Treetop
263
405
 
264
406
  i0, s0 = index, []
265
407
  if input.index('grammar', index) == index
266
- r1 = (SyntaxNode).new(input, index...(index + 7))
408
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
267
409
  @index += 7
268
410
  else
269
411
  terminal_parse_failure('grammar')
@@ -282,7 +424,7 @@ module Treetop
282
424
  if r4
283
425
  i6, s6 = index, []
284
426
  if input.index('do', index) == index
285
- r7 = (SyntaxNode).new(input, index...(index + 2))
427
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
286
428
  @index += 2
287
429
  else
288
430
  terminal_parse_failure('do')
@@ -294,7 +436,7 @@ module Treetop
294
436
  s6 << r8
295
437
  end
296
438
  if s6.last
297
- r6 = (SyntaxNode).new(input, i6...index, s6)
439
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
298
440
  r6.extend(Grammar0)
299
441
  else
300
442
  self.index = i6
@@ -303,7 +445,7 @@ module Treetop
303
445
  if r6
304
446
  r5 = r6
305
447
  else
306
- r5 = SyntaxNode.new(input, index...index)
448
+ r5 = instantiate_node(SyntaxNode,input, index...index)
307
449
  end
308
450
  s0 << r5
309
451
  if r5
@@ -314,12 +456,12 @@ module Treetop
314
456
  if r11
315
457
  r10 = r11
316
458
  else
317
- r10 = SyntaxNode.new(input, index...index)
459
+ r10 = instantiate_node(SyntaxNode,input, index...index)
318
460
  end
319
461
  s0 << r10
320
462
  if r10
321
463
  if input.index('end', index) == index
322
- r12 = (SyntaxNode).new(input, index...(index + 3))
464
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 3))
323
465
  @index += 3
324
466
  else
325
467
  terminal_parse_failure('end')
@@ -334,7 +476,7 @@ module Treetop
334
476
  end
335
477
  end
336
478
  if s0.last
337
- r0 = (Grammar).new(input, i0...index, s0)
479
+ r0 = instantiate_node(Grammar,input, i0...index, s0)
338
480
  r0.extend(Grammar1)
339
481
  else
340
482
  self.index = i0
@@ -359,7 +501,7 @@ module Treetop
359
501
 
360
502
  i0, s0 = index, []
361
503
  if input.index(Regexp.new('[A-Z]'), index) == index
362
- r1 = (SyntaxNode).new(input, index...(index + 1))
504
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
363
505
  @index += 1
364
506
  else
365
507
  r1 = nil
@@ -375,11 +517,11 @@ module Treetop
375
517
  break
376
518
  end
377
519
  end
378
- r2 = SyntaxNode.new(input, i2...index, s2)
520
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
379
521
  s0 << r2
380
522
  end
381
523
  if s0.last
382
- r0 = (SyntaxNode).new(input, i0...index, s0)
524
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
383
525
  r0.extend(GrammarName0)
384
526
  else
385
527
  self.index = i0
@@ -449,7 +591,7 @@ module Treetop
449
591
  s4 << r6
450
592
  end
451
593
  if s4.last
452
- r4 = (SyntaxNode).new(input, i4...index, s4)
594
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
453
595
  r4.extend(DeclarationSequence0)
454
596
  else
455
597
  self.index = i4
@@ -461,11 +603,11 @@ module Treetop
461
603
  break
462
604
  end
463
605
  end
464
- r3 = SyntaxNode.new(input, i3...index, s3)
606
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
465
607
  s1 << r3
466
608
  end
467
609
  if s1.last
468
- r1 = (DeclarationSequence).new(input, i1...index, s1)
610
+ r1 = instantiate_node(DeclarationSequence,input, i1...index, s1)
469
611
  r1.extend(DeclarationSequence1)
470
612
  r1.extend(DeclarationSequence2)
471
613
  else
@@ -476,7 +618,7 @@ module Treetop
476
618
  r0 = r1
477
619
  else
478
620
  if input.index('', index) == index
479
- r7 = (SyntaxNode).new(input, index...(index + 0))
621
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 0))
480
622
  r7.extend(DeclarationSequence3)
481
623
  @index += 0
482
624
  else
@@ -546,7 +688,7 @@ module Treetop
546
688
 
547
689
  i0, s0 = index, []
548
690
  if input.index('include', index) == index
549
- r1 = (SyntaxNode).new(input, index...(index + 7))
691
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
550
692
  @index += 7
551
693
  else
552
694
  terminal_parse_failure('include')
@@ -558,7 +700,7 @@ module Treetop
558
700
  s0 << r2
559
701
  if r2
560
702
  if input.index(Regexp.new('[A-Z]'), index) == index
561
- r3 = (SyntaxNode).new(input, index...(index + 1))
703
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
562
704
  @index += 1
563
705
  else
564
706
  r3 = nil
@@ -573,7 +715,7 @@ module Treetop
573
715
  r5 = r6
574
716
  else
575
717
  if input.index('::', index) == index
576
- r7 = (SyntaxNode).new(input, index...(index + 2))
718
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
577
719
  @index += 2
578
720
  else
579
721
  terminal_parse_failure('::')
@@ -592,13 +734,13 @@ module Treetop
592
734
  break
593
735
  end
594
736
  end
595
- r4 = SyntaxNode.new(input, i4...index, s4)
737
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
596
738
  s0 << r4
597
739
  end
598
740
  end
599
741
  end
600
742
  if s0.last
601
- r0 = (SyntaxNode).new(input, i0...index, s0)
743
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
602
744
  r0.extend(IncludeDeclaration0)
603
745
  r0.extend(IncludeDeclaration1)
604
746
  else
@@ -650,7 +792,7 @@ module Treetop
650
792
 
651
793
  i0, s0 = index, []
652
794
  if input.index('rule', index) == index
653
- r1 = (SyntaxNode).new(input, index...(index + 4))
795
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
654
796
  @index += 4
655
797
  else
656
798
  terminal_parse_failure('rule')
@@ -669,7 +811,7 @@ module Treetop
669
811
  if r4
670
812
  i6, s6 = index, []
671
813
  if input.index('do', index) == index
672
- r7 = (SyntaxNode).new(input, index...(index + 2))
814
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
673
815
  @index += 2
674
816
  else
675
817
  terminal_parse_failure('do')
@@ -681,7 +823,7 @@ module Treetop
681
823
  s6 << r8
682
824
  end
683
825
  if s6.last
684
- r6 = (SyntaxNode).new(input, i6...index, s6)
826
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
685
827
  r6.extend(ParsingRule0)
686
828
  else
687
829
  self.index = i6
@@ -690,7 +832,7 @@ module Treetop
690
832
  if r6
691
833
  r5 = r6
692
834
  else
693
- r5 = SyntaxNode.new(input, index...index)
835
+ r5 = instantiate_node(SyntaxNode,input, index...index)
694
836
  end
695
837
  s0 << r5
696
838
  if r5
@@ -701,7 +843,7 @@ module Treetop
701
843
  s0 << r10
702
844
  if r10
703
845
  if input.index('end', index) == index
704
- r11 = (SyntaxNode).new(input, index...(index + 3))
846
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 3))
705
847
  @index += 3
706
848
  else
707
849
  terminal_parse_failure('end')
@@ -716,7 +858,7 @@ module Treetop
716
858
  end
717
859
  end
718
860
  if s0.last
719
- r0 = (ParsingRule).new(input, i0...index, s0)
861
+ r0 = instantiate_node(ParsingRule,input, i0...index, s0)
720
862
  r0.extend(ParsingRule1)
721
863
  else
722
864
  self.index = i0
@@ -809,12 +951,12 @@ module Treetop
809
951
  if r5
810
952
  r4 = r5
811
953
  else
812
- r4 = SyntaxNode.new(input, index...index)
954
+ r4 = instantiate_node(SyntaxNode,input, index...index)
813
955
  end
814
956
  s3 << r4
815
957
  if r4
816
958
  if input.index('/', index) == index
817
- r6 = (SyntaxNode).new(input, index...(index + 1))
959
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
818
960
  @index += 1
819
961
  else
820
962
  terminal_parse_failure('/')
@@ -826,7 +968,7 @@ module Treetop
826
968
  if r8
827
969
  r7 = r8
828
970
  else
829
- r7 = SyntaxNode.new(input, index...index)
971
+ r7 = instantiate_node(SyntaxNode,input, index...index)
830
972
  end
831
973
  s3 << r7
832
974
  if r7
@@ -836,7 +978,7 @@ module Treetop
836
978
  end
837
979
  end
838
980
  if s3.last
839
- r3 = (SyntaxNode).new(input, i3...index, s3)
981
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
840
982
  r3.extend(Choice0)
841
983
  else
842
984
  self.index = i3
@@ -852,12 +994,12 @@ module Treetop
852
994
  self.index = i2
853
995
  r2 = nil
854
996
  else
855
- r2 = SyntaxNode.new(input, i2...index, s2)
997
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
856
998
  end
857
999
  s0 << r2
858
1000
  end
859
1001
  if s0.last
860
- r0 = (Choice).new(input, i0...index, s0)
1002
+ r0 = instantiate_node(Choice,input, i0...index, s0)
861
1003
  r0.extend(Choice1)
862
1004
  r0.extend(Choice2)
863
1005
  else
@@ -936,7 +1078,7 @@ module Treetop
936
1078
  s3 << r5
937
1079
  end
938
1080
  if s3.last
939
- r3 = (SyntaxNode).new(input, i3...index, s3)
1081
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
940
1082
  r3.extend(Sequence0)
941
1083
  else
942
1084
  self.index = i3
@@ -952,7 +1094,7 @@ module Treetop
952
1094
  self.index = i2
953
1095
  r2 = nil
954
1096
  else
955
- r2 = SyntaxNode.new(input, i2...index, s2)
1097
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
956
1098
  end
957
1099
  s0 << r2
958
1100
  if r2
@@ -961,7 +1103,7 @@ module Treetop
961
1103
  end
962
1104
  end
963
1105
  if s0.last
964
- r0 = (Sequence).new(input, i0...index, s0)
1106
+ r0 = instantiate_node(Sequence,input, i0...index, s0)
965
1107
  r0.extend(Sequence1)
966
1108
  r0.extend(Sequence2)
967
1109
  else
@@ -1110,7 +1252,7 @@ module Treetop
1110
1252
  s1 << r3
1111
1253
  end
1112
1254
  if s1.last
1113
- r1 = (SyntaxNode).new(input, i1...index, s1)
1255
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1114
1256
  r1.extend(Primary0)
1115
1257
  r1.extend(Primary1)
1116
1258
  else
@@ -1132,7 +1274,7 @@ module Treetop
1132
1274
  end
1133
1275
  end
1134
1276
  if s4.last
1135
- r4 = (SyntaxNode).new(input, i4...index, s4)
1277
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1136
1278
  r4.extend(Primary2)
1137
1279
  r4.extend(Primary3)
1138
1280
  else
@@ -1150,7 +1292,7 @@ module Treetop
1150
1292
  s8 << r10
1151
1293
  end
1152
1294
  if s8.last
1153
- r8 = (SyntaxNode).new(input, i8...index, s8)
1295
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
1154
1296
  r8.extend(Primary4)
1155
1297
  r8.extend(Primary5)
1156
1298
  else
@@ -1217,7 +1359,7 @@ module Treetop
1217
1359
  s0 << r2
1218
1360
  end
1219
1361
  if s0.last
1220
- r0 = (SyntaxNode).new(input, i0...index, s0)
1362
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1221
1363
  r0.extend(LabeledSequencePrimary0)
1222
1364
  r0.extend(LabeledSequencePrimary1)
1223
1365
  else
@@ -1275,11 +1417,11 @@ module Treetop
1275
1417
  break
1276
1418
  end
1277
1419
  end
1278
- r4 = SyntaxNode.new(input, i4...index, s4)
1420
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1279
1421
  s2 << r4
1280
1422
  end
1281
1423
  if s2.last
1282
- r2 = (SyntaxNode).new(input, i2...index, s2)
1424
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1283
1425
  r2.extend(Label0)
1284
1426
  else
1285
1427
  self.index = i2
@@ -1288,7 +1430,7 @@ module Treetop
1288
1430
  s1 << r2
1289
1431
  if r2
1290
1432
  if input.index(':', index) == index
1291
- r6 = (SyntaxNode).new(input, index...(index + 1))
1433
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1292
1434
  @index += 1
1293
1435
  else
1294
1436
  terminal_parse_failure(':')
@@ -1297,7 +1439,7 @@ module Treetop
1297
1439
  s1 << r6
1298
1440
  end
1299
1441
  if s1.last
1300
- r1 = (SyntaxNode).new(input, i1...index, s1)
1442
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1301
1443
  r1.extend(Label1)
1302
1444
  r1.extend(Label2)
1303
1445
  else
@@ -1308,7 +1450,7 @@ module Treetop
1308
1450
  r0 = r1
1309
1451
  else
1310
1452
  if input.index('', index) == index
1311
- r7 = (SyntaxNode).new(input, index...(index + 0))
1453
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 0))
1312
1454
  r7.extend(Label3)
1313
1455
  @index += 0
1314
1456
  else
@@ -1401,7 +1543,7 @@ module Treetop
1401
1543
  s1 << r3
1402
1544
  end
1403
1545
  if s1.last
1404
- r1 = (SyntaxNode).new(input, i1...index, s1)
1546
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1405
1547
  r1.extend(SequencePrimary0)
1406
1548
  r1.extend(SequencePrimary1)
1407
1549
  else
@@ -1419,7 +1561,7 @@ module Treetop
1419
1561
  s4 << r6
1420
1562
  end
1421
1563
  if s4.last
1422
- r4 = (SyntaxNode).new(input, i4...index, s4)
1564
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1423
1565
  r4.extend(SequencePrimary2)
1424
1566
  r4.extend(SequencePrimary3)
1425
1567
  else
@@ -1480,7 +1622,7 @@ module Treetop
1480
1622
  end
1481
1623
 
1482
1624
  if input.index('?', index) == index
1483
- r0 = (Optional).new(input, index...(index + 1))
1625
+ r0 = instantiate_node(Optional,input, index...(index + 1))
1484
1626
  @index += 1
1485
1627
  else
1486
1628
  terminal_parse_failure('?')
@@ -1536,7 +1678,7 @@ module Treetop
1536
1678
  s0 << r2
1537
1679
  end
1538
1680
  if s0.last
1539
- r0 = (SyntaxNode).new(input, i0...index, s0)
1681
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1540
1682
  r0.extend(NodeClassDeclarations0)
1541
1683
  r0.extend(NodeClassDeclarations1)
1542
1684
  else
@@ -1559,7 +1701,7 @@ module Treetop
1559
1701
 
1560
1702
  i0 = index
1561
1703
  if input.index('+', index) == index
1562
- r1 = (OneOrMore).new(input, index...(index + 1))
1704
+ r1 = instantiate_node(OneOrMore,input, index...(index + 1))
1563
1705
  @index += 1
1564
1706
  else
1565
1707
  terminal_parse_failure('+')
@@ -1569,7 +1711,7 @@ module Treetop
1569
1711
  r0 = r1
1570
1712
  else
1571
1713
  if input.index('*', index) == index
1572
- r2 = (ZeroOrMore).new(input, index...(index + 1))
1714
+ r2 = instantiate_node(ZeroOrMore,input, index...(index + 1))
1573
1715
  @index += 1
1574
1716
  else
1575
1717
  terminal_parse_failure('*')
@@ -1598,7 +1740,7 @@ module Treetop
1598
1740
 
1599
1741
  i0 = index
1600
1742
  if input.index('&', index) == index
1601
- r1 = (AndPredicate).new(input, index...(index + 1))
1743
+ r1 = instantiate_node(AndPredicate,input, index...(index + 1))
1602
1744
  @index += 1
1603
1745
  else
1604
1746
  terminal_parse_failure('&')
@@ -1608,7 +1750,7 @@ module Treetop
1608
1750
  r0 = r1
1609
1751
  else
1610
1752
  if input.index('!', index) == index
1611
- r2 = (NotPredicate).new(input, index...(index + 1))
1753
+ r2 = instantiate_node(NotPredicate,input, index...(index + 1))
1612
1754
  @index += 1
1613
1755
  else
1614
1756
  terminal_parse_failure('!')
@@ -1618,7 +1760,7 @@ module Treetop
1618
1760
  r0 = r2
1619
1761
  else
1620
1762
  if input.index('~', index) == index
1621
- r3 = (TransientPrefix).new(input, index...(index + 1))
1763
+ r3 = instantiate_node(TransientPrefix,input, index...(index + 1))
1622
1764
  @index += 1
1623
1765
  else
1624
1766
  terminal_parse_failure('~')
@@ -1693,7 +1835,7 @@ module Treetop
1693
1835
 
1694
1836
  i0, s0 = index, []
1695
1837
  if input.index('(', index) == index
1696
- r1 = (SyntaxNode).new(input, index...(index + 1))
1838
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1697
1839
  @index += 1
1698
1840
  else
1699
1841
  terminal_parse_failure('(')
@@ -1705,7 +1847,7 @@ module Treetop
1705
1847
  if r3
1706
1848
  r2 = r3
1707
1849
  else
1708
- r2 = SyntaxNode.new(input, index...index)
1850
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1709
1851
  end
1710
1852
  s0 << r2
1711
1853
  if r2
@@ -1716,12 +1858,12 @@ module Treetop
1716
1858
  if r6
1717
1859
  r5 = r6
1718
1860
  else
1719
- r5 = SyntaxNode.new(input, index...index)
1861
+ r5 = instantiate_node(SyntaxNode,input, index...index)
1720
1862
  end
1721
1863
  s0 << r5
1722
1864
  if r5
1723
1865
  if input.index(')', index) == index
1724
- r7 = (SyntaxNode).new(input, index...(index + 1))
1866
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
1725
1867
  @index += 1
1726
1868
  else
1727
1869
  terminal_parse_failure(')')
@@ -1733,7 +1875,7 @@ module Treetop
1733
1875
  end
1734
1876
  end
1735
1877
  if s0.last
1736
- r0 = (ParenthesizedExpression).new(input, i0...index, s0)
1878
+ r0 = instantiate_node(ParenthesizedExpression,input, i0...index, s0)
1737
1879
  r0.extend(ParenthesizedExpression0)
1738
1880
  r0.extend(ParenthesizedExpression1)
1739
1881
  else
@@ -1771,7 +1913,7 @@ module Treetop
1771
1913
  r1 = nil
1772
1914
  else
1773
1915
  self.index = i1
1774
- r1 = SyntaxNode.new(input, index...index)
1916
+ r1 = instantiate_node(SyntaxNode,input, index...index)
1775
1917
  end
1776
1918
  s0 << r1
1777
1919
  if r1
@@ -1788,11 +1930,11 @@ module Treetop
1788
1930
  break
1789
1931
  end
1790
1932
  end
1791
- r5 = SyntaxNode.new(input, i5...index, s5)
1933
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1792
1934
  s3 << r5
1793
1935
  end
1794
1936
  if s3.last
1795
- r3 = (SyntaxNode).new(input, i3...index, s3)
1937
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1796
1938
  r3.extend(Nonterminal0)
1797
1939
  else
1798
1940
  self.index = i3
@@ -1801,7 +1943,7 @@ module Treetop
1801
1943
  s0 << r3
1802
1944
  end
1803
1945
  if s0.last
1804
- r0 = (Nonterminal).new(input, i0...index, s0)
1946
+ r0 = instantiate_node(Nonterminal,input, i0...index, s0)
1805
1947
  r0.extend(Nonterminal1)
1806
1948
  else
1807
1949
  self.index = i0
@@ -1900,7 +2042,7 @@ module Treetop
1900
2042
 
1901
2043
  i0, s0 = index, []
1902
2044
  if input.index('"', index) == index
1903
- r1 = (SyntaxNode).new(input, index...(index + 1))
2045
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1904
2046
  @index += 1
1905
2047
  else
1906
2048
  terminal_parse_failure('"')
@@ -1913,7 +2055,7 @@ module Treetop
1913
2055
  i3, s3 = index, []
1914
2056
  i4 = index
1915
2057
  if input.index('"', index) == index
1916
- r5 = (SyntaxNode).new(input, index...(index + 1))
2058
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1917
2059
  @index += 1
1918
2060
  else
1919
2061
  terminal_parse_failure('"')
@@ -1923,13 +2065,13 @@ module Treetop
1923
2065
  r4 = nil
1924
2066
  else
1925
2067
  self.index = i4
1926
- r4 = SyntaxNode.new(input, index...index)
2068
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1927
2069
  end
1928
2070
  s3 << r4
1929
2071
  if r4
1930
2072
  i6 = index
1931
2073
  if input.index("\\\\", index) == index
1932
- r7 = (SyntaxNode).new(input, index...(index + 2))
2074
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
1933
2075
  @index += 2
1934
2076
  else
1935
2077
  terminal_parse_failure("\\\\")
@@ -1939,7 +2081,7 @@ module Treetop
1939
2081
  r6 = r7
1940
2082
  else
1941
2083
  if input.index('\"', index) == index
1942
- r8 = (SyntaxNode).new(input, index...(index + 2))
2084
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
1943
2085
  @index += 2
1944
2086
  else
1945
2087
  terminal_parse_failure('\"')
@@ -1949,7 +2091,7 @@ module Treetop
1949
2091
  r6 = r8
1950
2092
  else
1951
2093
  if index < input_length
1952
- r9 = (SyntaxNode).new(input, index...(index + 1))
2094
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1953
2095
  @index += 1
1954
2096
  else
1955
2097
  terminal_parse_failure("any character")
@@ -1966,7 +2108,7 @@ module Treetop
1966
2108
  s3 << r6
1967
2109
  end
1968
2110
  if s3.last
1969
- r3 = (SyntaxNode).new(input, i3...index, s3)
2111
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1970
2112
  r3.extend(DoubleQuotedString0)
1971
2113
  else
1972
2114
  self.index = i3
@@ -1978,11 +2120,11 @@ module Treetop
1978
2120
  break
1979
2121
  end
1980
2122
  end
1981
- r2 = SyntaxNode.new(input, i2...index, s2)
2123
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1982
2124
  s0 << r2
1983
2125
  if r2
1984
2126
  if input.index('"', index) == index
1985
- r10 = (SyntaxNode).new(input, index...(index + 1))
2127
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1986
2128
  @index += 1
1987
2129
  else
1988
2130
  terminal_parse_failure('"')
@@ -1992,7 +2134,7 @@ module Treetop
1992
2134
  end
1993
2135
  end
1994
2136
  if s0.last
1995
- r0 = (Terminal).new(input, i0...index, s0)
2137
+ r0 = instantiate_node(Terminal,input, i0...index, s0)
1996
2138
  r0.extend(DoubleQuotedString1)
1997
2139
  else
1998
2140
  self.index = i0
@@ -2024,7 +2166,7 @@ module Treetop
2024
2166
 
2025
2167
  i0, s0 = index, []
2026
2168
  if input.index("'", index) == index
2027
- r1 = (SyntaxNode).new(input, index...(index + 1))
2169
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
2028
2170
  @index += 1
2029
2171
  else
2030
2172
  terminal_parse_failure("'")
@@ -2037,7 +2179,7 @@ module Treetop
2037
2179
  i3, s3 = index, []
2038
2180
  i4 = index
2039
2181
  if input.index("'", index) == index
2040
- r5 = (SyntaxNode).new(input, index...(index + 1))
2182
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
2041
2183
  @index += 1
2042
2184
  else
2043
2185
  terminal_parse_failure("'")
@@ -2047,13 +2189,13 @@ module Treetop
2047
2189
  r4 = nil
2048
2190
  else
2049
2191
  self.index = i4
2050
- r4 = SyntaxNode.new(input, index...index)
2192
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2051
2193
  end
2052
2194
  s3 << r4
2053
2195
  if r4
2054
2196
  i6 = index
2055
2197
  if input.index("\\\\", index) == index
2056
- r7 = (SyntaxNode).new(input, index...(index + 2))
2198
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
2057
2199
  @index += 2
2058
2200
  else
2059
2201
  terminal_parse_failure("\\\\")
@@ -2063,7 +2205,7 @@ module Treetop
2063
2205
  r6 = r7
2064
2206
  else
2065
2207
  if input.index("\\'", index) == index
2066
- r8 = (SyntaxNode).new(input, index...(index + 2))
2208
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
2067
2209
  @index += 2
2068
2210
  else
2069
2211
  terminal_parse_failure("\\'")
@@ -2073,7 +2215,7 @@ module Treetop
2073
2215
  r6 = r8
2074
2216
  else
2075
2217
  if index < input_length
2076
- r9 = (SyntaxNode).new(input, index...(index + 1))
2218
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2077
2219
  @index += 1
2078
2220
  else
2079
2221
  terminal_parse_failure("any character")
@@ -2090,7 +2232,7 @@ module Treetop
2090
2232
  s3 << r6
2091
2233
  end
2092
2234
  if s3.last
2093
- r3 = (SyntaxNode).new(input, i3...index, s3)
2235
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2094
2236
  r3.extend(SingleQuotedString0)
2095
2237
  else
2096
2238
  self.index = i3
@@ -2102,11 +2244,11 @@ module Treetop
2102
2244
  break
2103
2245
  end
2104
2246
  end
2105
- r2 = SyntaxNode.new(input, i2...index, s2)
2247
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2106
2248
  s0 << r2
2107
2249
  if r2
2108
2250
  if input.index("'", index) == index
2109
- r10 = (SyntaxNode).new(input, index...(index + 1))
2251
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
2110
2252
  @index += 1
2111
2253
  else
2112
2254
  terminal_parse_failure("'")
@@ -2116,7 +2258,7 @@ module Treetop
2116
2258
  end
2117
2259
  end
2118
2260
  if s0.last
2119
- r0 = (Terminal).new(input, i0...index, s0)
2261
+ r0 = instantiate_node(Terminal,input, i0...index, s0)
2120
2262
  r0.extend(SingleQuotedString1)
2121
2263
  else
2122
2264
  self.index = i0
@@ -2160,7 +2302,7 @@ module Treetop
2160
2302
 
2161
2303
  i0, s0 = index, []
2162
2304
  if input.index('[', index) == index
2163
- r1 = (SyntaxNode).new(input, index...(index + 1))
2305
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
2164
2306
  @index += 1
2165
2307
  else
2166
2308
  terminal_parse_failure('[')
@@ -2173,7 +2315,7 @@ module Treetop
2173
2315
  i3, s3 = index, []
2174
2316
  i4 = index
2175
2317
  if input.index(']', index) == index
2176
- r5 = (SyntaxNode).new(input, index...(index + 1))
2318
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
2177
2319
  @index += 1
2178
2320
  else
2179
2321
  terminal_parse_failure(']')
@@ -2183,14 +2325,14 @@ module Treetop
2183
2325
  r4 = nil
2184
2326
  else
2185
2327
  self.index = i4
2186
- r4 = SyntaxNode.new(input, index...index)
2328
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2187
2329
  end
2188
2330
  s3 << r4
2189
2331
  if r4
2190
2332
  i6 = index
2191
2333
  i7, s7 = index, []
2192
2334
  if input.index('\\', index) == index
2193
- r8 = (SyntaxNode).new(input, index...(index + 1))
2335
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
2194
2336
  @index += 1
2195
2337
  else
2196
2338
  terminal_parse_failure('\\')
@@ -2199,7 +2341,7 @@ module Treetop
2199
2341
  s7 << r8
2200
2342
  if r8
2201
2343
  if index < input_length
2202
- r9 = (SyntaxNode).new(input, index...(index + 1))
2344
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2203
2345
  @index += 1
2204
2346
  else
2205
2347
  terminal_parse_failure("any character")
@@ -2208,7 +2350,7 @@ module Treetop
2208
2350
  s7 << r9
2209
2351
  end
2210
2352
  if s7.last
2211
- r7 = (SyntaxNode).new(input, i7...index, s7)
2353
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2212
2354
  r7.extend(CharacterClass0)
2213
2355
  else
2214
2356
  self.index = i7
@@ -2220,7 +2362,7 @@ module Treetop
2220
2362
  i10, s10 = index, []
2221
2363
  i11 = index
2222
2364
  if input.index('\\', index) == index
2223
- r12 = (SyntaxNode).new(input, index...(index + 1))
2365
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
2224
2366
  @index += 1
2225
2367
  else
2226
2368
  terminal_parse_failure('\\')
@@ -2230,12 +2372,12 @@ module Treetop
2230
2372
  r11 = nil
2231
2373
  else
2232
2374
  self.index = i11
2233
- r11 = SyntaxNode.new(input, index...index)
2375
+ r11 = instantiate_node(SyntaxNode,input, index...index)
2234
2376
  end
2235
2377
  s10 << r11
2236
2378
  if r11
2237
2379
  if index < input_length
2238
- r13 = (SyntaxNode).new(input, index...(index + 1))
2380
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
2239
2381
  @index += 1
2240
2382
  else
2241
2383
  terminal_parse_failure("any character")
@@ -2244,7 +2386,7 @@ module Treetop
2244
2386
  s10 << r13
2245
2387
  end
2246
2388
  if s10.last
2247
- r10 = (SyntaxNode).new(input, i10...index, s10)
2389
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
2248
2390
  r10.extend(CharacterClass1)
2249
2391
  else
2250
2392
  self.index = i10
@@ -2260,7 +2402,7 @@ module Treetop
2260
2402
  s3 << r6
2261
2403
  end
2262
2404
  if s3.last
2263
- r3 = (SyntaxNode).new(input, i3...index, s3)
2405
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2264
2406
  r3.extend(CharacterClass2)
2265
2407
  else
2266
2408
  self.index = i3
@@ -2276,12 +2418,12 @@ module Treetop
2276
2418
  self.index = i2
2277
2419
  r2 = nil
2278
2420
  else
2279
- r2 = SyntaxNode.new(input, i2...index, s2)
2421
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2280
2422
  end
2281
2423
  s0 << r2
2282
2424
  if r2
2283
2425
  if input.index(']', index) == index
2284
- r14 = (SyntaxNode).new(input, index...(index + 1))
2426
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
2285
2427
  @index += 1
2286
2428
  else
2287
2429
  terminal_parse_failure(']')
@@ -2291,7 +2433,7 @@ module Treetop
2291
2433
  end
2292
2434
  end
2293
2435
  if s0.last
2294
- r0 = (CharacterClass).new(input, i0...index, s0)
2436
+ r0 = instantiate_node(CharacterClass,input, i0...index, s0)
2295
2437
  r0.extend(CharacterClass3)
2296
2438
  r0.extend(CharacterClass4)
2297
2439
  else
@@ -2313,7 +2455,7 @@ module Treetop
2313
2455
  end
2314
2456
 
2315
2457
  if input.index('.', index) == index
2316
- r0 = (AnythingSymbol).new(input, index...(index + 1))
2458
+ r0 = instantiate_node(AnythingSymbol,input, index...(index + 1))
2317
2459
  @index += 1
2318
2460
  else
2319
2461
  terminal_parse_failure('.')
@@ -2361,7 +2503,7 @@ module Treetop
2361
2503
  s1 << r2
2362
2504
  if r2
2363
2505
  if input.index('<', index) == index
2364
- r3 = (SyntaxNode).new(input, index...(index + 1))
2506
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2365
2507
  @index += 1
2366
2508
  else
2367
2509
  terminal_parse_failure('<')
@@ -2374,7 +2516,7 @@ module Treetop
2374
2516
  i5, s5 = index, []
2375
2517
  i6 = index
2376
2518
  if input.index('>', index) == index
2377
- r7 = (SyntaxNode).new(input, index...(index + 1))
2519
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
2378
2520
  @index += 1
2379
2521
  else
2380
2522
  terminal_parse_failure('>')
@@ -2384,12 +2526,12 @@ module Treetop
2384
2526
  r6 = nil
2385
2527
  else
2386
2528
  self.index = i6
2387
- r6 = SyntaxNode.new(input, index...index)
2529
+ r6 = instantiate_node(SyntaxNode,input, index...index)
2388
2530
  end
2389
2531
  s5 << r6
2390
2532
  if r6
2391
2533
  if index < input_length
2392
- r8 = (SyntaxNode).new(input, index...(index + 1))
2534
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
2393
2535
  @index += 1
2394
2536
  else
2395
2537
  terminal_parse_failure("any character")
@@ -2398,7 +2540,7 @@ module Treetop
2398
2540
  s5 << r8
2399
2541
  end
2400
2542
  if s5.last
2401
- r5 = (SyntaxNode).new(input, i5...index, s5)
2543
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2402
2544
  r5.extend(NodeClassExpression0)
2403
2545
  else
2404
2546
  self.index = i5
@@ -2414,12 +2556,12 @@ module Treetop
2414
2556
  self.index = i4
2415
2557
  r4 = nil
2416
2558
  else
2417
- r4 = SyntaxNode.new(input, i4...index, s4)
2559
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2418
2560
  end
2419
2561
  s1 << r4
2420
2562
  if r4
2421
2563
  if input.index('>', index) == index
2422
- r9 = (SyntaxNode).new(input, index...(index + 1))
2564
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2423
2565
  @index += 1
2424
2566
  else
2425
2567
  terminal_parse_failure('>')
@@ -2430,7 +2572,7 @@ module Treetop
2430
2572
  end
2431
2573
  end
2432
2574
  if s1.last
2433
- r1 = (SyntaxNode).new(input, i1...index, s1)
2575
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2434
2576
  r1.extend(NodeClassExpression1)
2435
2577
  r1.extend(NodeClassExpression2)
2436
2578
  else
@@ -2441,7 +2583,7 @@ module Treetop
2441
2583
  r0 = r1
2442
2584
  else
2443
2585
  if input.index('', index) == index
2444
- r10 = (SyntaxNode).new(input, index...(index + 0))
2586
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 0))
2445
2587
  r10.extend(NodeClassExpression3)
2446
2588
  @index += 0
2447
2589
  else
@@ -2512,7 +2654,7 @@ module Treetop
2512
2654
  s1 << r3
2513
2655
  end
2514
2656
  if s1.last
2515
- r1 = (SyntaxNode).new(input, i1...index, s1)
2657
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2516
2658
  r1.extend(TrailingInlineModule0)
2517
2659
  r1.extend(TrailingInlineModule1)
2518
2660
  else
@@ -2523,7 +2665,7 @@ module Treetop
2523
2665
  r0 = r1
2524
2666
  else
2525
2667
  if input.index('', index) == index
2526
- r4 = (SyntaxNode).new(input, index...(index + 0))
2668
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
2527
2669
  r4.extend(TrailingInlineModule2)
2528
2670
  @index += 0
2529
2671
  else
@@ -2559,7 +2701,7 @@ module Treetop
2559
2701
 
2560
2702
  i0, s0 = index, []
2561
2703
  if input.index('{', index) == index
2562
- r1 = (SyntaxNode).new(input, index...(index + 1))
2704
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
2563
2705
  @index += 1
2564
2706
  else
2565
2707
  terminal_parse_failure('{')
@@ -2577,7 +2719,7 @@ module Treetop
2577
2719
  i5, s5 = index, []
2578
2720
  i6 = index
2579
2721
  if input.index(Regexp.new('[{}]'), index) == index
2580
- r7 = (SyntaxNode).new(input, index...(index + 1))
2722
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
2581
2723
  @index += 1
2582
2724
  else
2583
2725
  r7 = nil
@@ -2586,12 +2728,12 @@ module Treetop
2586
2728
  r6 = nil
2587
2729
  else
2588
2730
  self.index = i6
2589
- r6 = SyntaxNode.new(input, index...index)
2731
+ r6 = instantiate_node(SyntaxNode,input, index...index)
2590
2732
  end
2591
2733
  s5 << r6
2592
2734
  if r6
2593
2735
  if index < input_length
2594
- r8 = (SyntaxNode).new(input, index...(index + 1))
2736
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
2595
2737
  @index += 1
2596
2738
  else
2597
2739
  terminal_parse_failure("any character")
@@ -2600,7 +2742,7 @@ module Treetop
2600
2742
  s5 << r8
2601
2743
  end
2602
2744
  if s5.last
2603
- r5 = (SyntaxNode).new(input, i5...index, s5)
2745
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2604
2746
  r5.extend(InlineModule0)
2605
2747
  else
2606
2748
  self.index = i5
@@ -2619,11 +2761,11 @@ module Treetop
2619
2761
  break
2620
2762
  end
2621
2763
  end
2622
- r2 = SyntaxNode.new(input, i2...index, s2)
2764
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2623
2765
  s0 << r2
2624
2766
  if r2
2625
2767
  if input.index('}', index) == index
2626
- r9 = (SyntaxNode).new(input, index...(index + 1))
2768
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2627
2769
  @index += 1
2628
2770
  else
2629
2771
  terminal_parse_failure('}')
@@ -2633,7 +2775,7 @@ module Treetop
2633
2775
  end
2634
2776
  end
2635
2777
  if s0.last
2636
- r0 = (InlineModule).new(input, i0...index, s0)
2778
+ r0 = instantiate_node(InlineModule,input, i0...index, s0)
2637
2779
  r0.extend(InlineModule1)
2638
2780
  else
2639
2781
  self.index = i0
@@ -2659,7 +2801,7 @@ module Treetop
2659
2801
  i0, s0 = index, []
2660
2802
  i1 = index
2661
2803
  if input.index('rule', index) == index
2662
- r2 = (SyntaxNode).new(input, index...(index + 4))
2804
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
2663
2805
  @index += 4
2664
2806
  else
2665
2807
  terminal_parse_failure('rule')
@@ -2669,7 +2811,7 @@ module Treetop
2669
2811
  r1 = r2
2670
2812
  else
2671
2813
  if input.index('end', index) == index
2672
- r3 = (SyntaxNode).new(input, index...(index + 3))
2814
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
2673
2815
  @index += 3
2674
2816
  else
2675
2817
  terminal_parse_failure('end')
@@ -2690,12 +2832,12 @@ module Treetop
2690
2832
  r4 = nil
2691
2833
  else
2692
2834
  self.index = i4
2693
- r4 = SyntaxNode.new(input, index...index)
2835
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2694
2836
  end
2695
2837
  s0 << r4
2696
2838
  end
2697
2839
  if s0.last
2698
- r0 = (SyntaxNode).new(input, i0...index, s0)
2840
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2699
2841
  r0.extend(KeywordInsideGrammar0)
2700
2842
  else
2701
2843
  self.index = i0
@@ -2725,12 +2867,12 @@ module Treetop
2725
2867
  r1 = nil
2726
2868
  else
2727
2869
  self.index = i1
2728
- r1 = SyntaxNode.new(input, index...index)
2870
+ r1 = instantiate_node(SyntaxNode,input, index...index)
2729
2871
  end
2730
2872
  s0 << r1
2731
2873
  if r1
2732
2874
  if index < input_length
2733
- r3 = (SyntaxNode).new(input, index...(index + 1))
2875
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2734
2876
  @index += 1
2735
2877
  else
2736
2878
  terminal_parse_failure("any character")
@@ -2739,7 +2881,7 @@ module Treetop
2739
2881
  s0 << r3
2740
2882
  end
2741
2883
  if s0.last
2742
- r0 = (SyntaxNode).new(input, i0...index, s0)
2884
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2743
2885
  r0.extend(NonSpaceChar0)
2744
2886
  else
2745
2887
  self.index = i0
@@ -2760,7 +2902,7 @@ module Treetop
2760
2902
  end
2761
2903
 
2762
2904
  if input.index(Regexp.new('[A-Za-z_]'), index) == index
2763
- r0 = (SyntaxNode).new(input, index...(index + 1))
2905
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
2764
2906
  @index += 1
2765
2907
  else
2766
2908
  r0 = nil
@@ -2785,7 +2927,7 @@ module Treetop
2785
2927
  r0 = r1
2786
2928
  else
2787
2929
  if input.index(Regexp.new('[0-9]'), index) == index
2788
- r2 = (SyntaxNode).new(input, index...(index + 1))
2930
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
2789
2931
  @index += 1
2790
2932
  else
2791
2933
  r2 = nil
@@ -2836,7 +2978,7 @@ module Treetop
2836
2978
  self.index = i0
2837
2979
  r0 = nil
2838
2980
  else
2839
- r0 = SyntaxNode.new(input, i0...index, s0)
2981
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2840
2982
  end
2841
2983
 
2842
2984
  node_cache[:space][start_index] = r0
@@ -2860,7 +3002,7 @@ module Treetop
2860
3002
 
2861
3003
  i0, s0 = index, []
2862
3004
  if input.index('#', index) == index
2863
- r1 = (SyntaxNode).new(input, index...(index + 1))
3005
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
2864
3006
  @index += 1
2865
3007
  else
2866
3008
  terminal_parse_failure('#')
@@ -2873,7 +3015,7 @@ module Treetop
2873
3015
  i3, s3 = index, []
2874
3016
  i4 = index
2875
3017
  if input.index("\n", index) == index
2876
- r5 = (SyntaxNode).new(input, index...(index + 1))
3018
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
2877
3019
  @index += 1
2878
3020
  else
2879
3021
  terminal_parse_failure("\n")
@@ -2883,12 +3025,12 @@ module Treetop
2883
3025
  r4 = nil
2884
3026
  else
2885
3027
  self.index = i4
2886
- r4 = SyntaxNode.new(input, index...index)
3028
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2887
3029
  end
2888
3030
  s3 << r4
2889
3031
  if r4
2890
3032
  if index < input_length
2891
- r6 = (SyntaxNode).new(input, index...(index + 1))
3033
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
2892
3034
  @index += 1
2893
3035
  else
2894
3036
  terminal_parse_failure("any character")
@@ -2897,7 +3039,7 @@ module Treetop
2897
3039
  s3 << r6
2898
3040
  end
2899
3041
  if s3.last
2900
- r3 = (SyntaxNode).new(input, i3...index, s3)
3042
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2901
3043
  r3.extend(CommentToEol0)
2902
3044
  else
2903
3045
  self.index = i3
@@ -2909,11 +3051,11 @@ module Treetop
2909
3051
  break
2910
3052
  end
2911
3053
  end
2912
- r2 = SyntaxNode.new(input, i2...index, s2)
3054
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2913
3055
  s0 << r2
2914
3056
  end
2915
3057
  if s0.last
2916
- r0 = (SyntaxNode).new(input, i0...index, s0)
3058
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2917
3059
  r0.extend(CommentToEol1)
2918
3060
  else
2919
3061
  self.index = i0
@@ -2934,7 +3076,7 @@ module Treetop
2934
3076
  end
2935
3077
 
2936
3078
  if input.index(Regexp.new('[ \\t\\n\\r]'), index) == index
2937
- r0 = (SyntaxNode).new(input, index...(index + 1))
3079
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
2938
3080
  @index += 1
2939
3081
  else
2940
3082
  r0 = nil