class RLTK::StreamPosition

The StreamPosition class is used to indicate the position of a token or other text inside a stream.

Attributes

file_name[RW]

@return [String]

length[RW]

@return [Integer]

line_number[RW]

@return [Integer]

line_offset[RW]

@return [Integer]

start[RW]

@return [Integer]

stream_offset[RW]

@return [Integer]

Public Class Methods

new(stream_offset = 0, line_number = 0, line_offset = 0, length = 0, file_name = nil) click to toggle source

Instantiates a new StreamPosition object with the values specified.

@param [Integer] stream_offset The position from the beginning of the stream. @param [Integer] line_number The number of newlines since the beginning of the file. @param [Integer] line_offset The offset of this token from the beginning of the current line. @param [Integer] length The length of the text of the token. @param [String, nil] file_name The name of the file being lexed.

# File lib/rltk/token.rb, line 38
def initialize(stream_offset = 0, line_number = 0, line_offset = 0, length = 0, file_name = nil)
        @stream_offset       = stream_offset
        @line_number = line_number
        @line_offset = line_offset
        @length              = length
        @file_name   = file_name
end