xgrammar/compiler/
error.rs1use crate::{
4 converter::{LarkError, RegexError, SchemaError, StructuralTagError},
5 functor::FunctorError,
6 parser::EbnfError,
7};
8
9#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
11pub enum CompileError {
12 #[error(transparent)]
14 Ebnf(#[from] EbnfError),
15 #[error(transparent)]
17 Schema(#[from] SchemaError),
18 #[error(transparent)]
20 Regex(#[from] RegexError),
21 #[error(transparent)]
23 StructuralTag(#[from] StructuralTagError),
24 #[error(transparent)]
26 Functor(#[from] FunctorError),
27 #[error(transparent)]
29 Lark(#[from] LarkError),
30 #[error("Token id {token_id} in the grammar is out of the vocabulary range [0, {vocab_size})")]
32 TokenIdOutOfRange {
33 token_id: i32,
35 vocab_size: i32,
37 },
38}