Hacky fix for displaying error output non-interactively
This commit is contained in:
parent
6140de9f9c
commit
f56d7120c4
@ -19,7 +19,7 @@ pub struct EvalOptions {
|
|||||||
pub struct LanguageOutput {
|
pub struct LanguageOutput {
|
||||||
output: String,
|
output: String,
|
||||||
artifacts: Vec<TraceArtifact>,
|
artifacts: Vec<TraceArtifact>,
|
||||||
failed: bool,
|
pub failed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LanguageOutput {
|
impl LanguageOutput {
|
||||||
|
@ -111,8 +111,9 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let output = language.evaluate_in_repl(&buffer, &options);
|
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())
|
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();
|
let token_errors: Vec<&String> = tokens.iter().filter_map(|t| t.get_error()).collect();
|
||||||
if token_errors.len() != 0 {
|
if token_errors.len() != 0 {
|
||||||
output.add_output(format!("Tokenization error: {:?}\n", token_errors));
|
output.add_output(format!("Tokenization error: {:?}\n", token_errors));
|
||||||
|
output.failed = true;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,6 +65,7 @@ impl ProgrammingLanguageInterface for Schala {
|
|||||||
(Err(err), trace) => {
|
(Err(err), trace) => {
|
||||||
output.add_artifact(TraceArtifact::new_parse_trace(trace));
|
output.add_artifact(TraceArtifact::new_parse_trace(trace));
|
||||||
output.add_output(format!("Parse error: {:?}\n", err.msg));
|
output.add_output(format!("Parse error: {:?}\n", err.msg));
|
||||||
|
output.failed = true;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user