def enter_node(tree_node)
      parent = @stack.last
      if @delegate
        @delegate.enter_node(tree_node) if @delegate.respond_to? :enter_node
      else
        @on_enter_tree_node_blocks.each do |b|
          if b.arity == 1
            b.call(tree_node)
          elsif b.arity == 2
            b.call(tree_node, parent)
          end
        end
      end
      @root = tree_node if @stack.empty?
      @stack.push(tree_node)
    end
def enter_node(tree_node)
      parent = @stack.last
      if @delegate
        @delegate.enter_node(tree_node) if @delegate.respond_to? :enter_node
      else
        @on_enter_tree_node_blocks.each do |b|
          if b.arity == 1
            b.call(tree_node)
          elsif b.arity == 2
            b.call(tree_node, parent)
          end
        end
      end
      @root = tree_node if @stack.empty?
      @stack.push(tree_node)
    end
@param [Object] delegate

 called on tree node at start of the visit i.e. we start to visit the subtree