[antlr-interest] Fwd: [Newbie] "keywords vs. identifiers": how can I fix this?
Thiago F.G. Albuquerque
tfga at terra.com.br
Thu Apr 10 08:59:27 PDT 2003
>ID : LETRA (LETRA | DIGITO)* ;
>
>INT : (DIGITO)+ ;
>
>BOOL : "true"
> | "false"
> ;
>
>ANTLR Parser Generator Version 2.7.2 1989-2003 jGuru.com
>grammar.g: warning:lexical nondeterminism between rules ID and BOOL upon
>grammar.g: k==1:'f','t'
I fixed it like this:
ID : ("true") => ("true") { $setType(BOOL); }
| ("false") => ("false") { $setType(BOOL); }
| LETRA (LETRA | DIGITO)* ;
Is this ok? Is there a better way to do this?
TIA,
Thiago
PS:
LETRA == LETTER
DIGITO == DIGIT
(sorry, I forgot to translate)
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list