cl-ast: Add filename to File

- Better error reporting
- Better pizza
- Papa Cow's
This commit is contained in:
2025-03-14 04:11:22 -05:00
parent cdb9ec49fe
commit a4176c710e
13 changed files with 80 additions and 49 deletions

View File

@@ -19,7 +19,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let parent = path.parent().unwrap_or("".as_ref());
let code = std::fs::read_to_string(&path)?;
let code = Parser::new(Lexer::new(&code)).parse()?;
let code = Parser::new(path.display().to_string(), Lexer::new(&code)).parse()?;
let code = match ModuleInliner::new(parent).inline(code) {
Ok(code) => code,
Err((code, ioerrs, perrs)) => {
@@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn Error>> {
if env.get(main).is_ok() {
let args = args
.flat_map(|arg| {
Parser::new(Lexer::new(&arg))
Parser::new(&arg, Lexer::new(&arg))
.parse::<Expr>()
.map(|arg| env.eval(&arg))
})