commonMain.com.sunnychung.lib.multiplatform.kotlite.model.SourcePosition.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlite-interpreter-jvm Show documentation
Show all versions of kotlite-interpreter-jvm Show documentation
A Kotlin Multiplatform library to interpret Kotlite code, which is a subset of Kotlin language, in runtime in a safe way.
The newest version!
package com.sunnychung.lib.multiplatform.kotlite.model
import com.sunnychung.lib.multiplatform.kotlite.lexer.BuiltinFilename
data class SourcePosition(val filename: String, val lineNum: Int, val col: Int, val index: Int) {
companion object {
val NONE = SourcePosition("", 1, 1)
val BUILTIN = SourcePosition(BuiltinFilename.BUILTIN, 1, 1)
}
// make it compatible with interpreter:1.0.0-jvm
constructor(filename: String, lineNum: Int, col: Int) : this(filename, lineNum, col, 0)
override fun toString(): String {
return "[$filename:$lineNum:$col]"
}
}