From 7ca42f18daba0c5a5e46737ecf8ef48a6b58c2cc Mon Sep 17 00:00:00 2001 From: Aidan Hahn Date: Wed, 3 Nov 2021 23:46:41 -0700 Subject: [PATCH] hook concat into stl --- src/lib.rs | 2 +- src/stl.rs | 5 ++++- src/str.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 23bac7b..680eb6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,6 +36,6 @@ pub mod ast { pub mod stdlib { pub use crate::stl::{get_stdlib}; - pub use crate::str::{get_echo}; + pub use crate::str::{get_echo, get_concat}; pub use crate::append::{get_append}; } diff --git a/src/stl.rs b/src/stl.rs index 6a4690b..4f19ecf 100644 --- a/src/stl.rs +++ b/src/stl.rs @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -use crate::str::get_echo; +use crate::str::{get_echo, get_concat}; use crate::append::get_append; use crate::func::{FTable, func_declare}; use std::rc::Rc; @@ -29,6 +29,9 @@ pub fn get_stdlib() -> Result>, String> { if let Some(s) = func_declare(ft.clone(), Rc::new(RefCell::new(get_append()))) { return Err(s) } + if let Some(s) = func_declare(ft.clone(), Rc::new(RefCell::new(get_concat()))) { + return Err(s) + } return Ok(ft) } diff --git a/src/str.rs b/src/str.rs index 44cc125..cf0bb09 100644 --- a/src/str.rs +++ b/src/str.rs @@ -43,7 +43,7 @@ pub fn get_echo() -> Function { Ctr::Seg(c) => string.push_str(ast_as_string(c.clone(), true).as_str()), Ctr::None => () } - println!(string) + println!("{}", string); return true; }) { eprintln!("circuit loop in echo should not have returned false")