From 2e800457508ee4b667bc2c615485c39009a78f14 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 7 Mar 2018 22:07:13 -0800 Subject: [PATCH] Rename ReplOutput -> LanguageOutput --- schala-lib/src/language.rs | 6 +++--- schala-lib/src/lib.rs | 6 ++++-- source_files/schala/first.schala | 2 ++ src/maaru_lang/mod.rs | 6 +++--- src/robo_lang/mod.rs | 6 +++--- src/rukka_lang/mod.rs | 6 +++--- src/schala_lang/mod.rs | 6 +++--- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/schala-lib/src/language.rs b/schala-lib/src/language.rs index 3123721..f554b4b 100644 --- a/schala-lib/src/language.rs +++ b/schala-lib/src/language.rs @@ -16,12 +16,12 @@ pub struct EvalOptions { } #[derive(Debug, Default)] -pub struct ReplOutput { +pub struct LanguageOutput { output: String, artifacts: Vec } -impl ReplOutput { +impl LanguageOutput { pub fn add_artifact(&mut self, artifact: TraceArtifact) { self.artifacts.push(artifact); } @@ -90,7 +90,7 @@ impl TraceArtifact { } pub trait ProgrammingLanguageInterface { - fn evaluate_in_repl(&mut self, input: &str, eval_options: &EvalOptions) -> ReplOutput; + fn evaluate_in_repl(&mut self, input: &str, eval_options: &EvalOptions) -> LanguageOutput; fn get_language_name(&self) -> String; fn get_source_file_suffix(&self) -> String; fn compile(&mut self, _input: &str) -> LLVMCodeString { diff --git a/schala-lib/src/lib.rs b/schala-lib/src/lib.rs index 5b55adf..260183a 100644 --- a/schala-lib/src/lib.rs +++ b/schala-lib/src/lib.rs @@ -32,7 +32,7 @@ pub mod llvm_wrap; include!(concat!(env!("OUT_DIR"), "/static.rs")); -pub use language::{ProgrammingLanguageInterface, EvalOptions, ReplOutput, TraceArtifact, LLVMCodeString}; +pub use language::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, LanguageOutput, LLVMCodeString}; pub type PLIGenerator = Box Box + Send + Sync>; pub fn schala_main(generators: Vec) { @@ -110,7 +110,9 @@ fn run_noninteractive(filename: &str, languages: Vec ProgrammingLanguageInterface for Maaru<'a> { format!("maaru") } - fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> ReplOutput { - let mut output = ReplOutput::default(); + fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> LanguageOutput { + let mut output = LanguageOutput::default(); let tokens = match tokenizer::tokenize(input) { Ok(tokens) => { diff --git a/src/robo_lang/mod.rs b/src/robo_lang/mod.rs index d37404c..73be23a 100644 --- a/src/robo_lang/mod.rs +++ b/src/robo_lang/mod.rs @@ -1,5 +1,5 @@ use itertools::Itertools; -use schala_lib::{ProgrammingLanguageInterface, EvalOptions, ReplOutput}; +use schala_lib::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput}; pub struct Robo { } @@ -150,8 +150,8 @@ impl ProgrammingLanguageInterface for Robo { format!("robo") } - fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> ReplOutput { - let mut output = ReplOutput::default(); + fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> LanguageOutput { + let mut output = LanguageOutput::default(); let tokens = match tokenize(input) { Ok(tokens) => tokens, Err(e) => { diff --git a/src/rukka_lang/mod.rs b/src/rukka_lang/mod.rs index 499fb24..0118063 100644 --- a/src/rukka_lang/mod.rs +++ b/src/rukka_lang/mod.rs @@ -1,5 +1,5 @@ use itertools::Itertools; -use schala_lib::{ProgrammingLanguageInterface, EvalOptions, ReplOutput}; +use schala_lib::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput}; use std::iter::Peekable; use std::vec::IntoIter; use std::str::Chars; @@ -68,8 +68,8 @@ impl ProgrammingLanguageInterface for Rukka { format!("rukka") } - fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> ReplOutput { - let mut output = ReplOutput::default(); + fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> LanguageOutput { + let mut output = LanguageOutput::default(); let sexps = match read(input) { Err(err) => { output.add_output(format!("Error: {}", err)); diff --git a/src/schala_lang/mod.rs b/src/schala_lang/mod.rs index 5ebadcc..0bbc76e 100644 --- a/src/schala_lang/mod.rs +++ b/src/schala_lang/mod.rs @@ -1,5 +1,5 @@ use itertools::Itertools; -use schala_lib::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, ReplOutput}; +use schala_lib::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, LanguageOutput}; macro_rules! bx { ($e:expr) => { Box::new($e) } @@ -37,8 +37,8 @@ impl ProgrammingLanguageInterface for Schala { format!("schala") } - fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> ReplOutput { - let mut output = ReplOutput::default(); + fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> LanguageOutput { + let mut output = LanguageOutput::default(); let tokens = tokenizing::tokenize(input); if options.debug_tokens { let token_string = tokens.iter().map(|t| format!("{:?}", t.token_type, t.offset.0, t.offset.1)).join(", ");