ruby2ruby 1.3.1 → 2.0.0.b1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,26 @@
1
+ === 2.0.0.b1 / 2012-07-27
2
+
3
+ * 4 major enhancements:
4
+
5
+ * Made it work without arglist in call.
6
+ * Made it work without scope/block in class/module/defn/defs.
7
+ * Removed block from resbody
8
+ * Removed block from when node
9
+
10
+ * 4 minor enhancements:
11
+
12
+ * Added debug task to help isolate an error
13
+ * Empty hash is now a proper {}
14
+ * Refactored and added finish method.
15
+ * Switched to new Ruby18Parser to avoid deprecation warnings
16
+
17
+ * 4 bug fixes:
18
+
19
+ * Fixed call with empty hash arg. (neilconway)
20
+ * OMG WTF... removed long decrepit ParseTree dependency
21
+ * Removed isolate/rake require to reduce minimum bootstrap to hoe + rake + rake install_plugins (*2)
22
+ * Skip 1.9 tests for now.
23
+
1
24
  === 1.3.1 / 2011-09-22
2
25
 
3
26
  * 1 minor enhancement:
data/README.txt CHANGED
@@ -48,6 +48,18 @@ processors in ruby easier than ever!
48
48
 
49
49
  + sudo gem install ruby2ruby
50
50
 
51
+ == How to Contribute:
52
+
53
+ To get started all you need is a checkout, rake, and hoe. The easiest
54
+ way is:
55
+
56
+ % git clone seattlerb/ruby2ruby # assumes you use the `hub` wrapper.
57
+ % gem i rake hoe
58
+ % rake install_plugins # installs hoe-seattlerb & isolate
59
+ % rake install_plugins # installs minitest (referenced from hoe-seattlerb)
60
+
61
+ From here you should be good to go. We accept pull requests on github.
62
+
51
63
  == LICENSE:
52
64
 
53
65
  (The MIT License)
data/Rakefile CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
- require 'isolate/rake'
6
5
 
