Crate pegmd

source ·

Modules

Macros

  • Creates a struct to represent a container node, along with some trait implementations. Always requires an identifier for the name of the generated struct, and optionally accepts one more more tuples of (identifier, type) to add additional fields to the struct.
  • Sometimes, we need to extract the singleton child from a [pest::iterator::Pair] and fail if it’s missing. This is normally to make the rule processing less verbose. For example, we can match on the link rule, then extract the specific link variant for processing, and since we know that there must be a link variant as the only child of the node, we can raise an error if it’s missing.
  • Creates a struct to represent a leaf node, along with some trait implementations. Always requires an identifier for the name of the generated struct, and optionally accepts one more more tuples of (identifier, type) to add additional fields to the struct.