From f56d7120c4e6991d65c39a0d6b970ee6d5517d11 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 11 Mar 2018 12:56:51 -0700 Subject: [PATCH] Hacky fix for displaying error output non-interactively --- schala-lib/src/language.rs | 2 +- schala-lib/src/lib.rs | 5 +++-- source_files/schala/first.schala | 1 - src/schala_lang/mod.rs | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/schala-lib/src/language.rs b/schala-lib/src/language.rs index e44fd18..06e36c3 100644 --- a/schala-lib/src/language.rs +++ b/schala-lib/src/language.rs @@ -19,7 +19,7 @@ pub struct EvalOptions { pub struct LanguageOutput { output: String, artifacts: Vec, - failed: bool, + pub failed: bool, } impl LanguageOutput { diff --git a/schala-lib/src/lib.rs b/schala-lib/src/lib.rs index 573a410..899822a 100644 --- a/schala-lib/src/lib.rs +++ b/schala-lib/src/lib.rs @@ -111,8 +111,9 @@ fn run_noninteractive(filename: &str, languages: Vec = tokens.iter().filter_map(|t| t.get_error()).collect(); if token_errors.len() != 0 { output.add_output(format!("Tokenization error: {:?}\n", token_errors)); + output.failed = true; return output; } } @@ -64,6 +65,7 @@ impl ProgrammingLanguageInterface for Schala { (Err(err), trace) => { output.add_artifact(TraceArtifact::new_parse_trace(trace)); output.add_output(format!("Parse error: {:?}\n", err.msg)); + output.failed = true; return output; } };