aboutsummaryrefslogtreecommitdiff
path: root/sloth/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'sloth/src/main.rs')
-rw-r--r--sloth/src/main.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/sloth/src/main.rs b/sloth/src/main.rs
index 421bbea..a1a4756 100644
--- a/sloth/src/main.rs
+++ b/sloth/src/main.rs
@@ -54,7 +54,18 @@ fn main() {
// Parsing
let tokens = Lexer::new(&source).collect_vec();
let global_symtable = mk_symtable();
- let mut ast = AstParser::parse(tokens, global_symtable).unwrap();
+
+ let mut ast = match AstParser::parse(tokens, global_symtable) {
+ Ok(node) => node,
+ Err(error) => {
+ eprintln!(
+ "Error in file {} on line {}: {error}",
+ args[1 + (error.line() / 1_000) as usize],
+ error.line() % 1000 + 1,
+ );
+ return;
+ }
+ };
if let Err(error) = analyze(&mut ast) {
eprintln!(