A set of rule and position in it's RHS. Note that the number of pointers is more than rule's RHS array, because pointer points right edge of the final symbol when reducing.
# File lib/racc/grammar.rb, line 811 def initialize(rule, i, sym) @rule = rule @index = i @symbol = sym @ident = @rule.hash + i @reduce = sym.nil? end
# File lib/racc/grammar.rb, line 853 def before(len) @rule.ptrs[@index - len] or ptr_bug! end
# File lib/racc/grammar.rb, line 837 def eql?(ot) @hash == ot.hash end
# File lib/racc/grammar.rb, line 843 def head? @index == 0 end
# File lib/racc/grammar.rb, line 847 def next @rule.ptrs[@index + 1] or ptr_bug! end
# File lib/racc/grammar.rb, line 830 def to_s sprintf('(%d,%d %s)', @rule.ident, @index, (reduce?() ? '#' : @symbol.to_s)) end
# File lib/racc/grammar.rb, line 859 def ptr_bug! raise "racc: fatal: pointer not exist: self: #{to_s}" end