Clean up the output a little bit
This commit is contained in:
parent
780ada7034
commit
64b8d18fe8
29
src/main.rs
29
src/main.rs
|
@ -31,24 +31,21 @@ fn main() -> std::io::Result<()> {
|
|||
Ok(p) => p
|
||||
};
|
||||
|
||||
println!("Parse successful!!");
|
||||
for decl in &program.0 {
|
||||
println!("{decl:?}\n");
|
||||
}
|
||||
println!("Parse successful! Building IR...");
|
||||
|
||||
println!("Building IR...");
|
||||
match program.gen_ir() {
|
||||
Ok(program) => {
|
||||
println!(
|
||||
"IR built successfully!\n{}",
|
||||
program.iter()
|
||||
.map(|decl| format!("\n\n{decl}\n\n"))
|
||||
.collect::<String>(),
|
||||
);
|
||||
let program = match program.gen_ir() {
|
||||
Ok(program) => program,
|
||||
Err(e) => {
|
||||
println!("Oh noes! {e:?}");
|
||||
exit(2);
|
||||
}
|
||||
};
|
||||
|
||||
println!("IR built successfully! Evaluating...");
|
||||
|
||||
match display_program(program) {
|
||||
Ok(value) =>
|
||||
println!("Evaluated successfully! Got:\n{value}"),
|
||||
println!("Evaluated successfully!\n\n{value}"),
|
||||
Err(EvaluateError::UndefinedValue(v)) =>
|
||||
println!("Hit an error: {v} is undefined"),
|
||||
Err(EvaluateError::EvaluatingZeroLengthExpr) =>
|
||||
|
@ -66,10 +63,6 @@ fn main() -> std::io::Result<()> {
|
|||
Err(EvaluateError::IncompleteConditional) =>
|
||||
println!("Uh oh, a conditional somewhere isn't complete!"),
|
||||
}
|
||||
}
|
||||
Err(e) =>
|
||||
println!("Oh noes! {e:?}"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ impl Program {
|
|||
.enumerate()
|
||||
.filter_map(|(i, decl)| decl.get_identifier(&Identifier::ROOT, i as u32))
|
||||
.fold(BindingScope::builtins(), |scope, ident| scope.bind_single(ident));
|
||||
println!("DEBUG {root_scope:?}");
|
||||
self.0.into_iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, decl)| decl.gen_ir(&root_scope, i as u32, Identifier::ROOT).transpose())
|
||||
|
|
Loading…
Reference in a new issue