aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-08-09 16:54:55 -0400
committerDavid Robillard <d@drobilla.net>2016-08-09 16:54:55 -0400
commitb4ba568b24c43c64a758471b36c28923a5adafaa (patch)
tree9597fc681fe929fc42f7ce3a920e24b50bd9a064
parent25781975fc0783a14f76bc60c15df9d3fcb0f8b0 (diff)
downloadserd-b4ba568b24c43c64a758471b36c28923a5adafaa.tar.gz
serd-b4ba568b24c43c64a758471b36c28923a5adafaa.tar.bz2
serd-b4ba568b24c43c64a758471b36c28923a5adafaa.zip
Report missing statement separator errors
-rw-r--r--NEWS3
-rw-r--r--src/reader.c6
-rw-r--r--tests/bad/bad-missing-semi.ttl3
3 files changed, 11 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 0b22d3e0..1fb089e2 100644
--- a/NEWS
+++ b/NEWS
@@ -3,12 +3,13 @@ serd (0.23.0) unstable;
* Add serd_node_new_relative_uri()
* Fix construction and comparison of URIs with UTF-8 characters
* Report I/O errors with message and return appropriate status code
+ * Report missing statement separator errors
* Fix potential out of bounds read
* Fix unaligned memory access, undefined behaviour which breaks on ARM
* Fix documentation generation
* Update serdi man page
- -- David Robillard <d@drobilla.net> Sun, 10 Jul 2016 18:55:37 -0400
+ -- David Robillard <d@drobilla.net> Tue, 09 Aug 2016 16:54:23 -0400
serd (0.22.0) stable;
diff --git a/src/reader.c b/src/reader.c
index 59e0dd2e..0cfa1575 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1245,6 +1245,7 @@ read_predicateObjectList(SerdReader* reader, ReadContext ctx, bool* ate_dot)
return true;
}
+ bool ate_semi = false;
do {
read_ws_star(reader);
switch (c = peek_byte(reader)) {
@@ -1254,8 +1255,13 @@ read_predicateObjectList(SerdReader* reader, ReadContext ctx, bool* ate_dot)
return true;
case ';':
eat_byte_safe(reader, c);
+ ate_semi = true;
}
} while (c == ';');
+
+ if (!ate_semi) {
+ return r_err(reader, SERD_ERR_BAD_SYNTAX, "missing ';' or '.'\n");
+ }
}
pop_node(reader, ctx.predicate);
diff --git a/tests/bad/bad-missing-semi.ttl b/tests/bad/bad-missing-semi.ttl
new file mode 100644
index 00000000..f8838805
--- /dev/null
+++ b/tests/bad/bad-missing-semi.ttl
@@ -0,0 +1,3 @@
+@prefix a: <http://example.org/> .
+a:s1 a:p1 a:o1
+a:s2 a:p2 a:o2 .