File tree 2 files changed +6
-3
lines changed
src/commonMain/kotlin/dev/snipme/highlights/internal/locator
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ internal object NumericLiteralLocator {
31
31
} // Find start of literals
32
32
.forEach { number ->
33
33
// For given literal find all occurrences
34
- code.indicesOf(number).forEach { startIndex ->
34
+ val indices = code.indicesOf(number)
35
+ for (startIndex in indices) {
36
+ // TODO Correct this and publish
35
37
if (code.isFullNumber(number, startIndex).not ()) return @forEach
36
38
// Omit in the middle of text, probably variable name (this100)
37
39
if (code.isNumberFirstIndex(startIndex).not ()) return @forEach
Original file line number Diff line number Diff line change 1
1
package dev.snipme.highlights.internal.locator
2
2
3
- import dev.snipme.highlights.model.PhraseLocation
4
3
import dev.snipme.highlights.internal.SyntaxTokens.PUNCTUATION_CHARACTERS
5
4
import dev.snipme.highlights.internal.SyntaxTokens.TOKEN_DELIMITERS
6
5
import dev.snipme.highlights.internal.indicesOf
6
+ import dev.snipme.highlights.model.PhraseLocation
7
7
8
8
internal object PunctuationLocator {
9
9
fun locate (code : String ): List <PhraseLocation > {
@@ -14,7 +14,8 @@ internal object PunctuationLocator {
14
14
.filter { it.isNotBlank() }
15
15
.filter { it in PUNCTUATION_CHARACTERS }
16
16
.forEach {
17
- code.indicesOf(it, ).forEach { index ->
17
+ val indices = code.indicesOf(it)
18
+ for (index in indices) {
18
19
if (code[index].isWhitespace()) return @forEach
19
20
locations.add(PhraseLocation (index, index + 1 ))
20
21
}
You can’t perform that action at this time.
0 commit comments