diff options
Diffstat (limited to 'src/n3.c')
-rw-r--r-- | src/n3.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -937,7 +937,7 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, SerdNode** dest) bool empty; eat_byte_safe(reader, '['); if ((empty = peek_delim(reader, ']'))) { - *ctx.flags |= (subject) ? SERD_EMPTY_S : SERD_EMPTY_O; + *ctx.flags |= (subject) ? SERD_EMPTY_S : SERD_ANON_O_BEGIN; } else { *ctx.flags |= (subject) ? SERD_ANON_S_BEGIN : SERD_ANON_O_BEGIN; if (peek_delim(reader, '=')) { @@ -959,21 +959,19 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, SerdNode** dest) ctx.subject = *dest; if (!empty) { - *ctx.flags &= ~(SERD_LIST_CONT); - if (!subject) { - *ctx.flags |= SERD_ANON_CONT; - } bool ate_dot_in_list = false; read_predicateObjectList(reader, ctx, &ate_dot_in_list); if (ate_dot_in_list) { return r_err(reader, SERD_ERR_BAD_SYNTAX, "`.' inside blank\n"); } read_ws_star(reader); - if (reader->sink->end) { - reader->sink->end(reader->sink->handle, *dest); - } *ctx.flags = old_flags; } + + if (reader->sink->end && (!subject || !empty)) { + reader->sink->end(reader->sink->handle, *dest); + } + return (eat_byte_check(reader, ']') == ']') ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX; } @@ -1130,7 +1128,6 @@ end_collection(SerdReader* reader, SerdNode* n2, SerdStatus st) { - *ctx.flags &= ~SERD_LIST_CONT; if (!st) { eat_byte_safe(reader, ')'); } @@ -1148,7 +1145,6 @@ read_collection(SerdReader* reader, ReadContext ctx, SerdNode** dest) // subject predicate _:head *ctx.flags |= (end ? 0 : SERD_LIST_O_BEGIN); TRY(st, emit_statement(reader, ctx, *dest)); - *ctx.flags |= SERD_LIST_CONT; } else { *ctx.flags |= (end ? 0 : SERD_LIST_S_BEGIN); } @@ -1188,7 +1184,6 @@ read_collection(SerdReader* reader, ReadContext ctx, SerdNode** dest) } // _:node rdf:rest _:rest - *ctx.flags |= SERD_LIST_CONT; ctx.predicate = reader->rdf_rest; TRY(st, emit_statement(reader, ctx, (end ? reader->rdf_nil : rest))); |