From d63379e7777b1269ad4e8e075c971503b1732c30 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 25 Jun 2023 19:29:39 +0400 Subject: [PATCH] Add parser escape sequences --- src/core/parse.c | 8 ++++++++ src/core/pp.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/core/parse.c b/src/core/parse.c index 8358a996c..40ccfbf2a 100644 --- a/src/core/parse.c +++ b/src/core/parse.c @@ -259,6 +259,14 @@ static int checkescape(uint8_t c) { return '\f'; case 'v': return '\v'; + case 'a': + return '\a'; + case 'b': + return '\b'; + case '\'': + return '\''; + case '?': + return '?'; case 'e': return 27; case '"': diff --git a/src/core/pp.c b/src/core/pp.c index 7f20a48aa..9c897a0b4 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -152,6 +152,12 @@ static void janet_escape_string_impl(JanetBuffer *buffer, const uint8_t *str, in case '\v': janet_buffer_push_bytes(buffer, (const uint8_t *)"\\v", 2); break; + case '\a': + janet_buffer_push_bytes(buffer, (const uint8_t *)"\\a", 2); + break; + case '\b': + janet_buffer_push_bytes(buffer, (const uint8_t *)"\\b", 2); + break; case 27: janet_buffer_push_bytes(buffer, (const uint8_t *)"\\e", 2); break;