all repos — hex @ 7ef2aae8e5540c712fd6a1f2abbedc8f08abbc52

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Fixed backslash processing.
h3rald h3rald@h3rald.com
Wed, 11 Dec 2024 14:55:26 +0100
commit

7ef2aae8e5540c712fd6a1f2abbedc8f08abbc52

parent

dab4cefae4cab723ea9e597e7bfb9b6345438182

2 files changed, 17 insertions(+), 3 deletions(-)

jump to
M scripts/test.hexscripts/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.csrc/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