[K/N] Regex matching zero length should split surrogate pairs #KT-57401
Merge-request: KT-MR-11110 Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
7ecd7b8e61
commit
df16fa3306
@@ -33,12 +33,6 @@ internal class EmptySet(override var next: AbstractSet) : LeafSet() {
|
||||
|
||||
override fun find(startIndex: Int, testString: CharSequence, matchResult: MatchResultImpl): Int {
|
||||
for (index in startIndex..testString.length) {
|
||||
if (index < testString.length) {
|
||||
if (testString[index].isLowSurrogate() &&
|
||||
index > 0 && testString[index - 1].isHighSurrogate()) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if (next.matches(index, testString, matchResult) >= 0) {
|
||||
return index
|
||||
}
|
||||
@@ -48,12 +42,6 @@ internal class EmptySet(override var next: AbstractSet) : LeafSet() {
|
||||
|
||||
override fun findBack(leftLimit: Int, rightLimit: Int, testString: CharSequence, matchResult: MatchResultImpl): Int {
|
||||
for (index in rightLimit downTo leftLimit) {
|
||||
if (index < testString.length) {
|
||||
if (testString[index].isLowSurrogate() &&
|
||||
index > 0 && testString[index - 1].isHighSurrogate()) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if (next.matches(index, testString, matchResult) >= 0) {
|
||||
return index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user