diff options
author | David Robillard <d@drobilla.net> | 2023-02-25 16:02:00 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 74ddf7934336f16dcdce688333040d82972817fc (patch) | |
tree | f1c73da4a614dd7e7fd15762b0a772d56a341afe /src/read_ntriples.c | |
parent | 02d56e83931e53e1cde57247c64d56fda3804f77 (diff) | |
download | serd-74ddf7934336f16dcdce688333040d82972817fc.tar.gz serd-74ddf7934336f16dcdce688333040d82972817fc.tar.bz2 serd-74ddf7934336f16dcdce688333040d82972817fc.zip |
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.
Diffstat (limited to 'src/read_ntriples.c')
-rw-r--r-- | src/read_ntriples.c | 21 |
1 files changed, 20 insertions, 1 deletions
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. |