Expand description
The concrete syntax tree: a flat, pre-order arena of nodes and tokens.
Every byte of the source belongs to exactly one token (a leaf), and
the tokens, in order, spell the source: the CST is lossless
(cst.to_string() == source). Whitespace and bidi marks are
SyntaxKind::Trivia tokens; input the parser could not use is kept in
SyntaxKind::Error tokens. Nodes group tokens and other nodes; each
records the index one past its last descendant, so the tree is navigated
without pointers or recursion.
crate::parse_model fills the same arena without trivia and punctuation
tokens (lowering does not need them); such an arena is not lossless.
Structs§
- Cst
- An owned CST (see
crate::parse_cst). - CstRef
- A borrowed CST: the source, the arena and the syntax diagnostics.
- Node
- One entry of the arena.
- Syntax
Node - A node or token of a CST, with navigation.
Enums§
- Syntax
Kind - What a node or token is.