Sha256: 099c45510283484ba223b8d0f6d08edb5a9e584682b39622ec44aebd2fef027a
Contents?: true
Size: 724 Bytes
Versions: 7
Compression:
Stored size: 724 Bytes
Contents
module Furnace::AST module Visitor def visit(node) node.children.map! do |child| if child.is_a? Node visit child if child.type == :expand child = child.children end end child end node.children.flatten! node.children.delete_if do |child| if child.is_a? Node child.parent = node child.type == :remove end end # Invoke a specific handler on_handler = :"on_#{node.type}" if respond_to? on_handler send on_handler, node end # Invoke a generic handler if respond_to? :on_any send :on_any, node end node end end end
Version data entries
7 entries across 7 versions & 1 rubygems