rubinius-melbourne 2.0.1.0 → 2.1.0.0
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/.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/dsym_spec.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
describe "A Dsym node" do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
[:str, "y"]]
|
8
|
-
end
|
2
|
+
parse ':"x#{(1 + 1)}y"' do
|
3
|
+
[:dsym,
|
4
|
+
"x",
|
5
|
+
[:evstr, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
|
6
|
+
[:str, "y"]]
|
9
7
|
end
|
10
8
|
end
|
data/spec/dxstr_spec.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
describe "A Dxstr node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
t = 5
|
4
4
|
`touch \#{t}`
|
5
5
|
ruby
|
6
6
|
|
7
|
-
|
8
|
-
[:block, [:lasgn, :t, [:lit, 5]], [:dxstr, "touch ", [:evstr, [:lvar, :t]]]]
|
9
|
-
end
|
7
|
+
[:block, [:lasgn, :t, [:lit, 5]], [:dxstr, "touch ", [:evstr, [:lvar, :t]]]]
|
10
8
|
end
|
11
9
|
end
|
data/spec/ensure_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe "An Ensure node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
begin
|
4
4
|
# do nothing
|
5
5
|
rescue
|
@@ -9,12 +9,12 @@ describe "An Ensure node" do
|
|
9
9
|
end
|
10
10
|
ruby
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
[:ensure,
|
13
|
+
[:rescue, [:nil], [:resbody, [:array, [:const, :StandardError]], [:nil]]],
|
14
|
+
[:nil]]
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
parse <<-ruby do
|
18
18
|
begin
|
19
19
|
(1 + 1)
|
20
20
|
rescue SyntaxError => e1
|
@@ -28,22 +28,20 @@ describe "An Ensure node" do
|
|
28
28
|
end
|
29
29
|
ruby
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
[:lit, 5]]
|
43
|
-
end
|
31
|
+
[:ensure,
|
32
|
+
[:rescue,
|
33
|
+
[:call, [:lit, 1], :+, [:arglist, [:lit, 1]]],
|
34
|
+
[:resbody,
|
35
|
+
[:array, [:const, :SyntaxError], [:lasgn, :e1, [:gvar, :$!]]],
|
36
|
+
[:lit, 2],
|
37
|
+
[:resbody,
|
38
|
+
[:array, [:const, :Exception], [:lasgn, :e2, [:gvar, :$!]]],
|
39
|
+
[:lit, 3]]],
|
40
|
+
[:lit, 4]],
|
41
|
+
[:lit, 5]]
|
44
42
|
end
|
45
43
|
|
46
|
-
|
44
|
+
parse <<-ruby do
|
47
45
|
begin
|
48
46
|
a
|
49
47
|
rescue
|
@@ -53,14 +51,14 @@ describe "An Ensure node" do
|
|
53
51
|
end
|
54
52
|
ruby
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
[:ensure,
|
55
|
+
[:rescue,
|
56
|
+
[:call, nil, :a, [:arglist]],
|
57
|
+
[:resbody, [:array, [:const, :StandardError]], [:nil]]],
|
58
|
+
[:nil]]
|
61
59
|
end
|
62
60
|
|
63
|
-
|
61
|
+
parse <<-ruby do
|
64
62
|
begin
|
65
63
|
14
|
66
64
|
return 2
|
@@ -69,12 +67,10 @@ describe "An Ensure node" do
|
|
69
67
|
end
|
70
68
|
ruby
|
71
69
|
|
72
|
-
|
73
|
-
[:ensure, [:block, [:lit, 14], [:return, [:lit, 2]]], [:lit, 13]]
|
74
|
-
end
|
70
|
+
[:ensure, [:block, [:lit, 14], [:return, [:lit, 2]]], [:lit, 13]]
|
75
71
|
end
|
76
72
|
|
77
|
-
|
73
|
+
parse <<-ruby do
|
78
74
|
begin
|
79
75
|
begin
|
80
76
|
14
|
@@ -87,14 +83,12 @@ describe "An Ensure node" do
|
|
87
83
|
end
|
88
84
|
ruby
|
89
85
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
[:lit, 15]]
|
94
|
-
end
|
86
|
+
[:ensure,
|
87
|
+
[:ensure, [:block, [:lit, 14], [:return, [:lit, 2]]], [:lit, 13]],
|
88
|
+
[:lit, 15]]
|
95
89
|
end
|
96
90
|
|
97
|
-
|
91
|
+
parse <<-ruby do
|
98
92
|
begin
|
99
93
|
14
|
100
94
|
return 2
|
@@ -108,10 +102,8 @@ describe "An Ensure node" do
|
|
108
102
|
end
|
109
103
|
ruby
|
110
104
|
|
111
|
-
|
112
|
-
[:
|
113
|
-
|
114
|
-
[:ensure, [:block, [:lit, 15], [:return, [:lit, 3]]], [:lit, 16]]]
|
115
|
-
end
|
105
|
+
[:ensure,
|
106
|
+
[:block, [:lit, 14], [:return, [:lit, 2]]],
|
107
|
+
[:ensure, [:block, [:lit, 15], [:return, [:lit, 3]]], [:lit, 16]]]
|
116
108
|
end
|
117
109
|
end
|
data/spec/false_spec.rb
CHANGED
data/spec/flip2_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe "A Flip2 node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
x = if ((i % 4) == 0)..((i % 3) == 0) then
|
4
4
|
i
|
5
5
|
else
|
@@ -7,37 +7,33 @@ describe "A Flip2 node" do
|
|
7
7
|
end
|
8
8
|
ruby
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
[:nil]]]
|
25
|
-
end
|
10
|
+
[:lasgn,
|
11
|
+
:x,
|
12
|
+
[:if,
|
13
|
+
[:flip2,
|
14
|
+
[:call,
|
15
|
+
[:call, [:call, nil, :i, [:arglist]], :%, [:arglist, [:lit, 4]]],
|
16
|
+
:==,
|
17
|
+
[:arglist, [:lit, 0]]],
|
18
|
+
[:call,
|
19
|
+
[:call, [:call, nil, :i, [:arglist]], :%, [:arglist, [:lit, 3]]],
|
20
|
+
:==,
|
21
|
+
[:arglist, [:lit, 0]]]],
|
22
|
+
[:call, nil, :i, [:arglist]],
|
23
|
+
nil]]
|
26
24
|
end
|
27
25
|
|
28
|
-
|
26
|
+
parse <<-ruby do
|
29
27
|
if 1..2.a?(b) then
|
30
28
|
nil
|
31
29
|
end
|
32
30
|
ruby
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
nil]
|
41
|
-
end
|
32
|
+
[:if,
|
33
|
+
[:flip2,
|
34
|
+
[:lit, 1],
|
35
|
+
[:call, [:lit, 2], :a?, [:arglist, [:call, nil, :b, [:arglist]]]]],
|
36
|
+
[:nil],
|
37
|
+
nil]
|
42
38
|
end
|
43
39
|
end
|
data/spec/flip3_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe "A Flip3 node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
x = if ((i % 4) == 0)...((i % 3) == 0) then
|
4
4
|
i
|
5
5
|
else
|
@@ -7,21 +7,19 @@ describe "A Flip3 node" do
|
|
7
7
|
end
|
8
8
|
ruby
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
[:nil]]]
|
25
|
-
end
|
10
|
+
[:lasgn,
|
11
|
+
:x,
|
12
|
+
[:if,
|
13
|
+
[:flip3,
|
14
|
+
[:call,
|
15
|
+
[:call, [:call, nil, :i, [:arglist]], :%, [:arglist, [:lit, 4]]],
|
16
|
+
:==,
|
17
|
+
[:arglist, [:lit, 0]]],
|
18
|
+
[:call,
|
19
|
+
[:call, [:call, nil, :i, [:arglist]], :%, [:arglist, [:lit, 3]]],
|
20
|
+
:==,
|
21
|
+
[:arglist, [:lit, 0]]]],
|
22
|
+
[:call, nil, :i, [:arglist]],
|
23
|
+
nil]]
|
26
24
|
end
|
27
25
|
end
|
data/spec/for_spec.rb
CHANGED
@@ -1,55 +1,50 @@
|
|
1
1
|
describe "A For node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
for o in ary do
|
4
4
|
puts(o)
|
5
5
|
end
|
6
6
|
ruby
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
[:call, nil, :puts, [:arglist, [:lvar, :o]]]]
|
13
|
-
end
|
8
|
+
[:for,
|
9
|
+
[:lasgn, :o],
|
10
|
+
[:call, nil, :ary, [:arglist]],
|
11
|
+
[:call, nil, :puts, [:arglist, [:lvar, :o]]]]
|
14
12
|
end
|
15
13
|
|
16
|
-
|
14
|
+
parse <<-ruby do
|
17
15
|
for i in (0..max) do
|
18
16
|
# do nothing
|
19
17
|
end
|
20
18
|
ruby
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
[:for,
|
21
|
+
[:lasgn, :i],
|
22
|
+
[:dot2, [:lit, 0], [:call, nil, :max, [:arglist]]],
|
23
|
+
[:nil]]
|
25
24
|
end
|
26
25
|
|
27
|
-
|
26
|
+
parse <<-ruby do
|
28
27
|
for a, b in x do
|
29
28
|
5
|
30
29
|
end
|
31
30
|
ruby
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
[:lit, 5]]
|
38
|
-
end
|
32
|
+
[:for,
|
33
|
+
[:masgn, [:array, [:lasgn, :a], [:lasgn, :b]]],
|
34
|
+
[:call, nil, :x, [:arglist]],
|
35
|
+
[:lit, 5]]
|
39
36
|
end
|
40
37
|
|
41
|
-
|
38
|
+
parse <<-ruby do
|
42
39
|
for i in ()
|
43
40
|
i
|
44
41
|
end
|
45
42
|
ruby
|
46
43
|
|
47
|
-
|
48
|
-
[:for, [:nil], [:lasgn, :i], [:lvar, :i]]
|
49
|
-
end
|
44
|
+
[:for, [:lasgn, :i], [:nil], [:lvar, :i]]
|
50
45
|
end
|
51
46
|
|
52
|
-
|
47
|
+
parse <<-ruby do
|
53
48
|
c = 1
|
54
49
|
for i in a
|
55
50
|
for j in b
|
@@ -57,5 +52,12 @@ describe "A For node" do
|
|
57
52
|
end
|
58
53
|
end
|
59
54
|
ruby
|
55
|
+
|
56
|
+
[:block,
|
57
|
+
[:lasgn, :c, [:lit, 1]],
|
58
|
+
[:for,
|
59
|
+
[:lasgn, :i],
|
60
|
+
[:call, nil, :a, [:arglist]],
|
61
|
+
[:for, [:lasgn, :j], [:call, nil, :b, [:arglist]], [:lvar, :c]]]]
|
60
62
|
end
|
61
63
|
end
|
data/spec/gasgn_spec.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
describe "A Gasgn node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:gasgn, :$x, [:lit, 42]]
|
5
|
-
end
|
2
|
+
parse "$x = 42" do
|
3
|
+
[:gasgn, :$x, [:lit, 42]]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
[:gasgn, :$a, [:svalue, [:splat, [:array, [:lit, 1]]]]]
|
11
|
-
end
|
6
|
+
parse "$a = *[1]" do
|
7
|
+
[:gasgn, :$a, [:splat, [:array, [:lit, 1]]]]
|
12
8
|
end
|
13
9
|
end
|
data/spec/gvar_spec.rb
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
describe "A Gvar node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:gvar, :$x]
|
5
|
-
end
|
2
|
+
parse "$x" do
|
3
|
+
[:gvar, :$x]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
[:gvar, :$stderr]
|
11
|
-
end
|
6
|
+
parse "$stderr" do
|
7
|
+
[:gvar, :$stderr]
|
12
8
|
end
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
[:gvar, :$__blah]
|
17
|
-
end
|
10
|
+
parse "$__blah" do
|
11
|
+
[:gvar, :$__blah]
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
[:gvar, :$_]
|
23
|
-
end
|
14
|
+
parse "$_" do
|
15
|
+
[:gvar, :$_]
|
24
16
|
end
|
25
17
|
end
|
data/spec/hash_spec.rb
CHANGED
@@ -1,31 +1,27 @@
|
|
1
1
|
describe "A Hash node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:hash, [:lit, 1], [:lit, 2], [:lit, 3], [:lit, 4]]
|
5
|
-
end
|
2
|
+
parse "{ 1 => 2, 3 => 4 }" do
|
3
|
+
[:hash, [:lit, 1], [:lit, 2], [:lit, 3], [:lit, 4]]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
parse "{ 1 => (2 rescue 3) }" do
|
7
|
+
[:hash,
|
8
|
+
[:lit, 1],
|
9
|
+
[:rescue,
|
10
|
+
[:lit, 2],
|
11
|
+
[:resbody, [:array, [:const, :StandardError]], [:lit, 3]]]]
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
[:hash, [:lit, 1], [:array, [:splat, [:lit, 1]]]]
|
17
|
-
end
|
14
|
+
parse "{ 1 => [*1] }" do
|
15
|
+
[:hash, [:lit, 1], [:splat, [:lit, 1]]]
|
18
16
|
end
|
19
17
|
|
20
|
-
|
18
|
+
parse <<-ruby do
|
21
19
|
a = 1
|
22
20
|
{ :a => a }
|
23
21
|
ruby
|
24
22
|
|
25
|
-
|
26
|
-
[:
|
27
|
-
|
28
|
-
[:hash, [:lit, :a], [:lvar, :a]]]
|
29
|
-
end
|
23
|
+
[:block,
|
24
|
+
[:lasgn, :a, [:lit, 1]],
|
25
|
+
[:hash, [:lit, :a], [:lvar, :a]]]
|
30
26
|
end
|
31
27
|
end
|