aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-01-06 14:45:21 -0500
committerDavid Robillard <d@drobilla.net>2017-01-06 18:12:13 -0500
commit52590dbeb23100320417d6f72e20fadf215479e5 (patch)
tree8ec4edc72ee9beca1ed29531d6c9bbb90b6b8b7f /src/reader.c
parent5591d2367d540ffe202ebc71ffcc6ced47ea6962 (diff)
downloadserd-52590dbeb23100320417d6f72e20fadf215479e5.tar.gz
serd-52590dbeb23100320417d6f72e20fadf215479e5.tar.bz2
serd-52590dbeb23100320417d6f72e20fadf215479e5.zip
Tidy
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/reader.c b/src/reader.c
index 3916d4c5..edeb8956 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -57,7 +57,7 @@ typedef struct {
Ref predicate;
Ref object;
Ref datatype;
- Ref language;
+ Ref lang;
SerdStatementFlags* flags;
} ReadContext;
@@ -1263,7 +1263,7 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot)
} else if (ret && !emit) {
ctx->object = o;
ctx->datatype = datatype;
- ctx->language = lang;
+ ctx->lang = lang;
return true;
}
@@ -1600,25 +1600,16 @@ read_nquadsDoc(SerdReader* reader)
return !reader->error;
}
- // subject
- if (!(ctx.subject = read_subject(reader, ctx, &ctx.subject, &nested))) {
+ // subject predicate object
+ if (!(ctx.subject = read_subject(reader, ctx, &ctx.subject, &nested)) ||
+ !read_ws_star(reader) ||
+ !(ctx.predicate = read_IRIREF(reader)) ||
+ !read_ws_star(reader) ||
+ !read_object(reader, &ctx, false, &ate_dot)) {
return false;
}
- // predicate
- TRY_RET(read_ws_star(reader));
- if (!(ctx.predicate = read_IRIREF(reader))) {
- return false;
- }
-
- // object
- TRY_RET(read_ws_star(reader));
- if (!read_object(reader, &ctx, false, &ate_dot)) {
- return false;
- }
-
- if (!ate_dot) {
- // graphLabel?
+ if (!ate_dot) { // graphLabel?
TRY_RET(read_ws_star(reader));
switch (peek_byte(reader)) {
case '.':
@@ -1637,9 +1628,9 @@ read_nquadsDoc(SerdReader* reader)
eat_byte_check(reader, '.');
}
- TRY_RET(emit_statement(reader, ctx, ctx.object, ctx.datatype, ctx.language));
+ TRY_RET(emit_statement(reader, ctx, ctx.object, ctx.datatype, ctx.lang));
pop_node(reader, ctx.graph);
- pop_node(reader, ctx.language);
+ pop_node(reader, ctx.lang);
pop_node(reader, ctx.datatype);
pop_node(reader, ctx.object);
}