class Calcula::Token
A token that is created by the lexer and can be recognized by the parser.
@author Paul T.
Attributes
id[R]
@return [Symbol] Returns the type of the token
text[R]
@return [String] Returns the string segment from the source
Public Class Methods
Public Instance Methods
dup()
click to toggle source
Duplicates a token
@return [Calcula::Token] A duplicate of the token
# File lib/Token.rb, line 31 def dup Token.new(@id, @text) end
to_s()
click to toggle source
Converts the token into a format of `[:id => :text]`
@return [String] The string representation of the Token
in above format
# File lib/Token.rb, line 24 def to_s return "[#{@id}=>#{text}]" end