Skip to main content

adze_ir/
error.rs

1//! Error types for grammar IR operations.
2
3/// Errors that can occur while building and validating the IR.
4#[non_exhaustive]
5#[derive(Debug, thiserror::Error)]
6pub enum IrError {
7    /// The referenced symbol was malformed or not present in the grammar.
8    #[error("invalid symbol: {0}")]
9    InvalidSymbol(String),
10
11    /// Attempted to insert a rule that already exists.
12    #[error("duplicate rule: {0}")]
13    DuplicateRule(String),
14
15    /// An unexpected internal IR failure.
16    #[error("internal error: {0}")]
17    Internal(String),
18}
19
20/// Convenience type alias for IR results.
21pub type Result<T> = std::result::Result<T, IrError>;