[antlr-interest] Matching the * character
Gavin Lambert
antlr at mirality.co.nz
Fri Mar 28 00:49:57 PDT 2008
At 13:58 28/03/2008, Steve O'Hara wrote:
>Thanks for your help Loring unfortunately, it hasnt helped.
>Ive condensed the example down to something really simple;
>
>subExpressionText : QuotedString STAR? WS?;
>QuotedString :'\'' (~'\'')* '\'' ( '\'' (~'\'')* '\'' )* ;
>WS : (' ' | '\t' | '\n' | '\r')+ ;
>STAR : '*' ;
That QuotedString rule seems like a very weird
construction to me. I guess it will work anyway,
but I'd write it more like this (seems more
explicit, and leaves room to add additional
escapes later if you want to):
QuotedString : '\'' (~'\'' | '\'\'')* '\'';
Not really relevant to your problem, but I'm not
sure why you're getting the behaviour you're
describing unless it's something like what Ter
suggested and something else is messing with the
input before it gets to the parser. Or unless
you've got additional rules you haven't shown us
that are interfering.
More information about the antlr-interest
mailing list