Exception: Kanocc::ParseException

Inherits:
KanoccException show all
Defined in:
lib/kanocc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected_terminals, offending_input, pos) ⇒ ParseException

Returns a new instance of ParseException.



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/kanocc.rb', line 261

def initialize(expected_terminals, offending_input, pos)
  @expected_terminals, @offending_input, @pos =
  expected_terminals, offending_input, pos
  error_msg = "\n  Could not consume input: #{offending_input} at #{pos}"
  if expected_terminals.size > 0
    error_msg += " - expected " +
                 "#{expected_terminals.map {|t| t.inspect}.join(" or ")}"
  else
    error_msg += " - no input could be consumed at this point."
  end
  super(error_msg)
end

Instance Attribute Details

#expectedTerminalsObject (readonly)

Returns the value of attribute expectedTerminals.



260
261
262
# File 'lib/kanocc.rb', line 260

def expectedTerminals
  @expectedTerminals
end

#offendingInputObject (readonly)

Returns the value of attribute offendingInput.



260
261
262
# File 'lib/kanocc.rb', line 260

def offendingInput
  @offendingInput
end

#posObject (readonly)

Returns the value of attribute pos.



260
261
262
# File 'lib/kanocc.rb', line 260

def pos
  @pos
end