rubinius-melbourne 2.3.1.0 → 3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rubinius/code/melbourne/.spec_ruby_version +1 -0
  3. data/ext/rubinius/code/melbourne/Makefile +51 -0
  4. data/ext/rubinius/code/melbourne/bstrlib.o +0 -0
  5. data/ext/rubinius/{melbourne → code/melbourne}/encoding_compat.cpp +0 -0
  6. data/ext/rubinius/{melbourne → code/melbourne}/encoding_compat.hpp +0 -0
  7. data/ext/rubinius/{melbourne → code/melbourne}/extconf.rb +2 -2
  8. data/ext/rubinius/{melbourne → code/melbourne}/grammar.cpp +0 -0
  9. data/ext/rubinius/{melbourne → code/melbourne}/grammar.hpp +0 -0
  10. data/ext/rubinius/{melbourne → code/melbourne}/grammar.y +0 -0
  11. data/ext/rubinius/{melbourne → code/melbourne}/lex.c.blt +0 -0
  12. data/ext/rubinius/{melbourne → code/melbourne}/melbourne.cpp +0 -0
  13. data/ext/rubinius/{melbourne → code/melbourne}/melbourne.hpp +0 -0
  14. data/ext/rubinius/code/melbourne/namespace.h +3 -0
  15. data/ext/rubinius/{melbourne → code/melbourne}/node.hpp +0 -0
  16. data/ext/rubinius/{melbourne → code/melbourne}/node_types.cpp +0 -0
  17. data/ext/rubinius/{melbourne → code/melbourne}/node_types.hpp +0 -0
  18. data/ext/rubinius/{melbourne → code/melbourne}/node_types.rb +0 -0
  19. data/ext/rubinius/{melbourne → code/melbourne}/parser_state.hpp +0 -0
  20. data/ext/rubinius/{melbourne → code/melbourne}/symbols.cpp +0 -0
  21. data/ext/rubinius/{melbourne → code/melbourne}/symbols.hpp +0 -0
  22. data/ext/rubinius/{melbourne → code/melbourne}/var_table.cpp +0 -0
  23. data/ext/rubinius/{melbourne → code/melbourne}/var_table.hpp +0 -0
  24. data/ext/rubinius/{melbourne → code/melbourne}/visitor.cpp +0 -0
  25. data/ext/rubinius/{melbourne → code/melbourne}/visitor.hpp +0 -0
  26. data/lib/rubinius/code/melbourne/melbourne.bundle +0 -0
  27. data/lib/rubinius/{melbourne → code/melbourne}/version.rb +1 -1
  28. data/lib/rubinius/{melbourne.rb → code/melbourne.rb} +2 -2
  29. metadata +42 -233
  30. data/.gitignore +0 -24
  31. data/.travis.yml +0 -7
  32. data/Gemfile +0 -4
  33. data/LICENSE +0 -25
  34. data/README.md +0 -29
  35. data/Rakefile +0 -46
  36. data/rubinius-melbourne.gemspec +0 -29
  37. data/spec/alias_spec.rb +0 -35
  38. data/spec/and_spec.rb +0 -13
  39. data/spec/array_spec.rb +0 -75
  40. data/spec/attrasgn_spec.rb +0 -91
  41. data/spec/back_ref_spec.rb +0 -9
  42. data/spec/call_spec.rb +0 -210
  43. data/spec/case_spec.rb +0 -216
  44. data/spec/cdecl_spec.rb +0 -51
  45. data/spec/class_spec.rb +0 -71
  46. data/spec/colon2_spec.rb +0 -5
  47. data/spec/colon3_spec.rb +0 -5
  48. data/spec/const_spec.rb +0 -5
  49. data/spec/custom/matchers/parse_as.rb +0 -28
  50. data/spec/custom/runner/relates.rb +0 -87
  51. data/spec/cvar_spec.rb +0 -23
  52. data/spec/cvasgn_spec.rb +0 -35
  53. data/spec/default.mspec +0 -4
  54. data/spec/defined_spec.rb +0 -119
  55. data/spec/defn_spec.rb +0 -783
  56. data/spec/defs_spec.rb +0 -96
  57. data/spec/dot2_spec.rb +0 -5
  58. data/spec/dot3_spec.rb +0 -5
  59. data/spec/dregx_spec.rb +0 -38
  60. data/spec/dstr_spec.rb +0 -144
  61. data/spec/dsym_spec.rb +0 -8
  62. data/spec/dxstr_spec.rb +0 -9
  63. data/spec/ensure_spec.rb +0 -113
  64. data/spec/false_spec.rb +0 -5
  65. data/spec/flip2_spec.rb +0 -75
  66. data/spec/flip3_spec.rb +0 -25
  67. data/spec/for_spec.rb +0 -63
  68. data/spec/gasgn_spec.rb +0 -9
  69. data/spec/gvar_spec.rb +0 -17
  70. data/spec/hash_spec.rb +0 -74
  71. data/spec/iasgn_spec.rb +0 -19
  72. data/spec/if_spec.rb +0 -101
  73. data/spec/iter_spec.rb +0 -666
  74. data/spec/lambda_spec.rb +0 -107
  75. data/spec/lasgn_spec.rb +0 -320
  76. data/spec/lit_spec.rb +0 -57
  77. data/spec/masgn_spec.rb +0 -171
  78. data/spec/match2_spec.rb +0 -15
  79. data/spec/match3_spec.rb +0 -20
  80. data/spec/match_spec.rb +0 -5
  81. data/spec/module_spec.rb +0 -43
  82. data/spec/nil_spec.rb +0 -5
  83. data/spec/not_spec.rb +0 -15
  84. data/spec/nth_ref_spec.rb +0 -5
  85. data/spec/op_asgn_spec.rb +0 -206
  86. data/spec/or_spec.rb +0 -29
  87. data/spec/postexe_spec.rb +0 -5
  88. data/spec/regex_spec.rb +0 -20
  89. data/spec/rescue_spec.rb +0 -357
  90. data/spec/return_spec.rb +0 -40
  91. data/spec/sclass_spec.rb +0 -56
  92. data/spec/spec_helper.rb +0 -8
  93. data/spec/str_spec.rb +0 -79
  94. data/spec/super_spec.rb +0 -75
  95. data/spec/true_spec.rb +0 -5
  96. data/spec/undef_spec.rb +0 -83
  97. data/spec/until_spec.rb +0 -48
  98. data/spec/valias_spec.rb +0 -5
  99. data/spec/while_spec.rb +0 -113
  100. data/spec/xstr_spec.rb +0 -5
  101. data/spec/yield_spec.rb +0 -45
  102. data/spec/zsuper_spec.rb +0 -37
