lib/code/parser.rb in code-ruby-0.5.6 vs lib/code/parser.rb in code-ruby-0.6.0
- old
+ new
@@ -1,16 +1,23 @@
+# frozen_string_literal: true
+
class Code
class Parser
+ class Error < StandardError
+ end
+
def initialize(input)
@input = input
end
- def self.parse(input)
- new(input).parse
+ def self.parse(...)
+ new(...).parse
end
def parse
- ::Code::Parser::Code.parse(input)
+ Code.parse(input)
+ rescue Language::Parser::NotEndOfInput => e
+ raise Error, e.message
end
private
attr_reader :input