Module: Coherence::Engine::DSL

Defined in:
lib/coherence/engine/dsl.rb

Instance Method Summary collapse

Instance Method Details

#parse_gherkin(source, path = 'unknown') ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/coherence/engine/dsl.rb', line 8

def parse_gherkin(source, path='unknown')
  builder = AST::GherkinBuilder.new(path)
  parser = Gherkin::Parser::Parser.new(builder, true, 'root', false)

  begin
    parser.parse(source, path, 0)
    builder.language = parser.i18n_language
    builder.result
  rescue Gherkin::Lexer::LexingError, Gherkin::Parser::ParseError => e
    e.message.insert(0, "#{path}: ")
    raise e
  end
end