diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/n3.c | 8 | ||||
-rw-r--r-- | tests/good/test-local-name-ends-with-dot.ttl | 3 |
3 files changed, 10 insertions, 4 deletions
@@ -1,5 +1,6 @@ serd (0.29.3) unstable; + * Fix parsing local names that end with escaped dots * Add serdi option to write ASCII output * Make serdi guess input syntax from extension if unspecified * Make serdi syntax options case-insensitive @@ -11,7 +12,7 @@ serd (0.29.3) unstable; * Fix building with MSVC * Clean up testing code - -- David Robillard <d@drobilla.net> Sun, 24 Dec 2017 14:14:15 -0500 + -- David Robillard <d@drobilla.net> Thu, 08 Mar 2018 15:42:51 -0500 serd (0.28.0) stable; @@ -495,8 +495,9 @@ read_PLX(SerdReader* reader, Ref dest) static SerdStatus read_PN_LOCAL(SerdReader* reader, Ref dest, bool* ate_dot) { - uint8_t c = peek_byte(reader); - SerdStatus st = SERD_SUCCESS; + uint8_t c = peek_byte(reader); + SerdStatus st = SERD_SUCCESS; + bool trailing_unescaped_dot = false; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ':': case '_': @@ -518,10 +519,11 @@ read_PN_LOCAL(SerdReader* reader, Ref dest, bool* ate_dot) } else if (st != SERD_SUCCESS && (st = read_PN_CHARS(reader, dest))) { break; } + trailing_unescaped_dot = (c == '.'); } SerdNode* const n = deref(reader, dest); - if (n->buf[n->n_bytes - 1] == '.') { + if (trailing_unescaped_dot) { // Ate trailing dot, pop it from stack/node and inform caller --n->n_bytes; serd_stack_pop(&reader->stack, 1); diff --git a/tests/good/test-local-name-ends-with-dot.ttl b/tests/good/test-local-name-ends-with-dot.ttl new file mode 100644 index 00000000..e426876d --- /dev/null +++ b/tests/good/test-local-name-ends-with-dot.ttl @@ -0,0 +1,3 @@ +@prefix eg: <http://example.org/> . + +eg:s eg:p eg:foo\. . |