Coverage for src / rejuvenation / descendant_search.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-09-09 14:04 +0000

1from arpeggio import flatten 

2 

3from renaissance.syntax_tree import PatternMatch 

4from renaissance.syntax_tree.ast_node import ASTNode 

5from renaissance.syntax_tree.match_finder import match_pattern 

6 

7 

8def find_descendant_match(root: ASTNode, outer_pattern: ASTNode, inner_pattern: ASTNode) -> list[PatternMatch]: 

9 return flatten(match_pattern(match.nodes, [inner_pattern]) for match in match_pattern(root.children, [outer_pattern]))