From b603e1e6226c6c07319a51f2ea1cd4db5963b4c7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 25 Feb 2021 11:16:13 -0500 Subject: WIP: Leave statement cursor at the start of literals --- src/n3.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/n3.c b/src/n3.c index 570ba91d..65ed03ab 100644 --- a/src/n3.c +++ b/src/n3.c @@ -19,6 +19,7 @@ #include "reader.h" #include "serd_internal.h" #include "stack.h" +#include "statement.h" #include "string_utils.h" #include "uri_utils.h" @@ -1081,6 +1082,7 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot) static const size_t XSD_BOOLEAN_LEN = 40; const size_t orig_stack_size = reader->stack.size; + SerdCursor orig_cursor = reader->source.cur; SerdStatus ret = SERD_FAILURE; bool simple = (ctx->subject != 0); @@ -1134,6 +1136,7 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot) break; case '\"': case '\'': + ++orig_cursor.col; ret = read_literal(reader, &o, ate_dot); break; default: @@ -1166,7 +1169,14 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot) } if (!ret && emit && simple && o) { - ret = emit_statement(reader, *ctx, o); + serd_node_zero_pad(o); + + const SerdStatement statement = { + {ctx->subject, ctx->predicate, o, ctx->graph}, &orig_cursor}; + + ret = serd_sink_write_statement(reader->sink, *ctx->flags, &statement); + + *ctx->flags = 0; } else if (!ret && !emit) { ctx->object = o; return SERD_SUCCESS; -- cgit v1.2.1