| parseTree resultNode searchTree |

parseTree := RBParser parseMethod: 'renderContentOn: aRenderer

    aRenderer div id: ''id1'';
        with: [
            aRenderer div
                    id: ''idInner1'';
                    render: ''text1'' ].'.

searchTree := RBParser parseExpression: 'aRenderer div
                    id: ''idInner1'';
                    render: ''text1''.'.

resultNode := ( RBParseTreeSearcher new
    matchesTree: searchTree
    do: [ :aNode :answer | aNode parent ] ) executeTree: parseTree.

resultNode addNode: (RBParser parseExpression: 'envelopes := nil').
parseTree formattedCode.


2012/3/7 Sean P. DeNigris <s...@clipperadams.com>

> What's the easiest way to add a statement to an existing method?
>
> In the case I'm thinking about, it's going at the end, so I can cheat and
> just recompile with the string appended, but I'd like to know how to insert
> into an arbitrary place in the AST...
>
> Thanks.
> Sean
>
> --
> View this message in context:
> http://forum.world.st/Adding-a-statement-programmatically-tp4454447p4454447.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
>


-- 
Hernán Morales
Information Technology Manager,
Institute of Veterinary Genetics.
National Scientific and Technical Research Council (CONICET).
La Plata (1900), Buenos Aires, Argentina.
Telephone: +54 (0221) 421-1799.
Internal: 422
Fax: 425-7980 or 421-1799.

Reply via email to