class EBNF::LL1::Parser::Error

Raised for errors during parsing.

@example Raising a parser error

raise Error.new(
  "invalid token '%' on line 10",
  token: '%', lineno: 9, production: :turtleDoc)

@see ruby-doc.org/core/classes/StandardError.html

Attributes

lineno[R]

The line number where the error occurred.

@return [Integer]

production[R]

The current production.

@return [Symbol]

token[R]

The invalid token which triggered the error.

@return [String]

Public Class Methods

new(message, **options) click to toggle source

Initializes a new lexer error instance.

@param [String, to_s] message @param [Hash{Symbol => Object}] options @option options [Symbol] :production (nil) @option options [String] :token (nil) @option options [Integer] :lineno (nil)

Calls superclass method
# File lib/ebnf/ll1/parser.rb, line 794
def initialize(message, **options)
  @production = options[:production]
  @token      = options[:token]
  @lineno     = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
  super(message.to_s)
end