Exception: Minilex::UnrecognizedInput

Inherits:
StandardError
  • Object
show all
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

Instance Method Summary collapse

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

#posObject (readonly)

Returns the value of attribute pos.



130
131
132
# File 'lib/minilex.rb', line 130

def pos
  @pos
end

#scannerObject (readonly)

Returns the value of attribute scanner.



130
131
132
# File 'lib/minilex.rb', line 130

def scanner
  @scanner
end

Instance Method Details

#to_sObject



137
138
139
# File 'lib/minilex.rb', line 137

def to_s
  "\"#{scanner.peek(10)}\" at line:#{pos.line}, offset:#{pos.offset}"
end