On 12 Sep 2015, at 19:23, Peter Uhnák <i.uhnak@gmail.com> wrote:
| rewriter | rewriter := RBParseTreeRewriter new replace: ' `#aLiteral `{:node | node value isCharacter}' with: '`#aLiteral aMessage'; yourself. rewriter executeTree: (RBParser parseExpression: 'Array with: $a asciiValue with: $b with: #c with: d'). rewriter tree formattedCode
This is cool! And so simple!
This can be combined with the compiler transform plugins of Opal: -> make subclass of OCCompilerASTPlugin -> put your code in a method called #transform now when you override #compiler on the class side of a class like this: compiler ^super compiler addPlugin: ASTPluginMeaningOfLife. the plugin will be active for the hierarchy, which means that all code compiled will be transformed. There is a simple example ASTPluginMeaningOfLife in the image. Marcus