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

    self.context.unshift type

    exp.map! { |sub| Array === sub ? rewrite(sub) : sub }

    self.context.shift

    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