Source

interface Source

A possibly partial view of a source document.

Offsets, lines, and columns are always relative to the complete document, even when only a fragment of its text is retained.

Inheritors

Properties

Link copied to clipboard

First position after the text retained by this view.

Link copied to clipboard
abstract val id: String?

Optional stable identifier used in diagnostics, such as a path or URI.

Link copied to clipboard
abstract val start: SourcePosition

First position whose text is retained by this view.

Functions

Link copied to clipboard
abstract fun positionAt(offset: Int): SourcePosition

Converts an absolute UTF-16 offset within the retained range to a position.

Link copied to clipboard
open fun span(startOffset: Int, endExclusiveOffset: Int): SourceSpan

Creates a span from two absolute offsets.

Link copied to clipboard
open fun text(span: SourceSpan): String

Returns text covered by span.

abstract fun text(startOffset: Int = start.offset, endExclusiveOffset: Int = endExclusive.offset): String

Returns text between the absolute, end-exclusive offsets.