Skip to main content

Crate ktrs_syntax

Crate ktrs_syntax 

Source
Expand description

Lossless Kotlin syntax tree. Node and token kinds mirror the Kotlin compiler’s PSI element types one-to-one (see kinds.tsv), so trees can be diffed against DebugUtil.psiToString.

Re-exports§

pub use tree::ElementId;
pub use tree::Tree;
pub use tree::TreeBuilder;

Modules§

tree
Tree: a parsed file as flat preorder arrays. An element (node or token) is its preorder index; navigation is index arithmetic, and token text is a slice of the source. Replaces rowan’s green/red trees, which allocate per node when built and per step when walked (see research/06-tree-library.md for the measurements).

Structs§

Parse
A parsed file: the tree plus one message per ERROR_ELEMENT, in tree preorder.
TextRange
A range in text, represented as a pair of TextSize.
TextSize
A measure of text length. Also, equivalently, an index into text.

Enums§

SyntaxKind

Functions§

psi_dump
Renders parse exactly like IntelliJ’s DebugUtil.psiToString(file, true, false), the format of the compiler’s parser fixtures and of tools/psi-dump.