Struct chumsky::pratt::Pratt

source ·
pub struct Pratt<Atom, Ops> { /* private fields */ }
Available on crate feature pratt only.
Expand description

Trait Implementations§

source§

impl<Atom: Clone, Ops: Clone> Clone for Pratt<Atom, Ops>

source§

fn clone(&self) -> Pratt<Atom, Ops>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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>
where Atom: Send, Ops: Send,

§

impl<Atom, Ops> Sync for Pratt<Atom, Ops>
where Atom: Sync, Ops: Sync,

§

impl<Atom, Ops> Unpin for Pratt<Atom, Ops>
where Atom: Unpin, Ops: Unpin,

§

impl<Atom, Ops> UnwindSafe for Pratt<Atom, Ops>
where Atom: UnwindSafe, Ops: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<'a, I, O, E, P> Parser<'a, I, O, E> for P
where I: Input<'a>, E: ParserExtra<'a, I>, P: ParserSealed<'a, I, O, E> + ?Sized,

source§

fn parse(&self, input: I) -> ParseResult<O, E::Error>
where I: Input<'a>, E::State: Default, E::Context: Default,

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>
where I: Input<'a>, E::Context: Default,

Parse a stream of tokens, yielding an output if possible, and any errors encountered along the way. The provided state will be passed on to parsers that expect it, such as map_with. Read more
source§

fn check(&self, input: I) -> ParseResult<(), E::Error>
where Self: Sized, I: Input<'a>, E::State: Default, E::Context: Default,

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>
where Self: Sized, I: Input<'a>, E::Context: Default,

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,

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,

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,

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,

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>
where Self: Sized, O: Tuple,

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 more
source§

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,

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,

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,

Ignore the output of this parser, yielding () as an output instead. Read more
source§

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,

Transform all outputs of this parser to a predetermined value. Read more
source§

fn labelled<L>(self, label: L) -> Labelled<Self, L>
where Self: Sized, E::Error: LabelError<'a, I, 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,

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,

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,

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,

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 more
source§

fn ignore_with_ctx<U, P>( self, then: P ) -> IgnoreWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
where Self: Sized, O: 'a, P: Parser<'a, I, U, 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 more
source§

fn then_with_ctx<U, P>( self, then: P ) -> ThenWithCtx<Self, P, O, I, Full<E::Error, E::State, O>>
where Self: Sized, O: 'a, P: Parser<'a, I, U, 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 more
source§

fn with_ctx<Ctx>(self, ctx: Ctx) -> WithCtx<Self, Ctx>
where Self: Sized, Ctx: 'a + Clone,

Run the previous contextual parser with the provided context Read more
source§

fn with_state<State>(self, state: State) -> WithState<Self, State>
where Self: Sized, State: 'a + Clone,

TODO
source§

fn and_is<U, B>(self, other: B) -> AndIs<Self, B, U>
where Self: Sized, B: Parser<'a, I, U, E>,

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 more
source§

fn delimited_by<U, V, B, C>( self, start: B, end: C ) -> DelimitedBy<Self, B, C, U, V>
where Self: Sized, B: Parser<'a, I, U, E>, C: Parser<'a, I, V, E>,

Parse the pattern surrounded by the given delimiters. Read more
source§

fn padded_by<U, B>(self, padding: B) -> PaddedBy<Self, B, U>
where Self: Sized, B: Parser<'a, I, U, E>,

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>
where Self: Sized, B: Parser<'a, I, O, E>,

Parse one thing or, on failure, another thing. Read more
source§

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,

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 more
source§

fn repeated(self) -> Repeated<Self, O, I, E>
where Self: Sized,

Parse a pattern zero or more times (analog to Regex’s <PAT>*). Read more
source§

fn separated_by<U, B>(self, separator: B) -> SeparatedBy<Self, B, O, U, I, E>
where Self: Sized, B: Parser<'a, I, U, 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>
where F: Fn(O, OB) -> O, B: IterParser<'a, I, OB, E>, Self: Sized,

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>
where F: Fn(O, OB, &mut MapExtra<'a, '_, I, E>) -> O, B: IterParser<'a, I, OB, E>, Self: Sized,

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,

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>,

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>
where Self: Sized, I: Input<'a>, I::Token: Char,

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,

Apply a fallback recovery strategy to this parser should it fail. Read more
source§

fn map_err<F>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: Fn(E::Error) -> E::Error,

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>
where Self: Sized, F: Fn(E::Error, I::Span, &mut E::State) -> E::Error,

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>
where Self: Sized, F: Fn(O, &mut MapExtra<'a, '_, I, E>, &mut Emitter<E::Error>) -> U,

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
source§

fn from_str<U>(self) -> Map<Self, O, fn(_: O) -> Result<U, U::Err>>
where Self: Sized, U: FromStr, O: AsRef<str>,

Attempt to convert the output of this parser into something else using Rust’s FromStr trait. Read more
source§

fn unwrapped(self) -> Unwrapped<Self, O>
where Self: Sized,

For parsers that produce a Result as their output, unwrap the result (panicking if an Err is encountered). Read more
source§

fn into_iter(self) -> IntoIter<Self, O>
where Self: Sized, O: IntoIterator,

Turn this Parser into an IterParser if its output type implements IntoIterator. Read more
source§

fn boxed<'b>(self) -> Boxed<'a, 'b, I, O, E>
where Self: MaybeSync + Sized + 'a + 'b,

Box the parser, yielding a parser that performs parsing through dynamic dispatch. Read more
source§

fn pratt<Ops>(self, ops: Ops) -> Pratt<Self, Ops>
where Self: Sized,

Available on crate feature pratt only.
Use Pratt parsing to ergonomically parse this pattern separated by prefix, postfix, and infix operators of various associativites and precedence. Read more
source§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> MaybeSync for T
where T: Send + Sync,

source§

impl<'p, T> OrderedSeq<'p, T> for T
where T: Clone,