pub enum ParseErrorKind {
UnexpectedToken {
found: TokenInfo,
expected: Vec<ExpectedToken>,
},
UnexpectedEof {
expected: Vec<ExpectedToken>,
},
UnterminatedString {
start_location: SourceLocation,
delimiter: StringDelimiter,
},
UnterminatedComment {
start_location: SourceLocation,
},
InvalidNumber {
text: String,
reason: NumberError,
},
UnbalancedDelimiter {
opener: char,
open_location: SourceLocation,
found: Option<char>,
},
ReservedKeyword {
keyword: String,
context: IdentifierContext,
},
InvalidEscape {
sequence: String,
valid_escapes: Vec<String>,
},
InvalidCharacter {
char: char,
codepoint: u32,
},
MissingComponent {
component: MissingComponentKind,
after: Option<String>,
},
Custom {
message: String,
},
}Expand description
Specific parse error variants with structured context
Variants§
UnexpectedToken
Parser expected specific tokens but found something else
Fields
§
expected: Vec<ExpectedToken>What tokens/rules were expected
UnexpectedEof
End of input reached unexpectedly
Fields
§
expected: Vec<ExpectedToken>What tokens/rules were expected
UnterminatedString
Unterminated string literal
Fields
§
start_location: SourceLocationWhere the string started
§
delimiter: StringDelimiterThe delimiter used
UnterminatedComment
Unterminated block comment
Fields
§
start_location: SourceLocationWhere the comment started
InvalidNumber
Invalid number literal
UnbalancedDelimiter
Unbalanced delimiter (brackets, braces, parentheses)
Fields
§
open_location: SourceLocationWhere it was opened
ReservedKeyword
Reserved keyword used as identifier
Fields
§
context: IdentifierContextContext where it was used
InvalidEscape
Invalid escape sequence in string
Fields
InvalidCharacter
Invalid character in source
MissingComponent
Missing required component
Custom
Custom parse error from semantic validation during parsing
Trait Implementations§
Source§impl Clone for ParseErrorKind
impl Clone for ParseErrorKind
Source§fn clone(&self) -> ParseErrorKind
fn clone(&self) -> ParseErrorKind
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 moreSource§impl Debug for ParseErrorKind
impl Debug for ParseErrorKind
Source§impl PartialEq for ParseErrorKind
impl PartialEq for ParseErrorKind
impl StructuralPartialEq for ParseErrorKind
Auto Trait Implementations§
impl Freeze for ParseErrorKind
impl RefUnwindSafe for ParseErrorKind
impl Send for ParseErrorKind
impl Sync for ParseErrorKind
impl Unpin for ParseErrorKind
impl UnsafeUnpin for ParseErrorKind
impl UnwindSafe for ParseErrorKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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