pest::pratt_parser

Struct PrattParserMap

Source
pub struct PrattParserMap<'pratt, 'a, 'i, R, F, T>
where R: RuleType, F: FnMut(Pair<'i, R>) -> T,
{ /* private fields */ }
Expand description

Product of calling map_primary on PrattParser, defines how expressions should be mapped.

Implementations§

Source§

impl<'pratt, 'a, 'i, R, F, T> PrattParserMap<'pratt, 'a, 'i, R, F, T>
where R: RuleType + 'pratt, F: FnMut(Pair<'i, R>) -> T,

Source

pub fn map_prefix<X>(self, prefix: X) -> Self
where X: FnMut(Pair<'i, R>, T) -> T + 'a,

Maps prefix operators with closure prefix.

Source

pub fn map_postfix<X>(self, postfix: X) -> Self
where X: FnMut(T, Pair<'i, R>) -> T + 'a,

Maps postfix operators with closure postfix.

Source

pub fn map_infix<X>(self, infix: X) -> Self
where X: FnMut(T, Pair<'i, R>, T) -> T + 'a,

Maps infix operators with a closure infix.

Source

pub fn parse<P: Iterator<Item = Pair<'i, R>>>(&mut self, pairs: P) -> T

The last method to call on the provided pairs to execute the Pratt parser (previously defined using map_primary, map_prefix, map_postfix, and map_infix methods).

Auto Trait Implementations§

§

impl<'pratt, 'a, 'i, R, F, T> Freeze for PrattParserMap<'pratt, 'a, 'i, R, F, T>
where F: Freeze,

§

impl<'pratt, 'a, 'i, R, F, T> !RefUnwindSafe for PrattParserMap<'pratt, 'a, 'i, R, F, T>

§

impl<'pratt, 'a, 'i, R, F, T> !Send for PrattParserMap<'pratt, 'a, 'i, R, F, T>

§

impl<'pratt, 'a, 'i, R, F, T> !Sync for PrattParserMap<'pratt, 'a, 'i, R, F, T>

§

impl<'pratt, 'a, 'i, R, F, T> Unpin for PrattParserMap<'pratt, 'a, 'i, R, F, T>
where F: Unpin, T: Unpin,

§

impl<'pratt, 'a, 'i, R, F, T> !UnwindSafe for PrattParserMap<'pratt, 'a, 'i, R, F, T>

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.