Class: LXL::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/lxl.rb

Overview

Holds the lexical type and value of a parsed token.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ Token

Returns a new instance of Token.



175
176
177
178
# File 'lib/lxl.rb', line 175

def initialize(type, value)
  @type = type
  @value = value
end

Instance Attribute Details

#typeObject

Lexical type (Fixnum).



170
171
172
# File 'lib/lxl.rb', line 170

def type
  @type
end

#valueObject

Parsed value.



173
174
175
# File 'lib/lxl.rb', line 173

def value
  @value
end

Instance Method Details

#to_sObject Also known as: inspect



180
181
182
# File 'lib/lxl.rb', line 180

def to_s()
  "T:#{@type.chr}:#{@value}"
end