[antlr-interest] avoiding nondeterminism warning
Terence Parr
parrt at cs.usfca.edu
Wed Sep 14 12:06:33 PDT 2005
On Sep 14, 2005, at 11:45 AM, Michael Laszlo wrote:
> In my parser class I include a literal in the token section:
>
> tokens {
> VAR="var";
> }
>
> Also, my lexer includes the rule:
>
> ID: LETTER (LETTER|DIGIT)*
>
> and antlr.Tool runs without warning as expected. Fine.
>
> However, now I want to perform an action whenever VAR is scanned so
> I add this rule to my lexer:
>
> VAR: "var" { inVarDefinition = true; };
Instead, add the action in ID with an IF in front to check to see if
it's "var". :)
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the antlr-interest
mailing list