Class: LXL::Token
- Inherits:
-
Object
- Object
- LXL::Token
- Defined in:
- lib/lxl.rb
Overview
Holds the lexical type and value of a parsed token.
Instance Attribute Summary collapse
-
#type ⇒ Object
Lexical type (Fixnum).
-
#value ⇒ Object
Parsed value.
Instance Method Summary collapse
-
#initialize(type, value) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object (also: #inspect)
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
#type ⇒ Object
Lexical type (Fixnum).
170 171 172 |
# File 'lib/lxl.rb', line 170 def type @type end |
#value ⇒ Object
Parsed value.
173 174 175 |
# File 'lib/lxl.rb', line 173 def value @value end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
180 181 182 |
# File 'lib/lxl.rb', line 180 def to_s() "T:#{@type.chr}:#{@value}" end |