Hi everybody!
- Dr. Nick.
I have a larger grammar, a tiny portion of which is attached below.
Everything works as expected, except for one thing. In the tree
grammar, note the following rule:
decl: ID typeSpec { System.out.println( decl id= + $ID + ;type= +
$typeSpec.text );}
Given the
There's your problem..the enclosed block needs to be part of the
withStatement rule I would say (how else would you decide when the object in
the with statement goes out of scope?). Once you bring the enclosed block
into the rule, you will be able to reference the enclosing withStatement
It's not clear from your question if only method calls are legal within a
with statement, in which case the suggestions made should work, or if (as
I suspect) any statement is legal within a with, like in javascript.
Thanks for the replies, everyone.
You're correct, Peter, it is not limited
Problem solved. Thanks for the replies, the parameterized version does
exactly what I need:
localVariableDeclaration:
: LOCAL! variableDeclarationList[LOCAL]
;
variableDeclarationList[int type]
: variableDcl ( ',' variableDcl )*
- {type == LOCAL}? ^(LOCAL variableDcl)+
- //