diff options
author | David Robillard <d@drobilla.net> | 2020-10-10 12:31:29 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:06 -0500 |
commit | dc8831a4ebfee8a61975123f969f737845ad537f (patch) | |
tree | 3cb1e130571ef5808b06683d429e48d90276fd78 | |
parent | fc3e5a0a7c9c64d275fec498f0e80dc02444c12d (diff) | |
download | serd-dc8831a4ebfee8a61975123f969f737845ad537f.tar.gz serd-dc8831a4ebfee8a61975123f969f737845ad537f.tar.bz2 serd-dc8831a4ebfee8a61975123f969f737845ad537f.zip |
Add SERD_READ_EXACT_BLANKS flag
This allows suppressing the blank node ID clashing mechanism to read blank IDs
exactly as they appear in the input, even if they match the scheme used to
generate blank node IDs internally.
-rw-r--r-- | include/serd/serd.h | 5 | ||||
-rw-r--r-- | src/n3.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index b125bb3d..f3402dd1 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -304,8 +304,9 @@ typedef struct { /// Reader options typedef enum { - SERD_READ_LAX = 1u << 0u, ///< Tolerate invalid input where possible - SERD_READ_VARIABLES = 1u << 1u ///< Support variable nodes + SERD_READ_LAX = 1u << 0u, ///< Tolerate invalid input where possible + SERD_READ_VARIABLES = 1u << 1u, ///< Support variable nodes + SERD_READ_EXACT_BLANKS = 1u << 2u, ///< Allow clashes with generated blanks } SerdReaderFlag; /// Bitwise OR of SerdReaderFlag values @@ -1043,7 +1043,7 @@ read_BLANK_NODE_LABEL(SerdReader* reader, SerdNode** dest, bool* ate_dot) *ate_dot = true; } - if (fancy_syntax(reader)) { + if (fancy_syntax(reader) && !(reader->flags & SERD_READ_EXACT_BLANKS)) { if (is_digit(buf[reader->bprefix_len + 1])) { if ((buf[reader->bprefix_len]) == 'b') { buf[reader->bprefix_len] = 'B'; // Prevent clash |