[K/N] Make assert functions experimental with ExperimentalNativeApi

This commit is contained in:
Abduqodiri Qurbonzoda
2023-04-12 23:57:50 +03:00
committed by Space Team
parent 245ef256bd
commit b6c2ce2dc8
9 changed files with 26 additions and 4 deletions
@@ -24,6 +24,8 @@
@file:Suppress("DEPRECATION") // Char.toInt()
package kotlin.text.regex
import kotlin.experimental.ExperimentalNativeApi
/**
* This is base class for special tokens like character classes and quantifiers.
*/
@@ -516,6 +518,7 @@ internal class Lexer(val patternString: String, flags: Int) {
/** Process [lookAhead] in assumption that it's quantifier. */
private fun processQuantifier(): Quantifier {
@OptIn(ExperimentalNativeApi::class)
assert(lookAhead == '{'.toInt())
val sb = StringBuilder(4)
var min = -1
@@ -22,6 +22,8 @@
package kotlin.text.regex
import kotlin.experimental.ExperimentalNativeApi
/**
* The node which marks end of the particular group.
*/
@@ -45,6 +47,7 @@ open internal class FSet(val groupIndex: Int) : SimpleSet() {
override fun processSecondPass(): FSet {
val result = super.processSecondPass()
@OptIn(ExperimentalNativeApi::class)
assert(result == this)
return this
}
@@ -22,6 +22,8 @@
package kotlin.text.regex
import kotlin.experimental.ExperimentalNativeApi
/**
* Represents group, which is alternation of other subexpression.
* One should think about "group" in this model as JointSet opening group and corresponding FSet closing group.
@@ -73,6 +75,7 @@ open internal class JointSet(children: List<AbstractSet>, fSet: FSet) : Abstract
val fSet = this.fSet
if (!fSet.secondPassVisited) {
val newFSet = fSet.processSecondPass()
@OptIn(ExperimentalNativeApi::class)
assert(newFSet == fSet)
}
@@ -22,6 +22,8 @@
package kotlin.text.regex
import kotlin.experimental.ExperimentalNativeApi
/**
* Group node over subexpression without alternations.
*/
@@ -86,6 +88,7 @@ open internal class SingleSet(var kid: AbstractSet, fSet: FSet) : JointSet(listO
override fun processSecondPass(): AbstractSet {
if (secondPassVisited) {
if (fSet.isBackReferenced) {
@OptIn(ExperimentalNativeApi::class)
assert(backReferencedSet != null) // secondPassVisited
return backReferencedSet!!
}