Enum LexError
pub enum LexError {
UnexpectedCharacters {
char_pos: usize,
line: usize,
column: usize,
ch: char,
allowed: Vec<String>,
},
Callback {
message: String,
},
InputTooLarge {
byte_len: usize,
},
WrongContextToken {
token: Token,
allowed: Vec<String>,
},
}Expand description
Runtime lex errors. Construction-time problems are LexerBuildError.
Variants§
UnexpectedCharacters
No terminal matches. allowed is
scanner terminals − ignore_types, sorted, with Lark’s literal
empty-set fallback string (END_OF_FILE).
Fields
Callback
A user callback failed (binding-raised); carries its message.
InputTooLarge
Input longer than the u32 position ceiling can represent
(byte length > u32::MAX). The byte length is an upper bound on the
code-point count, so this single entry guard makes every downstream
char_pos as u32 cast provably safe (u32 positions).
WrongContextToken
Contextual-lexer root fallback: the character is a
valid terminal, just not in this parser state — the root lexer lexed
token, and allowed is the original per-state error’s set. The parse
path surfaces this as UnexpectedToken (exception
class parity is the v1 gate).
Trait Implementations§
impl Eq for LexError
§impl Error for LexError
impl Error for LexError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl StructuralPartialEq for LexError
Auto Trait Implementations§
impl Freeze for LexError
impl RefUnwindSafe for LexError
impl Send for LexError
impl Sync for LexError
impl Unpin for LexError
impl UnsafeUnpin for LexError
impl UnwindSafe for LexError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more