aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-17 05:50:07 +0000
committerDavid Robillard <d@drobilla.net>2014-12-17 05:50:07 +0000
commit96894224c76b371a7198dc18b9f6be78e7eb1b97 (patch)
tree97736b88ba1487516a8c28f0c133a51efc35429f /src/reader.c
parentb0de506d2d55627ffc4120a25d1016b1a59849bb (diff)
downloadserd-96894224c76b371a7198dc18b9f6be78e7eb1b97.tar.gz
serd-96894224c76b371a7198dc18b9f6be78e7eb1b97.tar.bz2
serd-96894224c76b371a7198dc18b9f6be78e7eb1b97.zip
Add support for Turtle named inline nodes extension.
git-svn-id: http://svn.drobilla.net/serd/trunk@482 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/reader.c b/src/reader.c
index d5c29c04..012dcb43 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1072,6 +1072,21 @@ blank_id(SerdReader* reader)
return ref;
}
+static Ref
+read_blankName(SerdReader* reader)
+{
+ eat_byte_safe(reader, '=');
+ if (eat_byte_check(reader, '=') != '=') {
+ return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected `='\n");
+ }
+
+ Ref subject = 0;
+ bool ate_dot = false;
+ read_ws_star(reader);
+ read_iri(reader, &subject, &ate_dot);
+ return subject;
+}
+
static bool
read_blank(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest, bool* ate_dot)
{
@@ -1086,9 +1101,17 @@ read_blank(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest, bool* a
*ctx.flags |= (subject) ? SERD_EMPTY_S : SERD_EMPTY_O;
} else {
*ctx.flags |= (subject) ? SERD_ANON_S_BEGIN : SERD_ANON_O_BEGIN;
+ if (peek_delim(reader, '=')) {
+ if (!(*dest = read_blankName(reader)) ||
+ !eat_delim(reader, ';')) {
+ return false;
+ }
+ }
}
- *dest = blank_id(reader);
+ if (!*dest) {
+ *dest = blank_id(reader);
+ }
if (ctx.subject) {
TRY_RET(emit_statement(reader, ctx, *dest, 0, 0));
}