def walk( mode = :pre, &block )
      raise ArgumentError, "Unknown walk mode #{mode.inspect}. Use either :pre, :post or :leaves" unless MODES.include? mode
      return to_enum(:walk, mode) unless block
      case(mode)
      when :pre   then walk_pre(&block)
      when :post  then walk_post(&block)
      when :leaves then walk_leaves(&block)
      end
    end
def walk( mode = :pre, &block )
      raise ArgumentError, "Unknown walk mode #{mode.inspect}. Use either :pre, :post or :leaves" unless MODES.include? mode
      return to_enum(:walk, mode) unless block
      case(mode)
      when :pre   then walk_pre(&block)
      when :post  then walk_post(&block)
      when :leaves then walk_leaves(&block)
      end
    end
works like each, but recursive

 @param mode [:pre, :post, :leaves]