pub enum ParserError {
UnexpectedToken(String),
UnexpectedEnd,
InvalidSyntax(String),
InvalidNumber(String),
UnclosedString,
InvalidEscape(String),
UnclosedComment,
UnclosedBacktick,
Expected {
expected: String,
found: String,
},
Coded {
code: &'static str,
message: String,
},
}Expand description
Parser errors
Variants§
UnexpectedToken(String)
UnexpectedEnd
InvalidSyntax(String)
InvalidNumber(String)
UnclosedString
InvalidEscape(String)
UnclosedComment
UnclosedBacktick
Expected
Coded
A JSONata-spec-coded parse error (S0214-S0217 for the %/@ operators). Code is at the start of the message (matching the DateTimeError::Coded convention from the datetime picture-string engine) so test_reference_suite.py’s extract_error_code() finds it.
Implementations§
Source§impl ParserError
impl ParserError
Sourcepub fn display_message(&self) -> String
pub fn display_message(&self) -> String
The full display-ready message: Coded variants (e.g. S0214) are
already exactly “code: message” via Display, so they pass
through unchanged; every other variant gets a “Parse error: “
prefix added. Used by both the Python bindings (src/lib.rs) and
the jsonata CLI.
Trait Implementations§
Source§impl Debug for ParserError
impl Debug for ParserError
Source§impl Display for ParserError
impl Display for ParserError
Source§impl Error for ParserError
impl Error for ParserError
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()
Auto Trait Implementations§
impl Freeze for ParserError
impl RefUnwindSafe for ParserError
impl Send for ParserError
impl Sync for ParserError
impl Unpin for ParserError
impl UnsafeUnpin for ParserError
impl UnwindSafe for ParserError
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