Nest escape handling under N_STRING2

This commit is contained in:
2025-06-23 13:06:12 -04:00
parent 7ae2ef5443
commit 4a9dfe0b45

View File

@@ -1102,7 +1102,6 @@ inline PRESERVE_NONE WeaselJsonStatus n_string2(Parser3 *self, char *buf,
MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd); MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd);
case '\\': case '\\':
++buf; ++buf;
self->pop();
if (auto s = self->push({N_STRING_FOLLOWING_ESCAPE})) { if (auto s = self->push({N_STRING_FOLLOWING_ESCAPE})) {
return s; return s;
} }
@@ -1127,15 +1126,12 @@ inline PRESERVE_NONE WeaselJsonStatus n_string_following_escape(Parser3 *self,
case 't': case 't':
*self->writeBuf++ = tables.unescape[uint8_t(*buf++)]; *self->writeBuf++ = tables.unescape[uint8_t(*buf++)];
self->pop(); self->pop();
if (auto s = self->push({N_STRING2})) {
return s;
}
MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd); MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd);
case 'u': case 'u':
++buf; ++buf;
self->utf8Codepoint = 0; self->utf8Codepoint = 0;
self->pop(); self->pop();
if (auto s = self->push({T_HEX, T_HEX, T_HEX, T_HEX2, N_STRING2})) { if (auto s = self->push({T_HEX, T_HEX, T_HEX, T_HEX2})) {
return s; return s;
} }
MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd); MUSTTAIL return Parser3::keepGoing(self, buf, bufEnd);