Exception: Minilex::UnrecognizedInput
- Inherits:
-
StandardError
- Object
- StandardError
- Minilex::UnrecognizedInput
- Defined in:
- lib/minilex.rb
Overview
The error raised when a Lexer can’t match some input
It will show the offending characters and tell you where in the input it was when it got confused.
Instance Attribute Summary collapse
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#scanner ⇒ Object
readonly
Returns the value of attribute scanner.
Instance Method Summary collapse
-
#initialize(scanner, pos) ⇒ UnrecognizedInput
constructor
A new instance of UnrecognizedInput.
- #to_s ⇒ Object
Constructor Details
#initialize(scanner, pos) ⇒ UnrecognizedInput
Returns a new instance of UnrecognizedInput.
132 133 134 135 |
# File 'lib/minilex.rb', line 132 def initialize(scanner, pos) @scanner = scanner @pos = pos end |
Instance Attribute Details
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
130 131 132 |
# File 'lib/minilex.rb', line 130 def pos @pos end |
#scanner ⇒ Object (readonly)
Returns the value of attribute scanner.
130 131 132 |
# File 'lib/minilex.rb', line 130 def scanner @scanner end |
Instance Method Details
#to_s ⇒ Object
137 138 139 |
# File 'lib/minilex.rb', line 137 def to_s "\"#{scanner.peek(10)}\" at line:#{pos.line}, offset:#{pos.offset}" end |