SyntaxTree

Immutable concrete syntax result with a self-contained source and token snapshot.

A tree remains usable after a streaming session releases committed input. Use source and tokens for exact source recovery; semanticTokens adds parser-derived roles for tooling.

val tree = parser.parseClause(lexer.lex(SourceText("f(X).")))
val exactClause = tree.source.text(tree.root.span)
val role = tree.semanticToken(tree.root.terminatorTokenId)?.role

Type Parameters

T

root-node type

Properties

Link copied to clipboard

immutable source/token snapshot owned by this tree

Link copied to clipboard
val root: T

typed root node

Link copied to clipboard

semantic annotations in token order

Link copied to clipboard

Immutable source fragment owned by this tree.

Link copied to clipboard

Absolute-ID-addressable tokens owned by this tree.

Functions

Link copied to clipboard

Returns the semantic annotation for tokenId, or null if it has no semantic role.

Link copied to clipboard
open override fun toRepresentation(): String

Returns the normalized representations of this tree's tokens joined in lexical order.