class RLTK::LexingError

A LexingError exception is raised when an input stream contains a substring that isn’t matched by any of a lexer’s rules.

Attributes

line_number[R]

@return [Integer]

line_offset[R]

@return [Integer]

remainder[R]

@return [String]

stream_offset[R]

@return [Integer]

Public Class Methods

new(stream_offset, line_number, line_offset, remainder) click to toggle source

@param [Integer] stream_offset Offset from begnning of string. @param [Integer] line_number Number of newlines encountered so far. @param [Integer] line_offset Offset from beginning of line. @param [String] remainder Rest of the string that couldn’t be lexed.

# 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

Public Instance Methods

to_s() click to toggle source

@return [String] String representation of the error.

# File lib/rltk/lexer.rb, line 48
def to_s
        "#{super()}: #{@remainder}"
end