Language::Tea::Traverse - Iterates into the Tea Op Tree


Language-Tea documentation  | view source Contained in the Language-Tea distribution.

Index


NAME

Top

Language::Tea::Traverse - Iterates into the Tea Op Tree

SYNOPSIS

Top

  use Language::Tree::Traverse;
  my $node = traverse_postfix($root, sub { }, []);
  my $node = traverse_prefix($root, sub { }, []);

DESCRIPTION

Top

This module iterates through the tree in two different ways

traverse_postfix($node, $visitor = sub { my ($node, \@children, @_) = @_ });

Bottom-up traversal. The visitor will receive both the current node and the result of the processing for each sub-node. As any other arguments passed to traverse_postfix.

traverse_prefix($node, $visitor = sub { my ($node, \@parents, @_) = @_ });

Top-Down traversal. The visitor will receive both the current node and the result of the processing for each upper level in the three (from the closest to the farest). It will also receive any other argument passed to traverse_prefix.


Language-Tea documentation  | view source Contained in the Language-Tea distribution.