7 8 9
# File 'lib/atomy/parser.rb', line 7 def parse_file(file) parse_string(File.read(file)) end
11 12 13 14 15 16 17 18 19
# File 'lib/atomy/parser.rb', line 11 def parse_string(source) grammar = Atomy::Grammar.new(source) grammar.raise_error unless grammar.parse grammar.result rescue KPeg::CompiledParser::ParseError => e raise SyntaxError, e.to_s end