hornbeam_interpreter/
lib.rs1use std::fmt::Debug;
2
3mod engine;
4#[cfg(feature = "formbeam")]
5pub mod formbeam_integration;
6mod functions;
7pub(crate) mod interface;
8
9pub mod localisation;
10
11use hornbeam_grammar::{Locator, ParseError};
12use hornbeam_ir::AstToIrError;
13use thiserror::Error;
14
15#[derive(Error, Debug, Clone)]
16pub enum InterpreterError<LE: Debug + Clone, OE: Debug> {
17 #[error("type error at {location}: {context} ({conflict})")]
18 TypeError {
19 context: String,
20 conflict: String,
21 location: Locator,
22 },
23 #[error("localisation lookup of {trans_key:?} at {location} failed: {underlying:?}")]
24 Localisation {
25 underlying: LE,
26 trans_key: String,
27 location: Locator,
28 },
29 #[error("failed to write to output: {underlying:?}")]
30 OutputError { underlying: OE },
31
32 #[error("failed to parse template: {0}")]
33 ParseError(#[from] ParseError),
34
35 #[error("failed to process parsed template: {0}")]
36 AstToIrError(#[from] AstToIrError),
37
38 #[error("error finding templates to load: {0}")]
39 TemplateFindError(String),
40}
41
42pub use functions::defaults::default_template_accessible_methods;
43#[cfg(feature = "formbeam")]
44pub use functions::formbeam_integration::formbeam_template_accessible_methods;
45pub use functions::TemplateAccessibleMethod;
46pub use interface::{LoadedTemplates, LocalisationSystem, OutputSystem, Params, PreparedTemplate};