[il-antlr-interest: 34113] [antlr-interest] Unexpected text

2011-09-21 Thread Graham Mer
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

[il-antlr-interest: 32198] Re: [antlr-interest] Previous rule element reference in a scope

2011-04-14 Thread Graham Mer
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

[il-antlr-interest: 32187] Re: [antlr-interest] Previous rule element reference in a scope

2011-04-13 Thread Graham Mer
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

[il-antlr-interest: 32098] Re: [antlr-interest] AST cardinality from called rules

2011-04-05 Thread Graham Mer
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)+ - //