You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The UDFNode.terminals() and UDFNode.preterminals() methods recursively descend through the tree and return lists of nodes, but for all other nodes the user must do this descent themselves. In addition to iterating over nonterminals (or non-preterminals), a way to get the root node (if it exists) could be handy. Currently one must test if node.is_root() is True.
Calling everything above preterminals "nonterminals" wouldn't be quite right, as preterminals are nonterminals, too. The wiki uses "internal nodes", so maybe internals()?
Whatever it's called, the desired change in functionality would be something like:
Derivation.root() -- return the root node if there is one, otherwise None
UDFNode.internals() (or something) -- return all non-root nodes above the preterminals
As for the iteration order, depth-first makes sense as it's the order encountered in the UDF string.
The text was updated successfully, but these errors were encountered:
The
UDFNode.terminals()
andUDFNode.preterminals()
methods recursively descend through the tree and return lists of nodes, but for all other nodes the user must do this descent themselves. In addition to iterating over nonterminals (or non-preterminals), a way to get the root node (if it exists) could be handy. Currently one must test ifnode.is_root()
is True.Calling everything above preterminals "nonterminals" wouldn't be quite right, as preterminals are nonterminals, too. The wiki uses "internal nodes", so maybe
internals()
?Whatever it's called, the desired change in functionality would be something like:
Derivation.root()
-- return the root node if there is one, otherwiseNone
UDFNode.internals()
(or something) -- return all non-root nodes above the preterminalsAs for the iteration order, depth-first makes sense as it's the order encountered in the UDF string.
The text was updated successfully, but these errors were encountered: