Module path

Module path 

Source
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.
AstNodeType
Auto-generated discriminant enum variants
PathComponent
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 AstNode for 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.