pub enum ParseErrorReason {
Eof {
expected: String,
span: Span,
},
ExtraTokens {
actual: Spanned<String>,
},
Mismatch {
expected: String,
actual: Spanned<String>,
},
Unclosed {
delimiter: String,
span: Span,
},
GeneralError {
message: String,
label: Spanned<String>,
},
ArgumentError {
command: Spanned<String>,
error: ArgumentError,
},
}
Expand description
A structured reason for a ParseError. Note that parsing in nu is more like macro expansion in other languages, so the kinds of errors that can occur during parsing are more contextual than you might expect.
Variants§
Eof
The parser encountered an EOF rather than what it was expecting
ExtraTokens
The parser expected to see the end of a token stream (possibly the token stream from inside a delimited token node), but found something else.
Mismatch
The parser encountered something other than what it was expecting
Unclosed
Unclosed delimiter
GeneralError
An unexpected internal error has occurred
ArgumentError
The parser tried to parse an argument for a command, but it failed for some reason
Trait Implementations§
Source§impl Clone for ParseErrorReason
impl Clone for ParseErrorReason
Source§fn clone(&self) -> ParseErrorReason
fn clone(&self) -> ParseErrorReason
Returns a copy 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 ParseErrorReason
impl Debug for ParseErrorReason
Source§impl<'de> Deserialize<'de> for ParseErrorReason
impl<'de> Deserialize<'de> for ParseErrorReason
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for ParseErrorReason
impl Hash for ParseErrorReason
Source§impl Ord for ParseErrorReason
impl Ord for ParseErrorReason
Source§fn cmp(&self, other: &ParseErrorReason) -> Ordering
fn cmp(&self, other: &ParseErrorReason) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ParseErrorReason
impl PartialEq for ParseErrorReason
Source§impl PartialOrd for ParseErrorReason
impl PartialOrd for ParseErrorReason
Source§impl Serialize for ParseErrorReason
impl Serialize for ParseErrorReason
impl Eq for ParseErrorReason
impl StructuralPartialEq for ParseErrorReason
Auto Trait Implementations§
impl Freeze for ParseErrorReason
impl RefUnwindSafe for ParseErrorReason
impl Send for ParseErrorReason
impl Sync for ParseErrorReason
impl Unpin for ParseErrorReason
impl UnwindSafe for ParseErrorReason
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.