From 2a80257535428c66eb1d5e04ed056925b6af92ae Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 22 May 2023 19:51:19 +0300 Subject: [PATCH] Support for more C escape sequences --- ir_aarch64.dasc | 24 ++++++++++++++++++++++++ ir_x86.dasc | 25 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ir_aarch64.dasc b/ir_aarch64.dasc index db0e852..2df1a7c 100644 --- a/ir_aarch64.dasc +++ b/ir_aarch64.dasc @@ -5065,6 +5065,24 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr) if (str[i+1] == '\\') { i++; c = '\\'; + } else if (str[i+1] == '\'') { + i++; + c = '\''; + } else if (str[i+1] == '"') { + i++; + c = '"'; + } else if (str[i+1] == 'a') { + i++; + c = '\a'; + } else if (str[i+1] == 'b') { + i++; + c = '\b'; + } else if (str[i+1] == 'e') { + i++; + c = '\e'; + } else if (str[i+1] == 'f') { + i++; + c = '\f'; } else if (str[i+1] == 'n') { i++; c = '\n'; @@ -5074,6 +5092,12 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr) } else if (str[i+1] == 't') { i++; c = '\t'; + } else if (str[i+1] == 'v') { + i++; + c = '\v'; + } else if (str[i+1] == '?') { + i++; + c = 0x3f; } } w |= c << (8 * j); diff --git a/ir_x86.dasc b/ir_x86.dasc index 42b1891..da069b7 100644 --- a/ir_x86.dasc +++ b/ir_x86.dasc @@ -8548,6 +8548,24 @@ next_block:; if (str[i+1] == '\\') { i++; c = '\\'; + } else if (str[i+1] == '\'') { + i++; + c = '\''; + } else if (str[i+1] == '"') { + i++; + c = '"'; + } else if (str[i+1] == 'a') { + i++; + c = '\a'; + } else if (str[i+1] == 'b') { + i++; + c = '\b'; + } else if (str[i+1] == 'e') { + i++; + c = '\e'; + } else if (str[i+1] == 'f') { + i++; + c = '\f'; } else if (str[i+1] == 'n') { i++; c = '\n'; @@ -8557,8 +8575,13 @@ next_block:; } else if (str[i+1] == 't') { i++; c = '\t'; + } else if (str[i+1] == 'v') { + i++; + c = '\v'; + } else if (str[i+1] == '?') { + i++; + c = 0x3f; } - } |.byte c i++;