Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated ruby_parser dep.

Cleaned up process_args and removed block handler.
Cleaned up minorly icky code here and there.

[git-p4: depot-paths = "//src/ruby2ruby/dev/": change = 7891]
  • Loading branch information...
commit ad041ab28b830d2d31caf1c4c3f1e420ea24427e 1 parent a515b1d
Ryan Davis authored November 01, 2012

Showing 2 changed files with 6 additions and 14 deletions. Show diff stats Hide diff stats

  1. 2  Rakefile
  2. 18  lib/ruby2ruby.rb
2  Rakefile
@@ -16,7 +16,7 @@ Hoe.spec 'ruby2ruby' do
16 16
   self.rubyforge_name = 'seattlerb'
17 17
 
18 18
   dependency "sexp_processor", "~> 4.0"
19  
-  dependency "ruby_parser",    "~> 3.0.0.a4"
  19
+  dependency "ruby_parser",    "~> 3.0.0.a10"
20 20
 end
21 21
 
22 22
 def process ruby, file="stdin"
18  lib/ruby2ruby.rb
@@ -88,19 +88,10 @@ def process_args(exp)
88 88
       case arg
89 89
       when Symbol then
90 90
         args << arg
91  
-      when Array then
  91
+      when Sexp then
92 92
         case arg.first
93 93
         when :lasgn then
94 94
           args << process(arg)
95  
-        when :block then
96  
-          asgns = {}
97  
-          arg[1..-1].each do |lasgn|
98  
-            asgns[lasgn[1]] = process(lasgn)
99  
-          end
100  
-
101  
-          args.each_with_index do |name, index|
102  
-            args[index] = asgns[name] if asgns.has_key? name
103  
-          end
104 95
         else
105 96
           raise "unknown arg type #{arg.first.inspect}"
106 97
         end
@@ -109,7 +100,7 @@ def process_args(exp)
109 100
       end
110 101
     end
111 102
 
112  
-    return "(#{args.join ', '})"
  103
+    "(#{args.join ', '})"
113 104
   end
114 105
 
115 106
   def process_array(exp)
@@ -338,7 +329,7 @@ def process_defn(exp)
338 329
 
339 330
     comm = exp.comments
340 331
     name = exp.shift
341  
-    args = process(exp.shift)
  332
+    args = process exp.shift
342 333
     args = "" if args == "()"
343 334
 
344 335
     exp.shift if exp == s(s(:nil)) # empty it out of a default nil expression
@@ -522,7 +513,8 @@ def process_iter(exp)
522 513
              " ||"
523 514
            else
524 515
              a = process(args)[1..-2]
525  
-             a.empty? ? "" : " |#{a}|"
  516
+             a = " |#{a}|" unless a.empty?
  517
+             a
526 518
            end
527 519
 
528 520
     b, e = if iter == "END" then

0 notes on commit ad041ab

Please sign in to comment.
Something went wrong with that request. Please try again.