pub enum ParseError {
UnexpectedToken {
found: TokenKind,
expected: Vec<TokenKind>,
span: Span,
},
UnexpectedEof {
expected: Vec<TokenKind>,
span: Span,
},
LexerError {
message: String,
span: Span,
},
}Expand description
Domain-specific parser errors.
Consumed by the lexer (week 2), recognizer (later wiring), CST builder
and AST builder. Each variant can be converted via
ParseError::to_diagnostic into a Diagnostic.
Variants§
UnexpectedToken
A specific set of tokens was expected, but a different token was found.
Fields
UnexpectedEof
Input ended before the production was complete. At least one more token was expected.
Fields
LexerError
Lexer-specific error (invalid character sequence, unterminated string, etc.). The detail text is lexer-specific.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn to_diagnostic(&self) -> Diagnostic
pub fn to_diagnostic(&self) -> Diagnostic
Converts a parser error into a uniform Diagnostic.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
impl Eq for ParseError
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
Source§fn eq(&self, other: &ParseError) -> bool
fn eq(&self, other: &ParseError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
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