Struct ParseState

Source
pub struct ParseState<T, TokErr, Idx, P: Parser<T>> {
    parser: P,
    end_of_input: Idx,
    state: State,
    stack: Stack<T, Idx, P>,
    queue: ExpressionQueue<T, Idx, P>,
    errors: Vec<ParseError<P::Error, TokErr, Idx>>,
}

Fields§

§parser: P§end_of_input: Idx§state: State§stack: Stack<T, Idx, P>§queue: ExpressionQueue<T, Idx, P>§errors: Vec<ParseError<P::Error, TokErr, Idx>>

Implementations§

Source§

impl<T, TokErr, Idx: Default + Clone, P: Parser<T>> ParseState<T, TokErr, Idx, P>

Source

pub fn new(parser: P) -> Self

Source

pub fn parse_result(&mut self, result: Result<Token<T, Idx>, TokErr>)

Source

pub fn parse_token(&mut self, token: Token<T, Idx>)

Source

pub fn has_parsed_expression(&mut self) -> bool

Returns whether the parser has parsed a complete expression.

Source

pub fn has_error(&mut self) -> bool

Returns whether the parser has encountered at least one error

Source

pub fn finish( self, ) -> Result<ExpressionQueue<T, Idx, P>, ParseErrors<P::Error, TokErr, Idx>>

Source

fn parse_term( &mut self, span: Span<Idx>, prefix: Prefix<<P as Parser<T>>::Precedence, <P as Parser<T>>::Delimiter, <P as Parser<T>>::UnaryOperator, <P as Parser<T>>::Term>, ) -> bool

Source

fn parse_operator( &mut self, span: Span<Idx>, postfix: Postfix<<P as Parser<T>>::Precedence, <P as Parser<T>>::Delimiter, <P as Parser<T>>::BinaryOperator, <P as Parser<T>>::UnaryOperator>, ) -> bool

Source

fn process_right_delimiter(&mut self, span: Span<Idx>, right: P::Delimiter)

Source

fn check_delimiter_match( &mut self, left: P::Delimiter, left_span: Span<Idx>, right: P::Delimiter, right_span: Span<Idx>, )

Source

fn process_binary_operator( &mut self, span: Span<Idx>, fixity: Fixity<P::Precedence>, binary: P::BinaryOperator, unary: Option<P::UnaryOperator>, )

Source

fn process_postfix_operator( &mut self, span: Span<Idx>, precedence: P::Precedence, operator: P::UnaryOperator, )

Source

fn pop_while_lower_precedence(&mut self, fixity: &Fixity<P::Precedence>)

Trait Implementations§

Source§

impl<T, TokErr, Idx: Default + Clone, P: Parser<T>> Extend<Result<Token<T, Idx>, TokErr>> for ParseState<T, TokErr, Idx, P>

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Result<Token<T, Idx>, TokErr>>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, TokErr, Idx: Default + Clone, P: Parser<T>> Extend<Token<T, Idx>> for ParseState<T, TokErr, Idx, P>

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Token<T, Idx>>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more

Auto Trait Implementations§

§

impl<T, TokErr, Idx, P> Freeze for ParseState<T, TokErr, Idx, P>
where P: Freeze, Idx: Freeze,

§

impl<T, TokErr, Idx, P> RefUnwindSafe for ParseState<T, TokErr, Idx, P>

§

impl<T, TokErr, Idx, P> Send for ParseState<T, TokErr, Idx, P>
where P: Send, Idx: Send, <P as Parser<T>>::BinaryOperator: Send, <P as Parser<T>>::UnaryOperator: Send, <P as Parser<T>>::Term: Send, <P as Parser<T>>::Error: Send, TokErr: Send, <P as Parser<T>>::Precedence: Send, <P as Parser<T>>::Delimiter: Send,

§

impl<T, TokErr, Idx, P> Sync for ParseState<T, TokErr, Idx, P>
where P: Sync, Idx: Sync, <P as Parser<T>>::BinaryOperator: Sync, <P as Parser<T>>::UnaryOperator: Sync, <P as Parser<T>>::Term: Sync, <P as Parser<T>>::Error: Sync, TokErr: Sync, <P as Parser<T>>::Precedence: Sync, <P as Parser<T>>::Delimiter: Sync,

§

impl<T, TokErr, Idx, P> Unpin for ParseState<T, TokErr, Idx, P>
where P: Unpin, Idx: Unpin, <P as Parser<T>>::BinaryOperator: Unpin, <P as Parser<T>>::UnaryOperator: Unpin, <P as Parser<T>>::Term: Unpin, <P as Parser<T>>::Error: Unpin, TokErr: Unpin, <P as Parser<T>>::Precedence: Unpin, <P as Parser<T>>::Delimiter: Unpin,

§

impl<T, TokErr, Idx, P> UnwindSafe for ParseState<T, TokErr, Idx, P>
where P: UnwindSafe, Idx: UnwindSafe, <P as Parser<T>>::BinaryOperator: UnwindSafe, <P as Parser<T>>::UnaryOperator: UnwindSafe, <P as Parser<T>>::Term: UnwindSafe, <P as Parser<T>>::Error: UnwindSafe, TokErr: UnwindSafe, <P as Parser<T>>::Precedence: UnwindSafe, <P as Parser<T>>::Delimiter: 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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.