SourcePosition

data class SourcePosition(sourceFile: SourceFile, offset: Int) : Comparable<SourcePosition>

Represents a position in a source file. Positions correspond to spaces between characters rather than characters themselves.

In a file with n characters, there are n + 1 positions: one before the first character, one after the last character, and n - 1 between each consecutive character.

Parameters

offset

Number of Chars (unicode code units, not code points) before this position, counting from the beginning of the file. Starts at 0.

Constructors

SourcePosition
Link copied to clipboard
fun SourcePosition(sourceFile: SourceFile, offset: Int)

Functions

compareTo
Link copied to clipboard
open operator override fun compareTo(other: SourcePosition): Int
toString
Link copied to clipboard
open override fun toString(): String

Properties

column
Link copied to clipboard
val column: Int

Column number of the character that comes after this position. 1 indexed.

line
Link copied to clipboard
val line: Int

Line number of this position. 1 indexed.

offset
Link copied to clipboard
val offset: Int
sourcePath
Link copied to clipboard
val sourcePath: String

Description of where the source file came from.