Exception: LexerKit::ParseError

Inherits:
DiagnosticError show all
Defined in:
lib/lexer_kit/errors.rb

Overview

Raised during regex parsing

Instance Attribute Summary collapse

Attributes inherited from DiagnosticError

#diagnostic, #source

Instance Method Summary collapse

Methods inherited from DiagnosticError

from_location, #render

Constructor Details

#initialize(message, source: nil, position: nil) ⇒ ParseError

Returns a new instance of ParseError.



60
61
62
63
64
# File 'lib/lexer_kit/errors.rb', line 60

def initialize(message, source: nil, position: nil)
  @position = position # character position (codepoint-based)
  span = source.span_for_char_index(position) if source && position
  super(message, source: source, span: span)
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



58
59
60
# File 'lib/lexer_kit/errors.rb', line 58

def position
  @position
end