Exception: Bismas::Parser::ParseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bismas/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, message) ⇒ ParseError

Returns a new instance of ParseError.



151
152
153
# File 'lib/bismas/parser.rb', line 151

def initialize(input, message)
  @input, @message = input, message
end

Instance Method Details

#to_sObject



155
156
157
158
159
160
161
# File 'lib/bismas/parser.rb', line 155

def to_s
  '%s at %d:%d: %s' % [@message]
    .insert(*@input.eos? ?
      [0, 'Unexpected end of input'] :
      [-1, @input.peek(16).inspect])
    .insert(1, $., @input.pos)
end