From 74ddf7934336f16dcdce688333040d82972817fc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 25 Feb 2023 16:02:00 -0500 Subject: Move read_IRIREF to read_ntriples.c Bit of a weird situation this one, since the rule is from NTriples but serd doesn't actually use it in the NTriples parser (since it uses a stricter one instead). Still, I think it makes sense here, and in practice, makes for a more sensible inlining situation. --- src/read_ntriples.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/read_ntriples.c') diff --git a/src/read_ntriples.c b/src/read_ntriples.c index e5101522..c431574a 100644 --- a/src/read_ntriples.c +++ b/src/read_ntriples.c @@ -178,7 +178,7 @@ read_pct_encoded(SerdReader* const reader, SerdNode* const node) return st; } -SerdStatus +static SerdStatus read_IRIREF_suffix(SerdReader* const reader, SerdNode* const node) { SerdStatus st = SERD_SUCCESS; @@ -239,6 +239,25 @@ read_IRIREF_suffix(SerdReader* const reader, SerdNode* const node) return st; } +// Note that read_IRI is used instead for NTriples, but this is used by Turtle +SerdStatus +read_IRIREF(SerdReader* const reader, SerdNode** const dest) +{ + SerdStatus st = SERD_SUCCESS; + TRY(st, eat_byte_check(reader, '<')); + + if (!(*dest = push_node_head(reader, SERD_URI))) { + return SERD_BAD_STACK; + } + + st = read_IRIREF_suffix(reader, *dest); + if (!tolerate_status(reader, st)) { + return st; + } + + return push_node_tail(reader); +} + /** Read an absolute IRI. -- cgit v1.2.1