Module ast

Module ast 

Source
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 &'src 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<'src>), use token_src instead of token.text().

Structs§

AltExpr
Anchor
AnonymousNode
Anonymous node: string literal ("+") or wildcard (_). Maps from CST Str or Wildcard.
Branch
CapturedExpr
Def
FieldExpr
NamedNode
NegatedField
QuantifiedExpr
Ref
Root
SeqExpr
Type

Enums§

AltKind
Whether an alternation uses tagged or untagged branches.
Expr
Expression: any pattern that can appear in the tree.
SeqItem
Either an expression or an anchor in a sequence.

Functions§

token_src
Extracts token text with source lifetime.