data/spec/case_spec.rb DELETED
@@ -1,216 +0,0 @@
1
- describe "A Case node" do
2
- parse <<-ruby do
3
- var = 2
4
- result = ""
5
- case var
6
- when 1 then
7
- puts("something")
8
- result = "red"
9
- when 2, 3 then
10
- result = "yellow"
11
- when 4 then
12
- # do nothing
13
- else
14
- result = "green"
15
- end
16
- case result
17
- when "red" then
18
- var = 1
19
- when "yellow" then
20
- var = 2
21
- when "green" then
22
- var = 3
23
- else
24
- # do nothing
25
- end
26
- ruby
27
-
28
- [:block,
29
- [:lasgn, :var, [:lit, 2]],
30
- [:lasgn, :result, [:str, ""]],
31
- [:case,
32
- [:lvar, :var],
33
- [:when,
34
- [:array, [:lit, 1]],
35
- [:block,
36
- [:call, nil, :puts, [:arglist, [:str, "something"]]],
37
- [:lasgn, :result, [:str, "red"]]]],
38
- [:when,
39
- [:array, [:lit, 2], [:lit, 3]],
40
- [:lasgn, :result, [:str, "yellow"]]],
41
- [:when, [:array, [:lit, 4]], [:nil]],
42
- [:lasgn, :result, [:str, "green"]]],
43
- [:case,
44
- [:lvar, :result],
45
- [:when, [:array, [:str, "red"]], [:lasgn, :var, [:lit, 1]]],
46
- [:when, [:array, [:str, "yellow"]], [:lasgn, :var, [:lit, 2]]],
47
- [:when, [:array, [:str, "green"]], [:lasgn, :var, [:lit, 3]]],
48
- [:nil]]]
49
- end
50
-
51
- parse <<-ruby do
52
- case a
53
- when b then
54
- case
55
- when (d and e) then
56
- f
57
- else
58
- # do nothing
59
- end
60
- else
61
- # do nothing
62
- end
63
- ruby
64
-
65
- [:case,
66
- [:call, nil, :a, [:arglist]],
67
- [:when,
68
- [:array, [:call, nil, :b, [:arglist]]],
69
- [:case,
70
- nil,
71
- [:when,
72
- [:array,
73
- [:and,
74
- [:call, nil, :d, [:arglist]],
75
- [:call, nil, :e, [:arglist]]]],
76
- [:call, nil, :f, [:arglist]]],
77
- [:nil]]],
78
- [:nil]]
79
- end
80
-
81
- parse <<-ruby do
82
- var1 = 1
83
- var2 = 2
84
- result = nil
85
- case var1
86
- when 1 then
87
- case var2
88
- when 1 then
89
- result = 1
90
- when 2 then
91
- result = 2
92
- else
93
- result = 3
94
- end
95
- when 2 then
96
- case var2
97
- when 1 then
98
- result = 4
99
- when 2 then
100
- result = 5
101
- else
102
- result = 6
103
- end
104
- else
105
- result = 7
106
- end
107
- ruby
108
-
109
- [:block,
110
- [:lasgn, :var1, [:lit, 1]],
111
- [:lasgn, :var2, [:lit, 2]],
112
- [:lasgn, :result, [:nil]],
113
- [:case,
114
- [:lvar, :var1],
115
- [:when,
116
- [:array, [:lit, 1]],
117
- [:case,
118
- [:lvar, :var2],
119
- [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 1]]],
120
- [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 2]]],
121
- [:lasgn, :result, [:lit, 3]]]],
122
- [:when,
123
- [:array, [:lit, 2]],
124
- [:case,
125
- [:lvar, :var2],
126
- [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 4]]],
127
- [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 5]]],
128
- [:lasgn, :result, [:lit, 6]]]],
129
- [:lasgn, :result, [:lit, 7]]]]
130
- end
131
-
132
- parse <<-ruby do
133
- case
134
- when (a == 1) then
135
- :a
136
- when (a == 2) then
137
- :b
138
- else
139
- :c
140
- end
141
- ruby
142
-
143
- [:case,
144
- nil,
145
- [:when,
146
- [:array,
147
- [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 1]]]],
148
- [:lit, :a]],
149
- [:when,
150
- [:array,
151
- [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 2]]]],
152
- [:lit, :b]],
153
- [:lit, :c]]
154
- end
155
-
156
- parse <<-ruby do
157
- case a
158
- when :b, *c then
159
- d
160
- else
161
- e
162
- end
163
- ruby
164
-
165
- [:case,
166
- [:call, nil, :a, [:arglist]],
167
- [:when,
168
- [:array, [:lit, :b], [:when, [:call, nil, :c, [:arglist]], nil]],
169
- [:call, nil, :d, [:arglist]]],
170
- [:call, nil, :e, [:arglist]]]
171
- end
172
-
173
- parse <<-ruby do
174
- case true
175
- when String, *%w(foo bar baz) then
176
- 12
177
- end
178
- ruby
179
-
180
- [:case,
181
- [:true],
182
- [:when,
183
- [:array, [:const, :String], [:str, "foo"], [:str, "bar"], [:str, "baz"]],
184
- [:lit, 12]],
185
- nil]
186
- end
187
-
188
- parse <<-ruby do
189
- case ()
190
- when a
191
- 1
192
- end
193
- ruby
194
-
195
- [:case,
196
- [:nil],
197
- [:when, [:array, [:call, nil, :a, [:arglist]]], [:lit, 1]],
198
- nil]
199
- end
200
-
201
- parse <<-ruby do
202
- x = 1
203
- case a
204
- when x
205
- 2
206
- end
207
- ruby
208
-
209
- [:block,
210
- [:lasgn, :x, [:lit, 1]],
211
- [:case,
212
- [:call, nil, :a, [:arglist]],
213
- [:when, [:array, [:lvar, :x]], [:lit, 2]],
214
- nil]]
215
- end
216
- end
data/spec/cdecl_spec.rb DELETED
@@ -1,51 +0,0 @@
1
- describe "A Cdecl node" do
2
- parse "X = 42" do
3
- [:cdecl, :X, [:lit, 42]]
4
- end
5
-
6
- parse "::X = 1" do
7
- [:cdecl, [:colon3, :X], [:lit, 1]]
8
- end
9
-
10
- parse "X::Y = 1" do
11
- [:cdecl, [:colon2, [:const, :X], :Y], [:lit, 1]]
12
- end
13
-
14
- parse "X::Y::Z = a" do
15
- [:cdecl,
16
- [:colon2, [:colon2, [:const, :X], :Y], :Z],
17
- [:call, nil, :a, [:arglist]]]
18
- end
19
-
20
- parse "a::A = 1" do
21
- [:cdecl, [:colon2, [:call, nil, :a, [:arglist]], :A], [:lit, 1]]
22
- end
23
-
24
- parse <<-ruby do
25
- a = Object
26
- a::B = b
27
- ruby
28
-
29
- [:block,
30
- [:lasgn, :a, [:const, :Object]],
31
- [:cdecl, [:colon2, [:lvar, :a], :B], [:call, nil, :b, [:arglist]]]]
32
- end
33
-
34
- parse "X::Y ||= 1" do
35
- [:cdecl,
36
- [:colon2, [:const, :X], :Y],
37
- [:or, [:colon2, [:const, :X], :Y], [:lit, 1]]]
38
- end
39
-
40
- parse "X::Y &&= 1" do
41
- [:cdecl,
42
- [:colon2, [:const, :X], :Y],
43
- [:and, [:colon2, [:const, :X], :Y], [:lit, 1]]]
44
- end
45
-
46
- parse "X::Y += 1" do
47
- [:cdecl,
48
- [:colon2, [:const, :X], :Y],
49
- [:call, [:colon2, [:const, :X], :Y], :+, [:arglist, [:lit, 1]]]]
50
- end
51
- end
data/spec/class_spec.rb DELETED
@@ -1,71 +0,0 @@
1
- describe "A Class node" do
2
- parse <<-ruby do
3
- class X
4
- puts((1 + 1))
5
- def blah
6
- puts("hello")
7
- end
8
- end
9
- ruby
10
-
11
- [:class,
12
- :X,
13
- nil,
14
- [:scope,
15
- [:block,
16
- [:call,
17
- nil,
18
- :puts,
19
- [:arglist, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]]],
20
- [:defn,
21
- :blah,
22
- [:args],
23
- [:scope,
24
- [:block, [:call, nil, :puts, [:arglist, [:str, "hello"]]]]]]]]]
25
- end
26
-
27
- parse <<-ruby do
28
- class ::Y
29
- c
30
- end
31
- ruby
32
-
33
- [:class, [:colon3, :Y], nil, [:scope, [:block, [:call, nil, :c, [:arglist]]]]]
34
- end
35
-
36
- parse <<-ruby do
37
- class X::Y
38
- c
39
- end
40
- ruby
41
-
42
- [:class,
43
- [:colon2, [:const, :X], :Y],
44
- nil,
45
- [:scope, [:block, [:call, nil, :c, [:arglist]]]]]
46
- end
47
-
48
- parse <<-ruby do
49
- class X < Array
50
- end
51
- ruby
52
-
53
- [:class, :X, [:const, :Array], [:scope]]
54
- end
55
-
56
- parse <<-ruby do
57
- class X < expr
58
- end
59
- ruby
60
-
61
- [:class, :X, [:call, nil, :expr, [:arglist]], [:scope]]
62
- end
63
-
64
- parse <<-ruby do
65
- class X < Object
66
- end
67
- ruby
68
-
69
- [:class, :X, [:const, :Object], [:scope]]
70
- end
71
- end
data/spec/colon2_spec.rb DELETED
@@ -1,5 +0,0 @@
1
- describe "A Colon2 node" do
2
- parse "X::Y" do
3
- [:colon2, [:const, :X], :Y]
4
- end
5
- end
data/spec/colon3_spec.rb DELETED
@@ -1,5 +0,0 @@
1
- describe "A Colon3 node" do
2
- parse "::X" do
3
- [:colon3, :X]
4
- end
5
- end
data/spec/const_spec.rb DELETED
@@ -1,5 +0,0 @@
1
- describe "A Const node" do
2
- parse "X" do
3
- [:const, :X]
4
- end
5
- end
@@ -1,28 +0,0 @@
1
- # The ParseAsMatcher wraps the logic for checking that a string of Ruby code
2
- # is converted to the expected s-expression. It is combined with the #parse_as
3
- # spec helper and enables specs of the form:
4
- #
5
- # "a = 1".should parse_as([:lasgn, :a, [:lit, 1]])
6
- #
7
- class ParseAsMatcher
8
- def initialize(expected)
9
- @expected = expected
10
- end
11
-
12
- def matches?(actual)
13
- parse = CodeTools::Melbourne.parse_string actual
14
- @actual = parse.to_sexp.to_a
15
- @actual == @expected
16
- end
17
-
18
- def failure_message
19
- ["Expected:\n#{@actual.pretty_inspect}\n",
20
- "to equal:\n#{@expected.pretty_inspect}"]
21
- end
22
- end
23
-
24
- class Object
25
- def parse_as(sexp)
26
- ParseAsMatcher.new sexp
27
- end
28
- end
@@ -1,87 +0,0 @@
1
- # SpecDataRelation enables concise specs that involve several different forms
2
- # of the same data. This is specifically useful for the parser and compiler
3
- # specs where the output of each stage is essentially related to the input
4
- # Ruby source. Together with the #relates spec method, it enables specs like:
5
- #
6
- # describe "An If node" do
7
- # relates "a if b" do
8
- # parse do
9
- # # return the expected sexp
10
- # end
11
- #
12
- # compile do |g|
13
- # # return the expected bytecode
14
- # end
15
- #
16
- # jit do |as|
17
- # # return the expected asm/machine code
18
- # end
19
- # end
20
- #
21
- # relates "if a; b; end" do
22
- # # ...
23
- # end
24
- # end
25
-
26
- class SpecDataRelation
27
- # Provides a simple configurability so that any one or more of the possible
28
- # processes can be run. See the custom options in custom/utils/options.rb.
29
- def self.enable(process)
30
- @processors ||= []
31
- @processors << process
32
- end
33
-
34
- # Returns true if no process is specifically set or if +process+ is in the
35
- # list of enabled processes. In other words, all processes are enabled by
36
- # default, or any combination of them may be enabled.
37
- def self.enabled?(process)
38
- @processors.nil? or @processors.include?(process)
39
- end
40
-
41
- def initialize(ruby)
42
- @ruby = ruby
43
- end
44
-
45
- # Formats the Ruby source code for reabable output in the -fs formatter
46
- # option. If the source contains no newline characters, wraps the source in
47
- # single quotes to set if off from the rest of the description string. If
48
- # the source does contain newline characters, sets the indent level to four
49
- # characters.
50
- def format(ruby)
51
- if /\n/ =~ ruby
52
- lines = ruby.rstrip.lines
53
- if /( *)/ =~ lines.first
54
- if $1.size > 4
55
- dedent = $1.size - 4
56
- ruby = lines.map { |l| l[dedent..-1] }.join
57
- else
58
- indent = " " * (4 - $1.size)
59
- ruby = lines.map { |l| "#{indent}#{l}" }.join
60
- end
61
- end
62
- "\n#{ruby}"
63
- else
64
- "'#{ruby}'"
65
- end
66
- end
67
-
68
- # Creates spec example blocks if the parse process is enabled.
69
- def parse(&block)
70
- return unless self.class.enabled? :parser
71
-
72
- ruby = @ruby
73
- it "is parsed from #{format ruby}" do
74
- ruby.should parse_as(block.call)
75
- end
76
- end
77
- end
78
-
79
- class Object
80
- def relates(str, &block)
81
- SpecDataRelation.new(str).instance_eval(&block)
82
- end
83
-
84
- def parse(str, &block)
85
- SpecDataRelation.new(str).parse(&block)
86
- end
87
- end