Exception: Walrat::ParseError

Inherits:
Exception
  • Object
show all
Includes:
LocationTracking
Defined in:
lib/walrat/parse_error.rb

Instance Attribute Summary

Attributes included from LocationTracking

#outer_end, #outer_source_text, #outer_start, #source_text

Instance Method Summary collapse

Methods included from LocationTracking

#column_end, #column_end=, #column_start, #column_start=, #end, #end=, #line_end, #line_end=, #line_start, #line_start=, #rightmost?, #start, #start=

Constructor Details

#initialize(message, info = {}) ⇒ ParseError

Takes an optional hash (for packing extra info into exception). position in string (irrespective of line number, column number) line number, column number filename



33
34
35
36
37
38
39
# File 'lib/walrat/parse_error.rb', line 33

def initialize message, info = {}
  super message
  self.line_start     = info[:line_start]
  self.column_start   = info[:column_start]
  self.line_end       = info[:line_end]
  self.column_end     = info[:column_end]
end

Instance Method Details

#inspectObject



41
42
43
44
45
# File 'lib/walrat/parse_error.rb', line 41

def inspect
  # TODO: also return filename if available
  '#<%s: %s @line_end=%d, @column_end=%d>' %
    [ self.class.to_s, self.to_s, self.line_end, self.column_end ]
end