aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/reader.c16
2 files changed, 17 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f35745fa..ed213940 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,13 @@
serd (0.29.3) unstable;
+ * Add basic error tolerant parsing for line-based formats
* Support strict parsing of prefixed names
* Report errors for all failing test cases
* Use more efficient stack allocation and growth policies
* Add NTriples test suite
* Fix building with MSVC
- -- David Robillard <d@drobilla.net> Sat, 23 Sep 2017 15:03:52 +0200
+ -- David Robillard <d@drobilla.net> Sat, 23 Sep 2017 20:33:19 +0200
serd (0.28.0) stable;
diff --git a/src/reader.c b/src/reader.c
index afaf411e..9e30f9c1 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1669,11 +1669,25 @@ read_statement(SerdReader* reader)
return ret;
}
+static void
+skip_until(SerdReader* reader, uint8_t byte)
+{
+ for (uint8_t c = 0; (c = peek_byte(reader)) && c != byte;) {
+ eat_byte_safe(reader, c);
+ }
+}
+
static bool
read_turtleTrigDoc(SerdReader* reader)
{
while (!reader->eof) {
- TRY_RET(read_statement(reader));
+ if (!read_statement(reader)) {
+ if (reader->strict) {
+ return 0;
+ }
+ skip_until(reader, '\n');
+ reader->status = SERD_ERR_BAD_SYNTAX;
+ }
}
return reader->status <= SERD_FAILURE;
}