[antlr-interest] Mismatched Character, expecting set null

Ken Klose kenklose at gmail.com
Sat Aug 7 01:31:26 PDT 2010


Thanks for all of the fantastic help you got me over my initial hurdle and
I've been slowly expanding my grammar.

I have arrived at a new problem that I can't resolve.  I am parsing a rather
simple data file and have to read a field that can be a number of the forms
"55", "+55", "-55", or ".." in case where no number has been assigned.  I've
tried the following token definitions but get MismatchedTokenException on
"55" and "+55".

These are two of the token definitions I have tried:

CHANGE: ( ( ('+' | '-')? DIGIT+) | '..' );
CHANGE: ( ( ('+')? ('-')? DIGIT+) | '..' );
fragment DIGIT: '0'..'9';


Thanks again for all your help.

--Ken


More information about the antlr-interest mailing list