From 7bce6f8e234b70237b82b9ac013f96dfae01bbb7 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Sat, 19 Oct 2024 20:01:28 -0700 Subject: [PATCH] Add \0 string escape Signed-off-by: Alek Ratzloff --- src/compiler.rs | 1 + src/parser.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler.rs b/src/compiler.rs index 3abfcef..4e07655 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -37,6 +37,7 @@ fn unescape(s: &str) -> String { .replace("\\\"", "\"") .replace("\\\'", "\'") .replace("\\\\", "\\") + .replace("0", "\0") } static BIN_OP_NAMES: LazyLock> = LazyLock::new(|| { diff --git a/src/parser.rs b/src/parser.rs index f9723c7..de0e0a4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -45,7 +45,7 @@ const NUMBER_START_CHARS: &str = "0123456789"; const NUMBER_CHARS: &str = "0123456789."; const NUMBER_HEX_CHARS: &str = "0123456789ABCDEFabcdef"; const STRING_START_CHARS: &str = "'\""; -const STRING_ESCAPES: &str = "nrt\\\"'"; +const STRING_ESCAPES: &str = "nrt\\\"'0"; //////////////////////////////////////////////////////////////////////////////// // Lexer