7
6
  Hoe.add_include_dirs("lib",
8
7
  "../../ruby_parser/dev/lib",
@@ -16,36 +15,42 @@ Hoe.spec 'ruby2ruby' do
16
15
 
17
16
  self.rubyforge_name = 'seattlerb'
18
17
 
19
- dependency "sexp_processor", "~> 3.0"
20
- dependency "ruby_parser", "~> 2.0"
21
- dependency "ParseTree", "~> 3.0", :developer
18
+ dependency "sexp_processor", "~> 4.0"
19
+ dependency "ruby_parser", "~> 3.0.0.a4"
20
+ end
21
+
22
+ def process ruby, file="stdin"
23
+ require "ruby_parser"
24
+ require "ruby2ruby"
25
+
26
+ parser = RubyParser.new
27
+ ruby2ruby = Ruby2Ruby.new
28
+
29
+ begin
30
+ sexp = parser.process(ruby, file)
31
+
32
+ ruby2ruby.process(sexp)
33
+ rescue Interrupt => e
34
+ raise e
35
+ end
22
36
  end
23
37
 
24
38
  task :stress do
25
39
  $: << "lib"
26
40
  $: << "../../ruby_parser/dev/lib"
27
- require "ruby_parser"
28
- require "ruby2ruby"
29
41
  require "pp"
30
42
 
31
43
  files = Dir["../../*/dev/**/*.rb"]
32
44
 
33
45
  warn "Stress testing against #{files.size} files"
34
- parser = RubyParser.new
35
- ruby2ruby = Ruby2Ruby.new
36
46
 
37
47
  bad = {}
38
48
 
39
49
  files.each do |file|
40
50
  warn file
41
- ruby = File.read(file)
42
51
 
43
52
  begin
44
- sexp = parser.process(ruby, file)
45
-
46
- # $stderr.puts sexp.pretty_inspect
47
-
48
- ruby2ruby.process(sexp)
53
+ process File.read(file), file
49
54
  rescue Interrupt => e
50
55
  raise e
51
56
  rescue Exception => e
@@ -56,4 +61,28 @@ task :stress do
56
61
  pp bad
57
62
  end
58
63
 
64
+ task :debug => :isolate do
65
+ ENV["V"] ||= "18"
66
+
67
+ $: << "lib"
68
+ require 'ruby_parser'
69
+
70
+ parser = if ENV["V"] == "18" then
71
+ Ruby18Parser.new
72
+ else
73
+ Ruby19Parser.new
74
+ end
75
+
76
+ file = ENV["F"] || ENV["FILE"]
77
+
78
+ ruby = if file then
79
+ File.read(file)
80
+ else
81
+ file = "env"
82
+ ENV["R"] || ENV["RUBY"]
83
+ end
84
+
85
+ puts process(ruby, file)
86
+ end
87
+
59
88
  # vim: syntax=ruby
data/bin/r2r_show CHANGED
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  ARGV.push "-" if ARGV.empty?
20
20
 
21
- parser = RubyParser.new
21
+ parser = Ruby18Parser.new
22
22
  ruby2ruby = Ruby2Ruby.new
23
23
 
24
24
  ARGV.each do |file|
data/lib/ruby2ruby.rb CHANGED
@@ -24,7 +24,7 @@ class Regexp
24
24
  end
25
25
 
26
26
  class Ruby2Ruby < SexpProcessor
27
- VERSION = '1.3.1'
27
+ VERSION = '2.0.0.b1'
28
28
  LINE_LENGTH = 78
29
29
 
30
30
  BINARY = [:<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :**]
@@ -121,8 +121,8 @@ class Ruby2Ruby < SexpProcessor
121
121
 
122
122
  case name
123
123
  when :[]= then
124
- rhs = process args.pop
125
- "#{receiver}[#{process(args)}] = #{rhs}"
124
+ rhs = exp.empty? ? nil : exp.shift
125
+ "#{receiver}[#{process args}] = #{process rhs}"
126
126
  else
127
127
  name = name.to_s.sub(/=$/, '')
128
128
  if args && args != s(:arglist) then
@@ -169,7 +169,7 @@ class Ruby2Ruby < SexpProcessor
169
169
 
170
170
  def parenthesize exp
171
171
  case self.context[1]
172
- when nil, :scope, :if, :iter, :resbody, :when, :while then
172
+ when nil, :defn, :defs, :class, :sclass, :if, :iter, :resbody, :when, :while then
173
173
  exp
174
174
  else
175
175
  "(#{exp})"
@@ -208,12 +208,14 @@ class Ruby2Ruby < SexpProcessor
208
208
  in_context :arglist do
209
209
  until exp.empty? do
210
210
  arg_type = exp.first.sexp_type
211
+ is_empty_hash = (exp.first == s(:hash))
211
212
  arg = process exp.shift
212
213
 
213
214
  next if arg.empty?
214
215
 
215
216
  strip_hash = (arg_type == :hash and
216
217
  not BINARY.include? name and
218
+ not is_empty_hash and
217
219
  (exp.empty? or exp.first.sexp_type == :splat))
218
220
  wrap_arg = Ruby2Ruby::ASSIGN_NODES.include? arg_type
219
221
 
@@ -332,20 +334,23 @@ class Ruby2Ruby < SexpProcessor
332
334
  end
333
335
  end
334
336
 
335
- case type1
336
- when :scope, :args then
337
- name = exp.shift
338
- args = process(exp.shift)
339
- args = "" if args == "()"
340
- body = []
341
- until exp.empty? do
342
- body << indent(process(exp.shift))
343
- end
344
- body = body.join("\n")
345
- return "#{exp.comments}def #{name}#{args}\n#{body}\nend".gsub(/\n\s*\n+/, "\n")
346
- else
347
- raise "Unknown defn type: #{type1} for #{exp.inspect}"
337
+ comm = exp.comments
338
+ name = exp.shift
339
+ args = process(exp.shift)
340
+ args = "" if args == "()"
341
+
342
+ exp.shift if exp == s(s(:nil)) # empty it out of a default nil expression
343
+
344
+ body = []
345
+ until exp.empty? do
346
+ body << indent(process(exp.shift))
348
347
  end
348
+
349
+ body << indent("# do nothing") if body.empty?
350
+
351
+ body = body.join("\n")
352
+
353
+ return "#{comm}def #{name}#{args}\n#{body}\nend".gsub(/\n\s*\n+/, "\n")
349
354
  end
350
355
 
351
356
  def process_defs(exp)
@@ -457,7 +462,7 @@ class Ruby2Ruby < SexpProcessor
457
462
  result << "#{lhs} => #{rhs}"
458
463
  end
459
464
 
460
- return "{ #{result.join(', ')} }"
465
+ return result.empty? ? "{}" : "{ #{result.join(', ')} }"
461
466
  end
462
467
 
463
468
  def process_iasgn(exp)
@@ -706,7 +711,8 @@ class Ruby2Ruby < SexpProcessor
706
711
 
707
712
  def process_resbody exp
708
713
  args = exp.shift
709
- body = process(exp.shift) || "# do nothing"
714
+ body = finish(exp)
715
+ body << "# do nothing" if body.empty?
710
716
 
711
717
  name = args.lasgn true
712
718
  name ||= args.iasgn true
@@ -714,7 +720,7 @@ class Ruby2Ruby < SexpProcessor
714
720
  args = " #{args}" unless args.empty?
715
721
  args += " => #{name[1]}" if name
716
722
 
717
- "rescue#{args}\n#{indent body}"
723
+ "rescue#{args}\n#{indent body.join("\n")}"
718
724
  end
719
725
 
720
726
  def process_rescue exp
@@ -761,10 +767,6 @@ class Ruby2Ruby < SexpProcessor
761
767
  "class << #{process(exp.shift)}\n#{indent(process(exp.shift))}\nend"
762
768
  end
763
769
 
764
- def process_scope(exp)
765
- exp.empty? ? "" : process(exp.shift)
766
- end
767
-
768
770
  def process_self(exp)
769
771
  "self"
770
772
  end
@@ -782,10 +784,7 @@ class Ruby2Ruby < SexpProcessor
782
784
  end
783
785
 
784
786
  def process_super(exp)
785
- args = []
786
- until exp.empty? do
787
- args << process(exp.shift)
788
- end
787
+ args = finish exp
789
788
 
790
789
  "super(#{args.join(', ')})"
791
790
  end
@@ -829,7 +828,7 @@ class Ruby2Ruby < SexpProcessor
829
828
 
830
829
  until exp.empty?
831
830
  cond = process(exp.shift).to_s[1..-2]
832
- code = indent(process(exp.shift))
831
+ code = indent(finish(exp).join("\n"))
833
832
  code = indent "# do nothing" if code =~ /\A\s*\Z/
834
833
  src << "when #{cond} then\n#{code.chomp}"
835
834
  end
@@ -935,6 +934,14 @@ class Ruby2Ruby < SexpProcessor
935
934
  ############################################################
936
935
  # Utility Methods:
937
936
 
937
+ def finish exp # REFACTOR: work this out of the rest of the processors
938
+ body = []
939
+ until exp.empty? do
940
+ body << process(exp.shift)
941
+ end
942
+ body.compact
943
+ end
944
+
938
945
  def dthing_escape type, lit
939
946
  lit = lit.gsub(/\n/, '\n')
940
947
  case type
@@ -992,7 +999,7 @@ class Ruby2Ruby < SexpProcessor
992
999
 
993
1000
  body = []
994
1001
  begin
995
- code = process(exp.shift)
1002
+ code = process(exp.shift) unless exp.empty?
996
1003
  body << code.chomp unless code.nil? or code.chomp.empty?
997
1004
  end until exp.empty?
998
1005
 
@@ -18,6 +18,8 @@ class R2RTestCase < ParseTreeTestCase
18
18
  def self.generate_test klass, node, data, input_name, output_name
19
19
  output_name = data.has_key?('Ruby2Ruby') ? 'Ruby2Ruby' : 'Ruby'
20
20
 
21
+ return if node.to_s =~ /19$/
22
+
21
23
  klass.class_eval <<-EOM
22
24
  def test_#{node}
23
25
  pt = #{data[input_name].inspect}
@@ -101,19 +103,18 @@ class TestRuby2Ruby < R2RTestCase
101
103
  end
102
104
 
103
105
  def test_call_self_index
104
- util_compare s(:call, nil, :[], s(:arglist, s(:lit, 42))), "self[42]"
106
+ util_compare s(:call, nil, :[], s(:lit, 42)), "self[42]"
105
107
  end
106
108
 
107
109
  def test_call_self_index_equals
108
- util_compare(s(:call, nil, :[]=, s(:arglist, s(:lit, 42), s(:lit, 24))),
110
+ util_compare(s(:call, nil, :[]=, s(:lit, 42), s(:lit, 24)),
109
111
  "self[42] = 24")
110
112
  end
111
113
 
112
114
  def test_call_arglist_hash_first
113
115
  inn = s(:call, nil, :method,
114
- s(:arglist,
115
- s(:hash, s(:lit, :a), s(:lit, 1)),
116
- s(:call, nil, :b, s(:arglist))))
116
+ s(:hash, s(:lit, :a), s(:lit, 1)),
117
+ s(:call, nil, :b))
117
118
  out = "method({ :a => 1 }, b)"
118
119
 
119
120
  util_compare inn, out
@@ -121,10 +122,9 @@ class TestRuby2Ruby < R2RTestCase
121
122
 
122
123
  def test_call_arglist_hash_first_last
123
124
  inn = s(:call, nil, :method,
124
- s(:arglist,
125
- s(:hash, s(:lit, :a), s(:lit, 1)),
126
- s(:call, nil, :b, s(:arglist)),
127
- s(:hash, s(:lit, :c), s(:lit, 1))))
125
+ s(:hash, s(:lit, :a), s(:lit, 1)),
126
+ s(:call, nil, :b),
127
+ s(:hash, s(:lit, :c), s(:lit, 1)))
128
128
  out = "method({ :a => 1 }, b, :c => 1)"
