class Racc::LocationPointer
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.
Attributes
dereference[R]
hash[R]
ident[R]
index[R]
reduce[R]
reduce?[R]
rule[R]
symbol[R]
Public Class Methods
new(rule, i, sym)
click to toggle source
# File lib/racc/grammar.rb, line 891 def initialize(rule, i, sym) @rule = rule @index = i @symbol = sym @ident = @rule.hash + i @reduce = sym.nil? end
Public Instance Methods
before(len)
click to toggle source
# File lib/racc/grammar.rb, line 933 def before(len) @rule.ptrs[@index - len] or ptr_bug! end
eql?(ot)
click to toggle source
# File lib/racc/grammar.rb, line 917 def eql?(ot) @hash == ot.hash end
Also aliased as: ==
head?()
click to toggle source
# File lib/racc/grammar.rb, line 923 def head? @index == 0 end
next()
click to toggle source
# File lib/racc/grammar.rb, line 927 def next @rule.ptrs[@index + 1] or ptr_bug! end
Also aliased as: increment
to_s()
click to toggle source
# File lib/racc/grammar.rb, line 910 def to_s sprintf('(%d,%d %s)', @rule.ident, @index, (reduce?() ? '#' : @symbol.to_s)) end
Also aliased as: inspect