Class: LL::Token
- Inherits:
-
Object
- Object
- LL::Token
- Defined in:
- lib/ll/token.rb
Overview
A Token contains the data of a single lexer token.
Instance Attribute Summary collapse
-
#source_line ⇒ Object
readonly
Returns the value of attribute source_line.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ TrueClass|FalseClass
-
#initialize(type, value, source_line) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(type, value, source_line) ⇒ Token
13 14 15 16 17 |
# File 'lib/ll/token.rb', line 13 def initialize(type, value, source_line) @type = type @value = value @source_line = source_line end |
Instance Attribute Details
#source_line ⇒ Object (readonly)
Returns the value of attribute source_line.
6 7 8 |
# File 'lib/ll/token.rb', line 6 def source_line @source_line end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/ll/token.rb', line 6 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/ll/token.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ TrueClass|FalseClass
22 23 24 25 26 27 28 |
# File 'lib/ll/token.rb', line 22 def ==(other) return false unless other.class == self.class return type == other.type && value == other.value && source_line == other.source_line end |