From 47e8ef315c8b3102ee744e23947572378d942e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=B6=E5=A1=9A=E5=A4=AA=E6=99=BA?= Date: Fri, 3 Jan 2025 14:33:07 +0900 Subject: [PATCH] Update main.rs --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index bb7aee9..0ec825e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1252,7 +1252,12 @@ impl Type { fn get_symbol(&self) -> String { match self { Type::Symbol(s) => s.to_string(), - Type::Text(s) => format!("\"{s}\""), + Type::Text(text) => format!( + "\"{}\"", + text.replace("'", "\\'") + .replace("\"", "\\\"") + .replace("`", "\\`") + ), Type::Number(n) => n.to_string(), Type::Null => "null".to_string(), Type::Function(Function::BuiltIn(obj)) => format!("λx.{obj:?}"),