Class: Deadfire::FrontEnd::Token
- Inherits:
-
Object
- Object
- Deadfire::FrontEnd::Token
- Defined in:
- lib/deadfire/front_end/token.rb
Instance Attribute Summary collapse
-
#lexeme ⇒ Object
readonly
Returns the value of attribute lexeme.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
-
#literal ⇒ Object
readonly
Returns the value of attribute literal.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, lexeme, literal, lineno) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type, lexeme, literal, lineno) ⇒ Token
Returns a new instance of Token.
8 9 10 11 12 13 |
# File 'lib/deadfire/front_end/token.rb', line 8 def initialize(type, lexeme, literal, lineno) @type = type @lexeme = lexeme @literal = literal @lineno = lineno end |
Instance Attribute Details
#lexeme ⇒ Object (readonly)
Returns the value of attribute lexeme.
6 7 8 |
# File 'lib/deadfire/front_end/token.rb', line 6 def lexeme @lexeme end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
6 7 8 |
# File 'lib/deadfire/front_end/token.rb', line 6 def lineno @lineno end |
#literal ⇒ Object (readonly)
Returns the value of attribute literal.
6 7 8 |
# File 'lib/deadfire/front_end/token.rb', line 6 def literal @literal end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/deadfire/front_end/token.rb', line 6 def type @type end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/deadfire/front_end/token.rb', line 15 def to_s "[:#{type}] #{lexeme}" end |