diff options
author | David Robillard <d@drobilla.net> | 2023-02-26 16:57:46 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 6ca012d4fb97c02a2206aebd42aef1f9cd5e1993 (patch) | |
tree | 4e69f79738c2a4e5c4533a173595a280a4e0fa14 /src/read_turtle.c | |
parent | 2d5e6aa234faeb406911ed44f56038dc73f8ff8e (diff) | |
download | serd-6ca012d4fb97c02a2206aebd42aef1f9cd5e1993.tar.gz serd-6ca012d4fb97c02a2206aebd42aef1f9cd5e1993.tar.bz2 serd-6ca012d4fb97c02a2206aebd42aef1f9cd5e1993.zip |
[WIP] Partially resurrect CURIE nodes1.x
Diffstat (limited to 'src/read_turtle.c')
-rw-r--r-- | src/read_turtle.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/read_turtle.c b/src/read_turtle.c index e8e57dfc..6457d608 100644 --- a/src/read_turtle.c +++ b/src/read_turtle.c @@ -393,18 +393,23 @@ read_PrefixedName(SerdReader* const reader, skip_byte(reader, ':'); - // Search environment for the prefix URI - const ZixStringView prefix = serd_node_string_view(dest); - const ZixStringView prefix_uri = serd_env_find_prefix(reader->env, prefix); - if (!prefix_uri.length) { - return r_err(reader, st, "unknown prefix \"%s\"", prefix.data); - } - - // Pop back to the start of the string - serd_stack_pop_to(&reader->stack, string_start_offset); - dest->length = 0U; - dest->type = SERD_URI; - push_bytes(reader, dest, (const uint8_t*)prefix_uri.data, prefix_uri.length); + if ((reader->flags & SERD_READ_CURIES)) { + dest->type = SERD_CURIE; + } else { + // Search environment for the prefix URI + const ZixStringView name = serd_node_string_view(dest); + const ZixStringView uri = serd_env_find_prefix(reader->env, name); + if (!uri.length) { + return r_err(reader, st, "unknown prefix \"%s\"", name.data); + } + + // Pop back to the start of the string and replace it + serd_stack_pop_to(&reader->stack, string_start_offset); + dest->length = 0U; + dest->type = SERD_URI; + push_bytes(reader, dest, (const uint8_t*)uri.data, uri.length); + } + if ((st = read_PN_LOCAL(reader, dest, ate_dot)) > SERD_FAILURE) { return st; } |