129
129
 
130
130
  util_compare inn, out
@@ -132,9 +132,8 @@ class TestRuby2Ruby < R2RTestCase
132
132
 
133
133
  def test_call_arglist_hash_last
134
134
  inn = s(:call, nil, :method,
135
- s(:arglist,
136
- s(:call, nil, :b, s(:arglist)),
137
- s(:hash, s(:lit, :a), s(:lit, 1))))
135
+ s(:call, nil, :b),
136
+ s(:hash, s(:lit, :a), s(:lit, 1)))
138
137
  out = "method(b, :a => 1)"
139
138
 
140
139
  util_compare inn, out
@@ -142,13 +141,12 @@ class TestRuby2Ruby < R2RTestCase
142
141
 
143
142
  def test_call_arglist_if
144
143
  inn = s(:call,
145
- s(:call, nil, :a, s(:arglist)),
144
+ s(:call, nil, :a),
146
145
  :+,
147
- s(:arglist,
148
- s(:if,
149
- s(:call, nil, :b, s(:arglist)),
150
- s(:call, nil, :c, s(:arglist)),
151
- s(:call, nil, :d, s(:arglist)))))
146
+ s(:if,
147
+ s(:call, nil, :b),
148
+ s(:call, nil, :c),
149
+ s(:call, nil, :d)))
152
150
 
