# Copyright (C) 2007-2008 Annas Al Maleh # Licensed under the LGPL. See /COPYING.LGPL for more details. class DepthFirstSearchIterator def initialize(node, node_visitor) @node = node @node_visitor = node_visitor end def iterate process(@node) end def process(node) @node_visitor.process_before_children(node) node.children.each { |child| process(child) } unless node.is_a?(String) @node_visitor.process_after_children(node) end end