Open serge-sans-paille opened 9 years ago
You should have a look at pattern_transform.py in the optimization folder which already do it for few patterns.
Yeah, the problem is that it could/should be part of the matcher interface, to match the re
interface. What do you think of this improvement?
I agree but ast_matcher is an analysis and the ast_matcher.sub will also modify the ast. Should it be something else than just analysis/optimization?
+1, maybe in utils.py?, or a tree_matcher.py at the root
I prefer tree_matcher.py at the root. It makes more sense to me.
ASTPattern, contributed by @pbrunet , does a great job at matching tree expressions. It would be great to have it support capturing patterns to provide a
re.sub
-like method.