Skip to main content

xgrammar/parser/
lexer_error.rs

1//! Error raised by the EBNF lexer —
2//! fatal (which aborts); here it is a recoverable [`Result`] error.
3
4/// A lexing failure, with the 1-based source position where it occurred.
5#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
6#[error("EBNF lexer error at line {line}, column {column}: {message}")]
7pub struct LexerError {
8    /// 1-based line of the error.
9    pub line: i32,
10    /// 1-based column of the error.
11    pub column: i32,
12    /// Human-readable description.
13    pub message: String,
14}