From bf7ce174cdd25827bb1c58b3020a1b808ae17bcc Mon Sep 17 00:00:00 2001 From: minneelyyyy Date: Thu, 17 Oct 2024 14:07:08 -0400 Subject: [PATCH] print now prints strings without parens --- src/executor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/executor.rs b/src/executor.rs index a904c05..d4d4528 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -1,4 +1,4 @@ -use super::{Value, Type, Function, FunctionType}; +use super::{Value, Type, Function}; use super::parser::{ParseTree, ParseError}; use std::collections::HashMap; @@ -369,6 +369,10 @@ where }, ParseTree::StringCast(x) => Ok(Value::String(format!("{}", self.exec(x, locals)?))), ParseTree::Print(x) => match self.exec(x, locals)? { + Value::String(s) => { + writeln!(self.stdout, "{s}").map_err(|e| RuntimeError::IO(e))?; + Ok(Value::Nil) + } x => { writeln!(self.stdout, "{x}").map_err(|e| RuntimeError::IO(e))?; Ok(Value::Nil)