class Cucumber::Parser::GherkinBuilder

AST.
“legacy” AST. It will be replaced later when we have a new “clean”
This class conforms to the Gherkin event API and builds the

def background(node)

def background(node)
  builder = BackgroundBuilder.new(file, node)
  @feature_builder.background_builder = builder
  @current = builder
end

def eof

def eof
end

def examples(examples)

def examples(examples)
  examples_fields = [
    Ast::Location.new(file, examples.line),
    Ast::Comment.new(examples.comments.map{|comment| comment.value}.join("\n")),
    examples.keyword,
    examples.name,
    examples.description,
    matrix(examples.rows)
  ]
  @current.add_examples examples_fields, examples
end

def feature(node)

def feature(node)
  @feature_builder = FeatureBuilder.new(file, node)
end

def file

def file
  if Cucumber::WINDOWS && !ENV['CUCUMBER_FORWARD_SLASH_PATHS']
    @path.gsub(/\//, '\\')
  else
    @path
  end
end

def initialize(path = 'UNKNOWN-FILE')

def initialize(path = 'UNKNOWN-FILE')
  @path = path
end

def language

def language
  @language || raise("Language has not been set")
end

def language=(language)

def language=(language)
  @language = language
end

def matrix(gherkin_table)

def matrix(gherkin_table)
  gherkin_table.map do |gherkin_row|
    row = gherkin_row.cells
    class << row
      attr_accessor :line
    end
    row.line = gherkin_row.line
    row
  end
end

def result

def result
  return nil unless @feature_builder
  @feature_builder.result(language)
end

def scenario(node)

def scenario(node)
  builder = ScenarioBuilder.new(file, node)
  @feature_builder.add_child builder
  @current = builder
end

def scenario_outline(node)

def scenario_outline(node)
  builder = ScenarioOutlineBuilder.new(file, node)
  @feature_builder.add_child builder
  @current = builder
end

def step(node)

def step(node)
  builder = StepBuilder.new(file, node)
  @current.add_child builder
end

def syntax_error(state, event, legal_events, line)

def syntax_error(state, event, legal_events, line)
  # raise "SYNTAX ERROR"
end

def uri(uri)

def uri(uri)
  @path = uri
end