Exception: RLTK::LexingError
- Inherits:
-
StandardError
- Object
- StandardError
- RLTK::LexingError
- Defined in:
- lib/rltk/lexer.rb
Overview
A LexingError exception is raised when an input stream contains a substring that isn’t matched by any of a lexer’s rules.
Instance Attribute Summary collapse
- #line_number ⇒ Integer readonly
- #line_offset ⇒ Integer readonly
- #remainder ⇒ String readonly
- #stream_offset ⇒ Integer readonly
Instance Method Summary collapse
-
#initialize(stream_offset, line_number, line_offset, remainder) ⇒ LexingError
constructor
A new instance of LexingError.
-
#to_s ⇒ String
String representation of the error.
Constructor Details
#initialize(stream_offset, line_number, line_offset, remainder) ⇒ LexingError
Returns a new instance of LexingError.
40 41 42 43 44 45 |
# File 'lib/rltk/lexer.rb', line 40 def initialize(stream_offset, line_number, line_offset, remainder) @stream_offset = stream_offset @line_number = line_number @line_offset = line_offset @remainder = remainder end |
Instance Attribute Details
#line_number ⇒ Integer (readonly)
28 29 30 |
# File 'lib/rltk/lexer.rb', line 28 def line_number @line_number end |
#line_offset ⇒ Integer (readonly)
31 32 33 |
# File 'lib/rltk/lexer.rb', line 31 def line_offset @line_offset end |
#remainder ⇒ String (readonly)
34 35 36 |
# File 'lib/rltk/lexer.rb', line 34 def remainder @remainder end |
#stream_offset ⇒ Integer (readonly)
25 26 27 |
# File 'lib/rltk/lexer.rb', line 25 def stream_offset @stream_offset end |
Instance Method Details
#to_s ⇒ String
Returns String representation of the error.
48 49 50 |
# File 'lib/rltk/lexer.rb', line 48 def to_s "#{super()}: #{@remainder}" end |