[fine] Beginning a binary
This commit is contained in:
parent
8a867de7e7
commit
d73f77cf00
1 changed files with 37 additions and 1 deletions
|
|
@ -1 +1,37 @@
|
|||
pub fn main() {}
|
||||
use fine::parser::Parser;
|
||||
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) => {
|
||||
eprintln!("Unable to read file {file}: {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let (mut tree, expr, lines) = Parser::new(&source).parse();
|
||||
if tree.errors.len() > 0 {
|
||||
for error in tree.errors {
|
||||
eprintln!("{error}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let _expr_type = tree.expr_type(&expr, &lines, true);
|
||||
if tree.errors.len() > 0 {
|
||||
for error in tree.errors {
|
||||
eprintln!("{error}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
for arg in &args[1..] {
|
||||
process_file(arg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue