From 9facb914c72bf4d0473b49faa797cdb5c9faf68b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 29 Mar 2024 06:55:05 -0400 Subject: Fix lax NQuads parsing --- src/n3.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/n3.c') diff --git a/src/n3.c b/src/n3.c index da3862db..6684fae8 100644 --- a/src/n3.c +++ b/src/n3.c @@ -1783,13 +1783,17 @@ read_nquads_statement(SerdReader* const reader) SerdStatus read_nquadsDoc(SerdReader* const reader) { - SerdStatus st = SERD_SUCCESS; - - while (!reader->source.eof && !st) { - st = read_nquads_statement(reader); + while (!reader->source.eof) { + const SerdStatus st = read_nquads_statement(reader); + if (st > SERD_FAILURE) { + if (reader->strict) { + return st; + } + serd_reader_skip_until_byte(reader, '\n'); + } } - return st; + return SERD_SUCCESS; } #if defined(__clang__) && __clang_major__ >= 10 -- cgit v1.2.1