File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
core/src/main/kotlin/io/github/cybercodernaj/parkour/lexer Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,30 @@ class Lexer(
126
126
do {
127
127
val ignoredMatch = startsWith(ignorePattern)
128
128
position = position.copy(col = ignoredMatch.range.last + 1 )
129
- // This would break because changing the position can also change currentLine.
129
+ // This loop will break because changing the position can also change currentLine.
130
+ } while (true )
131
+ }
132
+
133
+ option {
134
+ do {
135
+ startsWith(singleLineComments)
136
+ // If position is pointing at a singleLineComment, then this will continue
137
+ position = position.nextLine()
138
+ } while (true )
139
+ }
140
+
141
+ option {
142
+ startsWith(multilineComments?.first)
143
+ // If position is pointing at the beginning of multiline comment
144
+ do {
145
+ val line = currentLine.bind()
146
+ val endMatch = multilineComments!! .second.find(line, startIndex = position.col)
147
+ if (endMatch == null ) {
148
+ position = position.nextLine()
149
+ } else {
150
+ position = position.copy(col = endMatch.range.last + 1 )
151
+ break
152
+ }
130
153
} while (true )
131
154
}
132
155
}
You can’t perform that action at this time.
0 commit comments