Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@zenspider zenspider authored
Showing with 6 additions and 14 deletions.
  1. +1 −1  Rakefile
  2. +5 −13 lib/ruby2ruby.rb
View
2  Rakefile
@@ -16,7 +16,7 @@ Hoe.spec 'ruby2ruby' do
self.rubyforge_name = 'seattlerb'
dependency "sexp_processor", "~> 4.0"
- dependency "ruby_parser", "~> 3.0.0.a4"
+ dependency "ruby_parser", "~> 3.0.0.a10"
end
def process ruby, file="stdin"
View
18 lib/ruby2ruby.rb
@@ -88,19 +88,10 @@ def process_args(exp)
case arg
when Symbol then
args << arg
- when Array then
+ when Sexp then
case arg.first
when :lasgn then
args << process(arg)
- when :block then
- asgns = {}
- arg[1..-1].each do |lasgn|
- asgns[lasgn[1]] = process(lasgn)
- end
-
- args.each_with_index do |name, index|
- args[index] = asgns[name] if asgns.has_key? name
- end
else
raise "unknown arg type #{arg.first.inspect}"
end
@@ -109,7 +100,7 @@ def process_args(exp)
end
end
- return "(#{args.join ', '})"
+ "(#{args.join ', '})"
end
def process_array(exp)
@@ -338,7 +329,7 @@ def process_defn(exp)
comm = exp.comments
name = exp.shift
- args = process(exp.shift)
+ args = process exp.shift
args = "" if args == "()"
exp.shift if exp == s(s(:nil)) # empty it out of a default nil expression
@@ -522,7 +513,8 @@ def process_iter(exp)
" ||"
else
a = process(args)[1..-2]
- a.empty? ? "" : " |#{a}|"
+ a = " |#{a}|" unless a.empty?
+ a
end
b, e = if iter == "END" then
Please sign in to comment.
Something went wrong with that request. Please try again.