153
151
  out = "(a + (b ? (c) : (d)))"
154
152
  util_compare inn, out
@@ -161,14 +159,14 @@ class TestRuby2Ruby < R2RTestCase
161
159
  s(:array,
162
160
  s(:splat,
163
161
  s(:call,
164
- s(:call, nil, :line, s(:arglist)),
162
+ s(:call, nil, :line),
165
163
  :split,
166
- s(:arglist, s(:lit, /\=/), s(:lit, 2)))))),
164
+ s(:lit, /\=/), s(:lit, 2))))),
167
165
  s(:attrasgn,
168
166
  s(:self),
169
167
  :[]=,
170
- s(:arglist, s(:lvar, :k),
171
- s(:call, s(:lvar, :v), :strip, s(:arglist)))))
168
+ s(:arglist, s(:lvar, :k)),
169
+ s(:call, s(:lvar, :v), :strip)))
172
170
 
173
171
  out = "k, v = *line.split(/\\=/, 2)\nself[k] = v.strip\n"
174
172
 
@@ -181,15 +179,15 @@ class TestRuby2Ruby < R2RTestCase
181
179
  s(:array,
182
180
  s(:splat,
183
181
  s(:call,
184
- s(:call, nil, :line, s(:arglist)),
182
+ s(:call, nil, :line),
185
183
  :split,
186
- s(:arglist, s(:lit, /\=/), s(:lit, 2))))))
184
+ s(:lit, /\=/), s(:lit, 2)))))
187
185
  out = 'k, v = *line.split(/\\=/, 2)'
