[antlr-interest] Lexer fails

Peter Piper peterpiper797 at hotmail.com
Thu Jan 26 17:27:50 PST 2012


I'm sorry that I can only talk about the old stuff (v3) but can anyone
anyone see how the following lexer token definition:

FLOAT : ('0'..'9')+ ( '.' ('0'..'9')* )? ('E' | 'e') ('-')? ('0'..'9')+ ;

can possibly match the input:

3.142

?

There is no 'e' or 'E' in the input, so why does the ANTLR lexer think
that this is a "better" token to output than the other one I want it
to go for, namely:

FIXED : ('0'..'9')+ '.' ('0'..'9')* ;

?

Also, the Lexer seems happy to discard all characters that match no tokens
without complaining, though I haven't set option{filter=true} anywhere.
Does that remind anyone of anything I ought to know? :)

(This is with VS2010 C#, Antlr.Runtime v3.4.1.9004, if that's relevant?)

Dan

 		 	   		  


More information about the antlr-interest mailing list