Expand description
Concrete syntax tree and abstract syntax tree types.
These types define the public AST / CST surface for the parser frontend.
Node hierarchies will be expanded over time, but the structural
definitions — ConcreteSyntaxTree, Ast, TokenTape, TriviaTable
— are settled here.
§Lossless vs lossy
-
ConcreteSyntaxTreeis lossless: every delimiter, keyword, and trivia is represented with byte-offset spans. Round-tripping goes through the CST / token tape. -
Astis lossy (semantic): whitespace, comments, and exact delimiter positions are not preserved. Pretty-printing from the AST produces equivalent but not byte-identical output.
§Spanned invariant
Every AST node MUST carry a source Span. The Spanned trait
formalises this requirement. All new AST node types must implement
Spanned. This is enforced by code review, not by a compile-time
lint (Rust’s type system cannot express “every variant of an enum has
a span field”).
Structs§
- Ast
- The typed abstract syntax tree.
- Concrete
Syntax Tree - The lossless concrete syntax tree produced by a [
ParseBackend]. - CstNode
Id - Opaque identifier for a node in the
ConcreteSyntaxTree. - Source
File - A single parsed source file (the root of the typed AST).
- Source
Map - Maps
CstNodeIds to their sourceSpans.
Enums§
- AstDecl
- A top-level PL/SQL declaration.
- AstExpr
- A PL/SQL expression node.
- AstStatement
- A statement inside a routine / anonymous block body.
- AstType
Decl - A type declaration.
Traits§
- Spanned
- Every AST node must implement this trait.