Parent

Racc::ActionTable

The table of LALR actions. Actions are either of Shift, Reduce, Accept and Error.

Attributes

accept[R]
error[R]

Public Class Methods

new(rt, st) click to toggle source
     # File lib/racc/state.rb, line 812
812:     def initialize(rt, st)
813:       @grammar = rt
814:       @statetable = st
815: 
816:       @reduce = []
817:       @shift = []
818:       @accept = nil
819:       @error = nil
820:     end

Public Instance Methods

each_reduce(&block) click to toggle source
     # File lib/racc/state.rb, line 850
850:     def each_reduce(&block)
851:       @reduce.each(&block)
852:     end
each_shift(&block) click to toggle source
     # File lib/racc/state.rb, line 869
869:     def each_shift(&block)
870:       @shift.each(&block)
871:     end
init() click to toggle source
     # File lib/racc/state.rb, line 822
822:     def init
823:       @grammar.each do |rule|
824:         @reduce.push Reduce.new(rule)
825:       end
826:       @statetable.each do |state|
827:         @shift.push Shift.new(state)
828:       end
829:       @accept = Accept.new
830:       @error = Error.new
831:     end
reduce(i) click to toggle source
     # File lib/racc/state.rb, line 837
837:     def reduce(i)
838:       case i
839:       when Rule    then i = i.ident
840:       when Integer then ;
841:       else
842:         raise "racc: fatal: wrong class #{i.class} for reduce"
843:       end
844: 
845:       r = @reduce[i] or raise "racc: fatal: reduce action #{i.inspect} not exist"
846:       r.incref
847:       r
848:     end
reduce_n() click to toggle source
     # File lib/racc/state.rb, line 833
833:     def reduce_n
834:       @reduce.size
835:     end
shift(i) click to toggle source
     # File lib/racc/state.rb, line 858
858:     def shift(i)
859:       case i
860:       when State   then i = i.ident
861:       when Integer then ;
862:       else
863:         raise "racc: fatal: wrong class #{i.class} for shift"
864:       end
865: 
866:       @shift[i] or raise "racc: fatal: shift action #{i} does not exist"
867:     end
shift_n() click to toggle source
     # File lib/racc/state.rb, line 854
854:     def shift_n
855:       @shift.size
856:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.