aboutsummaryrefslogtreecommitdiffstats
path: root/src/ntriples.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-31 16:43:50 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commit2bb0250be8297cc950d0036915ecdf61ab6f3700 (patch)
treece8051b08017ac54c3195b529647b8b6422e9639 /src/ntriples.h
parent155fceabe7070b6610d577734734d038d097b088 (diff)
downloadserd-2bb0250be8297cc950d0036915ecdf61ab6f3700.tar.gz
serd-2bb0250be8297cc950d0036915ecdf61ab6f3700.tar.bz2
serd-2bb0250be8297cc950d0036915ecdf61ab6f3700.zip
Factor out and expose prefixed name predicates
Towards using these in the writer to escape names more precisely.
Diffstat (limited to 'src/ntriples.h')
-rw-r--r--src/ntriples.h36
1 files changed, 36 insertions, 0 deletions
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 <d@drobilla.net>
+
+ 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 <stdbool.h>
+
+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