each_reduce(&block)
click to toggle source
def each_reduce(&block)
@reduce.each(&block)
end
each_shift(&block)
click to toggle source
def each_shift(&block)
@shift.each(&block)
end
init()
click to toggle source
def init
@grammar.each do |rule|
@reduce.push Reduce.new(rule)
end
@statetable.each do |state|
@shift.push Shift.new(state)
end
@accept = Accept.new
@error = Error.new
end
reduce(i)
click to toggle source
def reduce(i)
case i
when Rule then i = i.ident
when Integer then ;
else
raise "racc: fatal: wrong class #{i.class} for reduce"
end
r = @reduce[i] or raise "racc: fatal: reduce action #{i.inspect} not exist"
r.incref
r
end
reduce_n()
click to toggle source
def reduce_n
@reduce.size
end
shift(i)
click to toggle source
def shift(i)
case i
when State then i = i.ident
when Integer then ;
else
raise "racc: fatal: wrong class #{i.class} for shift"
end
@shift[i] or raise "racc: fatal: shift action #{i} does not exist"
end
shift_n()
click to toggle source
def shift_n
@shift.size
end