Simplify some code
This commit is contained in:
parent
1b642c6321
commit
bec8aedc22
@ -36,7 +36,6 @@ impl ProgrammingLanguageInterface for Schala {
|
|||||||
if options.debug_tokens {
|
if options.debug_tokens {
|
||||||
let token_string = tokens.iter().map(|t| format!("{:?}<{}>", t.token_type, t.offset)).join(", ");
|
let token_string = tokens.iter().map(|t| format!("{:?}<{}>", t.token_type, t.offset)).join(", ");
|
||||||
output.add_artifact(TraceArtifact::new("tokens", format!("{:?}", token_string)));
|
output.add_artifact(TraceArtifact::new("tokens", format!("{:?}", token_string)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -80,16 +79,9 @@ impl ProgrammingLanguageInterface for Schala {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let evaluation_output = self.state.evaluate(ast);
|
let evaluation_outputs = self.state.evaluate(ast);
|
||||||
let mut acc = String::new();
|
let text_output: String = evaluation_outputs.into_iter().intersperse(format!("\n")).collect();
|
||||||
let mut iter = evaluation_output.iter().peekable();
|
output.add_output(text_output);
|
||||||
while let Some(s) = iter.next() {
|
|
||||||
acc.push_str(&s);
|
|
||||||
if let Some(_) = iter.peek() {
|
|
||||||
acc.push_str("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output.add_output(acc);
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user