pub enum ParseError<E = Infallible> {
Syntax {
terminal: SymbolId,
},
Action(E),
}Expand description
Parse error: either a syntax error (unexpected terminal) or a user action error.
The default type parameter E = Infallible means ParseError alone represents
syntax-only errors (e.g. from the raw Parser API). Generated typed parsers
return ParseError<A::Error> which can also carry action errors.
The parser remains in a valid state after a syntax error, so you can call
parser.format_error() to get a detailed error message.
Variants§
Syntax
Parser encountered an unexpected terminal.
Action(E)
A user action (reduction) returned an error.
Implementations§
Source§impl ParseError<Infallible>
impl ParseError<Infallible>
Sourcepub fn cast<F>(self) -> ParseError<F>
pub fn cast<F>(self) -> ParseError<F>
Cast a syntax-only error (ParseError<Infallible>) to any ParseError<F>.
Trait Implementations§
Source§impl<E: Clone> Clone for ParseError<E>
impl<E: Clone> Clone for ParseError<E>
Source§fn clone(&self) -> ParseError<E>
fn clone(&self) -> ParseError<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<E> Freeze for ParseError<E>where
E: Freeze,
impl<E> RefUnwindSafe for ParseError<E>where
E: RefUnwindSafe,
impl<E> Send for ParseError<E>where
E: Send,
impl<E> Sync for ParseError<E>where
E: Sync,
impl<E> Unpin for ParseError<E>where
E: Unpin,
impl<E> UnsafeUnpin for ParseError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for ParseError<E>where
E: 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