hook concat into stl

This commit is contained in:
Aidan Hahn 2021-11-03 23:46:41 -07:00
parent ff5e76ff98
commit 7ca42f18da
No known key found for this signature in database
GPG key ID: 327711E983899316
3 changed files with 6 additions and 3 deletions

View file

@ -36,6 +36,6 @@ pub mod ast {
pub mod stdlib { pub mod stdlib {
pub use crate::stl::{get_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}; pub use crate::append::{get_append};
} }

View file

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
use crate::str::get_echo; use crate::str::{get_echo, get_concat};
use crate::append::get_append; use crate::append::get_append;
use crate::func::{FTable, func_declare}; use crate::func::{FTable, func_declare};
use std::rc::Rc; use std::rc::Rc;
@ -29,6 +29,9 @@ pub fn get_stdlib() -> Result<Rc<RefCell<FTable>>, String> {
if let Some(s) = func_declare(ft.clone(), Rc::new(RefCell::new(get_append()))) { if let Some(s) = func_declare(ft.clone(), Rc::new(RefCell::new(get_append()))) {
return Err(s) return Err(s)
} }
if let Some(s) = func_declare(ft.clone(), Rc::new(RefCell::new(get_concat()))) {
return Err(s)
}
return Ok(ft) return Ok(ft)
} }

View file

@ -43,7 +43,7 @@ pub fn get_echo() -> Function {
Ctr::Seg(c) => string.push_str(ast_as_string(c.clone(), true).as_str()), Ctr::Seg(c) => string.push_str(ast_as_string(c.clone(), true).as_str()),
Ctr::None => () Ctr::None => ()
} }
println!(string) println!("{}", string);
return true; return true;
}) { }) {
eprintln!("circuit loop in echo should not have returned false") eprintln!("circuit loop in echo should not have returned false")