update parser to use 2.6

was choking on &. syntax
improved error reporting slightly
This commit is contained in:
Torsten Ruger
2019-03-04 19:00:47 +02:00
parent fb89c01681
commit 8d4eab72bf
4 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
require "parser/ruby22"
require "parser/current"
require "ast"
AST::Node.class_eval do

View File

@ -29,8 +29,17 @@ module Ruby
include AST::Sexp
def self.compile(input)
ast = Parser::Ruby22.parse( input )
self.new.process(ast)
begin
ast = Parser::CurrentRuby.parse( input )
rescue => e
puts "Error parsing #{input}"
end
begin
self.new.process(ast)
rescue => e
puts "Error processing #{ast}"
raise e
end
end
# raise a ProcessError. This means ruby-x doesn't know how to handle it.