protected fun processLine()

in dekaf-main/src/simplext/SimplextReader.kt [57:90]


    protected fun processLine(buffer: CharSequence, from: Int, till: Int) {
        lastLine++
        val n = min(buffer.length, till)
        var p = from
        if (p >= n) return

        var ind = 0
        var c = buffer[p]
        while (p < n && c.isWhitespace()) {
            if (c == '\t') ind = handleTab(ind)
            else ind++
            p++
            if (p >= n) return
            c = buffer[p]
        }

        var q = n
        val lcm = lineCommentMark
        if (lcm != null) q = buffer.indexOf(lcm, p, n, n)
        if (p == q) return // the line contains a comment only

        while (p < q && buffer[q - 1].isWhitespace()) q--
        if (p == q) return // this should never happened

        val lineText = buffer.subSequence(p, q)

        val indent = p - from
        unrollStackForIndent(indent)

        val entry = SimplextLine(getParentNode(), lastLine, indent, bufferOffset + p, lineText)
        val entryNode = handler(entry)
        val level = Level(entry, entryNode)
        stack.push(level)
    }