Exception: RLTK::LexingError

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

Constructor Details

#initialize(stream_offset, line_number, line_offset, remainder) ⇒ LexingError

Returns a new instance of LexingError.

Parameters:

  • stream_offset (Integer)

    Offset from begnning of string.

  • line_number (Integer)

    Number of newlines encountered so far.

  • line_offset (Integer)

    Offset from beginning of line.

  • remainder (String)

    Rest of the string that couldn’t be lexed.



30
31
32
33
34
35
# File 'lib/rltk/lexer.rb', line 30

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 Method Details

#to_sString

Returns String representation of the error.

Returns:

  • (String)

    String representation of the error.



38
39
40
# File 'lib/rltk/lexer.rb', line 38

def to_s
	"#{super()}: #{@remainder}"
end