[regex] Minor naming refactoring
This commit is contained in:
committed by
Ilya Matveev
parent
6cacbfbc36
commit
3610588666
@@ -88,8 +88,7 @@ internal abstract class AbstractCharClass : SpecialToken() {
|
|||||||
|
|
||||||
|
|
||||||
private val surrogates_ = AtomicReference<AbstractCharClass?>(null)
|
private val surrogates_ = AtomicReference<AbstractCharClass?>(null)
|
||||||
val surrogates: AbstractCharClass
|
fun classWithSurrogates(): AbstractCharClass {
|
||||||
get() {
|
|
||||||
surrogates_.value?.let {
|
surrogates_.value?.let {
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
@@ -113,8 +112,7 @@ internal abstract class AbstractCharClass : SpecialToken() {
|
|||||||
|
|
||||||
// We cannot cache this class as we've done with surrogates above because
|
// We cannot cache this class as we've done with surrogates above because
|
||||||
// here is a circular reference between it and AbstractCharClass.
|
// here is a circular reference between it and AbstractCharClass.
|
||||||
val withoutSurrogates: AbstractCharClass
|
fun classWithoutSurrogates(): AbstractCharClass {
|
||||||
get() {
|
|
||||||
val result = object : AbstractCharClass() {
|
val result = object : AbstractCharClass() {
|
||||||
override fun contains(ch: Int): Boolean {
|
override fun contains(ch: Int): Boolean {
|
||||||
val index = ch - Char.MIN_SURROGATE.toInt()
|
val index = ch - Char.MIN_SURROGATE.toInt()
|
||||||
|
|||||||
@@ -774,13 +774,13 @@ internal class Pattern(val pattern: String, flags: Int = 0) {
|
|||||||
|
|
||||||
private fun processRangeSet(charClass: AbstractCharClass): AbstractSet {
|
private fun processRangeSet(charClass: AbstractCharClass): AbstractSet {
|
||||||
if (charClass.hasLowHighSurrogates()) {
|
if (charClass.hasLowHighSurrogates()) {
|
||||||
val lowHighSurrRangeSet = SurrogateRangeSet(charClass.surrogates)
|
val lowHighSurrRangeSet = SurrogateRangeSet(charClass.classWithSurrogates())
|
||||||
|
|
||||||
if (charClass.mayContainSupplCodepoints) {
|
if (charClass.mayContainSupplCodepoints) {
|
||||||
return CompositeRangeSet(SupplementaryRangeSet(charClass.withoutSurrogates, hasFlag(CASE_INSENSITIVE)), lowHighSurrRangeSet)
|
return CompositeRangeSet(SupplementaryRangeSet(charClass.classWithoutSurrogates(), hasFlag(CASE_INSENSITIVE)), lowHighSurrRangeSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompositeRangeSet(RangeSet(charClass.withoutSurrogates, hasFlag(CASE_INSENSITIVE)), lowHighSurrRangeSet)
|
return CompositeRangeSet(RangeSet(charClass.classWithoutSurrogates(), hasFlag(CASE_INSENSITIVE)), lowHighSurrRangeSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (charClass.mayContainSupplCodepoints) {
|
if (charClass.mayContainSupplCodepoints) {
|
||||||
|
|||||||
Reference in New Issue
Block a user