diff options
author | David Robillard <d@drobilla.net> | 2019-04-28 17:54:00 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | 2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc (patch) | |
tree | 9fccf392d6eb69fb11b9bc2bbe24cf35eaa63ab2 /include/serd | |
parent | 01daa5914169d57a6a6c4925d3f8d76db80a2bd8 (diff) | |
download | serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.tar.gz serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.tar.bz2 serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.zip |
Replace serd_reader_set_strict() with SerdReaderFlags
This makes reader options extensible and should hopefully prevent the need for
grafting on more similar functions in the future.
Diffstat (limited to 'include/serd')
-rw-r--r-- | include/serd/serd.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index c6300721..ba1b4ddc 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -293,6 +293,14 @@ typedef struct { SerdStringView fragment; ///< Fragment } SerdURIView; +/// Reader options +typedef enum { + SERD_READ_LAX = 1u << 0u ///< Tolerate invalid input where possible +} SerdReaderFlag; + +/// Bitwise OR of SerdReaderFlag values +typedef uint32_t SerdReaderFlags; + /** Writer style options. @@ -305,7 +313,7 @@ typedef enum { SERD_WRITE_UNQUALIFIED = 1u << 1u, ///< Do not shorten URIs into CURIEs SERD_WRITE_UNRESOLVED = 1u << 2u, ///< Do not make URIs relative SERD_WRITE_TERSE = 1u << 3u, ///< Write terser output without newlines - SERD_WRITE_STRICT = 1u << 4u ///< Abort with error on lossy output + SERD_WRITE_LAX = 1u << 4u ///< Tolerate lossy output } SerdWriterFlag; /// Bitwise OR of SerdWriterFlag values @@ -1155,22 +1163,12 @@ SERD_API SerdReader* SERD_ALLOCATED serd_reader_new(SerdWorld* SERD_NONNULL world, SerdSyntax syntax, + SerdReaderFlags flags, const SerdSink* SERD_NONNULL sink, size_t stack_size); /** - Enable or disable strict parsing - - The reader is non-strict (lax) by default, which will tolerate URIs with - invalid characters. Setting strict will fail when parsing such files. An - error is printed for invalid input in either case. -*/ -SERD_API -void -serd_reader_set_strict(SerdReader* SERD_NONNULL reader, bool strict); - -/** - Set a prefix to be added to all blank node identifiers. + Set a prefix to be added to all blank node identifiers This is useful when multiple files are to be parsed into the same output (a model or a file). Since Serd preserves blank node IDs, this could cause |