SourcePosition

data class SourcePosition(sourceFile: SourceFile, val 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

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

Functions

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

Properties

Link copied to clipboard
val column: Int

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

Link copied to clipboard
val line: Int

Line number of this position. 1 indexed.

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

Description of where the source file came from.