Support for more C escape sequences

This commit is contained in:
Dmitry Stogov 2023-05-22 19:51:19 +03:00
parent 2a400f38ed
commit 2a80257535
2 changed files with 48 additions and 1 deletions

View File

@ -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);

View File

@ -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++;