src/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 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.

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

Source   Edit