MaterializedLexedSource

An immutable, self-contained token and source snapshot.

Properties

Link copied to clipboard

Absolute index of the first retained significant token.

Link copied to clipboard
abstract override val source: SourceText

Complete immutable source fragment owned by this snapshot.

Link copied to clipboard
abstract val tokens: TokenStore

ID-addressable token view; requesting tokens may force lazy lexing.

Functions

Link copied to clipboard

Returns this already materialized instance.

Link copied to clipboard
abstract fun significantToken(index: Int): Token

Returns the significant token at an absolute significant-token index. Requests beyond the end of input return the unique end-of-input token.

Link copied to clipboard
abstract fun significantTokens(): List<Token>

Forces lexing through EOF and returns retained significant tokens, including EOF.

Link copied to clipboard
abstract fun textOf(token: Token): String

Returns the exact source spelling of token, including original escapes and trivia.

open fun textOf(tokenId: Int): String

Returns the exact source spelling of the token with tokenId.

Link copied to clipboard
open fun token(id: Int): Token

Returns the token with absolute id, forcing lexing forward if necessary.