Add \0 string escape

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-10-19 20:01:28 -07:00
parent 283eaa1ebe
commit 7bce6f8e23
2 changed files with 2 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ fn unescape(s: &str) -> String {
.replace("\\\"", "\"")
.replace("\\\'", "\'")
.replace("\\\\", "\\")
.replace("0", "\0")
}
static BIN_OP_NAMES: LazyLock<HashMap<TokenKind, &'static str>> = LazyLock::new(|| {

View File

@@ -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