diff options
| author | romir kulshrestha <romir.kulshrestha@gmail.com> | 2026-03-04 19:54:34 +0100 |
|---|---|---|
| committer | romir kulshrestha <romir.kulshrestha@gmail.com> | 2026-03-04 19:54:34 +0100 |
| commit | 9d0c4a673036e48b4d8a455eb468806e9087fb4e (patch) | |
| tree | 8301ed4dca9001fe423889626920ce661cfbe774 /oryxc/src/compiler.rs | |
| parent | cb792e04c739aa0ea1e957595508b5d2b42fe1c2 (diff) | |
multiline usage
Diffstat (limited to 'oryxc/src/compiler.rs')
| -rw-r--r-- | oryxc/src/compiler.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/oryxc/src/compiler.rs b/oryxc/src/compiler.rs index 2a0a3c9..a83cf45 100644 --- a/oryxc/src/compiler.rs +++ b/oryxc/src/compiler.rs @@ -187,13 +187,11 @@ fn worker_loop( match job { Job::Lex { file, fdata } => { - let tokens = match lexer::tokenize(&fdata.buffer) { - Ok(xs) => xs, - Err(e) => { + let tokens = + lexer::tokenize(&fdata.buffer).unwrap_or_else(|e| { emit_errors(&fdata, once(e)); process::exit(1) - }, - }; + }); if state.flags.debug_lexer { let mut handle = io::stderr().lock(); @@ -207,14 +205,13 @@ fn worker_loop( state.push_job(&queue, Job::Parse { file, fdata }); }, Job::Parse { file, fdata } => { - let (ast, extra_data) = - match parser::parse(fdata.tokens.get().unwrap()) { - Ok(xs) => xs, - Err(errs) => { - emit_errors(&fdata, errs); - process::exit(1) - }, - }; + let (ast, extra_data) = parser::parse( + fdata.tokens.get().unwrap(), + ) + .unwrap_or_else(|errs| { + emit_errors(&fdata, errs); + process::exit(1) + }); if state.flags.debug_parser { let mut handle = io::stderr().lock(); |