summaryrefslogtreecommitdiffstats
path: root/crates/rebel-lang/examples/repl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-lang/examples/repl.rs')
-rw-r--r--crates/rebel-lang/examples/repl.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/rebel-lang/examples/repl.rs b/crates/rebel-lang/examples/repl.rs
index f7d29e3..0e3debc 100644
--- a/crates/rebel-lang/examples/repl.rs
+++ b/crates/rebel-lang/examples/repl.rs
@@ -65,6 +65,13 @@ fn main() -> rustyline::Result<()> {
continue;
}
};
+ match Type::ast_expr_type(&ctx, &expr) {
+ Ok(_) => (),
+ Err(err) => {
+ println!("Type error: {err:?}");
+ continue;
+ }
+ };
let value = match Value::eval(&ctx, &expr) {
Ok(value) => value,
Err(err) => {
@@ -72,7 +79,14 @@ fn main() -> rustyline::Result<()> {
continue;
}
};
- println!("{value}");
+ let typ = match value.typ() {
+ Ok(typ) => typ,
+ Err(err) => {
+ println!("Post-eval type error: {err:?}. This should not happen.");
+ continue;
+ }
+ };
+ println!("{value}: {typ}");
}
Ok(())