Hacky fix for displaying error output non-interactively
This commit is contained in:
parent
64a3705e35
commit
57f56168c5
@ -19,7 +19,7 @@ pub struct EvalOptions {
|
||||
pub struct LanguageOutput {
|
||||
output: String,
|
||||
artifacts: Vec<TraceArtifact>,
|
||||
failed: bool,
|
||||
pub failed: bool,
|
||||
}
|
||||
|
||||
impl LanguageOutput {
|
||||
|
@ -111,8 +111,9 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
|
||||
}
|
||||
} else {
|
||||
let output = language.evaluate_in_repl(&buffer, &options);
|
||||
// if output.has_error....
|
||||
|
||||
if output.failed {
|
||||
println!("{}", output.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,5 +6,4 @@ fn main() {
|
||||
|
||||
print(main())
|
||||
|
||||
const xxx
|
||||
|
||||
|
@ -49,6 +49,7 @@ impl ProgrammingLanguageInterface for Schala {
|
||||
let token_errors: Vec<&String> = 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;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user