Le 12/09/2015 15:46, Peter Uhnák a écrit :
If you don't want to manually operate on AST, you can use Mark's Rewrite
Tool ( http://screencast.com/t/LCEl0hFl ,
https://medium.com/@peteruhnak/using-rewrite-tool-for-fixing-deprecated-code-12a595b291d8
)

As for ASTs I would be also curious about the answer, as this seems like
it should be a simple task.

It is fairly easy if you write a RB AST visitor subclass, with a single method / case to handle character literal.

Now, I'm sure you can use RBParseTreeRewriter to do it with a single call...

Thierry

Peter

On Sat, Sep 12, 2015 at 2:24 PM, Julien Delplanque <jul...@tamere.eu
<mailto:jul...@tamere.eu>> wrote:

    Hi everyone,

    I would like to modify the AST of a smalltalk expression compiled to
    automatically send a certain message
    when a node represents a Character (so the user does not have to
    write the message sending explicitly).
    I would of course add a special button in the menu you get when
    right clicking in a playground so the user
    knows it is a "special" do-it...

    For example:
         $a.
    would transform into an ast that the source code looks like
         $a aMessage

    How can I do this? :)

    Julien




Reply via email to