Crate wdl_macros
source ·Expand description
Macros used with the wdl
crate ecosystem.
Modules
- Macros used in testing.
Macros
- Checks to ensure that a node is of a certain rule type. If the node does not match the specified
$type_
, apanic!
occurs. - 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. - 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. - Gathers all
Pair
s 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. - 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.