aboutsummaryrefslogtreecommitdiffstats
path: root/src/read_turtle.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-27 05:39:26 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit7ffa2c0488fcd96c3c12713e5650633eb03e91f7 (patch)
tree9ca96bb40f71b6c37789ae641af75e39a2751c18 /src/read_turtle.c
parent5e4538756d601e6a941c5290777af95ea8848e1a (diff)
downloadserd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.tar.gz
serd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.tar.bz2
serd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.zip
[WIP] Move SerdEnv mutation from writer to reader
Writing having side-effects seems questionable in general, and this prepares things for expanding URIs in the reader.
Diffstat (limited to 'src/read_turtle.c')
-rw-r--r--src/read_turtle.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/read_turtle.c b/src/read_turtle.c
index 22269741..8d9ec78a 100644
--- a/src/read_turtle.c
+++ b/src/read_turtle.c
@@ -14,6 +14,7 @@
#include "turtle.h"
#include "serd/caret.h"
+#include "serd/env.h"
#include "serd/node.h"
#include "serd/reader.h"
#include "serd/sink.h"
@@ -891,6 +892,7 @@ read_turtle_base(SerdReader* const reader, const bool sparql, const bool token)
}
serd_node_zero_pad(uri);
+ TRY(st, serd_env_set_base_uri(reader->env, serd_node_string_view(uri)));
TRY(st, serd_sink_write_base(reader->sink, uri));
read_turtle_ws_star(reader);
@@ -934,6 +936,11 @@ read_turtle_prefixID(SerdReader* const reader,
serd_node_zero_pad(name);
serd_node_zero_pad(uri);
+
+ TRY(st,
+ serd_env_set_prefix(
+ reader->env, serd_node_string_view(name), serd_node_string_view(uri)));
+
st = serd_sink_write_prefix(reader->sink, name, uri);
if (!sparql) {