pub struct TokError {
pub err_message: String,
pub produced: usize,
pub location: usize,
pub pairing_error: Option<(String, bool)>,
}Expand description
Tokenizer error state.
Fields§
§err_message: StringHuman-readable error message. Format is not guaranteed and may change arbitrarily.
produced: usizeNumber of tokens produced so far.
location: usizeAt what byte index in the input string did tokenization fail to continue?
pairing_error: Option<(String, bool)>Is Some if tokenization failed because of failing to pair brackets:
String: responsible token textbool: openness
If the bool is true, then the failed pairing is “open”, like the string ()(. Otherwise, it’s “closed”, like ()).
The responsible token is the token where the error was noticed, not the token that’s “missing”. E.g. for ()) it’s ")".
It is currently unspecified whether non-nested overlaps like ( { ) } trigger an error.
KNOWN BUG: “open” failed pairings like ()( do not currently produce errors. They will become errors in a future version.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokError
impl RefUnwindSafe for TokError
impl Send for TokError
impl Sync for TokError
impl Unpin for TokError
impl UnwindSafe for TokError
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