[antlr-interest] Can't see the wood (@init and @after)
Paul Keir
paul at paulkeir.com
Tue Jul 24 14:26:09 PDT 2007
Thanks for the explanation Jim, although I still have trouble putting
the conclusions it into practise. I remain confused about @init's safe use.
Can I suggest that as a simple rule-of-thumb for beginners, that @init
should be avoided, except when used to declare rule-local variables?
I'm now hoping that I can at least continue to use @after. I don't seem
to have the same problems when I use @after, and a variant (below) of my
a/b test for it, safely returns an equal number of a and b characters.
expression
@after { System.out.println("a"); }
: assignment_expression (',' assignment_expression)*
{ System.out.println(" b"); }
;
Cheers,
Paul
More information about the antlr-interest
mailing list