mirror of
https://github.com/Noratrieb/coldsquare.git
synced 2026-01-16 17:35:10 +01:00
better local vars/operand stack
This commit is contained in:
parent
43e2c59e73
commit
5ec9260b59
2 changed files with 27 additions and 17 deletions
25
src/main.rs
25
src/main.rs
|
|
@ -1,25 +0,0 @@
|
|||
use coldsquare::{display_class, parse_class_file};
|
||||
|
||||
fn main() {
|
||||
let file = std::env::args().nth(1).unwrap_or_else(|| {
|
||||
eprintln!("No file provided");
|
||||
std::process::exit(1);
|
||||
});
|
||||
let file = std::fs::read(file).unwrap_or_else(|_| {
|
||||
eprintln!("Could not read file");
|
||||
std::process::exit(1);
|
||||
});
|
||||
|
||||
let class_file = match parse_class_file(&file) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let stdout = std::io::stdout();
|
||||
|
||||
if let Err(why) = display_class(stdout.lock(), &class_file) {
|
||||
eprintln!("{}", why);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue