Class: Treetop::Runtime::CompiledParser

Inherits:
Object
  • Object
show all
Includes:
Cucumber::Parser::TreetopExt
Defined in:
lib/cucumber/parser/treetop_ext.rb

Constant Summary

Constants included from Cucumber::Parser::TreetopExt

Cucumber::Parser::TreetopExt::FILE_LINE_PATTERN

Instance Method Summary collapse

Methods included from Cucumber::Parser::TreetopExt

#parse_file

Instance Method Details

#parse_or_fail(s, file = nil, line = 0) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/cucumber/parser/treetop_ext.rb', line 55

def parse_or_fail(s, file=nil, line=0)
  parse_tree = parse(s)
  if parse_tree.nil?
    raise Cucumber::Parser::SyntaxError.new(self, file, line)
  else
    ast = parse_tree.build
    ast.file = file
    ast
  end
end