Expand description
Path-based AST navigation for SQL reduction.
This module provides utilities for navigating and modifying SQL ASTs using path-based addressing for precise AST manipulation.
Enums§
- AstField
- Represents all possible AST field names that can be navigated. This provides compile-time safety for field access.
- AstNode
- Represents a node in the AST that can be navigated and modified. This is a simplified representation focusing on the most commonly reduced SQL constructs.
- AstNode
Type - Auto-generated discriminant enum variants
- Path
Component - Represents a path component in an AST navigation path. Components that make up a path through the AST. Enables precise navigation to any AST node.
Functions§
- ast_
node_ to_ statement - Extract a Statement from an
AstNode. - display_
ast_ path - enumerate_
reduction_ paths - Enumerate all interesting paths in the AST for reduction. Systematically discovers all reducible AST locations.
- explore_
child_ 🔒field - Helper function to get a child node and recurse if it exists.
- get_
node_ at_ path - Navigate to a node in the AST using the given path. Enables precise AST node retrieval.
- get_
node_ type_ name - Get a human-readable name for an AST node type.
- path_
depth 🔒 - Calculate the depth of a path (number of components). Used for outer-first ordering: shallower paths (outer queries) come first.
- set_
node_ at_ path - Set a node in the AST at the given path. Enables precise AST node modification.
- statement_
to_ ast_ node - Convert a Statement to an
AstNodefor path-based operations.
Type Aliases§
- AstPath
- A path through the AST for precise node identification. This allows us to precisely identify and modify any node in the tree.