aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-09-23 13:53:02 +0200
committerDavid Robillard <d@drobilla.net>2017-09-23 15:59:22 +0200
commit33442629822d73f289c9e0ef8736f65442de4d31 (patch)
tree97cb8676420694d6ae0527a08ae130af258b03cb /src
parent96d088221b5251f36f55a638afab06e502beca9d (diff)
downloadserd-33442629822d73f289c9e0ef8736f65442de4d31.tar.gz
serd-33442629822d73f289c9e0ef8736f65442de4d31.tar.bz2
serd-33442629822d73f289c9e0ef8736f65442de4d31.zip
Report errors for directives or abbreviations in NTriples or NQuads
Diffstat (limited to 'src')
-rw-r--r--src/reader.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/reader.c b/src/reader.c
index 90f2d3dd..a8339a89 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1293,6 +1293,11 @@ static bool
read_objectList(SerdReader* reader, ReadContext ctx, bool* ate_dot)
{
TRY_RET(read_object(reader, &ctx, true, ate_dot));
+ if (!fancy_syntax(reader) && peek_delim(reader, ',')) {
+ return r_err(reader, SERD_ERR_BAD_SYNTAX,
+ "syntax does not support abbreviation\n");
+ }
+
while (!*ate_dot && eat_delim(reader, ',')) {
TRY_RET(read_object(reader, &ctx, true, ate_dot));
}
@@ -1602,6 +1607,10 @@ read_statement(SerdReader* reader)
reader->eof = true;
return reader->status <= SERD_FAILURE;
case '@':
+ if (!fancy_syntax(reader)) {
+ return r_err(reader, SERD_ERR_BAD_SYNTAX,
+ "syntax does not support directives\n");
+ }
TRY_RET(read_directive(reader));
read_ws_star(reader);
break;
@@ -1610,7 +1619,8 @@ read_statement(SerdReader* reader)
TRY_RET(read_wrappedGraph(reader, &ctx));
read_ws_star(reader);
} else {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "graph in Turtle\n");
+ return r_err(reader, SERD_ERR_BAD_SYNTAX,
+ "syntax does not support graphs\n");
}
break;
default:
@@ -1679,6 +1689,9 @@ read_nquadsDoc(SerdReader* reader)
if (peek_byte(reader) == '\0') {
reader->eof = true;
break;
+ } else if (peek_byte(reader) == '@') {
+ return r_err(reader, SERD_ERR_BAD_SYNTAX,
+ "syntax does not support directives\n");
}
// subject predicate object