knot

Source   Edit  

Macros

macro choice(T: type; name: untyped): untyped
Gathers the nodes tied to T under name as a symbol choice. Source   Edit  
macro pick(T: type; name: untyped): untyped
Picks a single node tied to T under name. Source   Edit  
macro tie(T: type; name: untyped; value: typed)
Tie value to T under the name name. Source   Edit  
macro tie(T: type; value: untyped)

Tie value to T.

If value is an identifier or symbol or symbol choice, it is tied under its own name.

If value is a routine, type, constant or variable declaration, the declared symbol is tied under its name.

If value is a statement list, it applies the above rules to each statement.

Source   Edit  
macro tieCount(T: type; name: untyped): untyped
Gives the number of nodes tied to T under name. Source   Edit  
macro unravel(T: type; name, node: untyped): untyped

Gathers the nodes tied to T under name into a node pattern specified by node.

If node is a collection literal, each node is appended to the collection.

If node is a call, each node is appended to the call as an argument.

If node is an anonymous routine, it is called with each node as the only argument. If the anonymous routine is a do, a template is generated instead of a proc.

Otherwise, node is directly called with each node as an argument.

Source   Edit  
macro unravelCase(T: type; name, value, node: untyped): untyped

Creates a case statement for value and an of branch for each node tied to T under name into a node pattern specified by node.

If node is a call, the node is added to it as an argument and called in each branch.

If node is an anonymous routine, it is called with each node as the only argument. If the anonymous routine is a do, a template is generated instead of a proc.

Otherwise, node is directly called with each node as an argument.

Source   Edit