[antlr-interest] variables, alternatives and actions
Gavin Lambert
antlr at mirality.co.nz
Sat Jul 5 15:24:55 PDT 2008
At 09:39 6/07/2008, Sven Efftinge wrote:
>in the following example the token is not assigned to the
>variable because the alternative contains actions:
>
>var=('+' { /* my action */} |'-' { /* my action */ })
>
>Is this intended or is it a bug? If it's a bug, has it been fixed
>in the latest version?
>I'm using 3.0.1 and the Java target.
Just to expand on what Ter said a bit: it's not the fact that
there's actions there that makes it not work, it's because you
have "var=(...)". Change this to:
(var='+' { /* stuff */} | var='-' { /* other stuff */ })
and it should work.
More information about the antlr-interest
mailing list