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)?.roleContent copied to clipboard
Type Parameters
T
root-node type
Properties
Functions
Link copied to clipboard
Returns the semantic annotation for tokenId, or null if it has no semantic role.
Link copied to clipboard
Returns the normalized representations of this tree's tokens joined in lexical order.