Crate wdl_macros

Source
Expand description

Macros used with the wdl crate ecosystem.

Modules§

test
Macros used in testing.

Macros§

check_node
Checks to ensure that a node is of a certain rule type. If the node does not match the specified $type_, a panic! occurs.
dive_one
Dives into a Pair to find exactly one node matching the provided $type_. Notably, this method does a depth-first search of the entire parse tree underneath the provided node—not just the immediate level below.
extract_one
Extracts exactly one node of a particular type from a Pair. This macro is intended for situations where a node contains one and only one child node of a particular type and you’d like to extract that node. For the immediate children of the node being examined, if either zero nodes match the desired node type or multiple nodes match the desired node type, then a panic occurs, as this indicates something is incorrect in the grammar parsing code.
gather
Gathers all Pairs within $node that match the provided $type_. Notably, this method does a depth-first search of the entire parse tree underneath the provided node—not just the immediate level below.
unwrap_one
Unwraps exactly one node from a Pair, regardless of node type. This macro is intended for situations where a node contains one and only one child node and you’d like to unwrap to the inner node. If either zero nodes or more than one nodes are found, then a panic occurs, as this indicates something is incorrect in the grammar parsing code.