[antlr-interest] literals.
Oliver Zeigermann
oliver at zeigermann.de
Tue Dec 9 23:37:30 PST 2003
cesar octavio lopez nataren wrote:
> On Wed, 2003-12-10 at 01:00, Oliver Zeigermann wrote:
> If I erase that and add the lexical rule
>
> IN: "in";
>
> I get:
>
> jscript.g: warning:lexical nondeterminism between rules IDENTIFIER and
> IN upon
> jscript-lexer-parser.g: k==1:'i'
> jscript-lexer-parser.g: k==2:'n'
> jscript-lexer-parser.g: k==3:<end-of-token>
>
> The definition of IDENTIFIER that I have is:
>
> IDENTIFIER
> options { testLiterals = true; }
> : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9')*
> ;
Ah, I see now. This looks like a real nondeterminism. If you were really
correct - I think nobody actually does this, this is just to make me
point clear - you would have to omit the string "in" from your
IDENTIFIER rule. Of course you should not do this, but simply put the IN
rule before the IDENTIFIER which gives preceedence of IN over IDENTIFIER
and ignore the warning.
Oliver
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list