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.
-
#raw_value ⇒ Object
Returns the value of attribute raw_value.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type:, value:, location:, raw_value: nil) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type:, value:, location:, raw_value: nil) ⇒ Token
Returns a new instance of Token.
11 12 13 14 15 16 |
# File 'lib/collie/parser/lexer.rb', line 11 def initialize(type:, value:, location:, raw_value: nil) @type = type @value = value @location = location @raw_value = raw_value 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 |
#raw_value ⇒ Object
Returns the value of attribute raw_value.
9 10 11 |
# File 'lib/collie/parser/lexer.rb', line 9 def raw_value @raw_value 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
18 19 20 |
# File 'lib/collie/parser/lexer.rb', line 18 def to_s "#{type}(#{value.inspect})" end |