class Paco::ParseError

Attributes

ctx[R]
expected[R]
pos[R]

Public Class Methods

new(ctx, expected) click to toggle source

@param [Paco::Context] ctx

# File lib/paco/parse_error.rb, line 10
def initialize(ctx, expected)
  @ctx = ctx
  @pos = ctx.pos
  @expected = expected
end

Public Instance Methods

callstack() click to toggle source
# File lib/paco/parse_error.rb, line 16
def callstack
  ctx.callstack
end
message() click to toggle source
# File lib/paco/parse_error.rb, line 20
    def message
      index = ctx.index(pos)
      <<~MSG
        \nParsing error
        line #{index.line}, column #{index.column}:
        unexpected #{ctx.eof? ? "end of file" : ctx.input[pos].inspect}
        expecting #{expected}
      MSG
    end