Expand description
Typed AST wrappers over CST nodes.
Each struct wraps a SyntaxNode and provides typed accessors.
Cast is infallible for correct SyntaxKind - validation happens elsewhere.
§String Lifetime Limitation
SyntaxToken::text() returns &str tied to the token’s lifetime, not to the
source &'q str. This is a rowan design: tokens store interned strings, not
spans into the original source.
When building data structures that need source-lifetime strings (e.g.,
SymbolTable<'q>), use token_src instead of token.text().
Structs§
- AltExpr
- Anchor
- Anonymous
Node - Anonymous node: string literal (
"+") or wildcard (_). Maps from CSTStrorWildcard. - Branch
- Captured
Expr - Def
- Field
Expr - Named
Node - Negated
Field - Node
Predicate - Quantified
Expr - Ref
- Regex
Literal - Root
- SeqExpr
- Type
Enums§
- AltKind
- Whether an alternation uses tagged or untagged branches.
- Expr
- Expression: any pattern that can appear in the tree.
- Predicate
Op - Predicate operator for node text filtering.
- Predicate
Value - Predicate value: either a string or a regex pattern.
- SeqItem
- Either an expression or an anchor in a sequence.
Functions§
- is_
truly_ empty_ scope - Checks if expression is a truly empty scope (sequence/alternation with no children).
Used to distinguish
{ } @x(empty struct) from{(expr) @_} @x(Node capture). - predicate_
op_ from_ syntax_ kind - Convert SyntaxKind to PredicateOp.
- token_
src - Extracts token text with source lifetime.