Exception: Paco::ParseError
- Defined in:
- lib/paco/parse_error.rb
Instance Attribute Summary collapse
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
Instance Method Summary collapse
- #callstack ⇒ Object
-
#initialize(ctx, expected) ⇒ ParseError
constructor
A new instance of ParseError.
- #message ⇒ Object
Constructor Details
#initialize(ctx, expected) ⇒ ParseError
Returns a new instance of ParseError.
10 11 12 13 14 |
# File 'lib/paco/parse_error.rb', line 10 def initialize(ctx, expected) @ctx = ctx @pos = ctx.pos @expected = expected end |
Instance Attribute Details
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
7 8 9 |
# File 'lib/paco/parse_error.rb', line 7 def ctx @ctx end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
7 8 9 |
# File 'lib/paco/parse_error.rb', line 7 def expected @expected end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
7 8 9 |
# File 'lib/paco/parse_error.rb', line 7 def pos @pos end |
Instance Method Details
#callstack ⇒ Object
16 17 18 |
# File 'lib/paco/parse_error.rb', line 16 def callstack ctx.callstack end |
#message ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/paco/parse_error.rb', line 20 def index = ctx.index(pos) " \\nParsing error\n line \#{index.line}, column \#{index.column}:\n unexpected \#{ctx.eof? ? \"end of file\" : ctx.input[pos].inspect}\n expecting \#{expected}\n MSG\nend\n" |