delorean_lang 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/delorean.gemspec +2 -2
- data/lib/delorean/delorean.rb +552 -294
- data/lib/delorean/delorean.treetop +6 -0
- data/lib/delorean/nodes.rb +6 -0
- data/lib/delorean/version.rb +1 -1
- data/spec/eval_spec.rb +8 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7beaa9c80edc5cb0ff96f48c4fce42f98b3d63e9
|
4
|
+
data.tar.gz: d92bab10346de0a0832041f0dd2e67e67fc57b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 520a6044020cc9c8f2a962b9147e9581b84b10d3775121a77ed4fc4c469072a9d448e86c5cd6aaaa085c95e0ef6559283bd84877162ea557283ff7a8b8ce0d33
|
7
|
+
data.tar.gz: 50f9a865be0e6171a5a8ce1e6e25ab8cfb43a5b99ec6008cc08bac02d9df75a0108c2152b5ee1f0afe06422afd133c41fb783883f23cffeafd85aea30beb19dc
|
data/delorean.gemspec
CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.add_dependency "treetop", "~> 1.4"
|
20
20
|
gem.add_dependency "activerecord", "~> 3.2"
|
21
|
-
gem.add_development_dependency "rspec", '~>
|
22
|
-
gem.add_development_dependency "sqlite3", '~>
|
21
|
+
gem.add_development_dependency "rspec", '~> 2.10'
|
22
|
+
gem.add_development_dependency "sqlite3", '~> 1.3'
|
23
23
|
end
|
data/lib/delorean/delorean.rb
CHANGED
@@ -23,7 +23,7 @@ module Delorean
|
|
23
23
|
if node_cache[:line].has_key?(index)
|
24
24
|
cached = node_cache[:line][index]
|
25
25
|
if cached
|
26
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
26
|
+
node_cache[:line][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
27
27
|
@index = cached.interval.end
|
28
28
|
end
|
29
29
|
return cached
|
@@ -42,9 +42,9 @@ module Delorean
|
|
42
42
|
s0 << r2
|
43
43
|
if r2
|
44
44
|
i5, s5 = index, []
|
45
|
-
if has_terminal?('#', false, index)
|
46
|
-
r6 =
|
47
|
-
@index +=
|
45
|
+
if (match_len = has_terminal?('#', false, index))
|
46
|
+
r6 = true
|
47
|
+
@index += match_len
|
48
48
|
else
|
49
49
|
terminal_parse_failure('#')
|
50
50
|
r6 = nil
|
@@ -54,7 +54,7 @@ module Delorean
|
|
54
54
|
s7, i7 = [], index
|
55
55
|
loop do
|
56
56
|
if index < input_length
|
57
|
-
r8 =
|
57
|
+
r8 = true
|
58
58
|
@index += 1
|
59
59
|
else
|
60
60
|
terminal_parse_failure("any character")
|
@@ -179,7 +179,7 @@ module Delorean
|
|
179
179
|
if node_cache[:formula].has_key?(index)
|
180
180
|
cached = node_cache[:formula][index]
|
181
181
|
if cached
|
182
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
182
|
+
node_cache[:formula][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
183
183
|
@index = cached.interval.end
|
184
184
|
end
|
185
185
|
return cached
|
@@ -201,9 +201,9 @@ module Delorean
|
|
201
201
|
end
|
202
202
|
s1 << r4
|
203
203
|
if r4
|
204
|
-
if has_terminal?('=?', false, index)
|
205
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index +
|
206
|
-
@index +=
|
204
|
+
if (match_len = has_terminal?('=?', false, index))
|
205
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
206
|
+
@index += match_len
|
207
207
|
else
|
208
208
|
terminal_parse_failure('=?')
|
209
209
|
r6 = nil
|
@@ -233,6 +233,7 @@ module Delorean
|
|
233
233
|
r1 = nil
|
234
234
|
end
|
235
235
|
if r1
|
236
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
236
237
|
r0 = r1
|
237
238
|
else
|
238
239
|
i10, s10 = index, []
|
@@ -250,9 +251,9 @@ module Delorean
|
|
250
251
|
end
|
251
252
|
s10 << r13
|
252
253
|
if r13
|
253
|
-
if has_terminal?('=?', false, index)
|
254
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index +
|
255
|
-
@index +=
|
254
|
+
if (match_len = has_terminal?('=?', false, index))
|
255
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
256
|
+
@index += match_len
|
256
257
|
else
|
257
258
|
terminal_parse_failure('=?')
|
258
259
|
r15 = nil
|
@@ -269,6 +270,7 @@ module Delorean
|
|
269
270
|
r10 = nil
|
270
271
|
end
|
271
272
|
if r10
|
273
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
272
274
|
r0 = r10
|
273
275
|
else
|
274
276
|
i16, s16 = index, []
|
@@ -286,9 +288,9 @@ module Delorean
|
|
286
288
|
end
|
287
289
|
s16 << r19
|
288
290
|
if r19
|
289
|
-
if has_terminal?('=', false, index)
|
290
|
-
r21 =
|
291
|
-
@index +=
|
291
|
+
if (match_len = has_terminal?('=', false, index))
|
292
|
+
r21 = true
|
293
|
+
@index += match_len
|
292
294
|
else
|
293
295
|
terminal_parse_failure('=')
|
294
296
|
r21 = nil
|
@@ -318,15 +320,16 @@ module Delorean
|
|
318
320
|
r16 = nil
|
319
321
|
end
|
320
322
|
if r16
|
323
|
+
r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
|
321
324
|
r0 = r16
|
322
325
|
else
|
323
326
|
i25, s25 = index, []
|
324
327
|
r26 = _nt_class_name
|
325
328
|
s25 << r26
|
326
329
|
if r26
|
327
|
-
if has_terminal?(':', false, index)
|
328
|
-
r27 =
|
329
|
-
@index +=
|
330
|
+
if (match_len = has_terminal?(':', false, index))
|
331
|
+
r27 = true
|
332
|
+
@index += match_len
|
330
333
|
else
|
331
334
|
terminal_parse_failure(':')
|
332
335
|
r27 = nil
|
@@ -345,9 +348,9 @@ module Delorean
|
|
345
348
|
r32 = _nt_class_name
|
346
349
|
s31 << r32
|
347
350
|
if r32
|
348
|
-
if has_terminal?('::', false, index)
|
349
|
-
r33 = instantiate_node(SyntaxNode,input, index...(index +
|
350
|
-
@index +=
|
351
|
+
if (match_len = has_terminal?('::', false, index))
|
352
|
+
r33 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
353
|
+
@index += match_len
|
351
354
|
else
|
352
355
|
terminal_parse_failure('::')
|
353
356
|
r33 = nil
|
@@ -382,15 +385,16 @@ module Delorean
|
|
382
385
|
r25 = nil
|
383
386
|
end
|
384
387
|
if r25
|
388
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
385
389
|
r0 = r25
|
386
390
|
else
|
387
391
|
i35, s35 = index, []
|
388
392
|
r36 = _nt_class_name
|
389
393
|
s35 << r36
|
390
394
|
if r36
|
391
|
-
if has_terminal?(':', false, index)
|
392
|
-
r37 =
|
393
|
-
@index +=
|
395
|
+
if (match_len = has_terminal?(':', false, index))
|
396
|
+
r37 = true
|
397
|
+
@index += match_len
|
394
398
|
else
|
395
399
|
terminal_parse_failure(':')
|
396
400
|
r37 = nil
|
@@ -405,12 +409,13 @@ module Delorean
|
|
405
409
|
r35 = nil
|
406
410
|
end
|
407
411
|
if r35
|
412
|
+
r35 = SyntaxNode.new(input, (index-1)...index) if r35 == true
|
408
413
|
r0 = r35
|
409
414
|
else
|
410
415
|
i38, s38 = index, []
|
411
|
-
if has_terminal?('import', false, index)
|
412
|
-
r39 = instantiate_node(SyntaxNode,input, index...(index +
|
413
|
-
@index +=
|
416
|
+
if (match_len = has_terminal?('import', false, index))
|
417
|
+
r39 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
418
|
+
@index += match_len
|
414
419
|
else
|
415
420
|
terminal_parse_failure('import')
|
416
421
|
r39 = nil
|
@@ -432,6 +437,7 @@ module Delorean
|
|
432
437
|
r38 = nil
|
433
438
|
end
|
434
439
|
if r38
|
440
|
+
r38 = SyntaxNode.new(input, (index-1)...index) if r38 == true
|
435
441
|
r0 = r38
|
436
442
|
else
|
437
443
|
@index = i0
|
@@ -456,27 +462,29 @@ module Delorean
|
|
456
462
|
if node_cache[:class_name].has_key?(index)
|
457
463
|
cached = node_cache[:class_name][index]
|
458
464
|
if cached
|
459
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
465
|
+
node_cache[:class_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
460
466
|
@index = cached.interval.end
|
461
467
|
end
|
462
468
|
return cached
|
463
469
|
end
|
464
470
|
|
465
471
|
i0, s0 = index, []
|
466
|
-
if has_terminal?('\
|
472
|
+
if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
|
467
473
|
r1 = true
|
468
474
|
@index += 1
|
469
475
|
else
|
476
|
+
terminal_parse_failure('[A-Z]')
|
470
477
|
r1 = nil
|
471
478
|
end
|
472
479
|
s0 << r1
|
473
480
|
if r1
|
474
481
|
s2, i2 = [], index
|
475
482
|
loop do
|
476
|
-
if has_terminal?('\
|
483
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
477
484
|
r3 = true
|
478
485
|
@index += 1
|
479
486
|
else
|
487
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
480
488
|
r3 = nil
|
481
489
|
end
|
482
490
|
if r3
|
@@ -551,7 +559,7 @@ module Delorean
|
|
551
559
|
if node_cache[:expression].has_key?(index)
|
552
560
|
cached = node_cache[:expression][index]
|
553
561
|
if cached
|
554
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
562
|
+
node_cache[:expression][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
555
563
|
@index = cached.interval.end
|
556
564
|
end
|
557
565
|
return cached
|
@@ -559,9 +567,9 @@ module Delorean
|
|
559
567
|
|
560
568
|
i0 = index
|
561
569
|
i1, s1 = index, []
|
562
|
-
if has_terminal?('ERR(', false, index)
|
563
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index +
|
564
|
-
@index +=
|
570
|
+
if (match_len = has_terminal?('ERR(', false, index))
|
571
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
572
|
+
@index += match_len
|
565
573
|
else
|
566
574
|
terminal_parse_failure('ERR(')
|
567
575
|
r2 = nil
|
@@ -587,9 +595,9 @@ module Delorean
|
|
587
595
|
end
|
588
596
|
s1 << r6
|
589
597
|
if r6
|
590
|
-
if has_terminal?(')', false, index)
|
591
|
-
r8 =
|
592
|
-
@index +=
|
598
|
+
if (match_len = has_terminal?(')', false, index))
|
599
|
+
r8 = true
|
600
|
+
@index += match_len
|
593
601
|
else
|
594
602
|
terminal_parse_failure(')')
|
595
603
|
r8 = nil
|
@@ -607,6 +615,7 @@ module Delorean
|
|
607
615
|
r1 = nil
|
608
616
|
end
|
609
617
|
if r1
|
618
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
610
619
|
r0 = r1
|
611
620
|
else
|
612
621
|
i9, s9 = index, []
|
@@ -633,12 +642,13 @@ module Delorean
|
|
633
642
|
r9 = nil
|
634
643
|
end
|
635
644
|
if r9
|
645
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
636
646
|
r0 = r9
|
637
647
|
else
|
638
648
|
i14, s14 = index, []
|
639
|
-
if has_terminal?('if', false, index)
|
640
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index +
|
641
|
-
@index +=
|
649
|
+
if (match_len = has_terminal?('if', false, index))
|
650
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
651
|
+
@index += match_len
|
642
652
|
else
|
643
653
|
terminal_parse_failure('if')
|
644
654
|
r15 = nil
|
@@ -664,9 +674,9 @@ module Delorean
|
|
664
674
|
end
|
665
675
|
s14 << r19
|
666
676
|
if r19
|
667
|
-
if has_terminal?('then', false, index)
|
668
|
-
r21 = instantiate_node(SyntaxNode,input, index...(index +
|
669
|
-
@index +=
|
677
|
+
if (match_len = has_terminal?('then', false, index))
|
678
|
+
r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
679
|
+
@index += match_len
|
670
680
|
else
|
671
681
|
terminal_parse_failure('then')
|
672
682
|
r21 = nil
|
@@ -692,9 +702,9 @@ module Delorean
|
|
692
702
|
end
|
693
703
|
s14 << r25
|
694
704
|
if r25
|
695
|
-
if has_terminal?('else', false, index)
|
696
|
-
r27 = instantiate_node(SyntaxNode,input, index...(index +
|
697
|
-
@index +=
|
705
|
+
if (match_len = has_terminal?('else', false, index))
|
706
|
+
r27 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
707
|
+
@index += match_len
|
698
708
|
else
|
699
709
|
terminal_parse_failure('else')
|
700
710
|
r27 = nil
|
@@ -729,6 +739,7 @@ module Delorean
|
|
729
739
|
r14 = nil
|
730
740
|
end
|
731
741
|
if r14
|
742
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
732
743
|
r0 = r14
|
733
744
|
else
|
734
745
|
i31, s31 = index, []
|
@@ -768,10 +779,12 @@ module Delorean
|
|
768
779
|
r31 = nil
|
769
780
|
end
|
770
781
|
if r31
|
782
|
+
r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
|
771
783
|
r0 = r31
|
772
784
|
else
|
773
785
|
r39 = _nt_getattr_exp
|
774
786
|
if r39
|
787
|
+
r39 = SyntaxNode.new(input, (index-1)...index) if r39 == true
|
775
788
|
r0 = r39
|
776
789
|
else
|
777
790
|
@index = i0
|
@@ -802,7 +815,7 @@ module Delorean
|
|
802
815
|
if node_cache[:getattr_exp].has_key?(index)
|
803
816
|
cached = node_cache[:getattr_exp][index]
|
804
817
|
if cached
|
805
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
818
|
+
node_cache[:getattr_exp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
806
819
|
@index = cached.interval.end
|
807
820
|
end
|
808
821
|
return cached
|
@@ -824,10 +837,12 @@ module Delorean
|
|
824
837
|
r1 = nil
|
825
838
|
end
|
826
839
|
if r1
|
840
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
827
841
|
r0 = r1
|
828
842
|
else
|
829
843
|
r4 = _nt_value
|
830
844
|
if r4
|
845
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
831
846
|
r0 = r4
|
832
847
|
else
|
833
848
|
@index = i0
|
@@ -855,7 +870,7 @@ module Delorean
|
|
855
870
|
if node_cache[:dotted].has_key?(index)
|
856
871
|
cached = node_cache[:dotted][index]
|
857
872
|
if cached
|
858
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
873
|
+
node_cache[:dotted][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
859
874
|
@index = cached.interval.end
|
860
875
|
end
|
861
876
|
return cached
|
@@ -922,7 +937,7 @@ module Delorean
|
|
922
937
|
if node_cache[:dot_exp].has_key?(index)
|
923
938
|
cached = node_cache[:dot_exp][index]
|
924
939
|
if cached
|
925
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
940
|
+
node_cache[:dot_exp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
926
941
|
@index = cached.interval.end
|
927
942
|
end
|
928
943
|
return cached
|
@@ -930,9 +945,9 @@ module Delorean
|
|
930
945
|
|
931
946
|
i0 = index
|
932
947
|
i1, s1 = index, []
|
933
|
-
if has_terminal?('[', false, index)
|
934
|
-
r2 =
|
935
|
-
@index +=
|
948
|
+
if (match_len = has_terminal?('[', false, index))
|
949
|
+
r2 = true
|
950
|
+
@index += match_len
|
936
951
|
else
|
937
952
|
terminal_parse_failure('[')
|
938
953
|
r2 = nil
|
@@ -958,9 +973,9 @@ module Delorean
|
|
958
973
|
end
|
959
974
|
s1 << r6
|
960
975
|
if r6
|
961
|
-
if has_terminal?(']', false, index)
|
962
|
-
r8 =
|
963
|
-
@index +=
|
976
|
+
if (match_len = has_terminal?(']', false, index))
|
977
|
+
r8 = true
|
978
|
+
@index += match_len
|
964
979
|
else
|
965
980
|
terminal_parse_failure(']')
|
966
981
|
r8 = nil
|
@@ -978,12 +993,13 @@ module Delorean
|
|
978
993
|
r1 = nil
|
979
994
|
end
|
980
995
|
if r1
|
996
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
981
997
|
r0 = r1
|
982
998
|
else
|
983
999
|
i9, s9 = index, []
|
984
|
-
if has_terminal?('(', false, index)
|
985
|
-
r10 =
|
986
|
-
@index +=
|
1000
|
+
if (match_len = has_terminal?('(', false, index))
|
1001
|
+
r10 = true
|
1002
|
+
@index += match_len
|
987
1003
|
else
|
988
1004
|
terminal_parse_failure('(')
|
989
1005
|
r10 = nil
|
@@ -1014,9 +1030,9 @@ module Delorean
|
|
1014
1030
|
end
|
1015
1031
|
s9 << r15
|
1016
1032
|
if r15
|
1017
|
-
if has_terminal?(')', false, index)
|
1018
|
-
r17 =
|
1019
|
-
@index +=
|
1033
|
+
if (match_len = has_terminal?(')', false, index))
|
1034
|
+
r17 = true
|
1035
|
+
@index += match_len
|
1020
1036
|
else
|
1021
1037
|
terminal_parse_failure(')')
|
1022
1038
|
r17 = nil
|
@@ -1034,12 +1050,13 @@ module Delorean
|
|
1034
1050
|
r9 = nil
|
1035
1051
|
end
|
1036
1052
|
if r9
|
1053
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
1037
1054
|
r0 = r9
|
1038
1055
|
else
|
1039
1056
|
i18, s18 = index, []
|
1040
|
-
if has_terminal?('.', false, index)
|
1041
|
-
r19 =
|
1042
|
-
@index +=
|
1057
|
+
if (match_len = has_terminal?('.', false, index))
|
1058
|
+
r19 = true
|
1059
|
+
@index += match_len
|
1043
1060
|
else
|
1044
1061
|
terminal_parse_failure('.')
|
1045
1062
|
r19 = nil
|
@@ -1057,9 +1074,9 @@ module Delorean
|
|
1057
1074
|
r22 = _nt_identifier
|
1058
1075
|
s18 << r22
|
1059
1076
|
if r22
|
1060
|
-
if has_terminal?('(', false, index)
|
1061
|
-
r23 =
|
1062
|
-
@index +=
|
1077
|
+
if (match_len = has_terminal?('(', false, index))
|
1078
|
+
r23 = true
|
1079
|
+
@index += match_len
|
1063
1080
|
else
|
1064
1081
|
terminal_parse_failure('(')
|
1065
1082
|
r23 = nil
|
@@ -1090,9 +1107,9 @@ module Delorean
|
|
1090
1107
|
end
|
1091
1108
|
s18 << r28
|
1092
1109
|
if r28
|
1093
|
-
if has_terminal?(')', false, index)
|
1094
|
-
r30 =
|
1095
|
-
@index +=
|
1110
|
+
if (match_len = has_terminal?(')', false, index))
|
1111
|
+
r30 = true
|
1112
|
+
@index += match_len
|
1096
1113
|
else
|
1097
1114
|
terminal_parse_failure(')')
|
1098
1115
|
r30 = nil
|
@@ -1113,12 +1130,13 @@ module Delorean
|
|
1113
1130
|
r18 = nil
|
1114
1131
|
end
|
1115
1132
|
if r18
|
1133
|
+
r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
|
1116
1134
|
r0 = r18
|
1117
1135
|
else
|
1118
1136
|
i31, s31 = index, []
|
1119
|
-
if has_terminal?('.', false, index)
|
1120
|
-
r32 =
|
1121
|
-
@index +=
|
1137
|
+
if (match_len = has_terminal?('.', false, index))
|
1138
|
+
r32 = true
|
1139
|
+
@index += match_len
|
1122
1140
|
else
|
1123
1141
|
terminal_parse_failure('.')
|
1124
1142
|
r32 = nil
|
@@ -1136,10 +1154,12 @@ module Delorean
|
|
1136
1154
|
i35 = index
|
1137
1155
|
r36 = _nt_identifier
|
1138
1156
|
if r36
|
1157
|
+
r36 = SyntaxNode.new(input, (index-1)...index) if r36 == true
|
1139
1158
|
r35 = r36
|
1140
1159
|
else
|
1141
1160
|
r37 = _nt_integer
|
1142
1161
|
if r37
|
1162
|
+
r37 = SyntaxNode.new(input, (index-1)...index) if r37 == true
|
1143
1163
|
r35 = r37
|
1144
1164
|
else
|
1145
1165
|
@index = i35
|
@@ -1157,6 +1177,7 @@ module Delorean
|
|
1157
1177
|
r31 = nil
|
1158
1178
|
end
|
1159
1179
|
if r31
|
1180
|
+
r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
|
1160
1181
|
r0 = r31
|
1161
1182
|
else
|
1162
1183
|
@index = i0
|
@@ -1192,7 +1213,7 @@ module Delorean
|
|
1192
1213
|
if node_cache[:unpack_args].has_key?(index)
|
1193
1214
|
cached = node_cache[:unpack_args][index]
|
1194
1215
|
if cached
|
1195
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1216
|
+
node_cache[:unpack_args][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1196
1217
|
@index = cached.interval.end
|
1197
1218
|
end
|
1198
1219
|
return cached
|
@@ -1211,9 +1232,9 @@ module Delorean
|
|
1211
1232
|
end
|
1212
1233
|
s3 << r4
|
1213
1234
|
if r4
|
1214
|
-
if has_terminal?(',', false, index)
|
1215
|
-
r6 =
|
1216
|
-
@index +=
|
1235
|
+
if (match_len = has_terminal?(',', false, index))
|
1236
|
+
r6 = true
|
1237
|
+
@index += match_len
|
1217
1238
|
else
|
1218
1239
|
terminal_parse_failure(',')
|
1219
1240
|
r6 = nil
|
@@ -1323,27 +1344,28 @@ module Delorean
|
|
1323
1344
|
if node_cache[:list_expr].has_key?(index)
|
1324
1345
|
cached = node_cache[:list_expr][index]
|
1325
1346
|
if cached
|
1326
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1347
|
+
node_cache[:list_expr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1327
1348
|
@index = cached.interval.end
|
1328
1349
|
end
|
1329
1350
|
return cached
|
1330
1351
|
end
|
1331
1352
|
|
1332
1353
|
i0 = index
|
1333
|
-
if has_terminal?('[]', false, index)
|
1334
|
-
r1 = instantiate_node(ListExpr,input, index...(index +
|
1335
|
-
@index +=
|
1354
|
+
if (match_len = has_terminal?('[]', false, index))
|
1355
|
+
r1 = instantiate_node(ListExpr,input, index...(index + match_len))
|
1356
|
+
@index += match_len
|
1336
1357
|
else
|
1337
1358
|
terminal_parse_failure('[]')
|
1338
1359
|
r1 = nil
|
1339
1360
|
end
|
1340
1361
|
if r1
|
1362
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1341
1363
|
r0 = r1
|
1342
1364
|
else
|
1343
1365
|
i2, s2 = index, []
|
1344
|
-
if has_terminal?('[', false, index)
|
1345
|
-
r3 =
|
1346
|
-
@index +=
|
1366
|
+
if (match_len = has_terminal?('[', false, index))
|
1367
|
+
r3 = true
|
1368
|
+
@index += match_len
|
1347
1369
|
else
|
1348
1370
|
terminal_parse_failure('[')
|
1349
1371
|
r3 = nil
|
@@ -1364,9 +1386,9 @@ module Delorean
|
|
1364
1386
|
r7 = _nt_sp
|
1365
1387
|
s2 << r7
|
1366
1388
|
if r7
|
1367
|
-
if has_terminal?('for', false, index)
|
1368
|
-
r8 = instantiate_node(SyntaxNode,input, index...(index +
|
1369
|
-
@index +=
|
1389
|
+
if (match_len = has_terminal?('for', false, index))
|
1390
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1391
|
+
@index += match_len
|
1370
1392
|
else
|
1371
1393
|
terminal_parse_failure('for')
|
1372
1394
|
r8 = nil
|
@@ -1382,9 +1404,9 @@ module Delorean
|
|
1382
1404
|
r11 = _nt_sp
|
1383
1405
|
s2 << r11
|
1384
1406
|
if r11
|
1385
|
-
if has_terminal?('in', false, index)
|
1386
|
-
r12 = instantiate_node(SyntaxNode,input, index...(index +
|
1387
|
-
@index +=
|
1407
|
+
if (match_len = has_terminal?('in', false, index))
|
1408
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1409
|
+
@index += match_len
|
1388
1410
|
else
|
1389
1411
|
terminal_parse_failure('in')
|
1390
1412
|
r12 = nil
|
@@ -1406,9 +1428,9 @@ module Delorean
|
|
1406
1428
|
s2 << r15
|
1407
1429
|
if r15
|
1408
1430
|
i18, s18 = index, []
|
1409
|
-
if has_terminal?('if', false, index)
|
1410
|
-
r19 = instantiate_node(SyntaxNode,input, index...(index +
|
1411
|
-
@index +=
|
1431
|
+
if (match_len = has_terminal?('if', false, index))
|
1432
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1433
|
+
@index += match_len
|
1412
1434
|
else
|
1413
1435
|
terminal_parse_failure('if')
|
1414
1436
|
r19 = nil
|
@@ -1445,9 +1467,9 @@ module Delorean
|
|
1445
1467
|
end
|
1446
1468
|
s2 << r17
|
1447
1469
|
if r17
|
1448
|
-
if has_terminal?(']', false, index)
|
1449
|
-
r24 =
|
1450
|
-
@index +=
|
1470
|
+
if (match_len = has_terminal?(']', false, index))
|
1471
|
+
r24 = true
|
1472
|
+
@index += match_len
|
1451
1473
|
else
|
1452
1474
|
terminal_parse_failure(']')
|
1453
1475
|
r24 = nil
|
@@ -1474,12 +1496,13 @@ module Delorean
|
|
1474
1496
|
r2 = nil
|
1475
1497
|
end
|
1476
1498
|
if r2
|
1499
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1477
1500
|
r0 = r2
|
1478
1501
|
else
|
1479
1502
|
i25, s25 = index, []
|
1480
|
-
if has_terminal?('[', false, index)
|
1481
|
-
r26 =
|
1482
|
-
@index +=
|
1503
|
+
if (match_len = has_terminal?('[', false, index))
|
1504
|
+
r26 = true
|
1505
|
+
@index += match_len
|
1483
1506
|
else
|
1484
1507
|
terminal_parse_failure('[')
|
1485
1508
|
r26 = nil
|
@@ -1505,9 +1528,9 @@ module Delorean
|
|
1505
1528
|
end
|
1506
1529
|
s25 << r30
|
1507
1530
|
if r30
|
1508
|
-
if has_terminal?(']', false, index)
|
1509
|
-
r32 =
|
1510
|
-
@index +=
|
1531
|
+
if (match_len = has_terminal?(']', false, index))
|
1532
|
+
r32 = true
|
1533
|
+
@index += match_len
|
1511
1534
|
else
|
1512
1535
|
terminal_parse_failure(']')
|
1513
1536
|
r32 = nil
|
@@ -1525,6 +1548,7 @@ module Delorean
|
|
1525
1548
|
r25 = nil
|
1526
1549
|
end
|
1527
1550
|
if r25
|
1551
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
1528
1552
|
r0 = r25
|
1529
1553
|
else
|
1530
1554
|
@index = i0
|
@@ -1539,6 +1563,52 @@ module Delorean
|
|
1539
1563
|
end
|
1540
1564
|
|
1541
1565
|
module SetExpr0
|
1566
|
+
def sp
|
1567
|
+
elements[1]
|
1568
|
+
end
|
1569
|
+
|
1570
|
+
def e3
|
1571
|
+
elements[2]
|
1572
|
+
end
|
1573
|
+
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
module SetExpr1
|
1577
|
+
def e2
|
1578
|
+
elements[2]
|
1579
|
+
end
|
1580
|
+
|
1581
|
+
def sp1
|
1582
|
+
elements[3]
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
def sp2
|
1586
|
+
elements[5]
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
def args
|
1590
|
+
elements[6]
|
1591
|
+
end
|
1592
|
+
|
1593
|
+
def sp3
|
1594
|
+
elements[7]
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
def sp4
|
1598
|
+
elements[9]
|
1599
|
+
end
|
1600
|
+
|
1601
|
+
def e1
|
1602
|
+
elements[10]
|
1603
|
+
end
|
1604
|
+
|
1605
|
+
def ifexp
|
1606
|
+
elements[12]
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
module SetExpr2
|
1542
1612
|
def args
|
1543
1613
|
elements[2]
|
1544
1614
|
end
|
@@ -1550,27 +1620,28 @@ module Delorean
|
|
1550
1620
|
if node_cache[:set_expr].has_key?(index)
|
1551
1621
|
cached = node_cache[:set_expr][index]
|
1552
1622
|
if cached
|
1553
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1623
|
+
node_cache[:set_expr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1554
1624
|
@index = cached.interval.end
|
1555
1625
|
end
|
1556
1626
|
return cached
|
1557
1627
|
end
|
1558
1628
|
|
1559
1629
|
i0 = index
|
1560
|
-
if has_terminal?('{-}', false, index)
|
1561
|
-
r1 = instantiate_node(SetExpr,input, index...(index +
|
1562
|
-
@index +=
|
1630
|
+
if (match_len = has_terminal?('{-}', false, index))
|
1631
|
+
r1 = instantiate_node(SetExpr,input, index...(index + match_len))
|
1632
|
+
@index += match_len
|
1563
1633
|
else
|
1564
1634
|
terminal_parse_failure('{-}')
|
1565
1635
|
r1 = nil
|
1566
1636
|
end
|
1567
1637
|
if r1
|
1638
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1568
1639
|
r0 = r1
|
1569
1640
|
else
|
1570
1641
|
i2, s2 = index, []
|
1571
|
-
if has_terminal?('{', false, index)
|
1572
|
-
r3 =
|
1573
|
-
@index +=
|
1642
|
+
if (match_len = has_terminal?('{', false, index))
|
1643
|
+
r3 = true
|
1644
|
+
@index += match_len
|
1574
1645
|
else
|
1575
1646
|
terminal_parse_failure('{')
|
1576
1647
|
r3 = nil
|
@@ -1585,41 +1656,180 @@ module Delorean
|
|
1585
1656
|
end
|
1586
1657
|
s2 << r4
|
1587
1658
|
if r4
|
1588
|
-
r6 =
|
1659
|
+
r6 = _nt_expression
|
1589
1660
|
s2 << r6
|
1590
1661
|
if r6
|
1591
|
-
|
1592
|
-
if r8
|
1593
|
-
r7 = r8
|
1594
|
-
else
|
1595
|
-
r7 = instantiate_node(SyntaxNode,input, index...index)
|
1596
|
-
end
|
1662
|
+
r7 = _nt_sp
|
1597
1663
|
s2 << r7
|
1598
1664
|
if r7
|
1599
|
-
if has_terminal?('
|
1600
|
-
|
1601
|
-
@index +=
|
1665
|
+
if (match_len = has_terminal?('for', false, index))
|
1666
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1667
|
+
@index += match_len
|
1602
1668
|
else
|
1603
|
-
terminal_parse_failure('
|
1604
|
-
|
1669
|
+
terminal_parse_failure('for')
|
1670
|
+
r8 = nil
|
1671
|
+
end
|
1672
|
+
s2 << r8
|
1673
|
+
if r8
|
1674
|
+
r9 = _nt_sp
|
1675
|
+
s2 << r9
|
1676
|
+
if r9
|
1677
|
+
r10 = _nt_unpack_args
|
1678
|
+
s2 << r10
|
1679
|
+
if r10
|
1680
|
+
r11 = _nt_sp
|
1681
|
+
s2 << r11
|
1682
|
+
if r11
|
1683
|
+
if (match_len = has_terminal?('in', false, index))
|
1684
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1685
|
+
@index += match_len
|
1686
|
+
else
|
1687
|
+
terminal_parse_failure('in')
|
1688
|
+
r12 = nil
|
1689
|
+
end
|
1690
|
+
s2 << r12
|
1691
|
+
if r12
|
1692
|
+
r13 = _nt_sp
|
1693
|
+
s2 << r13
|
1694
|
+
if r13
|
1695
|
+
r14 = _nt_expression
|
1696
|
+
s2 << r14
|
1697
|
+
if r14
|
1698
|
+
r16 = _nt_sp
|
1699
|
+
if r16
|
1700
|
+
r15 = r16
|
1701
|
+
else
|
1702
|
+
r15 = instantiate_node(SyntaxNode,input, index...index)
|
1703
|
+
end
|
1704
|
+
s2 << r15
|
1705
|
+
if r15
|
1706
|
+
i18, s18 = index, []
|
1707
|
+
if (match_len = has_terminal?('if', false, index))
|
1708
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1709
|
+
@index += match_len
|
1710
|
+
else
|
1711
|
+
terminal_parse_failure('if')
|
1712
|
+
r19 = nil
|
1713
|
+
end
|
1714
|
+
s18 << r19
|
1715
|
+
if r19
|
1716
|
+
r20 = _nt_sp
|
1717
|
+
s18 << r20
|
1718
|
+
if r20
|
1719
|
+
r21 = _nt_expression
|
1720
|
+
s18 << r21
|
1721
|
+
if r21
|
1722
|
+
r23 = _nt_sp
|
1723
|
+
if r23
|
1724
|
+
r22 = r23
|
1725
|
+
else
|
1726
|
+
r22 = instantiate_node(SyntaxNode,input, index...index)
|
1727
|
+
end
|
1728
|
+
s18 << r22
|
1729
|
+
end
|
1730
|
+
end
|
1731
|
+
end
|
1732
|
+
if s18.last
|
1733
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
1734
|
+
r18.extend(SetExpr0)
|
1735
|
+
else
|
1736
|
+
@index = i18
|
1737
|
+
r18 = nil
|
1738
|
+
end
|
1739
|
+
if r18
|
1740
|
+
r17 = r18
|
1741
|
+
else
|
1742
|
+
r17 = instantiate_node(SyntaxNode,input, index...index)
|
1743
|
+
end
|
1744
|
+
s2 << r17
|
1745
|
+
if r17
|
1746
|
+
if (match_len = has_terminal?('}', false, index))
|
1747
|
+
r24 = true
|
1748
|
+
@index += match_len
|
1749
|
+
else
|
1750
|
+
terminal_parse_failure('}')
|
1751
|
+
r24 = nil
|
1752
|
+
end
|
1753
|
+
s2 << r24
|
1754
|
+
end
|
1755
|
+
end
|
1756
|
+
end
|
1757
|
+
end
|
1758
|
+
end
|
1759
|
+
end
|
1760
|
+
end
|
1761
|
+
end
|
1605
1762
|
end
|
1606
|
-
s2 << r9
|
1607
1763
|
end
|
1608
1764
|
end
|
1609
1765
|
end
|
1610
1766
|
end
|
1611
1767
|
if s2.last
|
1612
|
-
r2 = instantiate_node(
|
1613
|
-
r2.extend(
|
1768
|
+
r2 = instantiate_node(SetComprehension,input, i2...index, s2)
|
1769
|
+
r2.extend(SetExpr1)
|
1614
1770
|
else
|
1615
1771
|
@index = i2
|
1616
1772
|
r2 = nil
|
1617
1773
|
end
|
1618
1774
|
if r2
|
1775
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1619
1776
|
r0 = r2
|
1620
1777
|
else
|
1621
|
-
|
1622
|
-
|
1778
|
+
i25, s25 = index, []
|
1779
|
+
if (match_len = has_terminal?('{', false, index))
|
1780
|
+
r26 = true
|
1781
|
+
@index += match_len
|
1782
|
+
else
|
1783
|
+
terminal_parse_failure('{')
|
1784
|
+
r26 = nil
|
1785
|
+
end
|
1786
|
+
s25 << r26
|
1787
|
+
if r26
|
1788
|
+
r28 = _nt_sp
|
1789
|
+
if r28
|
1790
|
+
r27 = r28
|
1791
|
+
else
|
1792
|
+
r27 = instantiate_node(SyntaxNode,input, index...index)
|
1793
|
+
end
|
1794
|
+
s25 << r27
|
1795
|
+
if r27
|
1796
|
+
r29 = _nt_fn_args
|
1797
|
+
s25 << r29
|
1798
|
+
if r29
|
1799
|
+
r31 = _nt_sp
|
1800
|
+
if r31
|
1801
|
+
r30 = r31
|
1802
|
+
else
|
1803
|
+
r30 = instantiate_node(SyntaxNode,input, index...index)
|
1804
|
+
end
|
1805
|
+
s25 << r30
|
1806
|
+
if r30
|
1807
|
+
if (match_len = has_terminal?('}', false, index))
|
1808
|
+
r32 = true
|
1809
|
+
@index += match_len
|
1810
|
+
else
|
1811
|
+
terminal_parse_failure('}')
|
1812
|
+
r32 = nil
|
1813
|
+
end
|
1814
|
+
s25 << r32
|
1815
|
+
end
|
1816
|
+
end
|
1817
|
+
end
|
1818
|
+
end
|
1819
|
+
if s25.last
|
1820
|
+
r25 = instantiate_node(SetExpr,input, i25...index, s25)
|
1821
|
+
r25.extend(SetExpr2)
|
1822
|
+
else
|
1823
|
+
@index = i25
|
1824
|
+
r25 = nil
|
1825
|
+
end
|
1826
|
+
if r25
|
1827
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
1828
|
+
r0 = r25
|
1829
|
+
else
|
1830
|
+
@index = i0
|
1831
|
+
r0 = nil
|
1832
|
+
end
|
1623
1833
|
end
|
1624
1834
|
end
|
1625
1835
|
|
@@ -1690,27 +1900,28 @@ module Delorean
|
|
1690
1900
|
if node_cache[:hash_expr].has_key?(index)
|
1691
1901
|
cached = node_cache[:hash_expr][index]
|
1692
1902
|
if cached
|
1693
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1903
|
+
node_cache[:hash_expr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1694
1904
|
@index = cached.interval.end
|
1695
1905
|
end
|
1696
1906
|
return cached
|
1697
1907
|
end
|
1698
1908
|
|
1699
1909
|
i0 = index
|
1700
|
-
if has_terminal?('{}', false, index)
|
1701
|
-
r1 = instantiate_node(HashExpr,input, index...(index +
|
1702
|
-
@index +=
|
1910
|
+
if (match_len = has_terminal?('{}', false, index))
|
1911
|
+
r1 = instantiate_node(HashExpr,input, index...(index + match_len))
|
1912
|
+
@index += match_len
|
1703
1913
|
else
|
1704
1914
|
terminal_parse_failure('{}')
|
1705
1915
|
r1 = nil
|
1706
1916
|
end
|
1707
1917
|
if r1
|
1918
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1708
1919
|
r0 = r1
|
1709
1920
|
else
|
1710
1921
|
i2, s2 = index, []
|
1711
|
-
if has_terminal?('{', false, index)
|
1712
|
-
r3 =
|
1713
|
-
@index +=
|
1922
|
+
if (match_len = has_terminal?('{', false, index))
|
1923
|
+
r3 = true
|
1924
|
+
@index += match_len
|
1714
1925
|
else
|
1715
1926
|
terminal_parse_failure('{')
|
1716
1927
|
r3 = nil
|
@@ -1736,9 +1947,9 @@ module Delorean
|
|
1736
1947
|
end
|
1737
1948
|
s2 << r7
|
1738
1949
|
if r7
|
1739
|
-
if has_terminal?(':', false, index)
|
1740
|
-
r9 =
|
1741
|
-
@index +=
|
1950
|
+
if (match_len = has_terminal?(':', false, index))
|
1951
|
+
r9 = true
|
1952
|
+
@index += match_len
|
1742
1953
|
else
|
1743
1954
|
terminal_parse_failure(':')
|
1744
1955
|
r9 = nil
|
@@ -1759,9 +1970,9 @@ module Delorean
|
|
1759
1970
|
r13 = _nt_sp
|
1760
1971
|
s2 << r13
|
1761
1972
|
if r13
|
1762
|
-
if has_terminal?('for', false, index)
|
1763
|
-
r14 = instantiate_node(SyntaxNode,input, index...(index +
|
1764
|
-
@index +=
|
1973
|
+
if (match_len = has_terminal?('for', false, index))
|
1974
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1975
|
+
@index += match_len
|
1765
1976
|
else
|
1766
1977
|
terminal_parse_failure('for')
|
1767
1978
|
r14 = nil
|
@@ -1777,9 +1988,9 @@ module Delorean
|
|
1777
1988
|
r17 = _nt_sp
|
1778
1989
|
s2 << r17
|
1779
1990
|
if r17
|
1780
|
-
if has_terminal?('in', false, index)
|
1781
|
-
r18 = instantiate_node(SyntaxNode,input, index...(index +
|
1782
|
-
@index +=
|
1991
|
+
if (match_len = has_terminal?('in', false, index))
|
1992
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1993
|
+
@index += match_len
|
1783
1994
|
else
|
1784
1995
|
terminal_parse_failure('in')
|
1785
1996
|
r18 = nil
|
@@ -1801,9 +2012,9 @@ module Delorean
|
|
1801
2012
|
s2 << r21
|
1802
2013
|
if r21
|
1803
2014
|
i24, s24 = index, []
|
1804
|
-
if has_terminal?('if', false, index)
|
1805
|
-
r25 = instantiate_node(SyntaxNode,input, index...(index +
|
1806
|
-
@index +=
|
2015
|
+
if (match_len = has_terminal?('if', false, index))
|
2016
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2017
|
+
@index += match_len
|
1807
2018
|
else
|
1808
2019
|
terminal_parse_failure('if')
|
1809
2020
|
r25 = nil
|
@@ -1840,9 +2051,9 @@ module Delorean
|
|
1840
2051
|
end
|
1841
2052
|
s2 << r23
|
1842
2053
|
if r23
|
1843
|
-
if has_terminal?('}', false, index)
|
1844
|
-
r30 =
|
1845
|
-
@index +=
|
2054
|
+
if (match_len = has_terminal?('}', false, index))
|
2055
|
+
r30 = true
|
2056
|
+
@index += match_len
|
1846
2057
|
else
|
1847
2058
|
terminal_parse_failure('}')
|
1848
2059
|
r30 = nil
|
@@ -1873,12 +2084,13 @@ module Delorean
|
|
1873
2084
|
r2 = nil
|
1874
2085
|
end
|
1875
2086
|
if r2
|
2087
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1876
2088
|
r0 = r2
|
1877
2089
|
else
|
1878
2090
|
i31, s31 = index, []
|
1879
|
-
if has_terminal?('{', false, index)
|
1880
|
-
r32 =
|
1881
|
-
@index +=
|
2091
|
+
if (match_len = has_terminal?('{', false, index))
|
2092
|
+
r32 = true
|
2093
|
+
@index += match_len
|
1882
2094
|
else
|
1883
2095
|
terminal_parse_failure('{')
|
1884
2096
|
r32 = nil
|
@@ -1904,9 +2116,9 @@ module Delorean
|
|
1904
2116
|
end
|
1905
2117
|
s31 << r36
|
1906
2118
|
if r36
|
1907
|
-
if has_terminal?('}', false, index)
|
1908
|
-
r38 =
|
1909
|
-
@index +=
|
2119
|
+
if (match_len = has_terminal?('}', false, index))
|
2120
|
+
r38 = true
|
2121
|
+
@index += match_len
|
1910
2122
|
else
|
1911
2123
|
terminal_parse_failure('}')
|
1912
2124
|
r38 = nil
|
@@ -1924,6 +2136,7 @@ module Delorean
|
|
1924
2136
|
r31 = nil
|
1925
2137
|
end
|
1926
2138
|
if r31
|
2139
|
+
r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
|
1927
2140
|
r0 = r31
|
1928
2141
|
else
|
1929
2142
|
@index = i0
|
@@ -1942,171 +2155,187 @@ module Delorean
|
|
1942
2155
|
if node_cache[:binary_op].has_key?(index)
|
1943
2156
|
cached = node_cache[:binary_op][index]
|
1944
2157
|
if cached
|
1945
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2158
|
+
node_cache[:binary_op][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1946
2159
|
@index = cached.interval.end
|
1947
2160
|
end
|
1948
2161
|
return cached
|
1949
2162
|
end
|
1950
2163
|
|
1951
2164
|
i0 = index
|
1952
|
-
if has_terminal?('==', false, index)
|
1953
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index +
|
1954
|
-
@index +=
|
2165
|
+
if (match_len = has_terminal?('==', false, index))
|
2166
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2167
|
+
@index += match_len
|
1955
2168
|
else
|
1956
2169
|
terminal_parse_failure('==')
|
1957
2170
|
r1 = nil
|
1958
2171
|
end
|
1959
2172
|
if r1
|
2173
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1960
2174
|
r0 = r1
|
1961
2175
|
else
|
1962
|
-
if has_terminal?('!=', false, index)
|
1963
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index +
|
1964
|
-
@index +=
|
2176
|
+
if (match_len = has_terminal?('!=', false, index))
|
2177
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2178
|
+
@index += match_len
|
1965
2179
|
else
|
1966
2180
|
terminal_parse_failure('!=')
|
1967
2181
|
r2 = nil
|
1968
2182
|
end
|
1969
2183
|
if r2
|
2184
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1970
2185
|
r0 = r2
|
1971
2186
|
else
|
1972
|
-
if has_terminal?('>=', false, index)
|
1973
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index +
|
1974
|
-
@index +=
|
2187
|
+
if (match_len = has_terminal?('>=', false, index))
|
2188
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2189
|
+
@index += match_len
|
1975
2190
|
else
|
1976
2191
|
terminal_parse_failure('>=')
|
1977
2192
|
r3 = nil
|
1978
2193
|
end
|
1979
2194
|
if r3
|
2195
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
1980
2196
|
r0 = r3
|
1981
2197
|
else
|
1982
|
-
if has_terminal?('<=', false, index)
|
1983
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index +
|
1984
|
-
@index +=
|
2198
|
+
if (match_len = has_terminal?('<=', false, index))
|
2199
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2200
|
+
@index += match_len
|
1985
2201
|
else
|
1986
2202
|
terminal_parse_failure('<=')
|
1987
2203
|
r4 = nil
|
1988
2204
|
end
|
1989
2205
|
if r4
|
2206
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
1990
2207
|
r0 = r4
|
1991
2208
|
else
|
1992
|
-
if has_terminal?('&&', false, index)
|
1993
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index +
|
1994
|
-
@index +=
|
2209
|
+
if (match_len = has_terminal?('&&', false, index))
|
2210
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2211
|
+
@index += match_len
|
1995
2212
|
else
|
1996
2213
|
terminal_parse_failure('&&')
|
1997
2214
|
r5 = nil
|
1998
2215
|
end
|
1999
2216
|
if r5
|
2217
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2000
2218
|
r0 = r5
|
2001
2219
|
else
|
2002
|
-
if has_terminal?('||', false, index)
|
2003
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index +
|
2004
|
-
@index +=
|
2220
|
+
if (match_len = has_terminal?('||', false, index))
|
2221
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2222
|
+
@index += match_len
|
2005
2223
|
else
|
2006
2224
|
terminal_parse_failure('||')
|
2007
2225
|
r6 = nil
|
2008
2226
|
end
|
2009
2227
|
if r6
|
2228
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2010
2229
|
r0 = r6
|
2011
2230
|
else
|
2012
|
-
if has_terminal?('>', false, index)
|
2013
|
-
r7 =
|
2014
|
-
@index +=
|
2231
|
+
if (match_len = has_terminal?('>', false, index))
|
2232
|
+
r7 = true
|
2233
|
+
@index += match_len
|
2015
2234
|
else
|
2016
2235
|
terminal_parse_failure('>')
|
2017
2236
|
r7 = nil
|
2018
2237
|
end
|
2019
2238
|
if r7
|
2239
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2020
2240
|
r0 = r7
|
2021
2241
|
else
|
2022
|
-
if has_terminal?('<', false, index)
|
2023
|
-
r8 =
|
2024
|
-
@index +=
|
2242
|
+
if (match_len = has_terminal?('<', false, index))
|
2243
|
+
r8 = true
|
2244
|
+
@index += match_len
|
2025
2245
|
else
|
2026
2246
|
terminal_parse_failure('<')
|
2027
2247
|
r8 = nil
|
2028
2248
|
end
|
2029
2249
|
if r8
|
2250
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
2030
2251
|
r0 = r8
|
2031
2252
|
else
|
2032
|
-
if has_terminal?('+', false, index)
|
2033
|
-
r9 =
|
2034
|
-
@index +=
|
2253
|
+
if (match_len = has_terminal?('+', false, index))
|
2254
|
+
r9 = true
|
2255
|
+
@index += match_len
|
2035
2256
|
else
|
2036
2257
|
terminal_parse_failure('+')
|
2037
2258
|
r9 = nil
|
2038
2259
|
end
|
2039
2260
|
if r9
|
2261
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
2040
2262
|
r0 = r9
|
2041
2263
|
else
|
2042
|
-
if has_terminal?('-', false, index)
|
2043
|
-
r10 =
|
2044
|
-
@index +=
|
2264
|
+
if (match_len = has_terminal?('-', false, index))
|
2265
|
+
r10 = true
|
2266
|
+
@index += match_len
|
2045
2267
|
else
|
2046
2268
|
terminal_parse_failure('-')
|
2047
2269
|
r10 = nil
|
2048
2270
|
end
|
2049
2271
|
if r10
|
2272
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
2050
2273
|
r0 = r10
|
2051
2274
|
else
|
2052
|
-
if has_terminal?('*', false, index)
|
2053
|
-
r11 =
|
2054
|
-
@index +=
|
2275
|
+
if (match_len = has_terminal?('*', false, index))
|
2276
|
+
r11 = true
|
2277
|
+
@index += match_len
|
2055
2278
|
else
|
2056
2279
|
terminal_parse_failure('*')
|
2057
2280
|
r11 = nil
|
2058
2281
|
end
|
2059
2282
|
if r11
|
2283
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
2060
2284
|
r0 = r11
|
2061
2285
|
else
|
2062
|
-
if has_terminal?('/', false, index)
|
2063
|
-
r12 =
|
2064
|
-
@index +=
|
2286
|
+
if (match_len = has_terminal?('/', false, index))
|
2287
|
+
r12 = true
|
2288
|
+
@index += match_len
|
2065
2289
|
else
|
2066
2290
|
terminal_parse_failure('/')
|
2067
2291
|
r12 = nil
|
2068
2292
|
end
|
2069
2293
|
if r12
|
2294
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
2070
2295
|
r0 = r12
|
2071
2296
|
else
|
2072
|
-
if has_terminal?('%', false, index)
|
2073
|
-
r13 =
|
2074
|
-
@index +=
|
2297
|
+
if (match_len = has_terminal?('%', false, index))
|
2298
|
+
r13 = true
|
2299
|
+
@index += match_len
|
2075
2300
|
else
|
2076
2301
|
terminal_parse_failure('%')
|
2077
2302
|
r13 = nil
|
2078
2303
|
end
|
2079
2304
|
if r13
|
2305
|
+
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
2080
2306
|
r0 = r13
|
2081
2307
|
else
|
2082
|
-
if has_terminal?('&', false, index)
|
2083
|
-
r14 =
|
2084
|
-
@index +=
|
2308
|
+
if (match_len = has_terminal?('&', false, index))
|
2309
|
+
r14 = true
|
2310
|
+
@index += match_len
|
2085
2311
|
else
|
2086
2312
|
terminal_parse_failure('&')
|
2087
2313
|
r14 = nil
|
2088
2314
|
end
|
2089
2315
|
if r14
|
2316
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
2090
2317
|
r0 = r14
|
2091
2318
|
else
|
2092
|
-
if has_terminal?('^', false, index)
|
2093
|
-
r15 =
|
2094
|
-
@index +=
|
2319
|
+
if (match_len = has_terminal?('^', false, index))
|
2320
|
+
r15 = true
|
2321
|
+
@index += match_len
|
2095
2322
|
else
|
2096
2323
|
terminal_parse_failure('^')
|
2097
2324
|
r15 = nil
|
2098
2325
|
end
|
2099
2326
|
if r15
|
2327
|
+
r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
|
2100
2328
|
r0 = r15
|
2101
2329
|
else
|
2102
|
-
if has_terminal?('|', false, index)
|
2103
|
-
r16 =
|
2104
|
-
@index +=
|
2330
|
+
if (match_len = has_terminal?('|', false, index))
|
2331
|
+
r16 = true
|
2332
|
+
@index += match_len
|
2105
2333
|
else
|
2106
2334
|
terminal_parse_failure('|')
|
2107
2335
|
r16 = nil
|
2108
2336
|
end
|
2109
2337
|
if r16
|
2338
|
+
r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
|
2110
2339
|
r0 = r16
|
2111
2340
|
else
|
2112
2341
|
@index = i0
|
@@ -2138,31 +2367,33 @@ module Delorean
|
|
2138
2367
|
if node_cache[:unary_op].has_key?(index)
|
2139
2368
|
cached = node_cache[:unary_op][index]
|
2140
2369
|
if cached
|
2141
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2370
|
+
node_cache[:unary_op][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2142
2371
|
@index = cached.interval.end
|
2143
2372
|
end
|
2144
2373
|
return cached
|
2145
2374
|
end
|
2146
2375
|
|
2147
2376
|
i0 = index
|
2148
|
-
if has_terminal?('!', false, index)
|
2149
|
-
r1 =
|
2150
|
-
@index +=
|
2377
|
+
if (match_len = has_terminal?('!', false, index))
|
2378
|
+
r1 = true
|
2379
|
+
@index += match_len
|
2151
2380
|
else
|
2152
2381
|
terminal_parse_failure('!')
|
2153
2382
|
r1 = nil
|
2154
2383
|
end
|
2155
2384
|
if r1
|
2385
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2156
2386
|
r0 = r1
|
2157
2387
|
else
|
2158
|
-
if has_terminal?('-', false, index)
|
2159
|
-
r2 =
|
2160
|
-
@index +=
|
2388
|
+
if (match_len = has_terminal?('-', false, index))
|
2389
|
+
r2 = true
|
2390
|
+
@index += match_len
|
2161
2391
|
else
|
2162
2392
|
terminal_parse_failure('-')
|
2163
2393
|
r2 = nil
|
2164
2394
|
end
|
2165
2395
|
if r2
|
2396
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2166
2397
|
r0 = r2
|
2167
2398
|
else
|
2168
2399
|
@index = i0
|
@@ -2204,7 +2435,7 @@ module Delorean
|
|
2204
2435
|
if node_cache[:value].has_key?(index)
|
2205
2436
|
cached = node_cache[:value][index]
|
2206
2437
|
if cached
|
2207
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2438
|
+
node_cache[:value][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2208
2439
|
@index = cached.interval.end
|
2209
2440
|
end
|
2210
2441
|
return cached
|
@@ -2213,42 +2444,52 @@ module Delorean
|
|
2213
2444
|
i0 = index
|
2214
2445
|
r1 = _nt_decimal
|
2215
2446
|
if r1
|
2447
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2216
2448
|
r0 = r1
|
2217
2449
|
else
|
2218
2450
|
r2 = _nt_integer
|
2219
2451
|
if r2
|
2452
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2220
2453
|
r0 = r2
|
2221
2454
|
else
|
2222
2455
|
r3 = _nt_string
|
2223
2456
|
if r3
|
2457
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2224
2458
|
r0 = r3
|
2225
2459
|
else
|
2226
2460
|
r4 = _nt_boolean
|
2227
2461
|
if r4
|
2462
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2228
2463
|
r0 = r4
|
2229
2464
|
else
|
2230
2465
|
r5 = _nt_nil_val
|
2231
2466
|
if r5
|
2467
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2232
2468
|
r0 = r5
|
2233
2469
|
else
|
2234
2470
|
r6 = _nt_identifier
|
2235
2471
|
if r6
|
2472
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2236
2473
|
r0 = r6
|
2237
2474
|
else
|
2238
2475
|
r7 = _nt_self
|
2239
2476
|
if r7
|
2477
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2240
2478
|
r0 = r7
|
2241
2479
|
else
|
2242
2480
|
r8 = _nt_list_expr
|
2243
2481
|
if r8
|
2482
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
2244
2483
|
r0 = r8
|
2245
2484
|
else
|
2246
2485
|
r9 = _nt_set_expr
|
2247
2486
|
if r9
|
2487
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
2248
2488
|
r0 = r9
|
2249
2489
|
else
|
2250
2490
|
r10 = _nt_hash_expr
|
2251
2491
|
if r10
|
2492
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
2252
2493
|
r0 = r10
|
2253
2494
|
else
|
2254
2495
|
i11, s11 = index, []
|
@@ -2256,9 +2497,9 @@ module Delorean
|
|
2256
2497
|
r14 = _nt_class_name
|
2257
2498
|
s13 << r14
|
2258
2499
|
if r14
|
2259
|
-
if has_terminal?('::', false, index)
|
2260
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index +
|
2261
|
-
@index +=
|
2500
|
+
if (match_len = has_terminal?('::', false, index))
|
2501
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2502
|
+
@index += match_len
|
2262
2503
|
else
|
2263
2504
|
terminal_parse_failure('::')
|
2264
2505
|
r15 = nil
|
@@ -2290,12 +2531,13 @@ module Delorean
|
|
2290
2531
|
r11 = nil
|
2291
2532
|
end
|
2292
2533
|
if r11
|
2534
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
2293
2535
|
r0 = r11
|
2294
2536
|
else
|
2295
2537
|
i17, s17 = index, []
|
2296
|
-
if has_terminal?('(', false, index)
|
2297
|
-
r18 =
|
2298
|
-
@index +=
|
2538
|
+
if (match_len = has_terminal?('(', false, index))
|
2539
|
+
r18 = true
|
2540
|
+
@index += match_len
|
2299
2541
|
else
|
2300
2542
|
terminal_parse_failure('(')
|
2301
2543
|
r18 = nil
|
@@ -2321,9 +2563,9 @@ module Delorean
|
|
2321
2563
|
end
|
2322
2564
|
s17 << r22
|
2323
2565
|
if r22
|
2324
|
-
if has_terminal?(')', false, index)
|
2325
|
-
r24 =
|
2326
|
-
@index +=
|
2566
|
+
if (match_len = has_terminal?(')', false, index))
|
2567
|
+
r24 = true
|
2568
|
+
@index += match_len
|
2327
2569
|
else
|
2328
2570
|
terminal_parse_failure(')')
|
2329
2571
|
r24 = nil
|
@@ -2341,6 +2583,7 @@ module Delorean
|
|
2341
2583
|
r17 = nil
|
2342
2584
|
end
|
2343
2585
|
if r17
|
2586
|
+
r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
|
2344
2587
|
r0 = r17
|
2345
2588
|
else
|
2346
2589
|
@index = i0
|
@@ -2384,7 +2627,7 @@ module Delorean
|
|
2384
2627
|
if node_cache[:fn_args].has_key?(index)
|
2385
2628
|
cached = node_cache[:fn_args][index]
|
2386
2629
|
if cached
|
2387
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2630
|
+
node_cache[:fn_args][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2388
2631
|
@index = cached.interval.end
|
2389
2632
|
end
|
2390
2633
|
return cached
|
@@ -2403,9 +2646,9 @@ module Delorean
|
|
2403
2646
|
end
|
2404
2647
|
s3 << r4
|
2405
2648
|
if r4
|
2406
|
-
if has_terminal?(',', false, index)
|
2407
|
-
r6 =
|
2408
|
-
@index +=
|
2649
|
+
if (match_len = has_terminal?(',', false, index))
|
2650
|
+
r6 = true
|
2651
|
+
@index += match_len
|
2409
2652
|
else
|
2410
2653
|
terminal_parse_failure(',')
|
2411
2654
|
r6 = nil
|
@@ -2482,7 +2725,7 @@ module Delorean
|
|
2482
2725
|
if node_cache[:hash_args].has_key?(index)
|
2483
2726
|
cached = node_cache[:hash_args][index]
|
2484
2727
|
if cached
|
2485
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2728
|
+
node_cache[:hash_args][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2486
2729
|
@index = cached.interval.end
|
2487
2730
|
end
|
2488
2731
|
return cached
|
@@ -2500,9 +2743,9 @@ module Delorean
|
|
2500
2743
|
end
|
2501
2744
|
s0 << r2
|
2502
2745
|
if r2
|
2503
|
-
if has_terminal?(':', false, index)
|
2504
|
-
r4 =
|
2505
|
-
@index +=
|
2746
|
+
if (match_len = has_terminal?(':', false, index))
|
2747
|
+
r4 = true
|
2748
|
+
@index += match_len
|
2506
2749
|
else
|
2507
2750
|
terminal_parse_failure(':')
|
2508
2751
|
r4 = nil
|
@@ -2529,9 +2772,9 @@ module Delorean
|
|
2529
2772
|
end
|
2530
2773
|
s9 << r10
|
2531
2774
|
if r10
|
2532
|
-
if has_terminal?(',', false, index)
|
2533
|
-
r12 =
|
2534
|
-
@index +=
|
2775
|
+
if (match_len = has_terminal?(',', false, index))
|
2776
|
+
r12 = true
|
2777
|
+
@index += match_len
|
2535
2778
|
else
|
2536
2779
|
terminal_parse_failure(',')
|
2537
2780
|
r12 = nil
|
@@ -2619,7 +2862,7 @@ module Delorean
|
|
2619
2862
|
if node_cache[:kw_args].has_key?(index)
|
2620
2863
|
cached = node_cache[:kw_args][index]
|
2621
2864
|
if cached
|
2622
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2865
|
+
node_cache[:kw_args][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2623
2866
|
@index = cached.interval.end
|
2624
2867
|
end
|
2625
2868
|
return cached
|
@@ -2638,9 +2881,9 @@ module Delorean
|
|
2638
2881
|
end
|
2639
2882
|
s2 << r4
|
2640
2883
|
if r4
|
2641
|
-
if has_terminal?('=', false, index)
|
2642
|
-
r6 =
|
2643
|
-
@index +=
|
2884
|
+
if (match_len = has_terminal?('=', false, index))
|
2885
|
+
r6 = true
|
2886
|
+
@index += match_len
|
2644
2887
|
else
|
2645
2888
|
terminal_parse_failure('=')
|
2646
2889
|
r6 = nil
|
@@ -2683,9 +2926,9 @@ module Delorean
|
|
2683
2926
|
end
|
2684
2927
|
s11 << r12
|
2685
2928
|
if r12
|
2686
|
-
if has_terminal?(',', false, index)
|
2687
|
-
r14 =
|
2688
|
-
@index +=
|
2929
|
+
if (match_len = has_terminal?(',', false, index))
|
2930
|
+
r14 = true
|
2931
|
+
@index += match_len
|
2689
2932
|
else
|
2690
2933
|
terminal_parse_failure(',')
|
2691
2934
|
r14 = nil
|
@@ -2750,7 +2993,7 @@ module Delorean
|
|
2750
2993
|
if node_cache[:decimal].has_key?(index)
|
2751
2994
|
cached = node_cache[:decimal][index]
|
2752
2995
|
if cached
|
2753
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2996
|
+
node_cache[:decimal][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2754
2997
|
@index = cached.interval.end
|
2755
2998
|
end
|
2756
2999
|
return cached
|
@@ -2760,9 +3003,9 @@ module Delorean
|
|
2760
3003
|
r1 = _nt_integer
|
2761
3004
|
s0 << r1
|
2762
3005
|
if r1
|
2763
|
-
if has_terminal?('.', false, index)
|
2764
|
-
r2 =
|
2765
|
-
@index +=
|
3006
|
+
if (match_len = has_terminal?('.', false, index))
|
3007
|
+
r2 = true
|
3008
|
+
@index += match_len
|
2766
3009
|
else
|
2767
3010
|
terminal_parse_failure('.')
|
2768
3011
|
r2 = nil
|
@@ -2771,10 +3014,11 @@ module Delorean
|
|
2771
3014
|
if r2
|
2772
3015
|
s3, i3 = [], index
|
2773
3016
|
loop do
|
2774
|
-
if has_terminal?('\
|
3017
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
2775
3018
|
r4 = true
|
2776
3019
|
@index += 1
|
2777
3020
|
else
|
3021
|
+
terminal_parse_failure('[0-9]')
|
2778
3022
|
r4 = nil
|
2779
3023
|
end
|
2780
3024
|
if r4
|
@@ -2813,38 +3057,41 @@ module Delorean
|
|
2813
3057
|
if node_cache[:integer].has_key?(index)
|
2814
3058
|
cached = node_cache[:integer][index]
|
2815
3059
|
if cached
|
2816
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3060
|
+
node_cache[:integer][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2817
3061
|
@index = cached.interval.end
|
2818
3062
|
end
|
2819
3063
|
return cached
|
2820
3064
|
end
|
2821
3065
|
|
2822
3066
|
i0 = index
|
2823
|
-
if has_terminal?('0', false, index)
|
2824
|
-
r1 = instantiate_node(Literal,input, index...(index +
|
2825
|
-
@index +=
|
3067
|
+
if (match_len = has_terminal?('0', false, index))
|
3068
|
+
r1 = instantiate_node(Literal,input, index...(index + match_len))
|
3069
|
+
@index += match_len
|
2826
3070
|
else
|
2827
3071
|
terminal_parse_failure('0')
|
2828
3072
|
r1 = nil
|
2829
3073
|
end
|
2830
3074
|
if r1
|
3075
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2831
3076
|
r0 = r1
|
2832
3077
|
else
|
2833
3078
|
i2, s2 = index, []
|
2834
|
-
if has_terminal?('\
|
3079
|
+
if has_terminal?(@regexps[gr = '\A[1-9]'] ||= Regexp.new(gr), :regexp, index)
|
2835
3080
|
r3 = true
|
2836
3081
|
@index += 1
|
2837
3082
|
else
|
3083
|
+
terminal_parse_failure('[1-9]')
|
2838
3084
|
r3 = nil
|
2839
3085
|
end
|
2840
3086
|
s2 << r3
|
2841
3087
|
if r3
|
2842
3088
|
s4, i4 = [], index
|
2843
3089
|
loop do
|
2844
|
-
if has_terminal?('\
|
3090
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
2845
3091
|
r5 = true
|
2846
3092
|
@index += 1
|
2847
3093
|
else
|
3094
|
+
terminal_parse_failure('[0-9]')
|
2848
3095
|
r5 = nil
|
2849
3096
|
end
|
2850
3097
|
if r5
|
@@ -2864,6 +3111,7 @@ module Delorean
|
|
2864
3111
|
r2 = nil
|
2865
3112
|
end
|
2866
3113
|
if r2
|
3114
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2867
3115
|
r0 = r2
|
2868
3116
|
else
|
2869
3117
|
@index = i0
|
@@ -2884,27 +3132,29 @@ module Delorean
|
|
2884
3132
|
if node_cache[:identifier].has_key?(index)
|
2885
3133
|
cached = node_cache[:identifier][index]
|
2886
3134
|
if cached
|
2887
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3135
|
+
node_cache[:identifier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2888
3136
|
@index = cached.interval.end
|
2889
3137
|
end
|
2890
3138
|
return cached
|
2891
3139
|
end
|
2892
3140
|
|
2893
3141
|
i0, s0 = index, []
|
2894
|
-
if has_terminal?('\
|
3142
|
+
if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
|
2895
3143
|
r1 = true
|
2896
3144
|
@index += 1
|
2897
3145
|
else
|
3146
|
+
terminal_parse_failure('[a-z]')
|
2898
3147
|
r1 = nil
|
2899
3148
|
end
|
2900
3149
|
s0 << r1
|
2901
3150
|
if r1
|
2902
3151
|
s2, i2 = [], index
|
2903
3152
|
loop do
|
2904
|
-
if has_terminal?('\
|
3153
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
2905
3154
|
r3 = true
|
2906
3155
|
@index += 1
|
2907
3156
|
else
|
3157
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
2908
3158
|
r3 = nil
|
2909
3159
|
end
|
2910
3160
|
if r3
|
@@ -2934,31 +3184,33 @@ module Delorean
|
|
2934
3184
|
if node_cache[:boolean].has_key?(index)
|
2935
3185
|
cached = node_cache[:boolean][index]
|
2936
3186
|
if cached
|
2937
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3187
|
+
node_cache[:boolean][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2938
3188
|
@index = cached.interval.end
|
2939
3189
|
end
|
2940
3190
|
return cached
|
2941
3191
|
end
|
2942
3192
|
|
2943
3193
|
i0 = index
|
2944
|
-
if has_terminal?('true', false, index)
|
2945
|
-
r1 = instantiate_node(Literal,input, index...(index +
|
2946
|
-
@index +=
|
3194
|
+
if (match_len = has_terminal?('true', false, index))
|
3195
|
+
r1 = instantiate_node(Literal,input, index...(index + match_len))
|
3196
|
+
@index += match_len
|
2947
3197
|
else
|
2948
3198
|
terminal_parse_failure('true')
|
2949
3199
|
r1 = nil
|
2950
3200
|
end
|
2951
3201
|
if r1
|
3202
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2952
3203
|
r0 = r1
|
2953
3204
|
else
|
2954
|
-
if has_terminal?('false', false, index)
|
2955
|
-
r2 = instantiate_node(Literal,input, index...(index +
|
2956
|
-
@index +=
|
3205
|
+
if (match_len = has_terminal?('false', false, index))
|
3206
|
+
r2 = instantiate_node(Literal,input, index...(index + match_len))
|
3207
|
+
@index += match_len
|
2957
3208
|
else
|
2958
3209
|
terminal_parse_failure('false')
|
2959
3210
|
r2 = nil
|
2960
3211
|
end
|
2961
3212
|
if r2
|
3213
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2962
3214
|
r0 = r2
|
2963
3215
|
else
|
2964
3216
|
@index = i0
|
@@ -2976,15 +3228,15 @@ module Delorean
|
|
2976
3228
|
if node_cache[:self].has_key?(index)
|
2977
3229
|
cached = node_cache[:self][index]
|
2978
3230
|
if cached
|
2979
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3231
|
+
node_cache[:self][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2980
3232
|
@index = cached.interval.end
|
2981
3233
|
end
|
2982
3234
|
return cached
|
2983
3235
|
end
|
2984
3236
|
|
2985
|
-
if has_terminal?('_', false, index)
|
2986
|
-
r0 = instantiate_node(Self,input, index...(index +
|
2987
|
-
@index +=
|
3237
|
+
if (match_len = has_terminal?('_', false, index))
|
3238
|
+
r0 = instantiate_node(Self,input, index...(index + match_len))
|
3239
|
+
@index += match_len
|
2988
3240
|
else
|
2989
3241
|
terminal_parse_failure('_')
|
2990
3242
|
r0 = nil
|
@@ -3000,15 +3252,15 @@ module Delorean
|
|
3000
3252
|
if node_cache[:nil_val].has_key?(index)
|
3001
3253
|
cached = node_cache[:nil_val][index]
|
3002
3254
|
if cached
|
3003
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3255
|
+
node_cache[:nil_val][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3004
3256
|
@index = cached.interval.end
|
3005
3257
|
end
|
3006
3258
|
return cached
|
3007
3259
|
end
|
3008
3260
|
|
3009
|
-
if has_terminal?('nil', false, index)
|
3010
|
-
r0 = instantiate_node(Literal,input, index...(index +
|
3011
|
-
@index +=
|
3261
|
+
if (match_len = has_terminal?('nil', false, index))
|
3262
|
+
r0 = instantiate_node(Literal,input, index...(index + match_len))
|
3263
|
+
@index += match_len
|
3012
3264
|
else
|
3013
3265
|
terminal_parse_failure('nil')
|
3014
3266
|
r0 = nil
|
@@ -3024,15 +3276,15 @@ module Delorean
|
|
3024
3276
|
if node_cache[:sp4].has_key?(index)
|
3025
3277
|
cached = node_cache[:sp4][index]
|
3026
3278
|
if cached
|
3027
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3279
|
+
node_cache[:sp4][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3028
3280
|
@index = cached.interval.end
|
3029
3281
|
end
|
3030
3282
|
return cached
|
3031
3283
|
end
|
3032
3284
|
|
3033
|
-
if has_terminal?(' ', false, index)
|
3034
|
-
r0 = instantiate_node(SyntaxNode,input, index...(index +
|
3035
|
-
@index +=
|
3285
|
+
if (match_len = has_terminal?(' ', false, index))
|
3286
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3287
|
+
@index += match_len
|
3036
3288
|
else
|
3037
3289
|
terminal_parse_failure(' ')
|
3038
3290
|
r0 = nil
|
@@ -3048,7 +3300,7 @@ module Delorean
|
|
3048
3300
|
if node_cache[:sp].has_key?(index)
|
3049
3301
|
cached = node_cache[:sp][index]
|
3050
3302
|
if cached
|
3051
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3303
|
+
node_cache[:sp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3052
3304
|
@index = cached.interval.end
|
3053
3305
|
end
|
3054
3306
|
return cached
|
@@ -3056,10 +3308,11 @@ module Delorean
|
|
3056
3308
|
|
3057
3309
|
s0, i0 = [], index
|
3058
3310
|
loop do
|
3059
|
-
if has_terminal?('\
|
3311
|
+
if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
|
3060
3312
|
r1 = true
|
3061
3313
|
@index += 1
|
3062
3314
|
else
|
3315
|
+
terminal_parse_failure('[\\s]')
|
3063
3316
|
r1 = nil
|
3064
3317
|
end
|
3065
3318
|
if r1
|
@@ -3094,7 +3347,7 @@ module Delorean
|
|
3094
3347
|
if node_cache[:string].has_key?(index)
|
3095
3348
|
cached = node_cache[:string][index]
|
3096
3349
|
if cached
|
3097
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3350
|
+
node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3098
3351
|
@index = cached.interval.end
|
3099
3352
|
end
|
3100
3353
|
return cached
|
@@ -3102,9 +3355,9 @@ module Delorean
|
|
3102
3355
|
|
3103
3356
|
i0 = index
|
3104
3357
|
i1, s1 = index, []
|
3105
|
-
if has_terminal?('"', false, index)
|
3106
|
-
r2 =
|
3107
|
-
@index +=
|
3358
|
+
if (match_len = has_terminal?('"', false, index))
|
3359
|
+
r2 = true
|
3360
|
+
@index += match_len
|
3108
3361
|
else
|
3109
3362
|
terminal_parse_failure('"')
|
3110
3363
|
r2 = nil
|
@@ -3114,21 +3367,22 @@ module Delorean
|
|
3114
3367
|
s3, i3 = [], index
|
3115
3368
|
loop do
|
3116
3369
|
i4 = index
|
3117
|
-
if has_terminal?('\"', false, index)
|
3118
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index +
|
3119
|
-
@index +=
|
3370
|
+
if (match_len = has_terminal?('\"', false, index))
|
3371
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3372
|
+
@index += match_len
|
3120
3373
|
else
|
3121
3374
|
terminal_parse_failure('\"')
|
3122
3375
|
r5 = nil
|
3123
3376
|
end
|
3124
3377
|
if r5
|
3378
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
3125
3379
|
r4 = r5
|
3126
3380
|
else
|
3127
3381
|
i6, s6 = index, []
|
3128
3382
|
i7 = index
|
3129
|
-
if has_terminal?('"', false, index)
|
3130
|
-
r8 =
|
3131
|
-
@index +=
|
3383
|
+
if (match_len = has_terminal?('"', false, index))
|
3384
|
+
r8 = true
|
3385
|
+
@index += match_len
|
3132
3386
|
else
|
3133
3387
|
terminal_parse_failure('"')
|
3134
3388
|
r8 = nil
|
@@ -3142,7 +3396,7 @@ module Delorean
|
|
3142
3396
|
s6 << r7
|
3143
3397
|
if r7
|
3144
3398
|
if index < input_length
|
3145
|
-
r9 =
|
3399
|
+
r9 = true
|
3146
3400
|
@index += 1
|
3147
3401
|
else
|
3148
3402
|
terminal_parse_failure("any character")
|
@@ -3158,6 +3412,7 @@ module Delorean
|
|
3158
3412
|
r6 = nil
|
3159
3413
|
end
|
3160
3414
|
if r6
|
3415
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
3161
3416
|
r4 = r6
|
3162
3417
|
else
|
3163
3418
|
@index = i4
|
@@ -3173,9 +3428,9 @@ module Delorean
|
|
3173
3428
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
3174
3429
|
s1 << r3
|
3175
3430
|
if r3
|
3176
|
-
if has_terminal?('"', false, index)
|
3177
|
-
r10 =
|
3178
|
-
@index +=
|
3431
|
+
if (match_len = has_terminal?('"', false, index))
|
3432
|
+
r10 = true
|
3433
|
+
@index += match_len
|
3179
3434
|
else
|
3180
3435
|
terminal_parse_failure('"')
|
3181
3436
|
r10 = nil
|
@@ -3191,12 +3446,13 @@ module Delorean
|
|
3191
3446
|
r1 = nil
|
3192
3447
|
end
|
3193
3448
|
if r1
|
3449
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3194
3450
|
r0 = r1
|
3195
3451
|
else
|
3196
3452
|
i11, s11 = index, []
|
3197
|
-
if has_terminal?("'", false, index)
|
3198
|
-
r12 =
|
3199
|
-
@index +=
|
3453
|
+
if (match_len = has_terminal?("'", false, index))
|
3454
|
+
r12 = true
|
3455
|
+
@index += match_len
|
3200
3456
|
else
|
3201
3457
|
terminal_parse_failure("'")
|
3202
3458
|
r12 = nil
|
@@ -3205,10 +3461,11 @@ module Delorean
|
|
3205
3461
|
if r12
|
3206
3462
|
s13, i13 = [], index
|
3207
3463
|
loop do
|
3208
|
-
if has_terminal?('\
|
3464
|
+
if has_terminal?(@regexps[gr = '\A[^\']'] ||= Regexp.new(gr), :regexp, index)
|
3209
3465
|
r14 = true
|
3210
3466
|
@index += 1
|
3211
3467
|
else
|
3468
|
+
terminal_parse_failure('[^\']')
|
3212
3469
|
r14 = nil
|
3213
3470
|
end
|
3214
3471
|
if r14
|
@@ -3220,9 +3477,9 @@ module Delorean
|
|
3220
3477
|
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
3221
3478
|
s11 << r13
|
3222
3479
|
if r13
|
3223
|
-
if has_terminal?("'", false, index)
|
3224
|
-
r15 =
|
3225
|
-
@index +=
|
3480
|
+
if (match_len = has_terminal?("'", false, index))
|
3481
|
+
r15 = true
|
3482
|
+
@index += match_len
|
3226
3483
|
else
|
3227
3484
|
terminal_parse_failure("'")
|
3228
3485
|
r15 = nil
|
@@ -3238,6 +3495,7 @@ module Delorean
|
|
3238
3495
|
r11 = nil
|
3239
3496
|
end
|
3240
3497
|
if r11
|
3498
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
3241
3499
|
r0 = r11
|
3242
3500
|
else
|
3243
3501
|
@index = i0
|