[antlr-interest] Strangeness when parsing strings and spaces

Kevin Jackson foamdino at gmail.com
Mon Jan 17 23:28:02 PST 2011


Hi,

> pair
>   :  LEFT_SQUARE IDENTIFIER QUOTED_TEXT RIGHT_SQUARE
>   ;
>
> LEFT_SQUARE  : '[';
> RIGHT_SQUARE : ']';
> IDENTIFIER   : ('a'..'z'|'A'..'Z')+;
> QUOTED_TEXT  : '"' ('a'..'z' | 'A'..'Z' | ' ' | ',' | '-')+ '"';
> SPACES       : (' ' | '\t')+ {skip();};

Thanks for the reply.  This nearly works!  However I don't want to
retain the '"' (quotes) in the rewrite rule, so although the
IDENTIFIER has fixed the first problem, I now have a problem with the
QUOTED_TEXT.

I should have mentioned that I suppose.

Thanks,
Kev


More information about the antlr-interest mailing list