[antlr-interest] string recognition

mzukowski at bco.com mzukowski at bco.com
Fri Mar 22 05:57:17 PST 2002


> I tried this:
> 
> WHITESPACE : '\r' | '\n' | '\t' ;
> STRING : QUOTE (~(WHITESPACE))* QUOTE ;
> 
> but I got ambiguity problem reported from ANTLR during class 
> creating.

Which is because QUOTE is part of ~(WHITESPACE).  Try ~(WHITESPACE | QUOTE).
If you allow escaping of a quote you will have to handle that separately.
See, for instance, STRING in the java.g grammar.

Monty

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list