188
186
  util_compare inn, out
189
187
  end
190
188
 
191
189
  def test_match3_asgn
192
- inn = s(:match3, s(:lit, //), s(:lasgn, :y, s(:call, nil, :x, s(:arglist))))
190
+ inn = s(:match3, s(:lit, //), s(:lasgn, :y, s(:call, nil, :x)))
193
191
  out = "(y = x) =~ //"
194
192
  # "y = x =~ //", which matches on x and assigns to y (not what sexp says).
195
193
  util_compare inn, out
@@ -197,12 +195,11 @@ class TestRuby2Ruby < R2RTestCase
197
195
 
198
196
  def test_splat_call
199
197
  inn = s(:call, nil, :x,
200
- s(:arglist,
201
- s(:splat,
202
- s(:call,
203
- s(:call, nil, :line, s(:arglist)),
204
- :split,
205
- s(:arglist, s(:lit, /\=/), s(:lit, 2))))))
198
+ s(:splat,
199
+ s(:call,
200
+ s(:call, nil, :line),
201
+ :split,
202
+ s(:lit, /\=/), s(:lit, 2))))
206
203
 
207
204
  out = 'x(*line.split(/\=/, 2))'
208
205
  util_compare inn, out
@@ -210,12 +207,12 @@ class TestRuby2Ruby < R2RTestCase
210
207
 
211
208
  def test_resbody_block
212
209
  inn = s(:rescue,
213
- s(:call, nil, :x1, s(:arglist)),
210
+ s(:call, nil, :x1),
214
211
  s(:resbody,
215
212
  s(:array),
216
213
  s(:block,
217
- s(:call, nil, :x2, s(:arglist)),
218
- s(:call, nil, :x3, s(:arglist)))))
214
+ s(:call, nil, :x2),
215
+ s(:call, nil, :x3))))
219
216
 
220
217
  out = "begin\n x1\nrescue\n x2\n x3\nend"
221
218
  util_compare inn, out
@@ -224,7 +221,7 @@ class TestRuby2Ruby < R2RTestCase
224
221
  def test_resbody_short_with_begin_end
225
222
  # "begin; blah; rescue; []; end"
226
223
  inn = s(:rescue,
227
- s(:call, nil, :blah, s(:arglist)),
224
+ s(:call, nil, :blah),
228
225
  s(:resbody, s(:array), s(:array)))
229
226
  out = "blah rescue []"
230
227
  util_compare inn, out
