diff --git a/src/jv_parse.c b/src/jv_parse.c index fe780540..649cfae4 100644 --- a/src/jv_parse.c +++ b/src/jv_parse.c @@ -785,9 +785,9 @@ jv jv_parser_next(struct jv_parser* p) { jv_free(value); if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) { // Skip to the next RS - p->st = JV_PARSER_WAITING_FOR_RS; value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column); parser_reset(p); + p->st = JV_PARSER_WAITING_FOR_RS; return value; } value = make_error(p, "%s at line %d, column %d", msg, p->line, p->column); diff --git a/tests/shtest b/tests/shtest index 8f3e0f63..9b27dc2f 100755 --- a/tests/shtest +++ b/tests/shtest @@ -87,6 +87,14 @@ EOF printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"false\n\036null'|$VALGRIND $Q $JQ -ces --seq '. == [2,3,[4,5],true,"ab",{},null]' > /dev/null 2> $d/out cmp $d/out $d/expected +# A syntax error skips the rest of the text, up to the next RS +cat > $d/expected < /dev/null 2> $d/out +cmp $d/out $d/expected + # Note that here jq sees no inputs at all but it still succeeds because # --seq ignores parse errors cat > $d/expected <