A table of LALR states.
# File lib/racc/state.rb, line 24 def initialize(grammar, debug_flags = DebugFlags.new) @grammar = grammar @symboltable = grammar.symboltable @d_state = debug_flags.state @d_la = debug_flags.la @d_prec = debug_flags.prec @states = [] @statecache = {} @actions = ActionTable.new(@grammar, self) @nfa_computed = false @dfa_computed = false end
DFA (Deterministic Finite Automaton) Generation
# File lib/racc/state.rb, line 195 def dfa return self if @dfa_computed nfa compute_dfa @dfa_computed = true self end
# File lib/racc/state.rb, line 60 def each_index(&block) @states.each_index(&block) end
# File lib/racc/state.rb, line 54 def each_state(&block) @states.each(&block) end
# File lib/racc/state.rb, line 44 def inspect '#<state table>' end
# File lib/racc/state.rb, line 87 def n_rrconflicts @n_rrconflicts ||= inject(0) {|sum, st| sum + st.n_rrconflicts } end
# File lib/racc/state.rb, line 79 def n_srconflicts @n_srconflicts ||= inject(0) {|sum, st| sum + st.n_srconflicts } end
NFA (Non-deterministic Finite Automaton) Computation
# File lib/racc/state.rb, line 101 def nfa return self if @nfa_computed compute_nfa @nfa_computed = true self end
# File lib/racc/state.rb, line 83 def rrconflict_exist? n_rrconflicts() != 0 end
# File lib/racc/state.rb, line 70 def should_report_srconflict? srconflict_exist? and (n_srconflicts() != @grammar.n_expected_srconflicts) end
# File lib/racc/state.rb, line 75 def srconflict_exist? n_srconflicts() != 0 end
Generated with the Darkfish Rdoc Generator 2.