@@ -234,7 +231,7 @@ class TestRuby2Ruby < R2RTestCase
234
231
  inn = s(:match3,
235
232
  s(:dregx,
236
233
  "abc",
237
- s(:evstr, s(:call, nil, :x, s(:arglist))),
234
+ s(:evstr, s(:call, nil, :x)),
238
235
  s(:str, "def"),
239
236
  4),
240
237
  s(:str, "a"))
@@ -244,7 +241,7 @@ class TestRuby2Ruby < R2RTestCase
244
241
 
245
242
  def test_resbody_short_with_rescue_args
246
243
  inn = s(:rescue,
247
- s(:call, nil, :blah, s(:arglist)),
244
+ s(:call, nil, :blah),
248
245
  s(:resbody, s(:array, s(:const, :A), s(:const, :B)), s(:array)))
249
246
  out = "begin\n blah\nrescue A, B\n []\nend"
250
247
  util_compare inn, out
@@ -256,9 +253,9 @@ class TestRuby2Ruby < R2RTestCase
256
253
  # end
257
254
 
258
255
  inn = s(:if, s(:lit, 42),
259
- s(:call, s(:call, nil, :args, s(:arglist)),
256
+ s(:call, s(:call, nil, :args),
260
257
  :<<,
261
- s(:arglist, s(:hash, s(:lit, :key), s(:lit, 24)))),
258
+ s(:hash, s(:lit, :key), s(:lit, 24))),
262
259
  nil)
263
260
 
264
261
  out = "(args << { :key => 24 }) if 42"
@@ -266,8 +263,14 @@ class TestRuby2Ruby < R2RTestCase
266
263
  util_compare inn, out
267
264
  end
268
265
 
266
+ def test_call_empty_hash
267
+ inn = s(:call, nil, :foo, s(:arglist, s(:hash)))
268
+ out = "foo({})"
269
+ util_compare inn, out
270
+ end
271
+
269
272
  def test_if_empty
270
- inn = s(:if, s(:call, nil, :x, s(:arglist)), nil, nil)
273
+ inn = s(:if, s(:call, nil, :x), nil, nil)
271
274
  out = "if x then\n # do nothing\nend"
272
275
  util_compare inn, out
273
276
  end
@@ -276,9 +279,9 @@ class TestRuby2Ruby < R2RTestCase
276
279
  # log_entry = " \e[#{message_color}m#{message}\e[0m "
277
280
  inn = s(:lasgn, :log_entry,
278
281
  s(:dstr, " \e[",
279
- s(:evstr, s(:call, nil, :message_color, s(:arglist))),
282
+ s(:evstr, s(:call, nil, :message_color)),
280
283
  s(:str, "m"),
281
- s(:evstr, s(:call, nil, :message, s(:arglist))),
284
+ s(:evstr, s(:call, nil, :message)),
282
285
  s(:str, "\e[0m ")))
283
286
  out = "log_entry = \" \e[#\{message_color}m#\{message}\e[0m \""
284
287
 
@@ -286,21 +289,21 @@ class TestRuby2Ruby < R2RTestCase
286
289
  end
287
290
 
288
291
  def test_class_comments
289
- inn = s(:class, :Z, nil, s(:scope))
292
+ inn = s(:class, :Z, nil)
290
293
  inn.comments = "# x\n# y\n"
291
294
  out = "# x\n# y\nclass Z\nend"
292
295
  util_compare inn, out
293
296
  end
294
297
 
295
298
  def test_module_comments
296
- inn = s(:module, :Z, s(:scope))
299
+ inn = s(:module, :Z)
297
300
  inn.comments = "# x\n# y\n"
298
301
  out = "# x\n# y\nmodule Z\nend"
299
302
  util_compare inn, out
300
303
  end
301
304
 
302
305
  def test_method_comments
303
- inn = s(:defn, :z, s(:args), s(:scope, s(:block, s(:nil))))
306
+ inn = s(:defn, :z, s(:args), s(:nil))
304
307
  inn.comments = "# x\n# y\n"
