Fixed backslash processing.
h3rald h3rald@h3rald.com
Wed, 11 Dec 2024 14:55:26 +0100
2 files changed,
17 insertions(+),
3 deletions(-)
M
scripts/test.hex
→
scripts/test.hex
@@ -218,6 +218,8 @@ (((0x2) 0x2 get) (error) try "Index out of range" ==)
((() 0x0 get) (error) try "Index out of range" ==) ((0x4 0x4 get) (error) try "Symbol 'get' requires a quotation or a string" ==) ;120 + + ("a/b/c" "t-path" : (t-path "/" index 0x0 >=) (t-path "/" "\\" replace "t-path" :) while t-path "a\\b\\c" == "t-path" #) ) "tests" :
M
src/hex.c
→
src/hex.c
@@ -214,9 +214,9 @@ break;
case 'v': *dst++ = '\v'; break; - case '\\': - *dst++ = '\\'; - break; + // case '\\': + // *dst++ = '\\'; + // break; case '\"': *dst++ = '\"'; break;@@ -628,6 +628,12 @@ ptr += 2;
len++; position->column += 2; } + if (*ptr == '\\' && *(ptr + 1) == '\\') + { + ptr += 2; + len++; + position->column += 2; + } else if (*ptr == '"') { break;@@ -666,6 +672,12 @@ {
if (*ptr == '\\' && *(ptr + 1) == '"') { *dst++ = '"'; + ptr += 2; + } + if (*ptr == '\\' && *(ptr + 1) == '\\') + { + *dst++ = '\\'; + *dst++ = '\\'; ptr += 2; } else