[fine] Rebuild main, it's probably broken

This commit is contained in:
John Doty 2024-01-05 19:42:15 -08:00
parent a9c1b04920
commit b205ebcb4c
4 changed files with 24 additions and 892 deletions

View file

@ -1,9 +1,9 @@
use fine::parser::old::Parser;
use fine::parser::parse;
use fine::semantics::Semantics;
use std::env;
use std::fs;
pub fn process_file(file: &str) {
println!("{file}");
let source = match fs::read_to_string(file) {
Ok(c) => c,
Err(e) => {
@ -12,20 +12,20 @@ pub fn process_file(file: &str) {
}
};
let (mut tree, expr, lines) = Parser::new(&source).parse();
if tree.errors.len() > 0 {
for error in tree.errors {
eprintln!("{error}");
}
return;
// What am I doing here?
let (tree, lines) = parse(&source);
let semantics = Semantics::new(&tree, &lines);
// This is... probably wrong, I don't know, what am I doing?
for t in tree.trees() {
let _ = semantics.type_of(t, false);
}
let _expr_type = tree.expr_type(&expr, &lines, true);
if tree.errors.len() > 0 {
for error in tree.errors {
eprintln!("{error}");
}
return;
// OK now there might be errors.
let mut errors = semantics.snapshot_errors();
errors.reverse();
for e in errors {
eprintln!("{file}: {}:{}: {}", e.start.0, e.start.1, e.message);
}
}