A NameTree representing fallback; it is evaluated by picking the first nonnegative (evaluated) subtree.
A NameTree representing a weighted union of trees.
A NameTree representing a weighted union of trees. It is evaluated by returning the union of its (recursively evaluated) children, leaving corresponding weights unchanged. When all children are negative, the Union itself evaluates negative.
NameTree gives no semantics to weights (they are interpreted higher in the stack) except to simplify away single-child Unions regardless of weight.
An empty NameTree.
A failing NameTree.
A negative NameTree.
Rewrite the paths in a tree for values defined by the given partial function.
Parse a NameTree from a string with concrete syntax
Parse a NameTree from a string with concrete syntax
tree ::= name weight '*' tree tree '&' tree tree '|' tree '(' tree ')' name ::= path | '!' | '~' | '$' weight ::= [0-9]*\.?[0-9]+
For example:
/foo & /bar | /baz | $
parses in to the NameTree
Alt(Union(Leaf(Path(foo)),Leaf(Path(bar))),Leaf(Path(baz)),Empty)
The production path
is documented at Path.read.
IllegalArgumentException
when the string does not
represent a valid name tree.
A string parseable by NameTree.read.
A string parseable by NameTree.read.
Simplify the given NameTree, yielding a new NameTree which is evaluation-equivalent.
The NameTree object comprises NameTree types as well as binding and evaluation routines.