[antlr-interest] Mismatched Character, expecting set null

Jim Idle jimi at temporal-wave.com
Sat Aug 7 09:50:01 PDT 2010


Unary positive and unary negative are operators usually - you should deal
with them in the parser really unless they are not used elsewhere in the
grammar. Are you using '.' elsewhere? If you are, you may need to left
factor '.'and '..' in to one rule.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Ken Klose
> Sent: Saturday, August 07, 2010 1:31 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Mismatched Character, expecting set null
> 
> 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
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list