Skip to content

Commit 13342eb

Browse files
committed
Add matching support for \p{Lc}
This is defined in UAX#44 as being equivalent to `Lu | Ll | Lt`.
1 parent e748aea commit 13342eb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.DS_Store
22

3+
# The current toolchain is dumping files in the package root, rude
4+
*.emit-module.*
5+
36
# Xcode
47
#
58
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

Sources/_StringProcessing/ConsumerInterface.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,9 @@ extension Unicode.ExtendedGeneralCategory {
691691
])
692692

693693
case .casedLetter:
694-
throw Unsupported(
695-
"TODO: cased letter? not the property?")
694+
return consumeScalarGCs([
695+
.uppercaseLetter, .lowercaseLetter, .titlecaseLetter
696+
])
696697

697698
case .control:
698699
return consumeScalarGC(.control)

Tests/RegexTests/MatchTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,12 @@ extension RegexTests {
693693
firstMatchTest(#"\p{gc=L}"#, input: "123abcXYZ", match: "a")
694694
firstMatchTest(#"\p{Lu}"#, input: "123abcXYZ", match: "X")
695695

696+
// U+0374 GREEK NUMERAL SIGN (Lm)
697+
// U+00AA FEMININE ORDINAL INDICATOR (Lo)
698+
firstMatchTest(#"\p{L}"#, input: "\u{0374}\u{00AA}123abcXYZ", match: "\u{0374}")
699+
firstMatchTest(#"\p{Lc}"#, input: "\u{0374}\u{00AA}123abcXYZ", match: "a")
700+
firstMatchTest(#"\p{Lc}"#, input: "\u{0374}\u{00AA}123XYZ", match: "X")
701+
696702
firstMatchTest(
697703
#"\P{Cc}"#, input: "\n\n\nXYZ", match: "X")
698704
firstMatchTest(

0 commit comments

Comments
 (0)