Last active
August 29, 2015 14:16
-
-
Save ThierryGoubier/54ba2fcf3cd2e7db9b1e to your computer and use it in GitHub Desktop.
Python Parser Tests refactoring: RBParseTreeRewritter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rewrite | | |
rewrite := RBParseTreeRewriter new | |
replace: 'self parse: `#l `{:node :dic | | |
| n | | |
n := ''source'' , (node methodNode selector allButFirst: 4). | |
dic at: #n put: n. | |
PythonParserTests compile: (RBParser parseMethod: n, '' ^ '', `#l newSource) formattedCode classified: ''resources''. | |
true }' | |
with: 'self parse: `{:dic | | |
RBParser parseExpression: ''self '', (dic at: #n) }'. | |
PythonParserTests methods | |
do: [ :e | | |
(rewrite executeTree: (RBParser parseMethod: e sourceCode)) | |
ifTrue: [ PythonParserTests compile: rewrite tree newSource ] ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using RBParseTreeRewritter: