Remove dead code and add version check for emoji

This commit is contained in:
Bruce Hill 2025-03-28 13:51:52 -04:00
parent 9bc18cb617
commit e6c3615681

View File

@ -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) {