TreeIterator

class TreeIterator(val childrenExtractor: (A_Phrase, (A_Phrase) -> Unit) -> Unit, val aBlock: (A_Phrase, parent: A_Phrase?) -> Unit)

A helper for traversing a phrase tree without recursion.

Constructors

Link copied to clipboard
constructor(childrenExtractor: (A_Phrase, (A_Phrase) -> Unit) -> Unit, aBlock: (A_Phrase, parent: A_Phrase?) -> Unit)

Properties

Link copied to clipboard
val aBlock: (A_Phrase, parent: A_Phrase?) -> Unit

What to execute with each phrase in the tree and its optional (only for the top phrase) parent.

Link copied to clipboard

A function that takes a phrase and a function that accepts a phrase, and evaluates the passed function with each child of the phrase.

Functions

Link copied to clipboard
fun visitAll(phrase: A_Phrase, parent: A_Phrase?)

Visit all phrases in the tree, in bottom-up order, invoking aBlock for each, and also passing the phrase's optional parent.