# File lib/sexp_processor.rb, line 171 def rewrite(exp) type = exp.first self.context.unshift type # FIX: first one doubles up because process already unshifted -- look at moving initial rewrite up above exp.map! { |sub| Array === sub ? rewrite(sub) : sub } begin meth = @rewriters[type] exp = self.send(meth, exp) if meth old_type, type = type, exp.first end until old_type == type self.context.shift exp end