diff --git a/maaru/src/lib.rs b/maaru/src/lib.rs
index 75192fb..c04adcc 100644
--- a/maaru/src/lib.rs
+++ b/maaru/src/lib.rs
@@ -7,7 +7,7 @@ mod parser;
mod eval;
mod compilation;
-use schala_repl::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput, TraceArtifact};
+use schala_repl::{ProgrammingLanguageInterface, EvalOptions, UnfinishedComputation, FinishedComputation, TraceArtifact};
#[derive(Debug)]
pub struct TokenError {
@@ -42,8 +42,8 @@ impl<'a> ProgrammingLanguageInterface for Maaru<'a> {
format!("maaru")
}
- fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> LanguageOutput {
- let mut output = LanguageOutput::default();
+ fn execute_pipeline(&mut self, input: &str, options: &EvalOptions) -> FinishedComputation {
+ let mut output = UnfinishedComputation::default();
let tokens = match tokenizer::tokenize(input) {
Ok(tokens) => {
@@ -53,8 +53,7 @@ impl<'a> ProgrammingLanguageInterface for Maaru<'a> {
tokens
},
Err(err) => {
- output.add_output(format!("Tokenization error: {:?}\n", err.msg));
- return output;
+ return output.finish(Err(format!("Tokenization error: {:?}\n", err.msg)))
}
};
@@ -66,16 +65,14 @@ impl<'a> ProgrammingLanguageInterface for Maaru<'a> {
ast
},
Err(err) => {
- output.add_output(format!("Parse error: {:?}\n", err.msg));
- return output;
+ return output.finish(Err(format!("Parse error: {:?}\n", err.msg)))
}
};
let mut evaluation_output = String::new();
for s in self.evaluator.run(ast).iter() {
evaluation_output.push_str(s);
}
- output.add_output(evaluation_output);
- return output;
+ output.finish(Ok(evaluation_output))
}
/* TODO make this work with new framework */
diff --git a/robo/src/lib.rs b/robo/src/lib.rs
index af0701b..f6cf2b1 100644
--- a/robo/src/lib.rs
+++ b/robo/src/lib.rs
@@ -4,7 +4,7 @@ extern crate itertools;
extern crate schala_repl;
use itertools::Itertools;
-use schala_repl::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput};
+use schala_repl::{ProgrammingLanguageInterface, EvalOptions, FinishedComputation, UnfinishedComputation};
pub struct Robo {
}
@@ -155,18 +155,16 @@ impl ProgrammingLanguageInterface for Robo {
format!("robo")
}
- fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> LanguageOutput {
- let mut output = LanguageOutput::default();
+ fn execute_pipeline(&mut self, input: &str, _eval_options: &EvalOptions) -> FinishedComputation {
+ let output = UnfinishedComputation::default();
let tokens = match tokenize(input) {
Ok(tokens) => tokens,
Err(e) => {
- output.add_output(format!("Tokenize error: {:?}", e));
- return output;
+ return output.finish(Err(format!("Tokenize error: {:?}", e)));
}
};
- output.add_output(format!("{:?}", tokens));
- output
+ output.finish(Ok(format!("{:?}", tokens)))
}
}
diff --git a/rukka/src/lib.rs b/rukka/src/lib.rs
index 3736bdf..cf470a5 100644
--- a/rukka/src/lib.rs
+++ b/rukka/src/lib.rs
@@ -4,7 +4,7 @@ extern crate itertools;
extern crate schala_repl;
use itertools::Itertools;
-use schala_repl::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput};
+use schala_repl::{ProgrammingLanguageInterface, EvalOptions, UnfinishedComputation, FinishedComputation};
use std::iter::Peekable;
use std::vec::IntoIter;
use std::str::Chars;
@@ -73,12 +73,11 @@ impl ProgrammingLanguageInterface for Rukka {
format!("rukka")
}
- fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> LanguageOutput {
- let mut output = LanguageOutput::default();
+ fn execute_pipeline(&mut self, input: &str, _eval_options: &EvalOptions) -> FinishedComputation {
+ let mut output = UnfinishedComputation::default();
let sexps = match read(input) {
Err(err) => {
- output.add_output(format!("Error: {}", err));
- return output;
+ return output.finish(Err(format!("Error: {}", err)));
},
Ok(sexps) => sexps
};
@@ -89,8 +88,7 @@ impl ProgrammingLanguageInterface for Rukka {
Err(err) => format!("{} Error: {}", i, err),
}
}).intersperse(format!("\n")).collect();
- output.add_output(output_str);
- output
+ output.finish(Ok(output_str))
}
}
diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs
index e28e7b5..9164450 100644
--- a/schala-repl/src/language.rs
+++ b/schala-repl/src/language.rs
@@ -163,12 +163,6 @@ impl TraceArtifact {
}
pub trait ProgrammingLanguageInterface {
- /* old */
- fn evaluate_in_repl(&mut self, _: &str, _: &EvalOptions) -> LanguageOutput {
- LanguageOutput { output: format!("Defunct"), artifacts: vec![], failed: false }
- }
- /* old */
-
fn execute_pipeline(&mut self, _input: &str, _eval_options: &EvalOptions) -> FinishedComputation {
FinishedComputation { artifacts: HashMap::new(), text_output: Err(format!("Execution pipeline not done")) }
}
diff --git a/schala-repl/src/webapp.rs b/schala-repl/src/webapp.rs
index 5d4975e..b4f01a1 100644
--- a/schala-repl/src/webapp.rs
+++ b/schala-repl/src/webapp.rs
@@ -35,8 +35,8 @@ struct Output {
fn interpreter_input(input: Json, generators: State>) -> Json