Bug implementations

This commit is contained in:
2026-05-16 06:50:24 +02:00
parent ced2d47977
commit 3619f0e7dc
10 changed files with 40 additions and 26 deletions
+11
View File
@@ -1,5 +1,7 @@
use std::fmt::Debug;
use pest::iterators::Pair;
use crate::Rule;
pub type AstResult<'a, T, ET = T> = Result<T, AstError<'a, ET>>;
@@ -45,6 +47,15 @@ impl<'a, F> AstError<'a, F> {
recovered: None,
}
}
pub fn bug_unimplemented<T>(pair: Pair<'a, Rule>) -> AstResult<'a, T, F> {
Err(Self {
span: pair.as_span(),
error_code: ErrorCode::AstGenBug,
error_message: format!("Possible bug, unimplemented: {:#?}", pair),
recovered: None,
})
}
}
pub trait IntoErr<T, FA, FR> {