class LL::SourceLine

Class containing data of a lexer token's source line source as the raw data, column, line number, etc.

Constants

DEFAULT_FILE

@return [String]

Attributes

column[R]
data[R]
file[R]
line[R]

Public Class Methods

new(data, line = 1, column = 1, file = DEFAULT_FILE) click to toggle source

@param [String] data @param [Fixnum] line @param [Fixnum] column @param [String] file

# File lib/ll/source_line.rb, line 20
def initialize(data, line = 1, column = 1, file = DEFAULT_FILE)
  @file   = file
  @data   = data
  @line   = line
  @column = column
end

Public Instance Methods

==(other) click to toggle source

@return [TrueClass|FalseClass]

# File lib/ll/source_line.rb, line 37
def ==(other)
  return false unless other.class == self.class

  return file == other.file &&
    data == other.data &&
    line == other.line &&
    column == other.column
end
source() click to toggle source

@return [String]

# File lib/ll/source_line.rb, line 30
def source
  return data.lines.to_a[line - 1].chomp
end