class Cucumber::Core::Gherkin::Parser

def document(document)

def document(document)
  messages = ::Gherkin::Gherkin.from_source(document.uri, document.body, {default_dialect: document.language, include_source: false})
  messages.each do |message|
    if !message.gherkinDocument.nil?
      event_bus.gherkin_source_parsed(message.gherkinDocument)
    elsif !message.pickle.nil?
      receiver.pickle(message.pickle)
    elsif !message.attachment.nil?
      # Parse error
      raise Core::Gherkin::ParseError.new("#{document.uri}: #{message.attachment.data}")
    else
      raise "Unknown message: #{message.to_hash}"
    end
  end
end