Class: Rutile::Parser::Token
- Inherits:
-
Object
- Object
- Rutile::Parser::Token
- Defined in:
- lib/rutile/lexer.rb
Instance Attribute Summary collapse
-
#string ⇒ Object
Returns the value of attribute string.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, string) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(type, string) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 12 13 14 |
# File 'lib/rutile/lexer.rb', line 7 def initialize(type, string) if type == [:transition_state] throw Exception.new("Malformed token: #{string}") end type.delete :transition_state @type = type @string = string end |
Instance Attribute Details
#string ⇒ Object
Returns the value of attribute string.
6 7 8 |
# File 'lib/rutile/lexer.rb', line 6 def string @string end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/rutile/lexer.rb', line 6 def type @type end |