This simply searches an inversion list without going through a swash.
It will be used in a future commit.
EMs |void |add_alternate |NN AV** alternate_ptr|NN U8* string|STRLEN len
EMsR |SV* |_new_invlist_C_array|NN UV* list
: Not used currently: EXMs |bool |_invlistEQ |NN SV* const a|NN SV* const b|bool complement_b
+EMsR |bool |_invlist_contains_cp|NN SV* const invlist|const UV cp
#endif
Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \
|NN char* strend|NN char* strbeg|I32 minend \
# if defined(PERL_IN_REGCOMP_C)
#define _append_range_to_invlist(a,b,c) S__append_range_to_invlist(aTHX_ a,b,c)
#define _invlist_array_init(a,b) S__invlist_array_init(aTHX_ a,b)
+#define _invlist_contains_cp(a,b) S__invlist_contains_cp(aTHX_ a,b)
#define _new_invlist_C_array(a) S__new_invlist_C_array(aTHX_ a)
#define add_alternate(a,b,c) S_add_alternate(aTHX_ a,b,c)
#define add_cp_to_invlist(a,b) S_add_cp_to_invlist(aTHX_ a,b)
#define PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT \
assert(invlist)
+STATIC bool S__invlist_contains_cp(pTHX_ SV* const invlist, const UV cp)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT__INVLIST_CONTAINS_CP \
+ assert(invlist)
+
STATIC SV* S__new_invlist_C_array(pTHX_ UV* list)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#endif
+STATIC bool
+S__invlist_contains_cp(pTHX_ SV* const invlist, const UV cp)
+{
+ /* Does <invlist> contain code point <cp> as part of the set? */
+
+ IV index = invlist_search(invlist, cp);
+
+ PERL_ARGS_ASSERT__INVLIST_CONTAINS_CP;
+
+ return index >= 0 && ELEMENT_RANGE_MATCHES_INVLIST(index);
+}
+
PERL_STATIC_INLINE SV*
S_add_cp_to_invlist(pTHX_ SV* invlist, const UV cp) {
return _add_range_to_invlist(invlist, cp, cp);