Class: Collie::Parser::Token
- Inherits:
-
Object
- Object
- Collie::Parser::Token
- Defined in:
- lib/collie/parser/lexer.rb
Overview
Token representation
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type:, value:, location:) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type:, value:, location:) ⇒ Token
Returns a new instance of Token.
11 12 13 14 15 |
# File 'lib/collie/parser/lexer.rb', line 11 def initialize(type:, value:, location:) @type = type @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
9 10 11 |
# File 'lib/collie/parser/lexer.rb', line 9 def location @location end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/collie/parser/lexer.rb', line 9 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/collie/parser/lexer.rb', line 9 def value @value end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/collie/parser/lexer.rb', line 17 def to_s "#{type}(#{value.inspect})" end |