LexedSource

interface LexedSource

A tokenized source whose token production may be lazy.

Inheritors

Properties

Link copied to clipboard

Absolute index of the first retained significant token.

Link copied to clipboard
abstract val source: Source

Possibly partial source view backing currently retained tokens.

Link copied to clipboard
abstract val tokens: TokenStore

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

Functions

Link copied to clipboard

Forces lexing through EOF and returns an immutable, self-contained source snapshot.

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.