in src/commonMain/kotlin/org/intellij/markdown/ast/ASTNodeBuilder.kt [22:47]
open fun createLeafNodes(type: IElementType, startOffset: Int, endOffset: Int): List<ASTNode> {
if (type == MarkdownTokenTypes.WHITE_SPACE) {
val result = ArrayList<ASTNode>()
var lastEol = startOffset
while (lastEol < endOffset) {
cancellationToken.checkCancelled()
val nextEol = indexOfSubSeq(text, lastEol, endOffset, '\n')
if (nextEol == -1) {
break
}
if (nextEol > lastEol) {
result.add(LeafASTNode(MarkdownTokenTypes.WHITE_SPACE, lastEol, nextEol))
}
result.add(LeafASTNode(MarkdownTokenTypes.EOL, nextEol, nextEol + 1))
lastEol = nextEol + 1
}
if (endOffset > lastEol) {
result.add(LeafASTNode(MarkdownTokenTypes.WHITE_SPACE, lastEol, endOffset))
}
return result
}
return listOf(LeafASTNode(type, startOffset, endOffset))
}