ZstrProcessEscape
Description
Decode one escape sequence starting at *str. *str must point at the leading \\; on success the pointer is advanced past the consumed escape. Handles single-character escapes (\\n/\\r/\\t/\\b/\\f/\\v/\\a/\\\\/\\"/\\'/\\0), hex escapes (\\xNN), and \\u{...} Unicode escapes that fit in a single byte.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in,out | Address of a Zstr cursor. Advanced past the consumed escape on success. |
Success
Returns the decoded byte; *str is advanced past the escape.
Failure
Returns 0; logs the malformed escape; *str may have been partially advanced.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:2201:
#endif // FEATURE_FLOAT
char ZstrProcessEscape(Zstr *str) {
if (!str || !*str)
return 0;- In
Io.c:2207:
Zstr s = *str;
if (*s != '\\') {
LOG_ERROR("ZstrProcessEscape called on non-escape sequence");
return 0;
}- In
Io.c:2298:
if (*i == '\\') {
const char *curr = i;
char c = ZstrProcessEscape(&curr);
if (c == 0) { // Error in escape sequence
StrDeinit(s);- In
Io.c:2339:
if (*i == '\\') {
const char *curr = i;
char c = ZstrProcessEscape(&curr);
if (c == 0) { // Error in escape sequence
StrDeinit(s);
Last updated on