Class: Rutile::Parser::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rutile/lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#stringObject

Returns the value of attribute string.



6
7
8
# File 'lib/rutile/lexer.rb', line 6

def string
  @string
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/rutile/lexer.rb', line 6

def type
  @type
end