Skip to content

Commit 55ae922

Browse files
authored
Merge pull request #29 from SnipMeDev/publish-0.8.0
Publish 0.8.0
2 parents 98caa5c + 63f173b commit 55ae922

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/commonMain/kotlin/dev/snipme/highlights/internal/locator/NumericLiteralLocator.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ internal object NumericLiteralLocator {
3131
} // Find start of literals
3232
.forEach { number ->
3333
// 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
3537
if (code.isFullNumber(number, startIndex).not()) return@forEach
3638
// Omit in the middle of text, probably variable name (this100)
3739
if (code.isNumberFirstIndex(startIndex).not()) return@forEach

src/commonMain/kotlin/dev/snipme/highlights/internal/locator/PunctuationLocator.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package dev.snipme.highlights.internal.locator
22

3-
import dev.snipme.highlights.model.PhraseLocation
43
import dev.snipme.highlights.internal.SyntaxTokens.PUNCTUATION_CHARACTERS
54
import dev.snipme.highlights.internal.SyntaxTokens.TOKEN_DELIMITERS
65
import dev.snipme.highlights.internal.indicesOf
6+
import dev.snipme.highlights.model.PhraseLocation
77

88
internal object PunctuationLocator {
99
fun locate(code: String): List<PhraseLocation> {
@@ -14,7 +14,8 @@ internal object PunctuationLocator {
1414
.filter { it.isNotBlank() }
1515
.filter { it in PUNCTUATION_CHARACTERS }
1616
.forEach {
17-
code.indicesOf(it, ).forEach { index ->
17+
val indices = code.indicesOf(it)
18+
for (index in indices) {
1819
if (code[index].isWhitespace()) return@forEach
1920
locations.add(PhraseLocation(index, index + 1))
2021
}

0 commit comments

Comments
 (0)