summaryrefslogtreecommitdiff
path: root/oryxc/src/compiler.rs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2026-03-03 00:25:45 +0100
committerThomas Voss <mail@thomasvoss.com> 2026-03-03 00:25:45 +0100
commit4fa4f07fe2f5b79eb4458ff89d9b6e2d6bb60f08 (patch)
tree557ec47e9da5c98958f13b846abecce4154bef05 /oryxc/src/compiler.rs
parent635c25af2e1f25f335319a32b41f38e2442ae2a2 (diff)
Begin work on recoverable parsing errors
Diffstat (limited to 'oryxc/src/compiler.rs')
-rw-r--r--oryxc/src/compiler.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/oryxc/src/compiler.rs b/oryxc/src/compiler.rs
index bca1ba6..d4010e0 100644
--- a/oryxc/src/compiler.rs
+++ b/oryxc/src/compiler.rs
@@ -150,12 +150,11 @@ fn worker_loop(
if let Some(job) = job {
match job {
Job::LexAndParse { file } => {
- let (name, buffer) = {
+ let buffer = {
let fdata = state.files.get(&file).unwrap();
- (fdata.name.clone(), fdata.buffer.clone())
+ fdata.buffer.clone()
};
- let (name, buffer) = (name.as_ref(), buffer.as_ref());
- let tokens = match lexer::tokenize(buffer) {
+ let tokens = match lexer::tokenize(buffer.as_ref()) {
Ok(xs) => xs,
Err(e) => {
emit_errors(state.clone(), file, vec![e]);
@@ -170,7 +169,13 @@ fn worker_loop(
}
}
- let (ast, _extra_data) = parser::parse(name, &tokens);
+ let (ast, _extra_data) = match parser::parse(&tokens) {
+ Ok((ast, _extra_data)) => (ast, _extra_data),
+ Err(errs) => {
+ emit_errors(state.clone(), file, errs);
+ process::exit(1);
+ },
+ };
if state.flags.debug_parser {
let mut handle = io::stderr().lock();