Crate pest_typed
source ·Expand description
Types for statically typed nodes and parser.
Based on pest grammar. See https://pest.rs for more information.
Features:
It’s suggested that you use pest_typed_derive to automatically generate types from your grammar.
And though we have a lot of macros in this crate, only some of them are designed for usage outside the crate. They’re listed below:
- Choices: choices!.
- Sequence: seq!.
- Rules:
- Atomic rule: atomic_rule!.
- Non-atomic rule: non_atomic_rule!.
- Compound atomic rule: compound_atomic_rule!.
- Normal rule: normal_rule!.
- Silent rule: silent_rule!.
- End-Of-Input rule: rule_eoi!.
- Tag: [tag!].
Modules§
- Definition of choices-related macros and types.
- Types for different kinds of parsing failures.
- Simulates
pest::iterators
. - Predefined tree nodes generics. The generator may use this for convenience. Normally you don’t need to reference this module by yourself.
- Macros and functions for defining structs, most of which are RuleStruct.
- Definition of sequence-related macros and types.
- Tracker for parsing failures.
Macros§
- Shortcut for atomic rule in pest.
- Generate choices with given type name and variant names.
- Generate choice helpers that can be used to traverse those branches. Automatically called by
crate::choices!
. - Shortcut for compound atomic rule in pest.
- Declare the body of the struct.
- Implement
core::ops::Deref
for structs if they have content. - Implement
core::ops::Deref
for structs with content. - Implement
Pair
for a struct. - Implement
Pairs
for a struct. - Implement ParsableTypedNode::try_parse for structs.
- Implement
Pair
for a struct. - Implement RuleWrapper for the struct.
- Implement TypedNode::try_parse_with for structs.
- Shortcut for non-atomic rule in pest.
- Shortcut for normal rule in pest.
- Start point of a rule.
- Start point of a end-of-input rule.
- Get inner type.
- Generate sequences generics.
- Shortcut for silent rule in pest.
Structs§
- A pointer type that uniquely owns a heap allocation of type
T
. - A cursor position in a
&str
which provides useful methods to manually parse that string. - Implementation of a
Stack
which maintains popped elements and length of previous states in order to rewind the stack to a previous state.
Traits§
- Convert to input.
- Bound for the length of vector.
- An object containing a constant.
- Input.
- Node of concrete syntax tree that never fails.
- Node of concrete syntax tree.
- A trait for those struct that correspond to rules with inner expression.
- A trait which parser rules must implement.
- Rule wrapper.
- A trait for those struct that correspond to non-silent rules.
- An object containing a constant.
- A wrapper for string array as a generics argument.
- A wrapper for string as a generics argument.
- Type wrapper.
- Node of concrete syntax tree.
- A trait with a single method that parses strings into typed concrete syntax tree.
Functions§
- Merges two spans into one.