[antlr-interest] string recognition
kordeul
tom_kra at hotmail.com
Fri Mar 22 01:14:00 PST 2002
Hi
In my parser I should be able to recognise strings, where a string
is the sequence of 0 or more characters included in quotes. I could
do the recognition inside lexer with
STRING : QUOTE (LETTER|DIGIT|COMMA|.....)* QUOTE ;
but this way I have to define every possible char that can be
included inside the string. Is there a smarter way of doing this -
the string is actually any char except whitespace (spaces are
allowed!)?
I tried this:
WHITESPACE : '\r' | '\n' | '\t' ;
STRING : QUOTE (~(WHITESPACE))* QUOTE ;
but I got ambiguity problem reported from ANTLR during class
creating.
BR Tom
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list