lex_hello worked for a second just now

this is just a backup however
This commit is contained in:
2025-02-02 10:20:03 +01:00
parent 2b79e96dc9
commit 1556d54226
45 changed files with 646 additions and 371 deletions

View File

@@ -1,3 +1,4 @@
use std::cell::RefCell;
use std::fmt;
use std::ops::Add;
use std::sync::Arc;
@@ -171,3 +172,17 @@ pub fn mk_errv(
pub trait Reporter {
fn report(&self, e: impl Into<OrcErrv>);
}
pub struct ReporterImpl {
errors: RefCell<Vec<OrcErr>>,
}
impl ReporterImpl {
pub fn new() -> Self { Self { errors: RefCell::new(vec![]) } }
pub fn errv(self) -> Option<OrcErrv> { OrcErrv::new(self.errors.into_inner()).ok() }
}
impl Reporter for ReporterImpl {
fn report(&self, e: impl Into<OrcErrv>) { self.errors.borrow_mut().extend(e.into()) }
}
impl Default for ReporterImpl {
fn default() -> Self { Self::new() }
}