This is the rest of the code: ast := RBParser parseExpression: 'Object new. String new'. ast annotateInClass: UndefinedObject. (ast allChildren select: [ :each | each isVariable and: [ each variableBinding isLiteralBinding ] ]) collect: [ :each | each variableBinding binding value ] --> an OrderedCollection(Object String) #variableBinding returns the object knowing all details about the variables. It is only available after you annotated the AST with #annotateInClass:. Lukas On 30 December 2011 08:56, Lukas Renggli <renggli@gmail.com> wrote:
On 30 December 2011 01:23, Sean P. DeNigris <sean@clipperadams.com> wrote:
Lukas Renggli wrote
Can be easily done with RB: You parse it (RBParser parseExpression: aString) and do a semantic analysis (see the tests in AST-Tests-Semantics for examples).
Thanks, Lukas! How did I know that you would answer ;-)
I got that far, but couldn't figure out what to pass to annotateInClass:. Not calling it, or passing nil both lead to errors.
Yes, you need to call it. It tells the AST in what context (to what class "self" should refer to) it is used. For a workspace expression where "self" refers to "nil" you have to pass in "UndefinedObject".
Lukas
-- Lukas Renggli www.lukas-renggli.ch
-- Lukas Renggli www.lukas-renggli.ch