Expand description
AST representation and pattern extraction data structures.
This module provides language-agnostic AST representations and specialized structures for pattern detection in different programming languages.
§Design Pattern Extraction
The module supports extracting design patterns from source code:
- Class hierarchies with inheritance and decorators
- Method definitions with abstract/override tracking
- Module-level singleton instances
- Assignment and expression analysis
§Example
ⓘ
use debtmap::core::ast::{ClassDef, ModuleScopeAnalysis};
// Extract classes from Python AST
let classes: Vec<ClassDef> = extractor.extract_classes(&module);
// Analyze module scope for singletons
let scope: ModuleScopeAnalysis = extractor.extract_module_scope(&module);§Performance Considerations
Pattern extraction is designed to add minimal overhead (< 5%) to existing parsing operations by extracting data during the single-pass AST traversal.
Structs§
- Assignment
- AstNode
- Class
Def - Represents a class definition with its metadata.
- GoAst
- Go AST wrapper
- Method
Def - Represents a method definition within a class.
- Module
Scope Analysis - Analysis of module-level scope for pattern detection.
- Python
Ast - Python AST wrapper
- RustAst
- Singleton
Instance - Solidity
Ast - Solidity AST wrapper
- Type
Script Ast - TypeScript/JavaScript AST wrapper
Enums§
- Ast
- Expression
- JsLanguage
Variant - JavaScript/TypeScript language variant
- Node
Kind - Scope