Sha256: 654c19f866170bf359c882bca3b2e44ef69203b8bb3a37d289dd799fb177cafd
Contents?: true
Size: 1.41 KB
Versions: 14
Compression:
Stored size: 1.41 KB
Contents
module Gherkin class ParserError < StandardError; end class ParserException < ParserError attr_reader :location def initialize(message, location) @location = location super("(#{location[:line]}:#{location[:column] || 0}): #{message}") end end class NoSuchLanguageException < ParserException def initialize(language, location) super "Language not supported: #{language}", location end end class AstBuilderException < ParserException; end class CompositeParserException < ParserError attr_reader :errors def initialize(errors) @errors = errors super "Parser errors:\n" + errors.map(&:message).join("\n") end end class UnexpectedTokenException < ParserException def initialize(received_token, expected_token_types, state_comment) message = "expected: #{expected_token_types.join(", ")}, got '#{received_token.token_value.strip}'" column = received_token.location[:column] location = (column.nil? || column.zero?) ? {line: received_token.location[:line], column: received_token.line.indent + 1} : received_token.location super(message, location) end end class UnexpectedEOFException < ParserException def initialize(received_token, expected_token_types, state_comment) message = "unexpected end of file, expected: #{expected_token_types.join(", ")}" super(message, received_token.location) end end end
Version data entries
14 entries across 14 versions & 2 rubygems