delorean_lang 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delorean/base.rb +2 -7
- data/lib/delorean/delorean.rb +718 -250
- data/lib/delorean/delorean.treetop +13 -3
- data/lib/delorean/engine.rb +7 -0
- data/lib/delorean/nodes.rb +54 -48
- data/lib/delorean/version.rb +1 -1
- data/spec/eval_spec.rb +54 -0
- data/spec/parse_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ee6c299a28d2661c437cfc0553212fea130fd66ecf24c0ffee3e107862c39cf
|
4
|
+
data.tar.gz: c4e175afaddad9ef6ec2f8c8f38627b0ccae1dc0221750c330fee618eede8797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40e755c1bc18b01c98a91954dd7b1885c3b36d807cd596fe6c867f94a8194d8475d3e0e5bc6784a7b64af40e4f55d39f125e3bcd63b020e163b18c95f5e24392
|
7
|
+
data.tar.gz: ad92b4bca8c7707fb3995799eb1de2b838972be97da2934d51f32dd2bc97c59f6f40dedf44be9f60ad74711bdb4eed4c8d6c557035d0e7d6765afacc53bbee9b
|
data/lib/delorean/base.rb
CHANGED
@@ -94,7 +94,7 @@ module Delorean
|
|
94
94
|
# This is pretty awful. NOTE: can't sanitize params as Marty
|
95
95
|
# patches NodeCall and modifies params to send _parent_id.
|
96
96
|
# This whole thing needs to be redone.
|
97
|
-
@cp ||= params
|
97
|
+
@cp ||= Hash[params]
|
98
98
|
end
|
99
99
|
|
100
100
|
def evaluate(attr)
|
@@ -258,12 +258,7 @@ module Delorean
|
|
258
258
|
s.detect {|sc| sc && ai.class <= sc}
|
259
259
|
end
|
260
260
|
|
261
|
-
|
262
|
-
# FIXME: can't freeze AR relations since then we can't chain
|
263
|
-
# calls (e.g. the chaining modifies the relation object. Not
|
264
|
-
# sure what this side-effect means. Delorean code which
|
265
|
-
# perform queries on queries seems to work.
|
266
|
-
(ActiveRecord::Relation === res || Class === res) ? res : res.freeze
|
261
|
+
obj.send(msg, *args)
|
267
262
|
end
|
268
263
|
|
269
264
|
######################################################################
|
data/lib/delorean/delorean.rb
CHANGED
@@ -914,19 +914,19 @@ module Delorean
|
|
914
914
|
end
|
915
915
|
|
916
916
|
module DotExp1
|
917
|
-
def
|
917
|
+
def i
|
918
918
|
elements[2]
|
919
919
|
end
|
920
920
|
|
921
|
+
def al
|
922
|
+
elements[5]
|
923
|
+
end
|
924
|
+
|
921
925
|
end
|
922
926
|
|
923
927
|
module DotExp2
|
924
|
-
def i
|
925
|
-
elements[2]
|
926
|
-
end
|
927
|
-
|
928
928
|
def al
|
929
|
-
elements[
|
929
|
+
elements[2]
|
930
930
|
end
|
931
931
|
|
932
932
|
end
|
@@ -1002,11 +1002,11 @@ module Delorean
|
|
1002
1002
|
r0 = r1
|
1003
1003
|
else
|
1004
1004
|
i9, s9 = index, []
|
1005
|
-
if (match_len = has_terminal?('
|
1005
|
+
if (match_len = has_terminal?('.', false, index))
|
1006
1006
|
r10 = true
|
1007
1007
|
@index += match_len
|
1008
1008
|
else
|
1009
|
-
terminal_parse_failure('\'
|
1009
|
+
terminal_parse_failure('\'.\'')
|
1010
1010
|
r10 = nil
|
1011
1011
|
end
|
1012
1012
|
s9 << r10
|
@@ -1019,36 +1019,59 @@ module Delorean
|
|
1019
1019
|
end
|
1020
1020
|
s9 << r11
|
1021
1021
|
if r11
|
1022
|
-
|
1023
|
-
if r14
|
1024
|
-
r13 = r14
|
1025
|
-
else
|
1026
|
-
r13 = instantiate_node(SyntaxNode,input, index...index)
|
1027
|
-
end
|
1022
|
+
r13 = _nt_identifier
|
1028
1023
|
s9 << r13
|
1029
1024
|
if r13
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1025
|
+
if (match_len = has_terminal?('(', false, index))
|
1026
|
+
r14 = true
|
1027
|
+
@index += match_len
|
1033
1028
|
else
|
1034
|
-
|
1029
|
+
terminal_parse_failure('\'(\'')
|
1030
|
+
r14 = nil
|
1035
1031
|
end
|
1036
|
-
s9 <<
|
1037
|
-
if
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1032
|
+
s9 << r14
|
1033
|
+
if r14
|
1034
|
+
r16 = _nt_sp
|
1035
|
+
if r16
|
1036
|
+
r15 = r16
|
1041
1037
|
else
|
1042
|
-
|
1043
|
-
|
1038
|
+
r15 = instantiate_node(SyntaxNode,input, index...index)
|
1039
|
+
end
|
1040
|
+
s9 << r15
|
1041
|
+
if r15
|
1042
|
+
r18 = _nt_fn_args
|
1043
|
+
if r18
|
1044
|
+
r17 = r18
|
1045
|
+
else
|
1046
|
+
r17 = instantiate_node(SyntaxNode,input, index...index)
|
1047
|
+
end
|
1048
|
+
s9 << r17
|
1049
|
+
if r17
|
1050
|
+
r20 = _nt_sp
|
1051
|
+
if r20
|
1052
|
+
r19 = r20
|
1053
|
+
else
|
1054
|
+
r19 = instantiate_node(SyntaxNode,input, index...index)
|
1055
|
+
end
|
1056
|
+
s9 << r19
|
1057
|
+
if r19
|
1058
|
+
if (match_len = has_terminal?(')', false, index))
|
1059
|
+
r21 = true
|
1060
|
+
@index += match_len
|
1061
|
+
else
|
1062
|
+
terminal_parse_failure('\')\'')
|
1063
|
+
r21 = nil
|
1064
|
+
end
|
1065
|
+
s9 << r21
|
1066
|
+
end
|
1067
|
+
end
|
1044
1068
|
end
|
1045
|
-
s9 << r17
|
1046
1069
|
end
|
1047
1070
|
end
|
1048
1071
|
end
|
1049
1072
|
end
|
1050
1073
|
if s9.last
|
1051
|
-
r9 = instantiate_node(
|
1074
|
+
r9 = instantiate_node(Call,input, i9...index, s9)
|
1052
1075
|
r9.extend(DotExp1)
|
1053
1076
|
else
|
1054
1077
|
@index = i9
|
@@ -1058,85 +1081,62 @@ module Delorean
|
|
1058
1081
|
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
1059
1082
|
r0 = r9
|
1060
1083
|
else
|
1061
|
-
|
1062
|
-
if (match_len = has_terminal?('
|
1063
|
-
|
1084
|
+
i22, s22 = index, []
|
1085
|
+
if (match_len = has_terminal?('(', false, index))
|
1086
|
+
r23 = true
|
1064
1087
|
@index += match_len
|
1065
1088
|
else
|
1066
|
-
terminal_parse_failure('\'
|
1067
|
-
|
1068
|
-
end
|
1069
|
-
|
1070
|
-
if
|
1071
|
-
|
1072
|
-
if
|
1073
|
-
|
1089
|
+
terminal_parse_failure('\'(\'')
|
1090
|
+
r23 = nil
|
1091
|
+
end
|
1092
|
+
s22 << r23
|
1093
|
+
if r23
|
1094
|
+
r25 = _nt_sp
|
1095
|
+
if r25
|
1096
|
+
r24 = r25
|
1074
1097
|
else
|
1075
|
-
|
1076
|
-
end
|
1077
|
-
|
1078
|
-
if
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1098
|
+
r24 = instantiate_node(SyntaxNode,input, index...index)
|
1099
|
+
end
|
1100
|
+
s22 << r24
|
1101
|
+
if r24
|
1102
|
+
r27 = _nt_kw_args
|
1103
|
+
if r27
|
1104
|
+
r26 = r27
|
1105
|
+
else
|
1106
|
+
r26 = instantiate_node(SyntaxNode,input, index...index)
|
1107
|
+
end
|
1108
|
+
s22 << r26
|
1109
|
+
if r26
|
1110
|
+
r29 = _nt_sp
|
1111
|
+
if r29
|
1112
|
+
r28 = r29
|
1085
1113
|
else
|
1086
|
-
|
1087
|
-
r23 = nil
|
1114
|
+
r28 = instantiate_node(SyntaxNode,input, index...index)
|
1088
1115
|
end
|
1089
|
-
|
1090
|
-
if
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1116
|
+
s22 << r28
|
1117
|
+
if r28
|
1118
|
+
if (match_len = has_terminal?(')', false, index))
|
1119
|
+
r30 = true
|
1120
|
+
@index += match_len
|
1094
1121
|
else
|
1095
|
-
|
1096
|
-
|
1097
|
-
s18 << r24
|
1098
|
-
if r24
|
1099
|
-
r27 = _nt_kw_args
|
1100
|
-
if r27
|
1101
|
-
r26 = r27
|
1102
|
-
else
|
1103
|
-
r26 = instantiate_node(SyntaxNode,input, index...index)
|
1104
|
-
end
|
1105
|
-
s18 << r26
|
1106
|
-
if r26
|
1107
|
-
r29 = _nt_sp
|
1108
|
-
if r29
|
1109
|
-
r28 = r29
|
1110
|
-
else
|
1111
|
-
r28 = instantiate_node(SyntaxNode,input, index...index)
|
1112
|
-
end
|
1113
|
-
s18 << r28
|
1114
|
-
if r28
|
1115
|
-
if (match_len = has_terminal?(')', false, index))
|
1116
|
-
r30 = true
|
1117
|
-
@index += match_len
|
1118
|
-
else
|
1119
|
-
terminal_parse_failure('\')\'')
|
1120
|
-
r30 = nil
|
1121
|
-
end
|
1122
|
-
s18 << r30
|
1123
|
-
end
|
1124
|
-
end
|
1122
|
+
terminal_parse_failure('\')\'')
|
1123
|
+
r30 = nil
|
1125
1124
|
end
|
1125
|
+
s22 << r30
|
1126
1126
|
end
|
1127
1127
|
end
|
1128
1128
|
end
|
1129
1129
|
end
|
1130
|
-
if
|
1131
|
-
|
1132
|
-
|
1130
|
+
if s22.last
|
1131
|
+
r22 = instantiate_node(NodeCall,input, i22...index, s22)
|
1132
|
+
r22.extend(DotExp2)
|
1133
1133
|
else
|
1134
|
-
@index =
|
1135
|
-
|
1134
|
+
@index = i22
|
1135
|
+
r22 = nil
|
1136
1136
|
end
|
1137
|
-
if
|
1138
|
-
|
1139
|
-
r0 =
|
1137
|
+
if r22
|
1138
|
+
r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
|
1139
|
+
r0 = r22
|
1140
1140
|
else
|
1141
1141
|
i31, s31 = index, []
|
1142
1142
|
if (match_len = has_terminal?('.', false, index))
|
@@ -2749,12 +2749,58 @@ module Delorean
|
|
2749
2749
|
end
|
2750
2750
|
|
2751
2751
|
module HashArgs0
|
2752
|
+
def sp
|
2753
|
+
elements[1]
|
2754
|
+
end
|
2755
|
+
|
2756
|
+
def e3
|
2757
|
+
elements[2]
|
2758
|
+
end
|
2759
|
+
|
2760
|
+
end
|
2761
|
+
|
2762
|
+
module HashArgs1
|
2752
2763
|
def al
|
2753
2764
|
elements[3]
|
2754
2765
|
end
|
2755
2766
|
end
|
2756
2767
|
|
2757
|
-
module
|
2768
|
+
module HashArgs2
|
2769
|
+
def splat
|
2770
|
+
elements[0]
|
2771
|
+
end
|
2772
|
+
|
2773
|
+
def e0
|
2774
|
+
elements[1]
|
2775
|
+
end
|
2776
|
+
|
2777
|
+
def ifexp
|
2778
|
+
elements[3]
|
2779
|
+
end
|
2780
|
+
|
2781
|
+
def args_rest
|
2782
|
+
elements[4]
|
2783
|
+
end
|
2784
|
+
end
|
2785
|
+
|
2786
|
+
module HashArgs3
|
2787
|
+
def sp
|
2788
|
+
elements[1]
|
2789
|
+
end
|
2790
|
+
|
2791
|
+
def e3
|
2792
|
+
elements[2]
|
2793
|
+
end
|
2794
|
+
|
2795
|
+
end
|
2796
|
+
|
2797
|
+
module HashArgs4
|
2798
|
+
def al
|
2799
|
+
elements[3]
|
2800
|
+
end
|
2801
|
+
end
|
2802
|
+
|
2803
|
+
module HashArgs5
|
2758
2804
|
def e0
|
2759
2805
|
elements[0]
|
2760
2806
|
end
|
@@ -2763,8 +2809,12 @@ module Delorean
|
|
2763
2809
|
elements[4]
|
2764
2810
|
end
|
2765
2811
|
|
2812
|
+
def ifexp
|
2813
|
+
elements[6]
|
2814
|
+
end
|
2815
|
+
|
2766
2816
|
def args_rest
|
2767
|
-
elements[
|
2817
|
+
elements[7]
|
2768
2818
|
end
|
2769
2819
|
end
|
2770
2820
|
|
@@ -2779,98 +2829,282 @@ module Delorean
|
|
2779
2829
|
return cached
|
2780
2830
|
end
|
2781
2831
|
|
2782
|
-
i0
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2832
|
+
i0 = index
|
2833
|
+
i1, s1 = index, []
|
2834
|
+
if (match_len = has_terminal?('**', false, index))
|
2835
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2836
|
+
@index += match_len
|
2837
|
+
else
|
2838
|
+
terminal_parse_failure('\'**\'')
|
2839
|
+
r2 = nil
|
2840
|
+
end
|
2841
|
+
s1 << r2
|
2842
|
+
if r2
|
2843
|
+
r3 = _nt_expression
|
2844
|
+
s1 << r3
|
2787
2845
|
if r3
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
end
|
2792
|
-
s0 << r2
|
2793
|
-
if r2
|
2794
|
-
if (match_len = has_terminal?(':', false, index))
|
2795
|
-
r4 = true
|
2796
|
-
@index += match_len
|
2846
|
+
r5 = _nt_sp
|
2847
|
+
if r5
|
2848
|
+
r4 = r5
|
2797
2849
|
else
|
2798
|
-
|
2799
|
-
r4 = nil
|
2850
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2800
2851
|
end
|
2801
|
-
|
2852
|
+
s1 << r4
|
2802
2853
|
if r4
|
2803
|
-
|
2804
|
-
if
|
2805
|
-
|
2854
|
+
i7, s7 = index, []
|
2855
|
+
if (match_len = has_terminal?('if', false, index))
|
2856
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2857
|
+
@index += match_len
|
2806
2858
|
else
|
2807
|
-
|
2859
|
+
terminal_parse_failure('\'if\'')
|
2860
|
+
r8 = nil
|
2808
2861
|
end
|
2809
|
-
|
2810
|
-
if
|
2811
|
-
|
2812
|
-
|
2813
|
-
if
|
2814
|
-
|
2815
|
-
|
2816
|
-
if
|
2817
|
-
|
2862
|
+
s7 << r8
|
2863
|
+
if r8
|
2864
|
+
r9 = _nt_sp
|
2865
|
+
s7 << r9
|
2866
|
+
if r9
|
2867
|
+
r10 = _nt_expression
|
2868
|
+
s7 << r10
|
2869
|
+
if r10
|
2870
|
+
r12 = _nt_sp
|
2871
|
+
if r12
|
2872
|
+
r11 = r12
|
2873
|
+
else
|
2874
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
2875
|
+
end
|
2876
|
+
s7 << r11
|
2877
|
+
end
|
2878
|
+
end
|
2879
|
+
end
|
2880
|
+
if s7.last
|
2881
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
2882
|
+
r7.extend(HashArgs0)
|
2883
|
+
else
|
2884
|
+
@index = i7
|
2885
|
+
r7 = nil
|
2886
|
+
end
|
2887
|
+
if r7
|
2888
|
+
r6 = r7
|
2889
|
+
else
|
2890
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
2891
|
+
end
|
2892
|
+
s1 << r6
|
2893
|
+
if r6
|
2894
|
+
i14, s14 = index, []
|
2895
|
+
r16 = _nt_sp
|
2896
|
+
if r16
|
2897
|
+
r15 = r16
|
2898
|
+
else
|
2899
|
+
r15 = instantiate_node(SyntaxNode,input, index...index)
|
2900
|
+
end
|
2901
|
+
s14 << r15
|
2902
|
+
if r15
|
2903
|
+
if (match_len = has_terminal?(',', false, index))
|
2904
|
+
r17 = true
|
2905
|
+
@index += match_len
|
2818
2906
|
else
|
2819
|
-
|
2907
|
+
terminal_parse_failure('\',\'')
|
2908
|
+
r17 = nil
|
2820
2909
|
end
|
2821
|
-
|
2822
|
-
if
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2910
|
+
s14 << r17
|
2911
|
+
if r17
|
2912
|
+
r19 = _nt_sp
|
2913
|
+
if r19
|
2914
|
+
r18 = r19
|
2826
2915
|
else
|
2827
|
-
|
2828
|
-
r12 = nil
|
2916
|
+
r18 = instantiate_node(SyntaxNode,input, index...index)
|
2829
2917
|
end
|
2830
|
-
|
2831
|
-
if
|
2832
|
-
|
2833
|
-
if
|
2834
|
-
|
2918
|
+
s14 << r18
|
2919
|
+
if r18
|
2920
|
+
r21 = _nt_hash_args
|
2921
|
+
if r21
|
2922
|
+
r20 = r21
|
2923
|
+
else
|
2924
|
+
r20 = instantiate_node(SyntaxNode,input, index...index)
|
2925
|
+
end
|
2926
|
+
s14 << r20
|
2927
|
+
end
|
2928
|
+
end
|
2929
|
+
end
|
2930
|
+
if s14.last
|
2931
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
2932
|
+
r14.extend(HashArgs1)
|
2933
|
+
else
|
2934
|
+
@index = i14
|
2935
|
+
r14 = nil
|
2936
|
+
end
|
2937
|
+
if r14
|
2938
|
+
r13 = r14
|
2939
|
+
else
|
2940
|
+
r13 = instantiate_node(SyntaxNode,input, index...index)
|
2941
|
+
end
|
2942
|
+
s1 << r13
|
2943
|
+
end
|
2944
|
+
end
|
2945
|
+
end
|
2946
|
+
end
|
2947
|
+
if s1.last
|
2948
|
+
r1 = instantiate_node(HashArgs,input, i1...index, s1)
|
2949
|
+
r1.extend(HashArgs2)
|
2950
|
+
else
|
2951
|
+
@index = i1
|
2952
|
+
r1 = nil
|
2953
|
+
end
|
2954
|
+
if r1
|
2955
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2956
|
+
r0 = r1
|
2957
|
+
else
|
2958
|
+
i22, s22 = index, []
|
2959
|
+
r23 = _nt_expression
|
2960
|
+
s22 << r23
|
2961
|
+
if r23
|
2962
|
+
r25 = _nt_sp
|
2963
|
+
if r25
|
2964
|
+
r24 = r25
|
2965
|
+
else
|
2966
|
+
r24 = instantiate_node(SyntaxNode,input, index...index)
|
2967
|
+
end
|
2968
|
+
s22 << r24
|
2969
|
+
if r24
|
2970
|
+
if (match_len = has_terminal?(':', false, index))
|
2971
|
+
r26 = true
|
2972
|
+
@index += match_len
|
2973
|
+
else
|
2974
|
+
terminal_parse_failure('\':\'')
|
2975
|
+
r26 = nil
|
2976
|
+
end
|
2977
|
+
s22 << r26
|
2978
|
+
if r26
|
2979
|
+
r28 = _nt_sp
|
2980
|
+
if r28
|
2981
|
+
r27 = r28
|
2982
|
+
else
|
2983
|
+
r27 = instantiate_node(SyntaxNode,input, index...index)
|
2984
|
+
end
|
2985
|
+
s22 << r27
|
2986
|
+
if r27
|
2987
|
+
r29 = _nt_expression
|
2988
|
+
s22 << r29
|
2989
|
+
if r29
|
2990
|
+
r31 = _nt_sp
|
2991
|
+
if r31
|
2992
|
+
r30 = r31
|
2993
|
+
else
|
2994
|
+
r30 = instantiate_node(SyntaxNode,input, index...index)
|
2995
|
+
end
|
2996
|
+
s22 << r30
|
2997
|
+
if r30
|
2998
|
+
i33, s33 = index, []
|
2999
|
+
if (match_len = has_terminal?('if', false, index))
|
3000
|
+
r34 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3001
|
+
@index += match_len
|
3002
|
+
else
|
3003
|
+
terminal_parse_failure('\'if\'')
|
3004
|
+
r34 = nil
|
3005
|
+
end
|
3006
|
+
s33 << r34
|
3007
|
+
if r34
|
3008
|
+
r35 = _nt_sp
|
3009
|
+
s33 << r35
|
3010
|
+
if r35
|
3011
|
+
r36 = _nt_expression
|
3012
|
+
s33 << r36
|
3013
|
+
if r36
|
3014
|
+
r38 = _nt_sp
|
3015
|
+
if r38
|
3016
|
+
r37 = r38
|
3017
|
+
else
|
3018
|
+
r37 = instantiate_node(SyntaxNode,input, index...index)
|
3019
|
+
end
|
3020
|
+
s33 << r37
|
3021
|
+
end
|
3022
|
+
end
|
3023
|
+
end
|
3024
|
+
if s33.last
|
3025
|
+
r33 = instantiate_node(SyntaxNode,input, i33...index, s33)
|
3026
|
+
r33.extend(HashArgs3)
|
3027
|
+
else
|
3028
|
+
@index = i33
|
3029
|
+
r33 = nil
|
3030
|
+
end
|
3031
|
+
if r33
|
3032
|
+
r32 = r33
|
2835
3033
|
else
|
2836
|
-
|
3034
|
+
r32 = instantiate_node(SyntaxNode,input, index...index)
|
2837
3035
|
end
|
2838
|
-
|
2839
|
-
if
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
3036
|
+
s22 << r32
|
3037
|
+
if r32
|
3038
|
+
i40, s40 = index, []
|
3039
|
+
r42 = _nt_sp
|
3040
|
+
if r42
|
3041
|
+
r41 = r42
|
3042
|
+
else
|
3043
|
+
r41 = instantiate_node(SyntaxNode,input, index...index)
|
3044
|
+
end
|
3045
|
+
s40 << r41
|
3046
|
+
if r41
|
3047
|
+
if (match_len = has_terminal?(',', false, index))
|
3048
|
+
r43 = true
|
3049
|
+
@index += match_len
|
3050
|
+
else
|
3051
|
+
terminal_parse_failure('\',\'')
|
3052
|
+
r43 = nil
|
3053
|
+
end
|
3054
|
+
s40 << r43
|
3055
|
+
if r43
|
3056
|
+
r45 = _nt_sp
|
3057
|
+
if r45
|
3058
|
+
r44 = r45
|
3059
|
+
else
|
3060
|
+
r44 = instantiate_node(SyntaxNode,input, index...index)
|
3061
|
+
end
|
3062
|
+
s40 << r44
|
3063
|
+
if r44
|
3064
|
+
r47 = _nt_hash_args
|
3065
|
+
if r47
|
3066
|
+
r46 = r47
|
3067
|
+
else
|
3068
|
+
r46 = instantiate_node(SyntaxNode,input, index...index)
|
3069
|
+
end
|
3070
|
+
s40 << r46
|
3071
|
+
end
|
3072
|
+
end
|
3073
|
+
end
|
3074
|
+
if s40.last
|
3075
|
+
r40 = instantiate_node(SyntaxNode,input, i40...index, s40)
|
3076
|
+
r40.extend(HashArgs4)
|
3077
|
+
else
|
3078
|
+
@index = i40
|
3079
|
+
r40 = nil
|
3080
|
+
end
|
3081
|
+
if r40
|
3082
|
+
r39 = r40
|
2843
3083
|
else
|
2844
|
-
|
3084
|
+
r39 = instantiate_node(SyntaxNode,input, index...index)
|
2845
3085
|
end
|
2846
|
-
|
3086
|
+
s22 << r39
|
2847
3087
|
end
|
2848
3088
|
end
|
2849
3089
|
end
|
2850
|
-
if s9.last
|
2851
|
-
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
2852
|
-
r9.extend(HashArgs0)
|
2853
|
-
else
|
2854
|
-
@index = i9
|
2855
|
-
r9 = nil
|
2856
|
-
end
|
2857
|
-
if r9
|
2858
|
-
r8 = r9
|
2859
|
-
else
|
2860
|
-
r8 = instantiate_node(SyntaxNode,input, index...index)
|
2861
|
-
end
|
2862
|
-
s0 << r8
|
2863
3090
|
end
|
2864
3091
|
end
|
2865
3092
|
end
|
2866
3093
|
end
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
3094
|
+
if s22.last
|
3095
|
+
r22 = instantiate_node(HashArgs,input, i22...index, s22)
|
3096
|
+
r22.extend(HashArgs5)
|
3097
|
+
else
|
3098
|
+
@index = i22
|
3099
|
+
r22 = nil
|
3100
|
+
end
|
3101
|
+
if r22
|
3102
|
+
r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
|
3103
|
+
r0 = r22
|
3104
|
+
else
|
3105
|
+
@index = i0
|
3106
|
+
r0 = nil
|
3107
|
+
end
|
2874
3108
|
end
|
2875
3109
|
|
2876
3110
|
node_cache[:hash_args][start_index] = r0
|
@@ -2879,8 +3113,12 @@ module Delorean
|
|
2879
3113
|
end
|
2880
3114
|
|
2881
3115
|
module KwArgs0
|
2882
|
-
def
|
2883
|
-
elements[
|
3116
|
+
def sp
|
3117
|
+
elements[1]
|
3118
|
+
end
|
3119
|
+
|
3120
|
+
def e3
|
3121
|
+
elements[2]
|
2884
3122
|
end
|
2885
3123
|
|
2886
3124
|
end
|
@@ -2892,7 +3130,7 @@ module Delorean
|
|
2892
3130
|
end
|
2893
3131
|
|
2894
3132
|
module KwArgs2
|
2895
|
-
def
|
3133
|
+
def splat
|
2896
3134
|
elements[0]
|
2897
3135
|
end
|
2898
3136
|
|
@@ -2900,9 +3138,55 @@ module Delorean
|
|
2900
3138
|
elements[1]
|
2901
3139
|
end
|
2902
3140
|
|
3141
|
+
def ifexp
|
3142
|
+
elements[3]
|
3143
|
+
end
|
3144
|
+
|
2903
3145
|
def args_rest
|
3146
|
+
elements[4]
|
3147
|
+
end
|
3148
|
+
end
|
3149
|
+
|
3150
|
+
module KwArgs3
|
3151
|
+
def i
|
3152
|
+
elements[0]
|
3153
|
+
end
|
3154
|
+
|
3155
|
+
end
|
3156
|
+
|
3157
|
+
module KwArgs4
|
3158
|
+
def sp
|
3159
|
+
elements[1]
|
3160
|
+
end
|
3161
|
+
|
3162
|
+
def e3
|
2904
3163
|
elements[2]
|
2905
3164
|
end
|
3165
|
+
|
3166
|
+
end
|
3167
|
+
|
3168
|
+
module KwArgs5
|
3169
|
+
def al
|
3170
|
+
elements[3]
|
3171
|
+
end
|
3172
|
+
end
|
3173
|
+
|
3174
|
+
module KwArgs6
|
3175
|
+
def k
|
3176
|
+
elements[0]
|
3177
|
+
end
|
3178
|
+
|
3179
|
+
def arg0
|
3180
|
+
elements[1]
|
3181
|
+
end
|
3182
|
+
|
3183
|
+
def ifexp
|
3184
|
+
elements[3]
|
3185
|
+
end
|
3186
|
+
|
3187
|
+
def args_rest
|
3188
|
+
elements[4]
|
3189
|
+
end
|
2906
3190
|
end
|
2907
3191
|
|
2908
3192
|
def _nt_kw_args
|
@@ -2916,112 +3200,296 @@ module Delorean
|
|
2916
3200
|
return cached
|
2917
3201
|
end
|
2918
3202
|
|
2919
|
-
i0
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
r5 = _nt_sp
|
2925
|
-
if r5
|
2926
|
-
r4 = r5
|
2927
|
-
else
|
2928
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2929
|
-
end
|
2930
|
-
s2 << r4
|
2931
|
-
if r4
|
2932
|
-
if (match_len = has_terminal?('=', false, index))
|
2933
|
-
r6 = true
|
2934
|
-
@index += match_len
|
2935
|
-
else
|
2936
|
-
terminal_parse_failure('\'=\'')
|
2937
|
-
r6 = nil
|
2938
|
-
end
|
2939
|
-
s2 << r6
|
2940
|
-
if r6
|
2941
|
-
r8 = _nt_sp
|
2942
|
-
if r8
|
2943
|
-
r7 = r8
|
2944
|
-
else
|
2945
|
-
r7 = instantiate_node(SyntaxNode,input, index...index)
|
2946
|
-
end
|
2947
|
-
s2 << r7
|
2948
|
-
end
|
2949
|
-
end
|
2950
|
-
end
|
2951
|
-
if s2.last
|
2952
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2953
|
-
r2.extend(KwArgs0)
|
3203
|
+
i0 = index
|
3204
|
+
i1, s1 = index, []
|
3205
|
+
if (match_len = has_terminal?('**', false, index))
|
3206
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3207
|
+
@index += match_len
|
2954
3208
|
else
|
2955
|
-
|
3209
|
+
terminal_parse_failure('\'**\'')
|
2956
3210
|
r2 = nil
|
2957
3211
|
end
|
3212
|
+
s1 << r2
|
2958
3213
|
if r2
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
r9 = _nt_expression
|
2966
|
-
s0 << r9
|
2967
|
-
if r9
|
2968
|
-
i11, s11 = index, []
|
2969
|
-
r13 = _nt_sp
|
2970
|
-
if r13
|
2971
|
-
r12 = r13
|
3214
|
+
r3 = _nt_expression
|
3215
|
+
s1 << r3
|
3216
|
+
if r3
|
3217
|
+
r5 = _nt_sp
|
3218
|
+
if r5
|
3219
|
+
r4 = r5
|
2972
3220
|
else
|
2973
|
-
|
3221
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2974
3222
|
end
|
2975
|
-
|
2976
|
-
if
|
2977
|
-
|
2978
|
-
|
3223
|
+
s1 << r4
|
3224
|
+
if r4
|
3225
|
+
i7, s7 = index, []
|
3226
|
+
if (match_len = has_terminal?('if', false, index))
|
3227
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2979
3228
|
@index += match_len
|
2980
3229
|
else
|
2981
|
-
terminal_parse_failure('\'
|
2982
|
-
|
3230
|
+
terminal_parse_failure('\'if\'')
|
3231
|
+
r8 = nil
|
2983
3232
|
end
|
2984
|
-
|
2985
|
-
if
|
3233
|
+
s7 << r8
|
3234
|
+
if r8
|
3235
|
+
r9 = _nt_sp
|
3236
|
+
s7 << r9
|
3237
|
+
if r9
|
3238
|
+
r10 = _nt_expression
|
3239
|
+
s7 << r10
|
3240
|
+
if r10
|
3241
|
+
r12 = _nt_sp
|
3242
|
+
if r12
|
3243
|
+
r11 = r12
|
3244
|
+
else
|
3245
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
3246
|
+
end
|
3247
|
+
s7 << r11
|
3248
|
+
end
|
3249
|
+
end
|
3250
|
+
end
|
3251
|
+
if s7.last
|
3252
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
3253
|
+
r7.extend(KwArgs0)
|
3254
|
+
else
|
3255
|
+
@index = i7
|
3256
|
+
r7 = nil
|
3257
|
+
end
|
3258
|
+
if r7
|
3259
|
+
r6 = r7
|
3260
|
+
else
|
3261
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
3262
|
+
end
|
3263
|
+
s1 << r6
|
3264
|
+
if r6
|
3265
|
+
i14, s14 = index, []
|
2986
3266
|
r16 = _nt_sp
|
2987
3267
|
if r16
|
2988
3268
|
r15 = r16
|
2989
3269
|
else
|
2990
3270
|
r15 = instantiate_node(SyntaxNode,input, index...index)
|
2991
3271
|
end
|
2992
|
-
|
3272
|
+
s14 << r15
|
2993
3273
|
if r15
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
3274
|
+
if (match_len = has_terminal?(',', false, index))
|
3275
|
+
r17 = true
|
3276
|
+
@index += match_len
|
2997
3277
|
else
|
2998
|
-
|
3278
|
+
terminal_parse_failure('\',\'')
|
3279
|
+
r17 = nil
|
2999
3280
|
end
|
3000
|
-
|
3281
|
+
s14 << r17
|
3282
|
+
if r17
|
3283
|
+
r19 = _nt_sp
|
3284
|
+
if r19
|
3285
|
+
r18 = r19
|
3286
|
+
else
|
3287
|
+
r18 = instantiate_node(SyntaxNode,input, index...index)
|
3288
|
+
end
|
3289
|
+
s14 << r18
|
3290
|
+
if r18
|
3291
|
+
r21 = _nt_kw_args
|
3292
|
+
if r21
|
3293
|
+
r20 = r21
|
3294
|
+
else
|
3295
|
+
r20 = instantiate_node(SyntaxNode,input, index...index)
|
3296
|
+
end
|
3297
|
+
s14 << r20
|
3298
|
+
end
|
3299
|
+
end
|
3300
|
+
end
|
3301
|
+
if s14.last
|
3302
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
3303
|
+
r14.extend(KwArgs1)
|
3304
|
+
else
|
3305
|
+
@index = i14
|
3306
|
+
r14 = nil
|
3307
|
+
end
|
3308
|
+
if r14
|
3309
|
+
r13 = r14
|
3310
|
+
else
|
3311
|
+
r13 = instantiate_node(SyntaxNode,input, index...index)
|
3001
3312
|
end
|
3313
|
+
s1 << r13
|
3002
3314
|
end
|
3003
3315
|
end
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3316
|
+
end
|
3317
|
+
end
|
3318
|
+
if s1.last
|
3319
|
+
r1 = instantiate_node(KwArgs,input, i1...index, s1)
|
3320
|
+
r1.extend(KwArgs2)
|
3321
|
+
else
|
3322
|
+
@index = i1
|
3323
|
+
r1 = nil
|
3324
|
+
end
|
3325
|
+
if r1
|
3326
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3327
|
+
r0 = r1
|
3328
|
+
else
|
3329
|
+
i22, s22 = index, []
|
3330
|
+
i24, s24 = index, []
|
3331
|
+
r25 = _nt_identifier
|
3332
|
+
s24 << r25
|
3333
|
+
if r25
|
3334
|
+
r27 = _nt_sp
|
3335
|
+
if r27
|
3336
|
+
r26 = r27
|
3007
3337
|
else
|
3008
|
-
|
3009
|
-
r11 = nil
|
3338
|
+
r26 = instantiate_node(SyntaxNode,input, index...index)
|
3010
3339
|
end
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3340
|
+
s24 << r26
|
3341
|
+
if r26
|
3342
|
+
if (match_len = has_terminal?('=', false, index))
|
3343
|
+
r28 = true
|
3344
|
+
@index += match_len
|
3345
|
+
else
|
3346
|
+
terminal_parse_failure('\'=\'')
|
3347
|
+
r28 = nil
|
3348
|
+
end
|
3349
|
+
s24 << r28
|
3350
|
+
if r28
|
3351
|
+
r30 = _nt_sp
|
3352
|
+
if r30
|
3353
|
+
r29 = r30
|
3354
|
+
else
|
3355
|
+
r29 = instantiate_node(SyntaxNode,input, index...index)
|
3356
|
+
end
|
3357
|
+
s24 << r29
|
3358
|
+
end
|
3015
3359
|
end
|
3016
|
-
s0 << r10
|
3017
3360
|
end
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3361
|
+
if s24.last
|
3362
|
+
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
3363
|
+
r24.extend(KwArgs3)
|
3364
|
+
else
|
3365
|
+
@index = i24
|
3366
|
+
r24 = nil
|
3367
|
+
end
|
3368
|
+
if r24
|
3369
|
+
r23 = r24
|
3370
|
+
else
|
3371
|
+
r23 = instantiate_node(SyntaxNode,input, index...index)
|
3372
|
+
end
|
3373
|
+
s22 << r23
|
3374
|
+
if r23
|
3375
|
+
r31 = _nt_expression
|
3376
|
+
s22 << r31
|
3377
|
+
if r31
|
3378
|
+
r33 = _nt_sp
|
3379
|
+
if r33
|
3380
|
+
r32 = r33
|
3381
|
+
else
|
3382
|
+
r32 = instantiate_node(SyntaxNode,input, index...index)
|
3383
|
+
end
|
3384
|
+
s22 << r32
|
3385
|
+
if r32
|
3386
|
+
i35, s35 = index, []
|
3387
|
+
if (match_len = has_terminal?('if', false, index))
|
3388
|
+
r36 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3389
|
+
@index += match_len
|
3390
|
+
else
|
3391
|
+
terminal_parse_failure('\'if\'')
|
3392
|
+
r36 = nil
|
3393
|
+
end
|
3394
|
+
s35 << r36
|
3395
|
+
if r36
|
3396
|
+
r37 = _nt_sp
|
3397
|
+
s35 << r37
|
3398
|
+
if r37
|
3399
|
+
r38 = _nt_expression
|
3400
|
+
s35 << r38
|
3401
|
+
if r38
|
3402
|
+
r40 = _nt_sp
|
3403
|
+
if r40
|
3404
|
+
r39 = r40
|
3405
|
+
else
|
3406
|
+
r39 = instantiate_node(SyntaxNode,input, index...index)
|
3407
|
+
end
|
3408
|
+
s35 << r39
|
3409
|
+
end
|
3410
|
+
end
|
3411
|
+
end
|
3412
|
+
if s35.last
|
3413
|
+
r35 = instantiate_node(SyntaxNode,input, i35...index, s35)
|
3414
|
+
r35.extend(KwArgs4)
|
3415
|
+
else
|
3416
|
+
@index = i35
|
3417
|
+
r35 = nil
|
3418
|
+
end
|
3419
|
+
if r35
|
3420
|
+
r34 = r35
|
3421
|
+
else
|
3422
|
+
r34 = instantiate_node(SyntaxNode,input, index...index)
|
3423
|
+
end
|
3424
|
+
s22 << r34
|
3425
|
+
if r34
|
3426
|
+
i42, s42 = index, []
|
3427
|
+
r44 = _nt_sp
|
3428
|
+
if r44
|
3429
|
+
r43 = r44
|
3430
|
+
else
|
3431
|
+
r43 = instantiate_node(SyntaxNode,input, index...index)
|
3432
|
+
end
|
3433
|
+
s42 << r43
|
3434
|
+
if r43
|
3435
|
+
if (match_len = has_terminal?(',', false, index))
|
3436
|
+
r45 = true
|
3437
|
+
@index += match_len
|
3438
|
+
else
|
3439
|
+
terminal_parse_failure('\',\'')
|
3440
|
+
r45 = nil
|
3441
|
+
end
|
3442
|
+
s42 << r45
|
3443
|
+
if r45
|
3444
|
+
r47 = _nt_sp
|
3445
|
+
if r47
|
3446
|
+
r46 = r47
|
3447
|
+
else
|
3448
|
+
r46 = instantiate_node(SyntaxNode,input, index...index)
|
3449
|
+
end
|
3450
|
+
s42 << r46
|
3451
|
+
if r46
|
3452
|
+
r49 = _nt_kw_args
|
3453
|
+
if r49
|
3454
|
+
r48 = r49
|
3455
|
+
else
|
3456
|
+
r48 = instantiate_node(SyntaxNode,input, index...index)
|
3457
|
+
end
|
3458
|
+
s42 << r48
|
3459
|
+
end
|
3460
|
+
end
|
3461
|
+
end
|
3462
|
+
if s42.last
|
3463
|
+
r42 = instantiate_node(SyntaxNode,input, i42...index, s42)
|
3464
|
+
r42.extend(KwArgs5)
|
3465
|
+
else
|
3466
|
+
@index = i42
|
3467
|
+
r42 = nil
|
3468
|
+
end
|
3469
|
+
if r42
|
3470
|
+
r41 = r42
|
3471
|
+
else
|
3472
|
+
r41 = instantiate_node(SyntaxNode,input, index...index)
|
3473
|
+
end
|
3474
|
+
s22 << r41
|
3475
|
+
end
|
3476
|
+
end
|
3477
|
+
end
|
3478
|
+
end
|
3479
|
+
if s22.last
|
3480
|
+
r22 = instantiate_node(KwArgs,input, i22...index, s22)
|
3481
|
+
r22.extend(KwArgs6)
|
3482
|
+
else
|
3483
|
+
@index = i22
|
3484
|
+
r22 = nil
|
3485
|
+
end
|
3486
|
+
if r22
|
3487
|
+
r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
|
3488
|
+
r0 = r22
|
3489
|
+
else
|
3490
|
+
@index = i0
|
3491
|
+
r0 = nil
|
3492
|
+
end
|
3025
3493
|
end
|
3026
3494
|
|
3027
3495
|
node_cache[:kw_args][start_index] = r0
|