class Lex::Token

Used to represent the tokens produced

Attributes

action[R]
name[RW]
value[RW]

Public Class Methods

new(name, value, &action) click to toggle source
# File lib/lex/token.rb, line 16
def initialize(name, value, &action)
  @name        = name
  @value       = value
  @action      = action
  @source_line = SourceLine.new
end

Public Instance Methods

inspect()
Alias for: to_s
to_ary() click to toggle source

Return this token as array of values

@return [Symbol, String, Integer, Integer]

@api public

# File lib/lex/token.rb, line 33
def to_ary
  [name, value, line, column]
end
to_s() click to toggle source

Return a string representation

@return String

@api public

# File lib/lex/token.rb, line 42
def to_s
  "Lex::Token(#{to_ary.join(',')})"
end
Also aliased as: inspect
update_line(line, column) click to toggle source
# File lib/lex/token.rb, line 23
def update_line(line, column)
  @source_line.line = line
  @source_line.column = column
end