mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IJPL-163132 Add KMP-compatible codePointAt and toCodePoint implementations to idea-flex-kotlin.skeleton
Also bumped to KFlex 1.10.13 Merge-request: IJ-MR-160215 Merged-by: Codrin Ogreanu <codrin.ogreanu@jetbrains.com> GitOrigin-RevId: 5726f30797c1eb0341a5b0119cd82fdba9b5da2e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0175466dc6
commit
edaef30179
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
// Generated by JFlex 1.10.11 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||
// Generated by JFlex 1.10.13 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||
// source: _JavaDocLexer.flex
|
||||
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
// Generated by JFlex 1.9.1 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||
// Generated by JFlex 1.10.13 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||
// source: _JavaLexer.flex
|
||||
|
||||
package com.intellij.lang.java.lexer;
|
||||
|
||||
@@ -153,6 +153,21 @@ companion object {
|
||||
return high.code
|
||||
}
|
||||
|
||||
/** Returns the character (Unicode code point) at the specified index. */
|
||||
internal fun String.codePointAt(index: Int): Int {
|
||||
val high = this[index]
|
||||
if (high.isHighSurrogate() && index + 1 < this.length) {
|
||||
val low = this[index + 1]
|
||||
if (low.isLowSurrogate()) {
|
||||
return Char.toCodePoint(high, low)
|
||||
}
|
||||
}
|
||||
return high.code
|
||||
}
|
||||
|
||||
internal fun Char.Companion.toCodePoint(high: Char, low: Char): Int =
|
||||
(((high - MIN_HIGH_SURROGATE) shl 10) or (low - MIN_LOW_SURROGATE)) + 0x10000
|
||||
|
||||
private fun charCount(codePoint: Int): Int = if (codePoint < 0x10000) 1 else 2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user