Class: Racc::ActionTable
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/racc/state.rb |
Overview
Class Method Summary
- .new(rt, st) ⇒ ActionTable constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(rt, st) ⇒ ActionTable
# File 'lib/racc/state.rb', line 817
def initialize(rt, st) @grammar = rt @statetable = st @reduce = [] @shift = [] @accept = nil @error = nil end
Instance Attribute Details
#accept (readonly)
[ GitHub ]# File 'lib/racc/state.rb', line 878
attr_reader :accept
#error (readonly)
[ GitHub ]# File 'lib/racc/state.rb', line 879
attr_reader :error
Instance Method Details
#each_reduce(&block)
[ GitHub ]# File 'lib/racc/state.rb', line 855
def each_reduce(&block) @reduce.each(&block) end
#each_shift(&block)
[ GitHub ]# File 'lib/racc/state.rb', line 874
def each_shift(&block) @shift.each(&block) end
#init
[ GitHub ]#reduce(i)
[ GitHub ]# File 'lib/racc/state.rb', line 842
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
[ GitHub ]# File 'lib/racc/state.rb', line 838
def reduce_n @reduce.size end
#shift(i)
[ GitHub ]# File 'lib/racc/state.rb', line 863
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
[ GitHub ]# File 'lib/racc/state.rb', line 859
def shift_n @shift.size end