delorean_lang 0.3.13 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/delorean.gemspec +1 -1
- data/lib/delorean/delorean.rb +370 -295
- data/lib/delorean/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76c3314a9357c25e11be73ad6d31ceb959a53d29
|
4
|
+
data.tar.gz: cff3207bc7ed0da6aed5c603c2c43cf456b8ff85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccbb1056dcba01a855712f297bc71db0d0030be2a0a431a1591636ec471bb2c7425f7b69018105c04787fac93eab710e0f88544822b517267b3f06e42fd30455
|
7
|
+
data.tar.gz: 4dfbfc73028b59458a9afbe71b4ef90fcd4dc16997460ff32d2bccf5ebda8be990660d5ddedc82c5cb28bcf8f57f53a45e3b0795ec6125a78a28302ea8a393e6
|
data/delorean.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.licenses = ['MIT']
|
17
17
|
|
18
18
|
|
19
|
-
gem.add_dependency "treetop", "~> 1.
|
19
|
+
gem.add_dependency "treetop", "~> 1.5"
|
20
20
|
gem.add_dependency "activerecord", ">= 3.2"
|
21
21
|
gem.add_development_dependency "rspec", '~> 2.1'
|
22
22
|
gem.add_development_dependency "sqlite3", '~> 1.3'
|
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
|
@@ -1596,27 +1620,28 @@ module Delorean
|
|
1596
1620
|
if node_cache[:set_expr].has_key?(index)
|
1597
1621
|
cached = node_cache[:set_expr][index]
|
1598
1622
|
if cached
|
1599
|
-
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
|
1600
1624
|
@index = cached.interval.end
|
1601
1625
|
end
|
1602
1626
|
return cached
|
1603
1627
|
end
|
1604
1628
|
|
1605
1629
|
i0 = index
|
1606
|
-
if has_terminal?('{-}', false, index)
|
1607
|
-
r1 = instantiate_node(SetExpr,input, index...(index +
|
1608
|
-
@index +=
|
1630
|
+
if (match_len = has_terminal?('{-}', false, index))
|
1631
|
+
r1 = instantiate_node(SetExpr,input, index...(index + match_len))
|
1632
|
+
@index += match_len
|
1609
1633
|
else
|
1610
1634
|
terminal_parse_failure('{-}')
|
1611
1635
|
r1 = nil
|
1612
1636
|
end
|
1613
1637
|
if r1
|
1638
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1614
1639
|
r0 = r1
|
1615
1640
|
else
|
1616
1641
|
i2, s2 = index, []
|
1617
|
-
if has_terminal?('{', false, index)
|
1618
|
-
r3 =
|
1619
|
-
@index +=
|
1642
|
+
if (match_len = has_terminal?('{', false, index))
|
1643
|
+
r3 = true
|
1644
|
+
@index += match_len
|
1620
1645
|
else
|
1621
1646
|
terminal_parse_failure('{')
|
1622
1647
|
r3 = nil
|
@@ -1637,9 +1662,9 @@ module Delorean
|
|
1637
1662
|
r7 = _nt_sp
|
1638
1663
|
s2 << r7
|
1639
1664
|
if r7
|
1640
|
-
if has_terminal?('for', false, index)
|
1641
|
-
r8 = instantiate_node(SyntaxNode,input, index...(index +
|
1642
|
-
@index +=
|
1665
|
+
if (match_len = has_terminal?('for', false, index))
|
1666
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1667
|
+
@index += match_len
|
1643
1668
|
else
|
1644
1669
|
terminal_parse_failure('for')
|
1645
1670
|
r8 = nil
|
@@ -1655,9 +1680,9 @@ module Delorean
|
|
1655
1680
|
r11 = _nt_sp
|
1656
1681
|
s2 << r11
|
1657
1682
|
if r11
|
1658
|
-
if has_terminal?('in', false, index)
|
1659
|
-
r12 = instantiate_node(SyntaxNode,input, index...(index +
|
1660
|
-
@index +=
|
1683
|
+
if (match_len = has_terminal?('in', false, index))
|
1684
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1685
|
+
@index += match_len
|
1661
1686
|
else
|
1662
1687
|
terminal_parse_failure('in')
|
1663
1688
|
r12 = nil
|
@@ -1679,9 +1704,9 @@ module Delorean
|
|
1679
1704
|
s2 << r15
|
1680
1705
|
if r15
|
1681
1706
|
i18, s18 = index, []
|
1682
|
-
if has_terminal?('if', false, index)
|
1683
|
-
r19 = instantiate_node(SyntaxNode,input, index...(index +
|
1684
|
-
@index +=
|
1707
|
+
if (match_len = has_terminal?('if', false, index))
|
1708
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1709
|
+
@index += match_len
|
1685
1710
|
else
|
1686
1711
|
terminal_parse_failure('if')
|
1687
1712
|
r19 = nil
|
@@ -1718,9 +1743,9 @@ module Delorean
|
|
1718
1743
|
end
|
1719
1744
|
s2 << r17
|
1720
1745
|
if r17
|
1721
|
-
if has_terminal?('}', false, index)
|
1722
|
-
r24 =
|
1723
|
-
@index +=
|
1746
|
+
if (match_len = has_terminal?('}', false, index))
|
1747
|
+
r24 = true
|
1748
|
+
@index += match_len
|
1724
1749
|
else
|
1725
1750
|
terminal_parse_failure('}')
|
1726
1751
|
r24 = nil
|
@@ -1747,12 +1772,13 @@ module Delorean
|
|
1747
1772
|
r2 = nil
|
1748
1773
|
end
|
1749
1774
|
if r2
|
1775
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1750
1776
|
r0 = r2
|
1751
1777
|
else
|
1752
1778
|
i25, s25 = index, []
|
1753
|
-
if has_terminal?('{', false, index)
|
1754
|
-
r26 =
|
1755
|
-
@index +=
|
1779
|
+
if (match_len = has_terminal?('{', false, index))
|
1780
|
+
r26 = true
|
1781
|
+
@index += match_len
|
1756
1782
|
else
|
1757
1783
|
terminal_parse_failure('{')
|
1758
1784
|
r26 = nil
|
@@ -1778,9 +1804,9 @@ module Delorean
|
|
1778
1804
|
end
|
1779
1805
|
s25 << r30
|
1780
1806
|
if r30
|
1781
|
-
if has_terminal?('}', false, index)
|
1782
|
-
r32 =
|
1783
|
-
@index +=
|
1807
|
+
if (match_len = has_terminal?('}', false, index))
|
1808
|
+
r32 = true
|
1809
|
+
@index += match_len
|
1784
1810
|
else
|
1785
1811
|
terminal_parse_failure('}')
|
1786
1812
|
r32 = nil
|
@@ -1798,6 +1824,7 @@ module Delorean
|
|
1798
1824
|
r25 = nil
|
1799
1825
|
end
|
1800
1826
|
if r25
|
1827
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
1801
1828
|
r0 = r25
|
1802
1829
|
else
|
1803
1830
|
@index = i0
|
@@ -1873,27 +1900,28 @@ module Delorean
|
|
1873
1900
|
if node_cache[:hash_expr].has_key?(index)
|
1874
1901
|
cached = node_cache[:hash_expr][index]
|
1875
1902
|
if cached
|
1876
|
-
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
|
1877
1904
|
@index = cached.interval.end
|
1878
1905
|
end
|
1879
1906
|
return cached
|
1880
1907
|
end
|
1881
1908
|
|
1882
1909
|
i0 = index
|
1883
|
-
if has_terminal?('{}', false, index)
|
1884
|
-
r1 = instantiate_node(HashExpr,input, index...(index +
|
1885
|
-
@index +=
|
1910
|
+
if (match_len = has_terminal?('{}', false, index))
|
1911
|
+
r1 = instantiate_node(HashExpr,input, index...(index + match_len))
|
1912
|
+
@index += match_len
|
1886
1913
|
else
|
1887
1914
|
terminal_parse_failure('{}')
|
1888
1915
|
r1 = nil
|
1889
1916
|
end
|
1890
1917
|
if r1
|
1918
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1891
1919
|
r0 = r1
|
1892
1920
|
else
|
1893
1921
|
i2, s2 = index, []
|
1894
|
-
if has_terminal?('{', false, index)
|
1895
|
-
r3 =
|
1896
|
-
@index +=
|
1922
|
+
if (match_len = has_terminal?('{', false, index))
|
1923
|
+
r3 = true
|
1924
|
+
@index += match_len
|
1897
1925
|
else
|
1898
1926
|
terminal_parse_failure('{')
|
1899
1927
|
r3 = nil
|
@@ -1919,9 +1947,9 @@ module Delorean
|
|
1919
1947
|
end
|
1920
1948
|
s2 << r7
|
1921
1949
|
if r7
|
1922
|
-
if has_terminal?(':', false, index)
|
1923
|
-
r9 =
|
1924
|
-
@index +=
|
1950
|
+
if (match_len = has_terminal?(':', false, index))
|
1951
|
+
r9 = true
|
1952
|
+
@index += match_len
|
1925
1953
|
else
|
1926
1954
|
terminal_parse_failure(':')
|
1927
1955
|
r9 = nil
|
@@ -1942,9 +1970,9 @@ module Delorean
|
|
1942
1970
|
r13 = _nt_sp
|
1943
1971
|
s2 << r13
|
1944
1972
|
if r13
|
1945
|
-
if has_terminal?('for', false, index)
|
1946
|
-
r14 = instantiate_node(SyntaxNode,input, index...(index +
|
1947
|
-
@index +=
|
1973
|
+
if (match_len = has_terminal?('for', false, index))
|
1974
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1975
|
+
@index += match_len
|
1948
1976
|
else
|
1949
1977
|
terminal_parse_failure('for')
|
1950
1978
|
r14 = nil
|
@@ -1960,9 +1988,9 @@ module Delorean
|
|
1960
1988
|
r17 = _nt_sp
|
1961
1989
|
s2 << r17
|
1962
1990
|
if r17
|
1963
|
-
if has_terminal?('in', false, index)
|
1964
|
-
r18 = instantiate_node(SyntaxNode,input, index...(index +
|
1965
|
-
@index +=
|
1991
|
+
if (match_len = has_terminal?('in', false, index))
|
1992
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1993
|
+
@index += match_len
|
1966
1994
|
else
|
1967
1995
|
terminal_parse_failure('in')
|
1968
1996
|
r18 = nil
|
@@ -1984,9 +2012,9 @@ module Delorean
|
|
1984
2012
|
s2 << r21
|
1985
2013
|
if r21
|
1986
2014
|
i24, s24 = index, []
|
1987
|
-
if has_terminal?('if', false, index)
|
1988
|
-
r25 = instantiate_node(SyntaxNode,input, index...(index +
|
1989
|
-
@index +=
|
2015
|
+
if (match_len = has_terminal?('if', false, index))
|
2016
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2017
|
+
@index += match_len
|
1990
2018
|
else
|
1991
2019
|
terminal_parse_failure('if')
|
1992
2020
|
r25 = nil
|
@@ -2023,9 +2051,9 @@ module Delorean
|
|
2023
2051
|
end
|
2024
2052
|
s2 << r23
|
2025
2053
|
if r23
|
2026
|
-
if has_terminal?('}', false, index)
|
2027
|
-
r30 =
|
2028
|
-
@index +=
|
2054
|
+
if (match_len = has_terminal?('}', false, index))
|
2055
|
+
r30 = true
|
2056
|
+
@index += match_len
|
2029
2057
|
else
|
2030
2058
|
terminal_parse_failure('}')
|
2031
2059
|
r30 = nil
|
@@ -2056,12 +2084,13 @@ module Delorean
|
|
2056
2084
|
r2 = nil
|
2057
2085
|
end
|
2058
2086
|
if r2
|
2087
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2059
2088
|
r0 = r2
|
2060
2089
|
else
|
2061
2090
|
i31, s31 = index, []
|
2062
|
-
if has_terminal?('{', false, index)
|
2063
|
-
r32 =
|
2064
|
-
@index +=
|
2091
|
+
if (match_len = has_terminal?('{', false, index))
|
2092
|
+
r32 = true
|
2093
|
+
@index += match_len
|
2065
2094
|
else
|
2066
2095
|
terminal_parse_failure('{')
|
2067
2096
|
r32 = nil
|
@@ -2087,9 +2116,9 @@ module Delorean
|
|
2087
2116
|
end
|
2088
2117
|
s31 << r36
|
2089
2118
|
if r36
|
2090
|
-
if has_terminal?('}', false, index)
|
2091
|
-
r38 =
|
2092
|
-
@index +=
|
2119
|
+
if (match_len = has_terminal?('}', false, index))
|
2120
|
+
r38 = true
|
2121
|
+
@index += match_len
|
2093
2122
|
else
|
2094
2123
|
terminal_parse_failure('}')
|
2095
2124
|
r38 = nil
|
@@ -2107,6 +2136,7 @@ module Delorean
|
|
2107
2136
|
r31 = nil
|
2108
2137
|
end
|
2109
2138
|
if r31
|
2139
|
+
r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
|
2110
2140
|
r0 = r31
|
2111
2141
|
else
|
2112
2142
|
@index = i0
|
@@ -2125,171 +2155,187 @@ module Delorean
|
|
2125
2155
|
if node_cache[:binary_op].has_key?(index)
|
2126
2156
|
cached = node_cache[:binary_op][index]
|
2127
2157
|
if cached
|
2128
|
-
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
|
2129
2159
|
@index = cached.interval.end
|
2130
2160
|
end
|
2131
2161
|
return cached
|
2132
2162
|
end
|
2133
2163
|
|
2134
2164
|
i0 = index
|
2135
|
-
if has_terminal?('==', false, index)
|
2136
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index +
|
2137
|
-
@index +=
|
2165
|
+
if (match_len = has_terminal?('==', false, index))
|
2166
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2167
|
+
@index += match_len
|
2138
2168
|
else
|
2139
2169
|
terminal_parse_failure('==')
|
2140
2170
|
r1 = nil
|
2141
2171
|
end
|
2142
2172
|
if r1
|
2173
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2143
2174
|
r0 = r1
|
2144
2175
|
else
|
2145
|
-
if has_terminal?('!=', false, index)
|
2146
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index +
|
2147
|
-
@index +=
|
2176
|
+
if (match_len = has_terminal?('!=', false, index))
|
2177
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2178
|
+
@index += match_len
|
2148
2179
|
else
|
2149
2180
|
terminal_parse_failure('!=')
|
2150
2181
|
r2 = nil
|
2151
2182
|
end
|
2152
2183
|
if r2
|
2184
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2153
2185
|
r0 = r2
|
2154
2186
|
else
|
2155
|
-
if has_terminal?('>=', false, index)
|
2156
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index +
|
2157
|
-
@index +=
|
2187
|
+
if (match_len = has_terminal?('>=', false, index))
|
2188
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2189
|
+
@index += match_len
|
2158
2190
|
else
|
2159
2191
|
terminal_parse_failure('>=')
|
2160
2192
|
r3 = nil
|
2161
2193
|
end
|
2162
2194
|
if r3
|
2195
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2163
2196
|
r0 = r3
|
2164
2197
|
else
|
2165
|
-
if has_terminal?('<=', false, index)
|
2166
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index +
|
2167
|
-
@index +=
|
2198
|
+
if (match_len = has_terminal?('<=', false, index))
|
2199
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2200
|
+
@index += match_len
|
2168
2201
|
else
|
2169
2202
|
terminal_parse_failure('<=')
|
2170
2203
|
r4 = nil
|
2171
2204
|
end
|
2172
2205
|
if r4
|
2206
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2173
2207
|
r0 = r4
|
2174
2208
|
else
|
2175
|
-
if has_terminal?('&&', false, index)
|
2176
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index +
|
2177
|
-
@index +=
|
2209
|
+
if (match_len = has_terminal?('&&', false, index))
|
2210
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2211
|
+
@index += match_len
|
2178
2212
|
else
|
2179
2213
|
terminal_parse_failure('&&')
|
2180
2214
|
r5 = nil
|
2181
2215
|
end
|
2182
2216
|
if r5
|
2217
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2183
2218
|
r0 = r5
|
2184
2219
|
else
|
2185
|
-
if has_terminal?('||', false, index)
|
2186
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index +
|
2187
|
-
@index +=
|
2220
|
+
if (match_len = has_terminal?('||', false, index))
|
2221
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2222
|
+
@index += match_len
|
2188
2223
|
else
|
2189
2224
|
terminal_parse_failure('||')
|
2190
2225
|
r6 = nil
|
2191
2226
|
end
|
2192
2227
|
if r6
|
2228
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2193
2229
|
r0 = r6
|
2194
2230
|
else
|
2195
|
-
if has_terminal?('>', false, index)
|
2196
|
-
r7 =
|
2197
|
-
@index +=
|
2231
|
+
if (match_len = has_terminal?('>', false, index))
|
2232
|
+
r7 = true
|
2233
|
+
@index += match_len
|
2198
2234
|
else
|
2199
2235
|
terminal_parse_failure('>')
|
2200
2236
|
r7 = nil
|
2201
2237
|
end
|
2202
2238
|
if r7
|
2239
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2203
2240
|
r0 = r7
|
2204
2241
|
else
|
2205
|
-
if has_terminal?('<', false, index)
|
2206
|
-
r8 =
|
2207
|
-
@index +=
|
2242
|
+
if (match_len = has_terminal?('<', false, index))
|
2243
|
+
r8 = true
|
2244
|
+
@index += match_len
|
2208
2245
|
else
|
2209
2246
|
terminal_parse_failure('<')
|
2210
2247
|
r8 = nil
|
2211
2248
|
end
|
2212
2249
|
if r8
|
2250
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
2213
2251
|
r0 = r8
|
2214
2252
|
else
|
2215
|
-
if has_terminal?('+', false, index)
|
2216
|
-
r9 =
|
2217
|
-
@index +=
|
2253
|
+
if (match_len = has_terminal?('+', false, index))
|
2254
|
+
r9 = true
|
2255
|
+
@index += match_len
|
2218
2256
|
else
|
2219
2257
|
terminal_parse_failure('+')
|
2220
2258
|
r9 = nil
|
2221
2259
|
end
|
2222
2260
|
if r9
|
2261
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
2223
2262
|
r0 = r9
|
2224
2263
|
else
|
2225
|
-
if has_terminal?('-', false, index)
|
2226
|
-
r10 =
|
2227
|
-
@index +=
|
2264
|
+
if (match_len = has_terminal?('-', false, index))
|
2265
|
+
r10 = true
|
2266
|
+
@index += match_len
|
2228
2267
|
else
|
2229
2268
|
terminal_parse_failure('-')
|
2230
2269
|
r10 = nil
|
2231
2270
|
end
|
2232
2271
|
if r10
|
2272
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
2233
2273
|
r0 = r10
|
2234
2274
|
else
|
2235
|
-
if has_terminal?('*', false, index)
|
2236
|
-
r11 =
|
2237
|
-
@index +=
|
2275
|
+
if (match_len = has_terminal?('*', false, index))
|
2276
|
+
r11 = true
|
2277
|
+
@index += match_len
|
2238
2278
|
else
|
2239
2279
|
terminal_parse_failure('*')
|
2240
2280
|
r11 = nil
|
2241
2281
|
end
|
2242
2282
|
if r11
|
2283
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
2243
2284
|
r0 = r11
|
2244
2285
|
else
|
2245
|
-
if has_terminal?('/', false, index)
|
2246
|
-
r12 =
|
2247
|
-
@index +=
|
2286
|
+
if (match_len = has_terminal?('/', false, index))
|
2287
|
+
r12 = true
|
2288
|
+
@index += match_len
|
2248
2289
|
else
|
2249
2290
|
terminal_parse_failure('/')
|
2250
2291
|
r12 = nil
|
2251
2292
|
end
|
2252
2293
|
if r12
|
2294
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
2253
2295
|
r0 = r12
|
2254
2296
|
else
|
2255
|
-
if has_terminal?('%', false, index)
|
2256
|
-
r13 =
|
2257
|
-
@index +=
|
2297
|
+
if (match_len = has_terminal?('%', false, index))
|
2298
|
+
r13 = true
|
2299
|
+
@index += match_len
|
2258
2300
|
else
|
2259
2301
|
terminal_parse_failure('%')
|
2260
2302
|
r13 = nil
|
2261
2303
|
end
|
2262
2304
|
if r13
|
2305
|
+
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
2263
2306
|
r0 = r13
|
2264
2307
|
else
|
2265
|
-
if has_terminal?('&', false, index)
|
2266
|
-
r14 =
|
2267
|
-
@index +=
|
2308
|
+
if (match_len = has_terminal?('&', false, index))
|
2309
|
+
r14 = true
|
2310
|
+
@index += match_len
|
2268
2311
|
else
|
2269
2312
|
terminal_parse_failure('&')
|
2270
2313
|
r14 = nil
|
2271
2314
|
end
|
2272
2315
|
if r14
|
2316
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
2273
2317
|
r0 = r14
|
2274
2318
|
else
|
2275
|
-
if has_terminal?('^', false, index)
|
2276
|
-
r15 =
|
2277
|
-
@index +=
|
2319
|
+
if (match_len = has_terminal?('^', false, index))
|
2320
|
+
r15 = true
|
2321
|
+
@index += match_len
|
2278
2322
|
else
|
2279
2323
|
terminal_parse_failure('^')
|
2280
2324
|
r15 = nil
|
2281
2325
|
end
|
2282
2326
|
if r15
|
2327
|
+
r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
|
2283
2328
|
r0 = r15
|
2284
2329
|
else
|
2285
|
-
if has_terminal?('|', false, index)
|
2286
|
-
r16 =
|
2287
|
-
@index +=
|
2330
|
+
if (match_len = has_terminal?('|', false, index))
|
2331
|
+
r16 = true
|
2332
|
+
@index += match_len
|
2288
2333
|
else
|
2289
2334
|
terminal_parse_failure('|')
|
2290
2335
|
r16 = nil
|
2291
2336
|
end
|
2292
2337
|
if r16
|
2338
|
+
r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
|
2293
2339
|
r0 = r16
|
2294
2340
|
else
|
2295
2341
|
@index = i0
|
@@ -2321,31 +2367,33 @@ module Delorean
|
|
2321
2367
|
if node_cache[:unary_op].has_key?(index)
|
2322
2368
|
cached = node_cache[:unary_op][index]
|
2323
2369
|
if cached
|
2324
|
-
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
|
2325
2371
|
@index = cached.interval.end
|
2326
2372
|
end
|
2327
2373
|
return cached
|
2328
2374
|
end
|
2329
2375
|
|
2330
2376
|
i0 = index
|
2331
|
-
if has_terminal?('!', false, index)
|
2332
|
-
r1 =
|
2333
|
-
@index +=
|
2377
|
+
if (match_len = has_terminal?('!', false, index))
|
2378
|
+
r1 = true
|
2379
|
+
@index += match_len
|
2334
2380
|
else
|
2335
2381
|
terminal_parse_failure('!')
|
2336
2382
|
r1 = nil
|
2337
2383
|
end
|
2338
2384
|
if r1
|
2385
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2339
2386
|
r0 = r1
|
2340
2387
|
else
|
2341
|
-
if has_terminal?('-', false, index)
|
2342
|
-
r2 =
|
2343
|
-
@index +=
|
2388
|
+
if (match_len = has_terminal?('-', false, index))
|
2389
|
+
r2 = true
|
2390
|
+
@index += match_len
|
2344
2391
|
else
|
2345
2392
|
terminal_parse_failure('-')
|
2346
2393
|
r2 = nil
|
2347
2394
|
end
|
2348
2395
|
if r2
|
2396
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2349
2397
|
r0 = r2
|
2350
2398
|
else
|
2351
2399
|
@index = i0
|
@@ -2387,7 +2435,7 @@ module Delorean
|
|
2387
2435
|
if node_cache[:value].has_key?(index)
|
2388
2436
|
cached = node_cache[:value][index]
|
2389
2437
|
if cached
|
2390
|
-
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
|
2391
2439
|
@index = cached.interval.end
|
2392
2440
|
end
|
2393
2441
|
return cached
|
@@ -2396,42 +2444,52 @@ module Delorean
|
|
2396
2444
|
i0 = index
|
2397
2445
|
r1 = _nt_decimal
|
2398
2446
|
if r1
|
2447
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2399
2448
|
r0 = r1
|
2400
2449
|
else
|
2401
2450
|
r2 = _nt_integer
|
2402
2451
|
if r2
|
2452
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2403
2453
|
r0 = r2
|
2404
2454
|
else
|
2405
2455
|
r3 = _nt_string
|
2406
2456
|
if r3
|
2457
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2407
2458
|
r0 = r3
|
2408
2459
|
else
|
2409
2460
|
r4 = _nt_boolean
|
2410
2461
|
if r4
|
2462
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2411
2463
|
r0 = r4
|
2412
2464
|
else
|
2413
2465
|
r5 = _nt_nil_val
|
2414
2466
|
if r5
|
2467
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2415
2468
|
r0 = r5
|
2416
2469
|
else
|
2417
2470
|
r6 = _nt_identifier
|
2418
2471
|
if r6
|
2472
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2419
2473
|
r0 = r6
|
2420
2474
|
else
|
2421
2475
|
r7 = _nt_self
|
2422
2476
|
if r7
|
2477
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2423
2478
|
r0 = r7
|
2424
2479
|
else
|
2425
2480
|
r8 = _nt_list_expr
|
2426
2481
|
if r8
|
2482
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
2427
2483
|
r0 = r8
|
2428
2484
|
else
|
2429
2485
|
r9 = _nt_set_expr
|
2430
2486
|
if r9
|
2487
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
2431
2488
|
r0 = r9
|
2432
2489
|
else
|
2433
2490
|
r10 = _nt_hash_expr
|
2434
2491
|
if r10
|
2492
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
2435
2493
|
r0 = r10
|
2436
2494
|
else
|
2437
2495
|
i11, s11 = index, []
|
@@ -2439,9 +2497,9 @@ module Delorean
|
|
2439
2497
|
r14 = _nt_class_name
|
2440
2498
|
s13 << r14
|
2441
2499
|
if r14
|
2442
|
-
if has_terminal?('::', false, index)
|
2443
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index +
|
2444
|
-
@index +=
|
2500
|
+
if (match_len = has_terminal?('::', false, index))
|
2501
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2502
|
+
@index += match_len
|
2445
2503
|
else
|
2446
2504
|
terminal_parse_failure('::')
|
2447
2505
|
r15 = nil
|
@@ -2473,12 +2531,13 @@ module Delorean
|
|
2473
2531
|
r11 = nil
|
2474
2532
|
end
|
2475
2533
|
if r11
|
2534
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
2476
2535
|
r0 = r11
|
2477
2536
|
else
|
2478
2537
|
i17, s17 = index, []
|
2479
|
-
if has_terminal?('(', false, index)
|
2480
|
-
r18 =
|
2481
|
-
@index +=
|
2538
|
+
if (match_len = has_terminal?('(', false, index))
|
2539
|
+
r18 = true
|
2540
|
+
@index += match_len
|
2482
2541
|
else
|
2483
2542
|
terminal_parse_failure('(')
|
2484
2543
|
r18 = nil
|
@@ -2504,9 +2563,9 @@ module Delorean
|
|
2504
2563
|
end
|
2505
2564
|
s17 << r22
|
2506
2565
|
if r22
|
2507
|
-
if has_terminal?(')', false, index)
|
2508
|
-
r24 =
|
2509
|
-
@index +=
|
2566
|
+
if (match_len = has_terminal?(')', false, index))
|
2567
|
+
r24 = true
|
2568
|
+
@index += match_len
|
2510
2569
|
else
|
2511
2570
|
terminal_parse_failure(')')
|
2512
2571
|
r24 = nil
|
@@ -2524,6 +2583,7 @@ module Delorean
|
|
2524
2583
|
r17 = nil
|
2525
2584
|
end
|
2526
2585
|
if r17
|
2586
|
+
r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
|
2527
2587
|
r0 = r17
|
2528
2588
|
else
|
2529
2589
|
@index = i0
|
@@ -2567,7 +2627,7 @@ module Delorean
|
|
2567
2627
|
if node_cache[:fn_args].has_key?(index)
|
2568
2628
|
cached = node_cache[:fn_args][index]
|
2569
2629
|
if cached
|
2570
|
-
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
|
2571
2631
|
@index = cached.interval.end
|
2572
2632
|
end
|
2573
2633
|
return cached
|
@@ -2586,9 +2646,9 @@ module Delorean
|
|
2586
2646
|
end
|
2587
2647
|
s3 << r4
|
2588
2648
|
if r4
|
2589
|
-
if has_terminal?(',', false, index)
|
2590
|
-
r6 =
|
2591
|
-
@index +=
|
2649
|
+
if (match_len = has_terminal?(',', false, index))
|
2650
|
+
r6 = true
|
2651
|
+
@index += match_len
|
2592
2652
|
else
|
2593
2653
|
terminal_parse_failure(',')
|
2594
2654
|
r6 = nil
|
@@ -2665,7 +2725,7 @@ module Delorean
|
|
2665
2725
|
if node_cache[:hash_args].has_key?(index)
|
2666
2726
|
cached = node_cache[:hash_args][index]
|
2667
2727
|
if cached
|
2668
|
-
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
|
2669
2729
|
@index = cached.interval.end
|
2670
2730
|
end
|
2671
2731
|
return cached
|
@@ -2683,9 +2743,9 @@ module Delorean
|
|
2683
2743
|
end
|
2684
2744
|
s0 << r2
|
2685
2745
|
if r2
|
2686
|
-
if has_terminal?(':', false, index)
|
2687
|
-
r4 =
|
2688
|
-
@index +=
|
2746
|
+
if (match_len = has_terminal?(':', false, index))
|
2747
|
+
r4 = true
|
2748
|
+
@index += match_len
|
2689
2749
|
else
|
2690
2750
|
terminal_parse_failure(':')
|
2691
2751
|
r4 = nil
|
@@ -2712,9 +2772,9 @@ module Delorean
|
|
2712
2772
|
end
|
2713
2773
|
s9 << r10
|
2714
2774
|
if r10
|
2715
|
-
if has_terminal?(',', false, index)
|
2716
|
-
r12 =
|
2717
|
-
@index +=
|
2775
|
+
if (match_len = has_terminal?(',', false, index))
|
2776
|
+
r12 = true
|
2777
|
+
@index += match_len
|
2718
2778
|
else
|
2719
2779
|
terminal_parse_failure(',')
|
2720
2780
|
r12 = nil
|
@@ -2802,7 +2862,7 @@ module Delorean
|
|
2802
2862
|
if node_cache[:kw_args].has_key?(index)
|
2803
2863
|
cached = node_cache[:kw_args][index]
|
2804
2864
|
if cached
|
2805
|
-
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
|
2806
2866
|
@index = cached.interval.end
|
2807
2867
|
end
|
2808
2868
|
return cached
|
@@ -2821,9 +2881,9 @@ module Delorean
|
|
2821
2881
|
end
|
2822
2882
|
s2 << r4
|
2823
2883
|
if r4
|
2824
|
-
if has_terminal?('=', false, index)
|
2825
|
-
r6 =
|
2826
|
-
@index +=
|
2884
|
+
if (match_len = has_terminal?('=', false, index))
|
2885
|
+
r6 = true
|
2886
|
+
@index += match_len
|
2827
2887
|
else
|
2828
2888
|
terminal_parse_failure('=')
|
2829
2889
|
r6 = nil
|
@@ -2866,9 +2926,9 @@ module Delorean
|
|
2866
2926
|
end
|
2867
2927
|
s11 << r12
|
2868
2928
|
if r12
|
2869
|
-
if has_terminal?(',', false, index)
|
2870
|
-
r14 =
|
2871
|
-
@index +=
|
2929
|
+
if (match_len = has_terminal?(',', false, index))
|
2930
|
+
r14 = true
|
2931
|
+
@index += match_len
|
2872
2932
|
else
|
2873
2933
|
terminal_parse_failure(',')
|
2874
2934
|
r14 = nil
|
@@ -2933,7 +2993,7 @@ module Delorean
|
|
2933
2993
|
if node_cache[:decimal].has_key?(index)
|
2934
2994
|
cached = node_cache[:decimal][index]
|
2935
2995
|
if cached
|
2936
|
-
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
|
2937
2997
|
@index = cached.interval.end
|
2938
2998
|
end
|
2939
2999
|
return cached
|
@@ -2943,9 +3003,9 @@ module Delorean
|
|
2943
3003
|
r1 = _nt_integer
|
2944
3004
|
s0 << r1
|
2945
3005
|
if r1
|
2946
|
-
if has_terminal?('.', false, index)
|
2947
|
-
r2 =
|
2948
|
-
@index +=
|
3006
|
+
if (match_len = has_terminal?('.', false, index))
|
3007
|
+
r2 = true
|
3008
|
+
@index += match_len
|
2949
3009
|
else
|
2950
3010
|
terminal_parse_failure('.')
|
2951
3011
|
r2 = nil
|
@@ -2954,10 +3014,11 @@ module Delorean
|
|
2954
3014
|
if r2
|
2955
3015
|
s3, i3 = [], index
|
2956
3016
|
loop do
|
2957
|
-
if has_terminal?('\
|
3017
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
2958
3018
|
r4 = true
|
2959
3019
|
@index += 1
|
2960
3020
|
else
|
3021
|
+
terminal_parse_failure('[0-9]')
|
2961
3022
|
r4 = nil
|
2962
3023
|
end
|
2963
3024
|
if r4
|
@@ -2996,38 +3057,41 @@ module Delorean
|
|
2996
3057
|
if node_cache[:integer].has_key?(index)
|
2997
3058
|
cached = node_cache[:integer][index]
|
2998
3059
|
if cached
|
2999
|
-
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
|
3000
3061
|
@index = cached.interval.end
|
3001
3062
|
end
|
3002
3063
|
return cached
|
3003
3064
|
end
|
3004
3065
|
|
3005
3066
|
i0 = index
|
3006
|
-
if has_terminal?('0', false, index)
|
3007
|
-
r1 = instantiate_node(Literal,input, index...(index +
|
3008
|
-
@index +=
|
3067
|
+
if (match_len = has_terminal?('0', false, index))
|
3068
|
+
r1 = instantiate_node(Literal,input, index...(index + match_len))
|
3069
|
+
@index += match_len
|
3009
3070
|
else
|
3010
3071
|
terminal_parse_failure('0')
|
3011
3072
|
r1 = nil
|
3012
3073
|
end
|
3013
3074
|
if r1
|
3075
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3014
3076
|
r0 = r1
|
3015
3077
|
else
|
3016
3078
|
i2, s2 = index, []
|
3017
|
-
if has_terminal?('\
|
3079
|
+
if has_terminal?(@regexps[gr = '\A[1-9]'] ||= Regexp.new(gr), :regexp, index)
|
3018
3080
|
r3 = true
|
3019
3081
|
@index += 1
|
3020
3082
|
else
|
3083
|
+
terminal_parse_failure('[1-9]')
|
3021
3084
|
r3 = nil
|
3022
3085
|
end
|
3023
3086
|
s2 << r3
|
3024
3087
|
if r3
|
3025
3088
|
s4, i4 = [], index
|
3026
3089
|
loop do
|
3027
|
-
if has_terminal?('\
|
3090
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
3028
3091
|
r5 = true
|
3029
3092
|
@index += 1
|
3030
3093
|
else
|
3094
|
+
terminal_parse_failure('[0-9]')
|
3031
3095
|
r5 = nil
|
3032
3096
|
end
|
3033
3097
|
if r5
|
@@ -3047,6 +3111,7 @@ module Delorean
|
|
3047
3111
|
r2 = nil
|
3048
3112
|
end
|
3049
3113
|
if r2
|
3114
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
3050
3115
|
r0 = r2
|
3051
3116
|
else
|
3052
3117
|
@index = i0
|
@@ -3067,27 +3132,29 @@ module Delorean
|
|
3067
3132
|
if node_cache[:identifier].has_key?(index)
|
3068
3133
|
cached = node_cache[:identifier][index]
|
3069
3134
|
if cached
|
3070
|
-
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
|
3071
3136
|
@index = cached.interval.end
|
3072
3137
|
end
|
3073
3138
|
return cached
|
3074
3139
|
end
|
3075
3140
|
|
3076
3141
|
i0, s0 = index, []
|
3077
|
-
if has_terminal?('\
|
3142
|
+
if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
|
3078
3143
|
r1 = true
|
3079
3144
|
@index += 1
|
3080
3145
|
else
|
3146
|
+
terminal_parse_failure('[a-z]')
|
3081
3147
|
r1 = nil
|
3082
3148
|
end
|
3083
3149
|
s0 << r1
|
3084
3150
|
if r1
|
3085
3151
|
s2, i2 = [], index
|
3086
3152
|
loop do
|
3087
|
-
if has_terminal?('\
|
3153
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
3088
3154
|
r3 = true
|
3089
3155
|
@index += 1
|
3090
3156
|
else
|
3157
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
3091
3158
|
r3 = nil
|
3092
3159
|
end
|
3093
3160
|
if r3
|
@@ -3117,31 +3184,33 @@ module Delorean
|
|
3117
3184
|
if node_cache[:boolean].has_key?(index)
|
3118
3185
|
cached = node_cache[:boolean][index]
|
3119
3186
|
if cached
|
3120
|
-
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
|
3121
3188
|
@index = cached.interval.end
|
3122
3189
|
end
|
3123
3190
|
return cached
|
3124
3191
|
end
|
3125
3192
|
|
3126
3193
|
i0 = index
|
3127
|
-
if has_terminal?('true', false, index)
|
3128
|
-
r1 = instantiate_node(Literal,input, index...(index +
|
3129
|
-
@index +=
|
3194
|
+
if (match_len = has_terminal?('true', false, index))
|
3195
|
+
r1 = instantiate_node(Literal,input, index...(index + match_len))
|
3196
|
+
@index += match_len
|
3130
3197
|
else
|
3131
3198
|
terminal_parse_failure('true')
|
3132
3199
|
r1 = nil
|
3133
3200
|
end
|
3134
3201
|
if r1
|
3202
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3135
3203
|
r0 = r1
|
3136
3204
|
else
|
3137
|
-
if has_terminal?('false', false, index)
|
3138
|
-
r2 = instantiate_node(Literal,input, index...(index +
|
3139
|
-
@index +=
|
3205
|
+
if (match_len = has_terminal?('false', false, index))
|
3206
|
+
r2 = instantiate_node(Literal,input, index...(index + match_len))
|
3207
|
+
@index += match_len
|
3140
3208
|
else
|
3141
3209
|
terminal_parse_failure('false')
|
3142
3210
|
r2 = nil
|
3143
3211
|
end
|
3144
3212
|
if r2
|
3213
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
3145
3214
|
r0 = r2
|
3146
3215
|
else
|
3147
3216
|
@index = i0
|
@@ -3159,15 +3228,15 @@ module Delorean
|
|
3159
3228
|
if node_cache[:self].has_key?(index)
|
3160
3229
|
cached = node_cache[:self][index]
|
3161
3230
|
if cached
|
3162
|
-
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
|
3163
3232
|
@index = cached.interval.end
|
3164
3233
|
end
|
3165
3234
|
return cached
|
3166
3235
|
end
|
3167
3236
|
|
3168
|
-
if has_terminal?('_', false, index)
|
3169
|
-
r0 = instantiate_node(Self,input, index...(index +
|
3170
|
-
@index +=
|
3237
|
+
if (match_len = has_terminal?('_', false, index))
|
3238
|
+
r0 = instantiate_node(Self,input, index...(index + match_len))
|
3239
|
+
@index += match_len
|
3171
3240
|
else
|
3172
3241
|
terminal_parse_failure('_')
|
3173
3242
|
r0 = nil
|
@@ -3183,15 +3252,15 @@ module Delorean
|
|
3183
3252
|
if node_cache[:nil_val].has_key?(index)
|
3184
3253
|
cached = node_cache[:nil_val][index]
|
3185
3254
|
if cached
|
3186
|
-
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
|
3187
3256
|
@index = cached.interval.end
|
3188
3257
|
end
|
3189
3258
|
return cached
|
3190
3259
|
end
|
3191
3260
|
|
3192
|
-
if has_terminal?('nil', false, index)
|
3193
|
-
r0 = instantiate_node(Literal,input, index...(index +
|
3194
|
-
@index +=
|
3261
|
+
if (match_len = has_terminal?('nil', false, index))
|
3262
|
+
r0 = instantiate_node(Literal,input, index...(index + match_len))
|
3263
|
+
@index += match_len
|
3195
3264
|
else
|
3196
3265
|
terminal_parse_failure('nil')
|
3197
3266
|
r0 = nil
|
@@ -3207,15 +3276,15 @@ module Delorean
|
|
3207
3276
|
if node_cache[:sp4].has_key?(index)
|
3208
3277
|
cached = node_cache[:sp4][index]
|
3209
3278
|
if cached
|
3210
|
-
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
|
3211
3280
|
@index = cached.interval.end
|
3212
3281
|
end
|
3213
3282
|
return cached
|
3214
3283
|
end
|
3215
3284
|
|
3216
|
-
if has_terminal?(' ', false, index)
|
3217
|
-
r0 = instantiate_node(SyntaxNode,input, index...(index +
|
3218
|
-
@index +=
|
3285
|
+
if (match_len = has_terminal?(' ', false, index))
|
3286
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3287
|
+
@index += match_len
|
3219
3288
|
else
|
3220
3289
|
terminal_parse_failure(' ')
|
3221
3290
|
r0 = nil
|
@@ -3231,7 +3300,7 @@ module Delorean
|
|
3231
3300
|
if node_cache[:sp].has_key?(index)
|
3232
3301
|
cached = node_cache[:sp][index]
|
3233
3302
|
if cached
|
3234
|
-
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
|
3235
3304
|
@index = cached.interval.end
|
3236
3305
|
end
|
3237
3306
|
return cached
|
@@ -3239,10 +3308,11 @@ module Delorean
|
|
3239
3308
|
|
3240
3309
|
s0, i0 = [], index
|
3241
3310
|
loop do
|
3242
|
-
if has_terminal?('\
|
3311
|
+
if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
|
3243
3312
|
r1 = true
|
3244
3313
|
@index += 1
|
3245
3314
|
else
|
3315
|
+
terminal_parse_failure('[\\s]')
|
3246
3316
|
r1 = nil
|
3247
3317
|
end
|
3248
3318
|
if r1
|
@@ -3277,7 +3347,7 @@ module Delorean
|
|
3277
3347
|
if node_cache[:string].has_key?(index)
|
3278
3348
|
cached = node_cache[:string][index]
|
3279
3349
|
if cached
|
3280
|
-
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
|
3281
3351
|
@index = cached.interval.end
|
3282
3352
|
end
|
3283
3353
|
return cached
|
@@ -3285,9 +3355,9 @@ module Delorean
|
|
3285
3355
|
|
3286
3356
|
i0 = index
|
3287
3357
|
i1, s1 = index, []
|
3288
|
-
if has_terminal?('"', false, index)
|
3289
|
-
r2 =
|
3290
|
-
@index +=
|
3358
|
+
if (match_len = has_terminal?('"', false, index))
|
3359
|
+
r2 = true
|
3360
|
+
@index += match_len
|
3291
3361
|
else
|
3292
3362
|
terminal_parse_failure('"')
|
3293
3363
|
r2 = nil
|
@@ -3297,21 +3367,22 @@ module Delorean
|
|
3297
3367
|
s3, i3 = [], index
|
3298
3368
|
loop do
|
3299
3369
|
i4 = index
|
3300
|
-
if has_terminal?('\"', false, index)
|
3301
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index +
|
3302
|
-
@index +=
|
3370
|
+
if (match_len = has_terminal?('\"', false, index))
|
3371
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3372
|
+
@index += match_len
|
3303
3373
|
else
|
3304
3374
|
terminal_parse_failure('\"')
|
3305
3375
|
r5 = nil
|
3306
3376
|
end
|
3307
3377
|
if r5
|
3378
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
3308
3379
|
r4 = r5
|
3309
3380
|
else
|
3310
3381
|
i6, s6 = index, []
|
3311
3382
|
i7 = index
|
3312
|
-
if has_terminal?('"', false, index)
|
3313
|
-
r8 =
|
3314
|
-
@index +=
|
3383
|
+
if (match_len = has_terminal?('"', false, index))
|
3384
|
+
r8 = true
|
3385
|
+
@index += match_len
|
3315
3386
|
else
|
3316
3387
|
terminal_parse_failure('"')
|
3317
3388
|
r8 = nil
|
@@ -3325,7 +3396,7 @@ module Delorean
|
|
3325
3396
|
s6 << r7
|
3326
3397
|
if r7
|
3327
3398
|
if index < input_length
|
3328
|
-
r9 =
|
3399
|
+
r9 = true
|
3329
3400
|
@index += 1
|
3330
3401
|
else
|
3331
3402
|
terminal_parse_failure("any character")
|
@@ -3341,6 +3412,7 @@ module Delorean
|
|
3341
3412
|
r6 = nil
|
3342
3413
|
end
|
3343
3414
|
if r6
|
3415
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
3344
3416
|
r4 = r6
|
3345
3417
|
else
|
3346
3418
|
@index = i4
|
@@ -3356,9 +3428,9 @@ module Delorean
|
|
3356
3428
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
3357
3429
|
s1 << r3
|
3358
3430
|
if r3
|
3359
|
-
if has_terminal?('"', false, index)
|
3360
|
-
r10 =
|
3361
|
-
@index +=
|
3431
|
+
if (match_len = has_terminal?('"', false, index))
|
3432
|
+
r10 = true
|
3433
|
+
@index += match_len
|
3362
3434
|
else
|
3363
3435
|
terminal_parse_failure('"')
|
3364
3436
|
r10 = nil
|
@@ -3374,12 +3446,13 @@ module Delorean
|
|
3374
3446
|
r1 = nil
|
3375
3447
|
end
|
3376
3448
|
if r1
|
3449
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3377
3450
|
r0 = r1
|
3378
3451
|
else
|
3379
3452
|
i11, s11 = index, []
|
3380
|
-
if has_terminal?("'", false, index)
|
3381
|
-
r12 =
|
3382
|
-
@index +=
|
3453
|
+
if (match_len = has_terminal?("'", false, index))
|
3454
|
+
r12 = true
|
3455
|
+
@index += match_len
|
3383
3456
|
else
|
3384
3457
|
terminal_parse_failure("'")
|
3385
3458
|
r12 = nil
|
@@ -3388,10 +3461,11 @@ module Delorean
|
|
3388
3461
|
if r12
|
3389
3462
|
s13, i13 = [], index
|
3390
3463
|
loop do
|
3391
|
-
if has_terminal?('\
|
3464
|
+
if has_terminal?(@regexps[gr = '\A[^\']'] ||= Regexp.new(gr), :regexp, index)
|
3392
3465
|
r14 = true
|
3393
3466
|
@index += 1
|
3394
3467
|
else
|
3468
|
+
terminal_parse_failure('[^\']')
|
3395
3469
|
r14 = nil
|
3396
3470
|
end
|
3397
3471
|
if r14
|
@@ -3403,9 +3477,9 @@ module Delorean
|
|
3403
3477
|
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
3404
3478
|
s11 << r13
|
3405
3479
|
if r13
|
3406
|
-
if has_terminal?("'", false, index)
|
3407
|
-
r15 =
|
3408
|
-
@index +=
|
3480
|
+
if (match_len = has_terminal?("'", false, index))
|
3481
|
+
r15 = true
|
3482
|
+
@index += match_len
|
3409
3483
|
else
|
3410
3484
|
terminal_parse_failure("'")
|
3411
3485
|
r15 = nil
|
@@ -3421,6 +3495,7 @@ module Delorean
|
|
3421
3495
|
r11 = nil
|
3422
3496
|
end
|
3423
3497
|
if r11
|
3498
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
3424
3499
|
r0 = r11
|
3425
3500
|
else
|
3426
3501
|
@index = i0
|