diff options
author | David Robillard <d@drobilla.net> | 2018-06-03 22:23:28 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-11-25 22:12:47 +0100 |
commit | afab9f8037f9281bcef6ee4201061aa234eeadac (patch) | |
tree | 2a19a8bbf85a02b3652c43c50a27f316143ce3ab /src | |
parent | 47e35393464abc9d92f92974ecef173c7e1b372f (diff) | |
download | serd-afab9f8037f9281bcef6ee4201061aa234eeadac.tar.gz serd-afab9f8037f9281bcef6ee4201061aa234eeadac.tar.bz2 serd-afab9f8037f9281bcef6ee4201061aa234eeadac.zip |
Add cursor to statement
This allows the file and position of statements to be used in sinks, for
example for more helpful error reporting outside the parser.
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.c | 3 | ||||
-rw-r--r-- | src/sink.c | 3 | ||||
-rw-r--r-- | src/statement.c | 6 | ||||
-rw-r--r-- | src/statement.h | 3 |
4 files changed, 12 insertions, 3 deletions
diff --git a/src/reader.c b/src/reader.c index b34f5a0f..9da58e79 100644 --- a/src/reader.c +++ b/src/reader.c @@ -123,7 +123,8 @@ emit_statement(SerdReader* reader, ReadContext ctx, SerdNode* o) serd_node_zero_pad(o); const SerdStatement statement = { - { ctx.subject, ctx.predicate, o, graph } + { ctx.subject, ctx.predicate, o, graph }, + &reader->source.cur }; const SerdStatus st = reader->sink->statement( @@ -48,7 +48,8 @@ serd_sink_write_nodes(const SerdSink* sink, const SerdNode* object, const SerdNode* graph) { - const SerdStatement statement = { { subject, predicate, object, graph } }; + const SerdStatement statement = { { subject, predicate, object, graph }, + NULL }; return sink->statement(sink->handle, flags, &statement); } diff --git a/src/statement.c b/src/statement.c index 5e2802eb..24440a38 100644 --- a/src/statement.c +++ b/src/statement.c @@ -45,3 +45,9 @@ serd_statement_get_graph(const SerdStatement* statement) { return statement->nodes[SERD_GRAPH]; } + +const SerdCursor* +serd_statement_get_cursor(const SerdStatement* statement) +{ + return statement->cursor; +} diff --git a/src/statement.h b/src/statement.h index 7b5d752d..7c8384e9 100644 --- a/src/statement.h +++ b/src/statement.h @@ -27,7 +27,8 @@ typedef const SerdNode* SerdQuad[4]; struct SerdStatementImpl { - SerdQuad nodes; + SerdQuad nodes; + SerdCursor* cursor; }; #endif // SERD_STATEMENT_H |