+static void
+json_lex_string(struct json_parser *p)
+{
+ const char *raw = ds_cstr(&p->buffer);
+ if (!strchr(raw, '\\')) {
+ json_parser_input_string(p, raw);
+ } else {
+ char *cooked;
+
+ if (json_string_unescape(raw, strlen(raw), &cooked)) {
+ json_parser_input_string(p, cooked);
+ } else {
+ json_error(p, "%s", cooked);
+ }
+
+ free(cooked);
+ }