class Token
Attributes
kind[RW]
pos[RW]
str[RW]
val[RW]
Public Class Methods
create(str)
click to toggle source
# File lib/crokus/token.rb, line 25 def self.create str Token.new [:id,str,[0,0]] end
new(tab)
click to toggle source
# File lib/crokus/token.rb, line 3 def initialize tab @kind,@val,@pos=*tab end
Public Instance Methods
accept(visitor,arg=nil)
click to toggle source
# File lib/crokus/token.rb, line 21 def accept visitor,arg=nil visitor.visitToken(self,arg) end
inspect()
click to toggle source
# File lib/crokus/token.rb, line 33 def inspect "(#{kind},#{val},#{pos})" end
is?(kind)
click to toggle source
# File lib/crokus/token.rb, line 7 def is? kind case kind when Symbol return @kind==kind when Array for sym in kind return true if @kind==sym end return false else raise "wrong type during lookahead" end end
to_s()
click to toggle source
# File lib/crokus/token.rb, line 29 def to_s val end