Enum lrpar::parser::LexParseError
source · pub enum LexParseError<StorageT> {
LexError(LexError),
ParseError(ParseError<StorageT>),
}
Expand description
A lexing or parsing error. Although the two are quite distinct in terms of what can be reported to users, both can (at least conceptually) occur at any point of the intertwined lexing/parsing process.
Variants
LexError(LexError)
ParseError(ParseError<StorageT>)
Implementations
sourceimpl<StorageT: Hash + PrimInt + Unsigned> LexParseError<StorageT>
impl<StorageT: Hash + PrimInt + Unsigned> LexParseError<StorageT>
sourcepub fn pp<'a>(
&self,
lexer: &dyn Lexer<StorageT>,
epp: &dyn Fn(TIdx<StorageT>) -> Option<&'a str>
) -> String
pub fn pp<'a>(
&self,
lexer: &dyn Lexer<StorageT>,
epp: &dyn Fn(TIdx<StorageT>) -> Option<&'a str>
) -> String
A pretty-printer of a lexer/parser error. This isn’t suitable for all purposes, but it’s often good enough. The output format is not guaranteed to be stable but is likely to be of the form:
Parsing error at line 3 column 8. Repair sequences found:
1: Insert ID
2: Delete +, Shift 3
If you are using the compile-time parse system, your grm_y
module exposes a suitable
epp
function; if you are
using the run-time system,
YaccGrammar
exposes a suitable
epp
function,
though you will have to wrap it in a closure e.g. &|t| grm.token_epp(t)
.
Trait Implementations
sourceimpl<StorageT: Debug> Debug for LexParseError<StorageT>
impl<StorageT: Debug> Debug for LexParseError<StorageT>
sourceimpl<StorageT: Debug> Display for LexParseError<StorageT>
impl<StorageT: Debug> Display for LexParseError<StorageT>
sourceimpl<StorageT: Debug> Error for LexParseError<StorageT>
impl<StorageT: Debug> Error for LexParseError<StorageT>
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
sourceimpl<StorageT> From<LexError> for LexParseError<StorageT>
impl<StorageT> From<LexError> for LexParseError<StorageT>
sourcefn from(err: LexError) -> LexParseError<StorageT>
fn from(err: LexError) -> LexParseError<StorageT>
Converts to this type from the input type.
sourceimpl<StorageT> From<ParseError<StorageT>> for LexParseError<StorageT>
impl<StorageT> From<ParseError<StorageT>> for LexParseError<StorageT>
sourcefn from(err: ParseError<StorageT>) -> LexParseError<StorageT>
fn from(err: ParseError<StorageT>) -> LexParseError<StorageT>
Converts to this type from the input type.
Auto Trait Implementations
impl<StorageT> RefUnwindSafe for LexParseError<StorageT>where
StorageT: RefUnwindSafe,
impl<StorageT> Send for LexParseError<StorageT>where
StorageT: Send,
impl<StorageT> Sync for LexParseError<StorageT>where
StorageT: Sync,
impl<StorageT> Unpin for LexParseError<StorageT>where
StorageT: Unpin,
impl<StorageT> UnwindSafe for LexParseError<StorageT>where
StorageT: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more