rubinius-melbourne 2.0.1.0 → 2.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -9
- data/Gemfile +0 -4
- data/Rakefile +26 -19
- data/ext/rubinius/melbourne/extconf.rb +4 -3
- data/ext/rubinius/melbourne/grammar.cpp +2 -2
- data/ext/rubinius/melbourne/grammar.y +2 -2
- data/ext/rubinius/melbourne/melbourne.cpp +4 -5
- data/lib/rubinius/melbourne/version.rb +2 -2
- data/lib/rubinius/melbourne.rb +1 -21
- data/rubinius-melbourne.gemspec +6 -3
- data/spec/alias_spec.rb +13 -18
- data/spec/and_spec.rb +6 -12
- data/spec/array_spec.rb +28 -54
- data/spec/attrasgn_spec.rb +60 -85
- data/spec/back_ref_spec.rb +6 -8
- data/spec/call_spec.rb +137 -225
- data/spec/case_spec.rb +94 -112
- data/spec/cdecl_spec.rb +16 -28
- data/spec/class_spec.rb +28 -40
- data/spec/colon2_spec.rb +2 -4
- data/spec/colon3_spec.rb +2 -4
- data/spec/const_spec.rb +2 -4
- data/spec/custom/runner/relates.rb +4 -0
- data/spec/cvar_spec.rb +6 -12
- data/spec/cvasgn_spec.rb +20 -15
- data/spec/defined_spec.rb +57 -55
- data/spec/defn_spec.rb +218 -280
- data/spec/defs_spec.rb +30 -38
- data/spec/dot2_spec.rb +2 -4
- data/spec/dot3_spec.rb +2 -4
- data/spec/dregx_spec.rb +20 -34
- data/spec/dstr_spec.rb +87 -111
- data/spec/dsym_spec.rb +5 -7
- data/spec/dxstr_spec.rb +2 -4
- data/spec/ensure_spec.rb +32 -40
- data/spec/false_spec.rb +2 -4
- data/spec/flip2_spec.rb +22 -26
- data/spec/flip3_spec.rb +15 -17
- data/spec/for_spec.rb +25 -23
- data/spec/gasgn_spec.rb +4 -8
- data/spec/gvar_spec.rb +8 -16
- data/spec/hash_spec.rb +14 -18
- data/spec/iasgn_spec.rb +8 -14
- data/spec/if_spec.rb +50 -80
- data/spec/iter_spec.rb +328 -402
- data/spec/lasgn_spec.rb +143 -200
- data/spec/lit_spec.rb +20 -40
- data/spec/masgn_spec.rb +278 -309
- data/spec/match2_spec.rb +6 -10
- data/spec/match3_spec.rb +9 -13
- data/spec/match_spec.rb +2 -4
- data/spec/module_spec.rb +12 -16
- data/spec/nil_spec.rb +2 -4
- data/spec/not_spec.rb +6 -8
- data/spec/nth_ref_spec.rb +2 -4
- data/spec/op_asgn_spec.rb +118 -158
- data/spec/or_spec.rb +18 -24
- data/spec/postexe_spec.rb +2 -4
- data/spec/regex_spec.rb +11 -19
- data/spec/rescue_spec.rb +135 -143
- data/spec/return_spec.rb +19 -36
- data/spec/sclass_spec.rb +26 -25
- data/spec/spec_helper.rb +9 -0
- data/spec/str_spec.rb +25 -43
- data/spec/super_spec.rb +31 -49
- data/spec/true_spec.rb +2 -4
- data/spec/undef_spec.rb +38 -53
- data/spec/until_spec.rb +13 -105
- data/spec/valias_spec.rb +2 -4
- data/spec/while_spec.rb +35 -117
- data/spec/xstr_spec.rb +2 -4
- data/spec/yield_spec.rb +22 -42
- data/spec/zsuper_spec.rb +8 -16
- metadata +64 -22
- data/spec/cvdecl_spec.rb +0 -12
data/spec/lit_spec.rb
CHANGED
@@ -1,61 +1,41 @@
|
|
1
1
|
describe "A Lit node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:lit, 15]
|
5
|
-
end
|
2
|
+
parse "0b1111" do
|
3
|
+
[:lit, 15]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
[:lit, 1.1]
|
11
|
-
end
|
6
|
+
parse "1.1" do
|
7
|
+
[:lit, 1.1]
|
12
8
|
end
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
[:lit, 18446744073709551615]
|
17
|
-
end
|
10
|
+
parse "0xffffffffffffffff" do
|
11
|
+
[:lit, 18446744073709551615]
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
[:lit, 18446744073709551615]
|
23
|
-
end
|
14
|
+
parse "0xffff_ffff_ffff_ffff" do
|
15
|
+
[:lit, 18446744073709551615]
|
24
16
|
end
|
25
17
|
|
26
|
-
|
27
|
-
|
28
|
-
[:lit, 4012]
|
29
|
-
end
|
18
|
+
parse "07654" do
|
19
|
+
[:lit, 4012]
|
30
20
|
end
|
31
21
|
|
32
|
-
|
33
|
-
|
34
|
-
[:lit, -1]
|
35
|
-
end
|
22
|
+
parse "-1" do
|
23
|
+
[:lit, -1]
|
36
24
|
end
|
37
25
|
|
38
|
-
|
39
|
-
|
40
|
-
[:lit, 1]
|
41
|
-
end
|
26
|
+
parse "1" do
|
27
|
+
[:lit, 1]
|
42
28
|
end
|
43
29
|
|
44
|
-
|
45
|
-
|
46
|
-
[:lit, 80000000]
|
47
|
-
end
|
30
|
+
parse "8000_0000" do
|
31
|
+
[:lit, 80000000]
|
48
32
|
end
|
49
33
|
|
50
|
-
|
51
|
-
|
52
|
-
[:lit, :x]
|
53
|
-
end
|
34
|
+
parse ":x" do
|
35
|
+
[:lit, :x]
|
54
36
|
end
|
55
37
|
|
56
|
-
|
57
|
-
|
58
|
-
[:lit, :"*args"]
|
59
|
-
end
|
38
|
+
parse ":\"*args\"" do
|
39
|
+
[:lit, :"*args"]
|
60
40
|
end
|
61
41
|
end
|
data/spec/masgn_spec.rb
CHANGED
@@ -1,406 +1,375 @@
|
|
1
1
|
describe "A Masgn node" do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
[:masgn,
|
39
|
-
[:array,
|
40
|
-
[:attrasgn, [:call, nil, :a, [:arglist]], :b=, [:arglist]],
|
41
|
-
[:attrasgn, [:call, nil, :a, [:arglist]], :c=, [:arglist]],
|
42
|
-
[:lasgn, :_]],
|
43
|
-
[:to_ary, [:call, nil, :q, [:arglist]]]]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
relates <<-ruby do
|
2
|
+
parse "a, b.c = b.c, true" do
|
3
|
+
[:masgn,
|
4
|
+
[:array,
|
5
|
+
[:lasgn, :a],
|
6
|
+
[:attrasgn, [:call, nil, :b, [:arglist]], :c=, [:arglist]]],
|
7
|
+
[:array, [:call, [:call, nil, :b, [:arglist]], :c, [:arglist]], [:true]]]
|
8
|
+
end
|
9
|
+
|
10
|
+
parse "a, b = 1, 2, 3" do
|
11
|
+
[:masgn,
|
12
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
13
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
14
|
+
end
|
15
|
+
|
16
|
+
parse "a, b = c, d" do
|
17
|
+
[:masgn,
|
18
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
19
|
+
[:array, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
|
20
|
+
end
|
21
|
+
|
22
|
+
parse "a, b, *c = 1, 2, *[3, 4]" do
|
23
|
+
[:masgn,
|
24
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
25
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3], [:lit, 4]]]
|
26
|
+
end
|
27
|
+
|
28
|
+
parse "a.b, a.c, _ = q" do
|
29
|
+
[:masgn,
|
30
|
+
[:array,
|
31
|
+
[:attrasgn, [:call, nil, :a, [:arglist]], :b=, [:arglist]],
|
32
|
+
[:attrasgn, [:call, nil, :a, [:arglist]], :c=, [:arglist]],
|
33
|
+
[:lasgn, :_]],
|
34
|
+
[:to_ary, [:call, nil, :q, [:arglist]]]]
|
35
|
+
end
|
36
|
+
|
37
|
+
parse <<-ruby do
|
48
38
|
a, i, j = [], 1, 2
|
49
39
|
a[i], a[j] = a[j], a[i]
|
50
40
|
ruby
|
51
41
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
relates <<-ruby do
|
42
|
+
[:block,
|
43
|
+
[:masgn,
|
44
|
+
[:array, [:lasgn, :a], [:lasgn, :i], [:lasgn, :j]],
|
45
|
+
[:array, [:array], [:lit, 1], [:lit, 2]]],
|
46
|
+
[:masgn,
|
47
|
+
[:array,
|
48
|
+
[:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lvar, :i]]],
|
49
|
+
[:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lvar, :j]]]],
|
50
|
+
[:array,
|
51
|
+
[:call, [:lvar, :a], :[], [:arglist, [:lvar, :j]]],
|
52
|
+
[:call, [:lvar, :a], :[], [:arglist, [:lvar, :i]]]]]]
|
53
|
+
end
|
54
|
+
|
55
|
+
parse <<-ruby do
|
68
56
|
c, d, e, f = [], 1, 2, 3
|
69
57
|
a, *b = c[d] = f(e, f, c)
|
70
58
|
ruby
|
71
59
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
[:call, nil, :f, [:arglist, [:lvar, :e], [:lvar, :f], [:lvar, :c]]]]]]]]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
relates "a, b.c = d, e" do
|
90
|
-
parse do
|
91
|
-
[:masgn,
|
92
|
-
[:array,
|
93
|
-
[:lasgn, :a],
|
94
|
-
[:attrasgn, [:call, nil, :b, [:arglist]], :c=, [:arglist]]],
|
95
|
-
[:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
relates "*a.m = *b" do
|
100
|
-
parse do
|
101
|
-
[:masgn,
|
102
|
-
[:array,
|
103
|
-
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
104
|
-
[:splat, [:call, nil, :b, [:arglist]]]]
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
relates "*a.m = b" do
|
109
|
-
parse do
|
110
|
-
[:masgn,
|
111
|
-
[:array,
|
112
|
-
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
113
|
-
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
relates "A, B, C = 1, 2, 3" do
|
118
|
-
parse do
|
119
|
-
[:masgn,
|
120
|
-
[:array, [:cdecl, :A], [:cdecl, :B], [:cdecl, :C]],
|
121
|
-
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
relates "* = 1, 2" do
|
126
|
-
parse do
|
127
|
-
[:masgn, [:array, [:splat]], [:array, [:lit, 1], [:lit, 2]]]
|
128
|
-
end
|
60
|
+
[:block,
|
61
|
+
[:masgn,
|
62
|
+
[:array, [:lasgn, :c], [:lasgn, :d], [:lasgn, :e], [:lasgn, :f]],
|
63
|
+
[:array, [:array], [:lit, 1], [:lit, 2], [:lit, 3]]],
|
64
|
+
[:masgn,
|
65
|
+
[:array, [:lasgn, :a], [:splat, [:lasgn, :b]]],
|
66
|
+
[:to_ary,
|
67
|
+
[:attrasgn,
|
68
|
+
[:lvar, :c],
|
69
|
+
:[]=,
|
70
|
+
[:arglist,
|
71
|
+
[:lvar, :d],
|
72
|
+
[:call, nil, :f, [:arglist, [:lvar, :e], [:lvar, :f], [:lvar, :c]]]]]]]]
|
129
73
|
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
74
|
+
|
75
|
+
parse "a, b.c = d, e" do
|
76
|
+
[:masgn,
|
77
|
+
[:array,
|
78
|
+
[:lasgn, :a],
|
79
|
+
[:attrasgn, [:call, nil, :b, [:arglist]], :c=, [:arglist]]],
|
80
|
+
[:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]
|
137
81
|
end
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
82
|
+
|
83
|
+
parse "*a.m = *b" do
|
84
|
+
[:masgn,
|
85
|
+
[:array,
|
86
|
+
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
87
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
145
88
|
end
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
end
|
89
|
+
|
90
|
+
parse "*a.m = b" do
|
91
|
+
[:masgn,
|
92
|
+
[:array,
|
93
|
+
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
94
|
+
[:array, [:call, nil, :b, [:arglist]]]]
|
153
95
|
end
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
160
|
-
end
|
96
|
+
|
97
|
+
parse "A, B, C = 1, 2, 3" do
|
98
|
+
[:masgn,
|
99
|
+
[:array, [:cdecl, :A], [:cdecl, :B], [:cdecl, :C]],
|
100
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
161
101
|
end
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
[:masgn,
|
166
|
-
[:array, [:splat, [:iasgn, :@a]]],
|
167
|
-
[:splat, [:call, nil, :b, [:arglist]]]]
|
168
|
-
end
|
102
|
+
|
103
|
+
parse "* = 1, 2" do
|
104
|
+
[:masgn, [:array, [:splat]], [:array, [:lit, 1], [:lit, 2]]]
|
169
105
|
end
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
[:array, [:lit, 1], [:lit, 2]]]
|
176
|
-
end
|
106
|
+
|
107
|
+
parse "*$a = b" do
|
108
|
+
[:masgn,
|
109
|
+
[:array, [:splat, [:gasgn, :$a]]],
|
110
|
+
[:array, [:call, nil, :b, [:arglist]]]]
|
177
111
|
end
|
178
112
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
[:array, [:iasgn, :@a, [:lit, 1]], [:ivar, :@a]]]
|
184
|
-
end
|
113
|
+
parse "*$a = *b" do
|
114
|
+
[:masgn,
|
115
|
+
[:array, [:splat, [:gasgn, :$a]]],
|
116
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
185
117
|
end
|
186
118
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
[:array, [:lit, 1], [:lit, 2]]]
|
192
|
-
end
|
119
|
+
parse "a, @b = c, d" do
|
120
|
+
[:masgn,
|
121
|
+
[:array, [:lasgn, :a], [:iasgn, :@b]],
|
122
|
+
[:array, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
|
193
123
|
end
|
194
124
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
200
|
-
end
|
125
|
+
parse "*@a = b" do
|
126
|
+
[:masgn,
|
127
|
+
[:array, [:splat, [:iasgn, :@a]]],
|
128
|
+
[:array, [:call, nil, :b, [:arglist]]]]
|
201
129
|
end
|
202
130
|
|
203
|
-
|
204
|
-
|
131
|
+
parse "*@a = *b" do
|
132
|
+
[:masgn,
|
133
|
+
[:array, [:splat, [:iasgn, :@a]]],
|
134
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
205
135
|
end
|
206
136
|
|
207
|
-
|
208
|
-
|
137
|
+
parse "@a, $b = 1, 2" do
|
138
|
+
[:masgn,
|
139
|
+
[:array, [:iasgn, :@a], [:gasgn, :$b]],
|
140
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
209
141
|
end
|
210
142
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
[:splat, [:call, nil, :d, [:arglist]]]]
|
216
|
-
end
|
143
|
+
parse "a, b = (@a = 1), @a" do
|
144
|
+
[:masgn,
|
145
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
146
|
+
[:array, [:iasgn, :@a, [:lit, 1]], [:ivar, :@a]]]
|
217
147
|
end
|
218
148
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
[:array, [:lit, 1], [:splat, [:call, nil, :d, [:arglist]]]]]
|
224
|
-
end
|
149
|
+
parse "@@a, @@b = 1, 2" do
|
150
|
+
[:masgn,
|
151
|
+
[:array, [:cvasgn, :@@a], [:cvasgn, :@@b]],
|
152
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
225
153
|
end
|
226
154
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
[:splat, [:call, nil, :d, [:arglist]]]]
|
232
|
-
end
|
155
|
+
parse "a, b, *c = 1, 2, 3" do
|
156
|
+
[:masgn,
|
157
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
158
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
233
159
|
end
|
234
160
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
240
|
-
end
|
161
|
+
parse "a, b, *c = 1, 2" do
|
162
|
+
[:masgn,
|
163
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
164
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
241
165
|
end
|
242
166
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
248
|
-
end
|
167
|
+
parse "a, b, c, *d = 1, 2" do
|
168
|
+
[:masgn,
|
169
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c], [:splat, [:lasgn, :d]]],
|
170
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
249
171
|
end
|
250
172
|
|
251
|
-
|
252
|
-
|
253
|
-
[:
|
254
|
-
|
255
|
-
[:splat, [:call, nil, :b, [:arglist]]]]
|
256
|
-
end
|
173
|
+
parse "a, b, c = *d" do
|
174
|
+
[:masgn,
|
175
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
176
|
+
[:splat, [:call, nil, :d, [:arglist]]]]
|
257
177
|
end
|
258
178
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
[:to_ary, [:array, [:lit, 1], [:array, [:lit, 2], [:lit, 3]]]]]
|
264
|
-
end
|
179
|
+
parse "a, b, c = 1, *d" do
|
180
|
+
[:masgn,
|
181
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
182
|
+
[:argscat, [:array, [:lit, 1]], [:call, nil, :d, [:arglist]]]]
|
265
183
|
end
|
266
184
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
[:splat, [:array, [:array, [:array, [:lit, 1]]]]]]
|
272
|
-
end
|
185
|
+
parse "a, b, *c = *d" do
|
186
|
+
[:masgn,
|
187
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
188
|
+
[:splat, [:call, nil, :d, [:arglist]]]]
|
273
189
|
end
|
274
190
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
280
|
-
end
|
191
|
+
parse "*a = 1, 2, 3" do
|
192
|
+
[:masgn,
|
193
|
+
[:array, [:splat, [:lasgn, :a]]],
|
194
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
281
195
|
end
|
282
196
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
288
|
-
end
|
197
|
+
parse "*a = b" do
|
198
|
+
[:masgn,
|
199
|
+
[:array, [:splat, [:lasgn, :a]]],
|
200
|
+
[:array, [:call, nil, :b, [:arglist]]]]
|
289
201
|
end
|
290
202
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
[:to_ary, [:call, nil, :m, [:arglist, [:call, nil, :d, [:arglist]]]]]]
|
296
|
-
end
|
203
|
+
parse "*a = *b" do
|
204
|
+
[:masgn,
|
205
|
+
[:array, [:splat, [:lasgn, :a]]],
|
206
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
297
207
|
end
|
298
208
|
|
299
|
-
|
209
|
+
parse "a, (b, c) = [1, [2, 3]]" do
|
210
|
+
[:masgn,
|
211
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
212
|
+
[:to_ary, [:array, [:lit, 1], [:array, [:lit, 2], [:lit, 3]]]]]
|
213
|
+
end
|
214
|
+
|
215
|
+
parse "a, = *[[[1]]]" do
|
216
|
+
[:masgn,
|
217
|
+
[:array, [:lasgn, :a]],
|
218
|
+
[:splat, [:array, [:array, [:array, [:lit, 1]]]]]]
|
219
|
+
end
|
220
|
+
|
221
|
+
parse "a, b, * = c" do
|
222
|
+
[:masgn,
|
223
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat]],
|
224
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
225
|
+
end
|
226
|
+
|
227
|
+
parse "a, b, = c" do
|
228
|
+
[:masgn,
|
229
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
230
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
231
|
+
end
|
232
|
+
|
233
|
+
parse "a, b, c = m d" do
|
234
|
+
[:masgn,
|
235
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
236
|
+
[:to_ary, [:call, nil, :m, [:arglist, [:call, nil, :d, [:arglist]]]]]]
|
237
|
+
end
|
300
238
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
end
|
239
|
+
parse "a, b, *c = d, e, f, g" do
|
240
|
+
[:masgn,
|
241
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
242
|
+
[:array,
|
243
|
+
[:call, nil, :d, [:arglist]],
|
244
|
+
[:call, nil, :e, [:arglist]],
|
245
|
+
[:call, nil, :f, [:arglist]],
|
246
|
+
[:call, nil, :g, [:arglist]]]]
|
310
247
|
end
|
311
248
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
[:to_ary, [:call, [:call, nil, :d, [:arglist]], :e, [:arglist, [:str, "f"]]]]]
|
317
|
-
end
|
249
|
+
parse "a, b, *c = d.e(\"f\")" do
|
250
|
+
[:masgn,
|
251
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
252
|
+
[:to_ary, [:call, [:call, nil, :d, [:arglist]], :e, [:arglist, [:str, "f"]]]]]
|
318
253
|
end
|
319
254
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
[:to_ary, [:call, nil, :d, [:arglist]]]]
|
325
|
-
end
|
255
|
+
parse "a, b, *c = d" do
|
256
|
+
[:masgn,
|
257
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
258
|
+
[:to_ary, [:call, nil, :d, [:arglist]]]]
|
326
259
|
end
|
327
260
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
333
|
-
end
|
261
|
+
parse "a, b = c" do
|
262
|
+
[:masgn,
|
263
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
264
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
334
265
|
end
|
335
266
|
|
336
|
-
|
267
|
+
parse <<-ruby do
|
337
268
|
m do
|
338
269
|
a, b = 1, 2
|
339
270
|
next
|
340
271
|
end
|
341
272
|
ruby
|
342
273
|
|
343
|
-
|
274
|
+
[:call,
|
275
|
+
nil,
|
276
|
+
:m,
|
277
|
+
[:arglist,
|
344
278
|
[:iter,
|
345
|
-
[:
|
346
|
-
nil,
|
279
|
+
[:args],
|
347
280
|
[:block,
|
348
281
|
[:masgn,
|
349
282
|
[:array, [:lasgn, :a], [:lasgn, :b]],
|
350
283
|
[:array, [:lit, 1], [:lit, 2]]],
|
351
|
-
[:next]]]
|
352
|
-
end
|
284
|
+
[:next]]]]]
|
353
285
|
end
|
354
286
|
|
355
|
-
|
356
|
-
|
287
|
+
parse "a, (b, c) = 1" do
|
288
|
+
[:masgn,
|
289
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
290
|
+
[:to_ary, [:lit, 1]]]
|
357
291
|
end
|
358
292
|
|
359
|
-
|
360
|
-
|
293
|
+
parse "a, (b, c) = *1" do
|
294
|
+
[:masgn,
|
295
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
296
|
+
[:splat, [:lit, 1]]]
|
361
297
|
end
|
362
298
|
|
363
|
-
|
364
|
-
|
299
|
+
parse "a, (b, c) = 1, 2, 3" do
|
300
|
+
[:masgn,
|
301
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
302
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
365
303
|
end
|
366
304
|
|
367
|
-
|
368
|
-
|
305
|
+
parse "a, (b, *c), d = 1, 2, 3, 4" do
|
306
|
+
[:masgn,
|
307
|
+
[:array,
|
308
|
+
[:lasgn, :a],
|
309
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]]],
|
310
|
+
[:lasgn, :d]],
|
311
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3], [:lit, 4]]]
|
369
312
|
end
|
370
313
|
|
371
|
-
|
372
|
-
|
314
|
+
parse "a, (b, c) = 1, *2" do
|
315
|
+
[:masgn,
|
316
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
317
|
+
[:argscat, [:array, [:lit, 1]], [:lit, 2]]]
|
373
318
|
end
|
374
319
|
|
375
|
-
|
376
|
-
|
320
|
+
parse "a, (b, *c) = 1" do
|
321
|
+
[:masgn,
|
322
|
+
[:array,
|
323
|
+
[:lasgn, :a],
|
324
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]]]],
|
325
|
+
[:to_ary, [:lit, 1]]]
|
377
326
|
end
|
378
327
|
|
379
|
-
|
380
|
-
|
328
|
+
parse "a, (b, *c) = 1, 2" do
|
329
|
+
[:masgn,
|
330
|
+
[:array,
|
331
|
+
[:lasgn, :a],
|
332
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]]]],
|
333
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
381
334
|
end
|
382
335
|
|
383
|
-
|
384
|
-
|
336
|
+
parse "a, (b, *c) = *1" do
|
337
|
+
[:masgn,
|
338
|
+
[:array,
|
339
|
+
[:lasgn, :a],
|
340
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]]]],
|
341
|
+
[:splat, [:lit, 1]]]
|
385
342
|
end
|
386
343
|
|
387
|
-
|
388
|
-
|
344
|
+
parse "a, (b, *c) = 1, *2" do
|
345
|
+
[:masgn,
|
346
|
+
[:array,
|
347
|
+
[:lasgn, :a],
|
348
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]]]],
|
349
|
+
[:argscat, [:array, [:lit, 1]], [:lit, 2]]]
|
389
350
|
end
|
390
351
|
|
391
|
-
|
392
|
-
|
352
|
+
parse "a, (*b) = 1" do
|
353
|
+
[:masgn,
|
354
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:splat, [:lasgn, :b]]]]],
|
355
|
+
[:to_ary, [:lit, 1]]]
|
393
356
|
end
|
394
357
|
|
395
|
-
|
396
|
-
|
358
|
+
parse "a, (*b) = 1, 2" do
|
359
|
+
[:masgn,
|
360
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:splat, [:lasgn, :b]]]]],
|
361
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
397
362
|
end
|
398
363
|
|
399
|
-
|
400
|
-
|
364
|
+
parse "a, (*b) = *1" do
|
365
|
+
[:masgn,
|
366
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:splat, [:lasgn, :b]]]]],
|
367
|
+
[:splat, [:lit, 1]]]
|
401
368
|
end
|
402
369
|
|
403
|
-
|
404
|
-
|
370
|
+
parse "a, (*b) = 1, *2" do
|
371
|
+
[:masgn,
|
372
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:splat, [:lasgn, :b]]]]],
|
373
|
+
[:argscat, [:array, [:lit, 1]], [:lit, 2]]]
|
405
374
|
end
|
406
375
|
end
|