pub enum LexingError {
UnknownError,
UnexpectedCharacter(String, Span),
UnexpectedEOF(Span),
ParseIntError(ParseIntError, Span),
ParseFloatError(ParseFloatError, Span),
}
Expand description
An Enum for any errors that may occur during lexing.
Variants§
UnknownError
Error for any unknown reason. Usually when a character is encountered that can not be lexed.
UnexpectedCharacter(String, Span)
Error for an unexpected character.
UnexpectedEOF(Span)
Error when encountering EOF before we expect.
ParseIntError(ParseIntError, Span)
Error when parsing an int
ParseFloatError(ParseFloatError, Span)
Error when parsing a float
Trait Implementations§
Source§impl Clone for LexingError
impl Clone for LexingError
Source§fn clone(&self) -> LexingError
fn clone(&self) -> LexingError
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 LexingError
impl Debug for LexingError
Source§impl Default for LexingError
impl Default for LexingError
Source§fn default() -> LexingError
fn default() -> LexingError
Returns the “default value” for a type. Read more
Source§impl Display for LexingError
impl Display for LexingError
Source§impl Error for LexingError
impl Error for LexingError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for LexingError
impl PartialEq for LexingError
Source§impl<'source> ResultNext<Tokens, LexingError> for LexerBridge<'source>
impl<'source> ResultNext<Tokens, LexingError> for LexerBridge<'source>
Source§fn next_result(&mut self) -> Result<Tokens, LexingError>
fn next_result(&mut self) -> Result<Tokens, LexingError>
If you have an iterator that holds
Result
items, you start having to deal with nested Some(Ok(...))
patterns,
which gets annoying quickly. This trait is intended so that the iterator always returns some sort of Result
, which can then be unwrapped as needed (probably using ?
). Read moreSource§impl<'source> ResultPeek<Tokens, LexingError> for LexerBridge<'source>
impl<'source> ResultPeek<Tokens, LexingError> for LexerBridge<'source>
Source§fn peek_result(&mut self) -> Result<&Tokens, LexingError>
fn peek_result(&mut self) -> Result<&Tokens, LexingError>
See
next_result
. Read moreSource§impl Spannable for LexingError
impl Spannable for LexingError
impl Eq for LexingError
impl StructuralPartialEq for LexingError
Auto Trait Implementations§
impl Freeze for LexingError
impl RefUnwindSafe for LexingError
impl Send for LexingError
impl Sync for LexingError
impl Unpin for LexingError
impl UnwindSafe for LexingError
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> 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