pub struct Pratt<Atom, Ops> { /* private fields */ }
Available on crate feature
pratt
only.Expand description
See Parser::pratt
.
Trait Implementations§
impl<Atom: Copy, Ops: Copy> Copy for Pratt<Atom, Ops>
Auto Trait Implementations§
impl<Atom, Ops> RefUnwindSafe for Pratt<Atom, Ops>where
Atom: RefUnwindSafe,
Ops: RefUnwindSafe,
impl<Atom, Ops> Send for Pratt<Atom, Ops>
impl<Atom, Ops> Sync for Pratt<Atom, Ops>
impl<Atom, Ops> Unpin for Pratt<Atom, Ops>
impl<Atom, Ops> UnwindSafe for Pratt<Atom, Ops>where
Atom: UnwindSafe,
Ops: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<'a, I, O, E, P> Parser<'a, I, O, E> for P
impl<'a, I, O, E, P> Parser<'a, I, O, E> for P
source§fn parse(&self, input: I) -> ParseResult<O, E::Error>
fn parse(&self, input: I) -> ParseResult<O, E::Error>
Parse a stream of tokens, yielding an output if possible, and any errors encountered along the way. Read more
source§fn parse_with_state(
&self,
input: I,
state: &mut E::State
) -> ParseResult<O, E::Error>
fn parse_with_state( &self, input: I, state: &mut E::State ) -> ParseResult<O, E::Error>
source§fn check(&self, input: I) -> ParseResult<(), E::Error>
fn check(&self, input: I) -> ParseResult<(), E::Error>
Parse a stream of tokens, ignoring any output, and returning any errors encountered along the way. Read more
source§fn check_with_state(
&self,
input: I,
state: &mut E::State
) -> ParseResult<(), E::Error>
fn check_with_state( &self, input: I, state: &mut E::State ) -> ParseResult<(), E::Error>
Parse a stream of tokens, ignoring any output, and returning any errors encountered along the way. Read more
source§fn to_slice(self) -> ToSlice<Self, O>where
Self: Sized,
fn to_slice(self) -> ToSlice<Self, O>where
Self: Sized,
Convert the output of this parser into a slice of the input, based on the current parser’s
span.
source§fn filter<F: Fn(&O) -> bool>(self, f: F) -> Filter<Self, F>where
Self: Sized,
fn filter<F: Fn(&O) -> bool>(self, f: F) -> Filter<Self, F>where
Self: Sized,
Filter the output of this parser, accepting only inputs that match the given predicate. Read more
source§fn map<U, F: Fn(O) -> U>(self, f: F) -> Map<Self, O, F>where
Self: Sized,
fn map<U, F: Fn(O) -> U>(self, f: F) -> Map<Self, O, F>where
Self: Sized,
Map the output of this parser to another value. Read more
source§fn map_with<U, F: Fn(O, &mut MapExtra<'a, '_, I, E>) -> U>(
self,
f: F
) -> MapWith<Self, O, F>where
Self: Sized,
fn map_with<U, F: Fn(O, &mut MapExtra<'a, '_, I, E>) -> U>(
self,
f: F
) -> MapWith<Self, O, F>where
Self: Sized,
Map the output of this parser to another value, with the opportunity to get extra metadata. Read more
source§fn map_group<F: Fn<O>>(self, f: F) -> MapGroup<Self, O, F>
fn map_group<F: Fn<O>>(self, f: F) -> MapGroup<Self, O, F>
Available on crate feature
nightly
only.Map the output of this parser to another value.
If the output of this parser isn’t a tuple, use
Parser::map
. Read moresource§fn to_span(self) -> ToSpan<Self, O>where
Self: Sized,
fn to_span(self) -> ToSpan<Self, O>where
Self: Sized,
Transform the output of this parser to the pattern’s span. Read more
source§fn try_map<U, F: Fn(O, I::Span) -> Result<U, E::Error>>(
self,
f: F
) -> TryMap<Self, O, F>where
Self: Sized,
fn try_map<U, F: Fn(O, I::Span) -> Result<U, E::Error>>(
self,
f: F
) -> TryMap<Self, O, F>where
Self: Sized,
After a successful parse, apply a fallible function to the output. If the function produces an error, treat it
as a parsing error. Read more
source§fn try_map_with<U, F: Fn(O, &mut MapExtra<'a, '_, I, E>) -> Result<U, E::Error>>(
self,
f: F
) -> TryMapWith<Self, O, F>where
Self: Sized,
fn try_map_with<U, F: Fn(O, &mut MapExtra<'a, '_, I, E>) -> Result<U, E::Error>>(
self,
f: F
) -> TryMapWith<Self, O, F>where
Self: Sized,
After a successful parse, apply a fallible function to the output, with the opportunity to get extra metadata.
If the function produces an error, treat it as a parsing error. Read more
source§fn ignored(self) -> Ignored<Self, O>where
Self: Sized,
fn ignored(self) -> Ignored<Self, O>where
Self: Sized,
Ignore the output of this parser, yielding
()
as an output instead. Read moresource§fn memoized(self) -> Memoized<Self>where
Self: Sized,
fn memoized(self) -> Memoized<Self>where
Self: Sized,
Available on crate feature
memoization
only.Memoize the parser such that later attempts to parse the same input ‘remember’ the attempt and exit early. Read more
source§fn to<U: Clone>(self, to: U) -> To<Self, O, U>where
Self: Sized,
fn to<U: Clone>(self, to: U) -> To<Self, O, U>where
Self: Sized,
Transform all outputs of this parser to a predetermined value. Read more
source§fn labelled<L>(self, label: L) -> Labelled<Self, L>
fn labelled<L>(self, label: L) -> Labelled<Self, L>
Available on crate feature
label
only.Label this parser with the given label. Read more
source§fn then<U, B: Parser<'a, I, U, E>>(self, other: B) -> Then<Self, B, O, U, E>where
Self: Sized,
fn then<U, B: Parser<'a, I, U, E>>(self, other: B) -> Then<Self, B, O, U, E>where
Self: Sized,
Parse one thing and then another thing, yielding a tuple of the two outputs. Read more
source§fn ignore_then<U, B: Parser<'a, I, U, E>>(
self,
other: B
) -> IgnoreThen<Self, B, O, E>where
Self: Sized,
fn ignore_then<U, B: Parser<'a, I, U, E>>(
self,
other: B
) -> IgnoreThen<Self, B, O, E>where
Self: Sized,
Parse one thing and then another thing, yielding only the output of the latter. Read more
source§fn then_ignore<U, B: Parser<'a, I, U, E>>(
self,
other: B
) -> ThenIgnore<Self, B, U, E>where
Self: Sized,
fn then_ignore<U, B: Parser<'a, I, U, E>>(
self,
other: B
) -> ThenIgnore<Self, B, U, E>where
Self: Sized,
Parse one thing and then another thing, yielding only the output of the former. Read more
source§fn nested_in<B: Parser<'a, I, I, E>>(self, other: B) -> NestedIn<Self, B, O, E>where
Self: Sized,
I: 'a,
fn nested_in<B: Parser<'a, I, I, E>>(self, other: B) -> NestedIn<Self, B, O, E>where
Self: Sized,
I: 'a,
Parse input as part of a token-tree - using an input generated from within the current
input. In other words, this parser will attempt to create a new input stream from within
the one it is being run on, and the parser it was called on will be provided this new input.
By default, the original parser is expected to consume up to the end of the new stream. To
allow only consuming part of the stream, use
Parser::lazy
to ignore trailing tokens. Read moresource§fn ignore_with_ctx<U, P>(
self,
then: P
) -> IgnoreWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
fn ignore_with_ctx<U, P>( self, then: P ) -> IgnoreWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
Parse one thing and then another thing, creating the second parser from the result of
the first. If you don’t need the context in the output, use
Parser::then_with_ctx
. Read moresource§fn then_with_ctx<U, P>(
self,
then: P
) -> ThenWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
fn then_with_ctx<U, P>( self, then: P ) -> ThenWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
Parse one thing and then another thing, creating the second parser from the result of
the first. If you don’t need the context in the output, prefer
Parser::ignore_with_ctx
. Read moresource§fn with_ctx<Ctx>(self, ctx: Ctx) -> WithCtx<Self, Ctx>
fn with_ctx<Ctx>(self, ctx: Ctx) -> WithCtx<Self, Ctx>
Run the previous contextual parser with the provided context Read more
source§fn with_state<State>(self, state: State) -> WithState<Self, State>
fn with_state<State>(self, state: State) -> WithState<Self, State>
TODO
source§fn and_is<U, B>(self, other: B) -> AndIs<Self, B, U>
fn and_is<U, B>(self, other: B) -> AndIs<Self, B, U>
Applies both parsers to the same position in the input, succeeding
only if both succeed. The returned value will be that of the first parser,
and the input will be at the end of the first parser if
and_is
succeeds. Read moresource§fn delimited_by<U, V, B, C>(
self,
start: B,
end: C
) -> DelimitedBy<Self, B, C, U, V>
fn delimited_by<U, V, B, C>( self, start: B, end: C ) -> DelimitedBy<Self, B, C, U, V>
Parse the pattern surrounded by the given delimiters. Read more
source§fn padded_by<U, B>(self, padding: B) -> PaddedBy<Self, B, U>
fn padded_by<U, B>(self, padding: B) -> PaddedBy<Self, B, U>
Parse a pattern, but with an instance of another pattern on either end, yielding the output of the inner. Read more
source§fn or<B>(self, other: B) -> Or<Self, B>
fn or<B>(self, other: B) -> Or<Self, B>
Parse one thing or, on failure, another thing. Read more
source§fn or_not(self) -> OrNot<Self>where
Self: Sized,
fn or_not(self) -> OrNot<Self>where
Self: Sized,
Attempt to parse something, but only if it exists. Read more
source§fn not(self) -> Not<Self, O>where
Self: Sized,
fn not(self) -> Not<Self, O>where
Self: Sized,
Invert the result of the contained parser, failing if it succeeds and succeeding if it fails.
The output of this parser is always
()
, the unit type. Read moresource§fn repeated(self) -> Repeated<Self, O, I, E>where
Self: Sized,
fn repeated(self) -> Repeated<Self, O, I, E>where
Self: Sized,
Parse a pattern zero or more times (analog to Regex’s
<PAT>*
). Read moresource§fn separated_by<U, B>(self, separator: B) -> SeparatedBy<Self, B, O, U, I, E>
fn separated_by<U, B>(self, separator: B) -> SeparatedBy<Self, B, O, U, I, E>
Parse a pattern, separated by another, any number of times. Read more
source§fn foldl<B, F, OB>(self, other: B, f: F) -> Foldl<F, Self, B, OB, E>
fn foldl<B, F, OB>(self, other: B, f: F) -> Foldl<F, Self, B, OB, E>
Left-fold the output of the parser into a single value. Read more
source§fn foldl_with<B, F, OB>(self, other: B, f: F) -> FoldlWith<F, Self, B, OB, E>
fn foldl_with<B, F, OB>(self, other: B, f: F) -> FoldlWith<F, Self, B, OB, E>
Left-fold the output of the parser into a single value, making use of the parser’s state when doing so. Read more
source§fn rewind(self) -> Rewind<Self>where
Self: Sized,
fn rewind(self) -> Rewind<Self>where
Self: Sized,
Parse a pattern. Afterwards, the input stream will be rewound to its original state, as if parsing had not
occurred. Read more
source§fn lazy(self) -> Lazy<'a, Self, I, E>where
Self: Sized,
I: ValueInput<'a>,
fn lazy(self) -> Lazy<'a, Self, I, E>where
Self: Sized,
I: ValueInput<'a>,
Make the parser lazy, such that it parses as much as it validly can and then finished successfully, leaving
trailing input untouched. Read more
source§fn padded(self) -> Padded<Self>
fn padded(self) -> Padded<Self>
Parse a pattern, ignoring any amount of whitespace both before and after the pattern. Read more
source§fn recover_with<S: Strategy<'a, I, O, E>>(
self,
strategy: S
) -> RecoverWith<Self, S>where
Self: Sized,
fn recover_with<S: Strategy<'a, I, O, E>>(
self,
strategy: S
) -> RecoverWith<Self, S>where
Self: Sized,
Apply a fallback recovery strategy to this parser should it fail. Read more
source§fn map_err<F>(self, f: F) -> MapErr<Self, F>
fn map_err<F>(self, f: F) -> MapErr<Self, F>
Map the primary error of this parser to another value. Read more
source§fn map_err_with_state<F>(self, f: F) -> MapErrWithState<Self, F>
fn map_err_with_state<F>(self, f: F) -> MapErrWithState<Self, F>
Map the primary error of this parser to another value, making use of the parser state. Read more
source§fn validate<U, F>(self, f: F) -> Validate<Self, O, F>
fn validate<U, F>(self, f: F) -> Validate<Self, O, F>
Validate an output, producing non-terminal errors if it does not fulfill certain criteria.
The errors will not immediately halt parsing on this path, but instead it will continue,
potentially emitting one or more other errors, only failing after the pattern has otherwise
successfully, or emitted another terminal error. Read more