Skip to main content

xgrammar/parser/
parse_error.rs

1//! Error raised by the EBNF parser —
2//! fatal.
3
4/// A parsing failure, with the 1-based source position where it occurred.
5#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
6#[error("EBNF parser error at line {line}, column {column}: {message}")]
7pub struct ParserError {
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}