Crate pest_typed

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:

  • std: include std support.

    Without this feature, we’ll use core and alloc.

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:

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 feature std enabled), or core and alloc (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::Deref for structs if they have content.
impl_deref_with_content
Implement core::ops::Deref for structs with content.
impl_pair
Implement Pair for a struct.
impl_pair_with_content
Implement Pair for a struct with inner Pairs.
impl_pair_with_empty
Implement Pair for a struct without inner Pairs.
impl_pairs
Implement Pairs for a struct.
impl_pairs_with_inner
Implement Pairs for a struct that contains Pairs.
impl_pairs_with_self
Implement Pairs for a struct that is a Pair.
impl_parse
Implement ParsableTypedNode::try_parse for structs.
impl_rule_struct
Implement Pair for 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 &str which provides useful methods to manually parse that string.
Span
A span over a &str. It is created from either two Positions or from a Pair.
Stack
Implementation of a Stack which maintains popped elements and length of previous states in order to rewind the stack to a previous state.

Traits§

AsInput
Convert to input.
BoundWrapper
Bound for the length of vector.
ConstantStorage
An object containing a constant.
Input
Input with span information.
NeverFailedTypedNode
Node of concrete syntax tree that never fails.
ParsableTypedNode
Node of concrete syntax tree.
RuleStruct
A trait for those struct that correspond to rules with inner expression.
RuleType
A trait that is implemented for all pest rules. An extension of pest::RuleType.
RuleWrapper
Rule wrapper.
Spanned
A trait for those struct that correspond to non-silent rules.
Storage
An object containing a constant.
StringArrayWrapper
A wrapper for string array as a generics argument.
StringWrapper
A wrapper for string as a generics argument.
TypeWrapper
Type wrapper.
TypedNode
Node of concrete syntax tree.
TypedParser
A trait with a single method that parses strings into typed concrete syntax tree.

Functions§

merge_spans
Merges two spans into one.