Skip to content

Commit 3062457

Browse files
committed
fix: comment traces
1 parent 863b4ff commit 3062457

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/kotlin/com/github/xepozz/toon/language/parser/IndentingLexerAdapter.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ abstract class IndentingLexerAdapter(
1717

1818
if (tokenType == null) {
1919
val endOffset = baseLexer.tokenEnd
20+
// println("compensation last: ${indentStack.size}, offset: $endOffset")
2021
while (indentStack.size > 1) {
2122
indentStack.removeLast()
2223
addToken(endOffset, dedentTokenType)
24+
// println("tokenType(emulate): $dedentTokenType")
2325
}
26+
// println("tokenType: $tokenType")
27+
2428
advanceAs(baseLexer, tokenType)
2529
return
2630
}
2731

32+
// println("tokenType: $tokenType")
2833
if (tokenType != eolTokenType) {
2934
advanceAs(baseLexer, tokenType)
3035
return
@@ -50,9 +55,10 @@ abstract class IndentingLexerAdapter(
5055
columns++
5156
index++
5257
}
58+
5359
'\t' -> {
54-
columns+=2
55-
index+=2
60+
columns += 2
61+
index += 2
5662
}
5763

5864
'\r', '\n' -> return
@@ -71,12 +77,15 @@ abstract class IndentingLexerAdapter(
7177
newIndent > currentIndent -> {
7278
indentStack.add(newIndent)
7379
addToken(logicalLineStart, indentTokenType)
80+
// println("tokenType(emulate): $indentTokenType")
7481
}
7582

7683
newIndent < currentIndent -> {
84+
// println("compensation in process: ${indentStack.size}, offset: $logicalLineStart")
7785
while (indentStack.size > 1 && newIndent < indentStack.last()) {
7886
indentStack.removeLast()
7987
addToken(logicalLineStart, dedentTokenType)
88+
// println("tokenType(emulate): $dedentTokenType")
8089
}
8190
}
8291

0 commit comments

Comments
 (0)