tb Hex/byte escapes

This commit is contained in:
2025-09-29 23:18:27 +02:00
parent 39981fdbbf
commit fa8a774115
2 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,20 @@ void tz_tokenize(Tokenizer *tz) {
case '\\': c = '\\'; break;
case '\'': c = '\''; break;
case '"': c = '"'; break;
case 'x': {
if (i + 2 < len) {
char buf[3];
buf[0] = tz->str[i + 1];
buf[1] = tz->str[i + 2];
buf[2] = '\0';
char *endp;
uint8_t b = (uint8_t)string_conv_strtoul(buf, &endp, 16);
c = *(char *)&b;
i += 2;
}
} break;
default: c = tz->str[i]; break;
}
if (j + 1 < TZ_MAX_TK) {