[antlr-interest] v3 lexer cannot tell keyword from identifier (very strange)
Terence Parr
parrt at cs.usfca.edu
Tue Mar 13 13:54:45 PDT 2007
On Feb 22, 2007, at 1:30 PM, Martin d'Anjou wrote:
> Hi,
>
> I have a very strange problem in 3.0b6. Given the input text:
>
> int id;
> int int_id;
>
> The error:
>
> line 2:4 mismatched input 'int' expecting IDENTIFIER
>
> It is mistaking "int_id" for "int", treating the underscore as a
> token separator. The (ridiculous looking) lexer is:
...
Hmm...my test grammar builds correct DFA:
lexer grammar U;
A : 'int' ;
ID : ('a'..'z'|'_')+ ;
'int_' predicts ID.
Ter
More information about the antlr-interest
mailing list