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§
- choices
- Definition of choices-related macros and types.
- error
- Types for different kinds of parsing failures.
- iterators
- Simulates
pest::iterators. - line_
indexer - A trait and a type for splitting a string into lines.
- predefined_
node - Predefined tree nodes generics. The generator may use this for convenience. Normally you don’t need to reference this module by yourself.
- re_
exported - Re-export items from
std(if featurestdenabled), orcoreandalloc(if disabled). - rule
- Macros and functions for defining structs, most of which are RuleStruct.
- sequence
- Definition of sequence-related macros and types.
- tracker
- Tracker for parsing failures.
Macros§
- atomic_
rule - Shortcut for atomic rule in pest.
- choices
- Generate choices with given type name and variant names.
- choices_
helper - Generate choice helpers that can be used to traverse those branches.
Automatically called by
crate::choices!. - compound_
atomic_ rule - Shortcut for compound atomic rule in pest.
- declare_
rule_ struct - Declare the body of the struct.
- impl_
deref - Implement
core::ops::Dereffor structs if they have content. - impl_
deref_ with_ content - Implement
core::ops::Dereffor structs with content. - impl_
pair - Implement
Pairfor a struct. - impl_
pair_ with_ content - Implement
Pairfor a struct with innerPairs. - impl_
pair_ with_ empty - Implement
Pairfor a struct without innerPairs. - impl_
pairs - Implement
Pairsfor a struct. - impl_
pairs_ with_ inner - Implement
Pairsfor a struct that containsPairs. - impl_
pairs_ with_ self - Implement
Pairsfor a struct that is aPair. - impl_
parse - Implement ParsableTypedNode::try_parse for structs.
- impl_
rule_ struct - Implement
Pairfor a struct. - impl_
rule_ wrapper - Implement RuleWrapper for the struct.
- impl_
try_ parse_ with - Implement TypedNode::try_parse_with for structs.
- non_
atomic_ rule - Shortcut for non-atomic rule in pest.
- normal_
rule - Shortcut for normal rule in pest.
- rule
- Start point of a rule.
- rule_
eoi - Start point of a end-of-input rule.
- rule_
inner - Get inner type.
- seq
- Generate sequences generics.
- silent_
rule - Shortcut for silent rule in pest.
Structs§
- Box
- A pointer type that uniquely owns a heap allocation of type
T. - Position
- A cursor position in a
&strwhich provides useful methods to manually parse that string. - Span
- A span over a
&str. It is created from either twoPositions or from aPair. - Stack
- Implementation of a
Stackwhich maintains popped elements and length of previous states in order to rewind the stack to a previous state.
Traits§
- AsInput
- Convert to input.
- Bound
Wrapper - Bound for the length of vector.
- Constant
Storage - An object containing a constant.
- Input
- Input with span information.
- Never
Failed Typed Node - Node of concrete syntax tree that never fails.
- Parsable
Typed Node - Node of concrete syntax tree.
- Rule
Struct - A trait for those struct that correspond to rules with inner expression.
- Rule
Type - A trait that is implemented for all pest rules. An extension of
pest::RuleType. - Rule
Wrapper - Rule wrapper.
- Spanned
- A trait for those struct that correspond to non-silent rules.
- Storage
- An object containing a constant.
- String
Array Wrapper - A wrapper for string array as a generics argument.
- String
Wrapper - A wrapper for string as a generics argument.
- Type
Wrapper - Type wrapper.
- Typed
Node - Node of concrete syntax tree.
- Typed
Parser - A trait with a single method that parses strings into typed concrete syntax tree.
Functions§
- merge_
spans - Merges two spans into one.