Skip to main content

haystack_core/xeto/
mod.rs

1// Xeto schema language support -- lexer, parser, spec resolution, and fitting.
2
3pub mod ast;
4pub mod bundled;
5pub mod export;
6pub mod fitting;
7pub mod lexer;
8pub mod loader;
9pub mod parser;
10pub mod resolver;
11pub mod spec;
12
13pub use ast::{LibPragma, SlotDef, SpecDef, XetoFile};
14pub use fitting::{EntityResolver, fits, fits_explain};
15pub use lexer::{Token, TokenType, XetoLexer};
16pub use parser::parse_xeto;
17pub use resolver::XetoResolver;
18pub use spec::{Slot, Spec};
19
20/// Errors that can occur during Xeto parsing, resolution, or loading.
21#[derive(Debug, thiserror::Error)]
22pub enum XetoError {
23    /// Error during tokenization or parsing.
24    #[error("parse error at line {line}, col {col}: {message}")]
25    Parse {
26        line: usize,
27        col: usize,
28        message: String,
29    },
30    /// Error during name resolution.
31    #[error("resolve error: {0}")]
32    Resolve(String),
33    /// Error during library loading.
34    #[error("load error: {0}")]
35    Load(String),
36}