From 2bb0250be8297cc950d0036915ecdf61ab6f3700 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 31 Jul 2021 16:43:50 -0400 Subject: Factor out and expose prefixed name predicates Towards using these in the writer to escape names more precisely. --- src/ntriples.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ntriples.h (limited to 'src/ntriples.h') diff --git a/src/ntriples.h b/src/ntriples.h new file mode 100644 index 00000000..566a8ddc --- /dev/null +++ b/src/ntriples.h @@ -0,0 +1,36 @@ +/* + Copyright 2011-2021 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef SERD_NTRIPLES_H +#define SERD_NTRIPLES_H + +#include "string_utils.h" + +#include + +static inline bool +is_PN_CHARS_BASE(const int c) +{ + return (is_alpha(c) || in_range(c, 0x000C0u, 0x000D6u) || + in_range(c, 0x000D8u, 0x000F6u) || in_range(c, 0x000F8u, 0x002FFu) || + in_range(c, 0x00370u, 0x0037Du) || in_range(c, 0x0037Fu, 0x01FFFu) || + in_range(c, 0x0200Cu, 0x0200Du) || in_range(c, 0x02070u, 0x0218Fu) || + in_range(c, 0x02C00u, 0x02FEFu) || in_range(c, 0x03001u, 0x0D7FFu) || + in_range(c, 0x0F900u, 0x0FDCFu) || in_range(c, 0x0FDF0u, 0x0FFFDu) || + in_range(c, 0x10000u, 0xEFFFFu)); +} + +#endif // SERD_NTRIPLES_H -- cgit v1.2.1