A fairly major refactor / simplification.

This commit is contained in:
2023-01-16 20:11:06 -08:00
parent 2e82fcf343
commit afcf3c65cd
26 changed files with 800 additions and 1132 deletions

36
src/pass_result.rs Normal file
View File

@@ -0,0 +1,36 @@
pub mod errors;
pub mod warnings;
use crate::syntax::ParserError;
pub use self::errors::Error;
pub use self::warnings::Warning;
pub struct PassResult<T> {
pub result: Option<T>,
pub warnings: Vec<Warning>,
pub errors: Vec<Error>,
}
impl<T> From<ParserError> for PassResult<T> {
fn from(value: ParserError) -> Self {
PassResult {
result: None,
warnings: vec![],
errors: vec![Error::ParserError(value)],
}
}
}
impl<T, E> From<E> for PassResult<T>
where
Error: From<E>,
{
fn from(x: E) -> Self {
PassResult {
result: None,
warnings: vec![],
errors: vec![Error::from(x)],
}
}
}