# File lib/sexp_processor.rb, line 139
  def rewrite(exp)
    type = exp.first

    in_context type do
      exp.map! { |sub| Array === sub ? rewrite(sub) : sub }
    end

    begin
      meth = @rewriters[type]
      exp  = self.send(meth, exp) if meth
      break unless Sexp === exp
      old_type, type = type, exp.first
    end until old_type == type

    exp
  end