org.bitbucket.inkytonik.kiama.attribution
A pair of attributes that thread through a tree in a depth-first left-to-right fashion.
A decorator that progagates an attribute value down the tree.
A decorator that progagates an attribute value down the tree. The
partial function a
should define the value of the attribute at
the root. The value defined at the root will also be made available
at all other nodes.
Create a new attribute chain.
Create a new attribute chain. The update
functions provide ways to
influence the chain value, by taking the default computation of the
in
or out
attribute and returning a partial function. If the domain
of the partial function contains a node, then that function is used
to compute the chain value at the node n, otherwise the default chain
attribute is used. If an update function is omitted, it defaults
to the identity.
If the root of the tree is reached without a definition being supplied for the chain, a runtime exception is thrown. Both of the components of the chain are reset to avoid errors for cyclic if the exception is caught and they are subsequently evaluated again.
Variant of down
that takes a default value instead of a default function.
A decorator that propagates an attribute value down the tree.
A decorator that propagates an attribute value down the tree. The
partial function a
should define the value of the attribute at
nodes where it is known. If a
does not define a value for the
attribute at a particular node, then the decorator asks the parent
of the node for its value of the attribute and uses that value.
If no node on the path to the root defines a value for the attribute,
then default applied to the root is returned.
Variant of down
that throws an error if a
is not defined on the
path to the root of the tree.
Variant of down
that returns None
if a
is not defined on the
path to the root of the tree, otherwise it wraps the value that a
returns in Some
.
Decorators are higher-order operations that provide common patterns of tree attribution based on simple attributes or functions. A
Tree
must be supplied to give the decorators access to the tree structure.