Sha256: 461d18ae0092f8a1ddba37b3a70a14ff045ffaf45c9acc5d770ff52ca33901ca
Contents?: true
Size: 1022 Bytes
Versions: 1
Compression:
Stored size: 1022 Bytes
Contents
require 'gherkin/parser' require 'gherkin/token_scanner' require 'gherkin/errors' require 'cucumber/core/gherkin/ast_builder' require 'cucumber/core/ast' module Cucumber module Core module Gherkin ParseError = Class.new(StandardError) class Parser attr_reader :receiver private :receiver def initialize(receiver) @receiver = receiver end def document(document) parser = ::Gherkin::Parser.new scanner = ::Gherkin::TokenScanner.new(document.body) core_builder = AstBuilder.new(document.uri) begin result = parser.parse(scanner) receiver.feature core_builder.feature(result) rescue *PARSER_ERRORS => e raise Core::Gherkin::ParseError.new("#{document.uri}: #{e.message}") end end def done receiver.done self end private PARSER_ERRORS = ::Gherkin::ParserError end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber-core-1.5.0 | lib/cucumber/core/gherkin/parser.rb |