305
308
  out = "# x\n# y\ndef z\n # do nothing\nend"
306
309
  util_compare inn, out
@@ -311,19 +314,19 @@ class TestRuby2Ruby < R2RTestCase
311
314
  out = "begin\n 1\nensure\n 2\nend"
312
315
  util_compare inn, out
313
316
  end
314
-
317
+
315
318
  def test_nested_ensure
316
319
  inn = s(:ensure, s(:lit, 1), s(:ensure, s(:lit, 2), s(:lit, 3)))
317
320
  out = "begin\n 1\nensure\n begin\n 2\n ensure\n 3\n end\nend"
318
321
  util_compare inn, out
319
322
  end
320
-
323
+
321
324
  def test_nested_rescue
322
325
  inn = s(:ensure, s(:lit, 1), s(:rescue, s(:lit, 2), s(:resbody, s(:array), s(:lit, 3))))
323
326
  out = "begin\n 1\nensure\n 2 rescue 3\nend"
324
327
  util_compare inn, out
325
328
  end
326
-
329
+
327
330
  def test_nested_rescue_exception
328
331
  inn = s(:ensure, s(:lit, 1), s(:rescue, s(:lit, 2), s(:resbody, s(:array, s(:const, :Exception)), s(:lit, 3))))
329
332
  out = "begin\n 1\nensure\n begin\n 2\n rescue Exception\n 3\n end\nend"
@@ -338,15 +341,15 @@ class TestRuby2Ruby < R2RTestCase
338
341
 
339
342
  def test_rescue_block
340
343
  inn = s(:rescue,
341
- s(:call, nil, :alpha, s(:arglist)),
342
- s(:resbody, s(:array),
344
+ s(:call, nil, :alpha),
345
+ s(:resbody, s(:array),
343
346
  s(:block,
344
- s(:call, nil, :beta, s(:arglist)),
345
- s(:call, nil, :gamma, s(:arglist)))))
347
+ s(:call, nil, :beta),
348
+ s(:call, nil, :gamma))))
346
349
  out = "begin\n alpha\nrescue\n beta\n gamma\nend"
347
350
  util_compare inn, out
348
351
  end
349
-
352
+
350
353
  def util_compare sexp, expected_ruby, expected_eval = nil
351
354
  assert_equal expected_ruby, @processor.process(sexp)
352
355
  assert_equal expected_eval, eval(expected_ruby) if expected_eval
@@ -355,7 +358,7 @@ class TestRuby2Ruby < R2RTestCase
355
358
  def util_thingy(type)
356
359
  s(type,
357
360
  'a"b',
358
- s(:evstr, s(:call, s(:lit, 1), :+, s(:arglist, s(:lit, 1)))),
361
+ s(:evstr, s(:call, s(:lit, 1), :+, s(:lit, 1))),
359
362
  s(:str, 'c"d/e'))
360
363
  end
361
364
  end
@@ -381,7 +384,8 @@ def silent_eval ruby
381
384
  end
382
385
 
383
386
  def morph_and_eval src, from, to, processor
384
- new_src = processor.new.process(RubyParser.new.process(src.sub(from, to)))
387
+ new_src = processor.new.process(Ruby18Parser.new.process(src.sub(from, to)))
388
+
385
389
  silent_eval new_src
386
390
  new_src
387
391
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
4
+ hash: -533234434
5
+ prerelease: 6
6
6
  segments:
7
+ - 2
8
+ - 0
9
+ - 0
10
+ - b
7
11
  - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
12
+ version: 2.0.0.b1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Ryan Davis
@@ -36,7 +38,7 @@ cert_chain:
36
38
  FBHgymkyj/AOSqKRIpXPhjC6
37
39
  -----END CERTIFICATE-----
38
40
 
