class Racc::LogFileGenerator

def action_out(f, state)

def action_out(f, state)
  sr = state.srconf && state.srconf.dup
  rr = state.rrconf && state.rrconf.dup
  acts = state.action
  keys = acts.keys
  keys.sort! {|a,b| a.ident <=> b.ident }
  [ Shift, Reduce, Error, Accept ].each do |klass|
    keys.delete_if do |tok|
      act = acts[tok]
      if act.kind_of?(klass)
        outact f, tok, act
        if sr and c = sr.delete(tok)
          outsrconf f, c
        end
        if rr and c = rr.delete(tok)
          outrrconf f, c
        end
        true
      else
        false
      end
    end
  end
  sr.each {|tok, c| outsrconf f, c } if sr
  rr.each {|tok, c| outrrconf f, c } if rr
  act = state.defact
  if not act.kind_of?(Error) or @debug_flags.any?
    outact f, '$default', act
  end
  f.puts
  state.goto_table.each do |t, st|
    if t.nonterminal?
      f.printf "  %-12s  go to state %d\n", t.to_s, st.ident
    end
  end
end