aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 13:51:52 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 13:51:52 -0400
commite6c361568181b5ff952a72b08897033981910147 (patch)
tree8aa32e9ea99f8bd71b30214f8c62d102103a6614 /src
parent9bc18cb6174ff563c18a1ca9b462c58971b51733 (diff)
Remove dead code and add version check for emoji
Diffstat (limited to 'src')
-rw-r--r--src/stdlib/patterns.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/stdlib/patterns.c b/src/stdlib/patterns.c
index 500d29d2..07a17afb 100644
--- a/src/stdlib/patterns.c
+++ b/src/stdlib/patterns.c
@@ -4,6 +4,7 @@
#include <sys/param.h>
#include <unictype.h>
#include <uniname.h>
+#include <unistring/version.h>
#include "arrays.h"
#include "integers.h"
@@ -67,18 +68,6 @@ static INLINE bool match_str(TextIter_t *state, int64_t *i, const char *str)
return true;
}
-static INLINE bool match_property(TextIter_t *state, int64_t *i, uc_property_t prop)
-{
- if (*i >= state->stack[0].text.length) return false;
- uint32_t grapheme = Text$get_main_grapheme_fast(state, *i);
- // TODO: check every codepoint in the cluster?
- if (uc_is_property(grapheme, prop)) {
- *i += 1;
- return true;
- }
- return false;
-}
-
static int64_t parse_int(TextIter_t *state, int64_t *i)
{
int64_t value = 0;
@@ -618,9 +607,12 @@ static pat_t parse_next_pat(TextIter_t *state, int64_t *index)
return PAT(PAT_END, .non_capturing=!negated);
} else if (strcasecmp(prop_name, "email") == 0) {
return PAT(PAT_FUNCTION, .fn=match_email);
- } else if (strcasecmp(prop_name, "emoji") == 0) {
+ }
+#if _LIBUNISTRING_VERSION >= 0x0100000
+ else if (strcasecmp(prop_name, "emoji") == 0) {
return PAT(PAT_PROPERTY, .property=UC_PROPERTY_EMOJI);
}
+#endif
break;
case 'h':
if (strcasecmp(prop_name, "host") == 0) {