[antlr-interest] Lexer problem ( add ALLCHARS )

Martin Probst mail at martin-probst.com
Thu Mar 8 03:13:43 PST 2007


from what I see the input "aa" can be matched by these rules in your  
lexer grammar:
So the lexer cannot figure out which rule to use for this input, and  
apparently it picks one you don't expect. You should get lots of  
warning by ANTLR about this, did you ignore those? You certainly  

You will have to make up your mind on what literal should be selected  
at which point of time. It's usually better to resolve such issues in  
the parser.


PS: can someone change ANTLR so that it includes the type of the  
mismatched token in the error message? I think this is one of the  
most common problems, and users would at least have a hint on what's  
going on if they'd see "expecting IDENTIFIER, found 'aa' (ALLCHARS)".

More information about the antlr-interest mailing list