class Racc::States

def check_useless

def check_useless
  used = []
  @actions.each_reduce do |act|
    if not act or act.refn == 0
      act.rule.useless = true
    else
      t = act.rule.target
      used[t.ident] = t
    end
  end
  @symboltable.nt_base.upto(@symboltable.nt_max - 1) do |n|
    unless used[n]
      @symboltable[n].useless = true
    end
  end
end