39
- date: 2011-09-22 00:00:00 Z
41
+ date: 2012-07-28 00:00:00 Z
40
42
  dependencies:
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: sexp_processor
@@ -46,11 +48,11 @@ dependencies:
46
48
  requirements:
47
49
  - - ~>
48
50
  - !ruby/object:Gem::Version
49
- hash: 7
51
+ hash: 27
50
52
  segments:
51
- - 3
53
+ - 4
52
54
  - 0
53
- version: "3.0"
55
+ version: "4.0"
54
56
  type: :runtime
55
57
  version_requirements: *id001
56
58
  - !ruby/object:Gem::Dependency
@@ -61,11 +63,14 @@ dependencies:
61
63
  requirements:
62
64
  - - ~>
63
65
  - !ruby/object:Gem::Version
64
- hash: 3
66
+ hash: -533251372
65
67
  segments:
66
- - 2
68
+ - 3
69
+ - 0
67
70
  - 0
68
- version: "2.0"
71
+ - a
72
+ - 4
73
+ version: 3.0.0.a4
69
74
  type: :runtime
70
75
  version_requirements: *id002
71
76
  - !ruby/object:Gem::Dependency
@@ -76,26 +81,26 @@ dependencies:
76
81
  requirements:
77
82
  - - ~>
78
83
  - !ruby/object:Gem::Version
79
- hash: 9
84
+ hash: 3
80
85
  segments:
86
+ - 3
81
87
  - 2
82
- - 5
83
- version: "2.5"
88
+ version: "3.2"
84
89
  type: :development
85
90
  version_requirements: *id003
86
91
  - !ruby/object:Gem::Dependency
87
- name: ParseTree
92
+ name: rdoc
88
93
  prerelease: false
89
94
  requirement: &id004 !ruby/object:Gem::Requirement
90
95
  none: false
91
96
  requirements:
92
97
  - - ~>
93
98
  - !ruby/object:Gem::Version
94
- hash: 7
99
+ hash: 19
95
100
  segments:
96
101
  - 3
97
- - 0
98
- version: "3.0"
102
+ - 10
103
+ version: "3.10"
99
104
  type: :development
100
105
  version_requirements: *id004
101
106
  - !ruby/object:Gem::Dependency
@@ -106,11 +111,11 @@ dependencies:
106
111
  requirements:
107
112
  - - ~>
108
113
  - !ruby/object:Gem::Version
109
- hash: 27
114
+ hash: 7
110
115
  segments:
111
- - 2
112
- - 12
113
- version: "2.12"
116
+ - 3
117
+ - 0
118
+ version: "3.0"
114
119
  type: :development
115
120
  version_requirements: *id005
116
121
  description: |-
@@ -158,16 +163,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
163
  required_rubygems_version: !ruby/object:Gem::Requirement
159
164
  none: false
160
165
  requirements:
161
- - - ">="
166
+ - - ">"
162
167
  - !ruby/object:Gem::Version
163
- hash: 3
168
+ hash: 25
164
169
  segments:
165
- - 0
166
- version: "0"
170
+ - 1
171
+ - 3
172
+ - 1
173
+ version: 1.3.1
167
174
  requirements: []
168
175
 
169
176
  rubyforge_project: seattlerb
170
- rubygems_version: 1.8.10
177
+ rubygems_version: 1.8.24
171
178
  signing_key:
172
179
  specification_version: 3
173
180
  summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser compatible Sexps
metadata.gz.sig CHANGED
@@ -1 +1,3 @@
1
- �|����6d�4�e
2
1
  �ڿ7]�0���o+1�y' �s1��
2
+ �eߵB�IY��:���q�F��5M��H�{�V>LYy��8��uc��$���{������Q`{��f.���#�8���� cs� ׵Ct�|ɘB��ӭ��\������������H_5����Wb�m �k���������
3
+ ��k㎄8K��m\����ti���y��JT��5�_�� �p��1g]�Wk+��_��nmQ��]
4
+ ��L�8�%�?��&����a`��ލ<g�3(�����=��L