From 5b35c2a036bfaca30b7c64b76ae43bd2e6bbc68d Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 13 Mar 2019 00:13:39 -0700 Subject: [PATCH] Add new types for ProgrammingLanguageInterface --- schala-repl/src/language.rs | 42 +++++++++++++++++++++++++++++++++++++ schala-repl/src/repl/mod.rs | 11 ++++++++++ 2 files changed, 53 insertions(+) diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index ce2bedd..34af586 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -170,6 +170,48 @@ pub trait ProgrammingLanguageInterface { fn get_doc(&self, _commands: &Vec<&str>) -> Option { None } + + /* ------- */ + // new trait methods + // + // + + fn run_computation(&mut self, _request: ComputationRequest) -> ComputationResponse { + ComputationResponse { + main_output: Err(format!("Computation pipeline not implemented")), + global_output_stats: GlobalOutputStats::default(), + debug_responses: vec![], + } + } + + fn repl_request(&self, repl_request: String) -> String { + format!("Repl request not implemented") + } } +struct ComputationRequest { + pub source: String, + pub debug_requests: Vec, +} +struct ComputationResponse { + pub main_output: Result, + pub global_output_stats: GlobalOutputStats, + pub debug_responses: Vec, +} + +struct DebugRequest { + kind: String, + value: String +} + +struct DebugResponse { + kind: String, + value: String +} + +#[derive(Default, Debug)] +struct GlobalOutputStats { + total_duration: Option, + stage_durations: Option> +} diff --git a/schala-repl/src/repl/mod.rs b/schala-repl/src/repl/mod.rs index 0647765..6f0aef0 100644 --- a/schala-repl/src/repl/mod.rs +++ b/schala-repl/src/repl/mod.rs @@ -103,6 +103,17 @@ impl NewRepl { } } + + + +/* --------------------------------------------- */ + + + + + + + pub struct Repl { options: EvalOptions, languages: Vec>,