Skip to content

Commit e7e8944

Browse files
author
Hana Dusíková
committed
support negative First set calculation for unicode properties
1 parent 481e18b commit e7e8944

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/ctre/first.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ template <typename CB> constexpr int64_t negative_helper(ctre::set<>, CB &, int6
319319
return start;
320320
}
321321

322+
template <auto Property, typename CB>
323+
constexpr auto negative_helper(ctre::binary_property<Property>, CB &&, int64_t start) {
324+
return start;
325+
}
326+
327+
template <auto Property, auto Value, typename CB>
328+
constexpr auto negative_helper(ctre::property<Property, Value>, CB &&, int64_t start) {
329+
return start;
330+
}
331+
322332
template <typename Head, typename... Rest, typename CB> constexpr int64_t negative_helper(ctre::set<Head, Rest...>, CB & cb, int64_t start) {
323333
start = negative_helper(Head{}, cb, start);
324334
return negative_helper(ctre::set<Rest...>{}, cb, start);

tests/_unicode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ static_assert(CTRE_CREATE(U"\\u20AC").match(U"€"));
6060
// TODO only \p and \P is not supported
6161
static_assert(CTRE_SYNTAX(U"\\p{L}"));
6262
static_assert(CTRE_SYNTAX(U"\\p{Letter}"));
63+
static_assert(CTRE_CREATE(U"\\P{Letter}").match(U"1"));
64+
static_assert(CTRE_CREATE(U"\\P{latin}").match(U"Є"));
65+
static_assert(CTRE_CREATE(U"[^\\p{latin}\\p{script=Greek}]").match(U"ש"));
6366
static_assert(CTRE_CREATE(U"\\p{Letter}+").match(u8"abcDEF"));
6467
static_assert(CTRE_CREATE(U"\\p{Letter}+").match(U"abcDEF"));
6568
static_assert(CTRE_CREATE(U"\\p{Ll}+").match(U"abcdef"));

0 commit comments

Comments
 (0)