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)
-
- (Object) source_line
readonly
Returns the value of attribute source_line.
-
- (Object) type
readonly
Returns the value of attribute type.
-
- (Object) value
readonly
Returns the value of attribute value.
Instance Method Summary (collapse)
-
- (TrueClass|FalseClass) ==(other)
-
- (Token) initialize(type, value, source_line)
constructor
A new instance of Token.
Constructor Details
- (Token) initialize(type, value, source_line)
Returns a new instance of 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
- (Object) source_line (readonly)
Returns the value of attribute source_line
6 7 8 |
# File 'lib/ll/token.rb', line 6 def source_line @source_line end |
- (Object) type (readonly)
Returns the value of attribute type
6 7 8 |
# File 'lib/ll/token.rb', line 6 def type @type end |
- (Object) value (readonly)
Returns the value of attribute value
6 7 8 |
# File 'lib/ll/token.rb', line 6 def value @value end |
Instance Method Details
- (TrueClass|FalseClass) ==(other)
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 |