aboutsummaryrefslogtreecommitdiffstats
path: root/src/n3.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-03-08 15:43:40 -0500
committerDavid Robillard <d@drobilla.net>2018-03-08 15:43:59 -0500
commitf124a075ccc31285250872f93e9ff16ea865d4eb (patch)
tree2a0d6f7d3341782605674336b1a6e60b1bef63a2 /src/n3.c
parentb336b464087f5c2199999020ab810be9977f6d7c (diff)
downloadserd-f124a075ccc31285250872f93e9ff16ea865d4eb.tar.gz
serd-f124a075ccc31285250872f93e9ff16ea865d4eb.tar.bz2
serd-f124a075ccc31285250872f93e9ff16ea865d4eb.zip
Fix parsing local names that end with escaped dots
Diffstat (limited to 'src/n3.c')
-rw-r--r--src/n3.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/n3.c b/src/n3.c
index 0c78de1e..b35031bb 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -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);