[antlr-interest] Parse quotes with negation?

derek_kusiak derek_kusiak at yahoo.com
Sat Dec 4 19:17:37 PST 2004



I'm parsing a file format that contains quote-delimited string
literals.  In my lexer I deal with them like this:

  STRING_LITERAL : '"' (~'"')* '"' ;

If my input is a simple string like "hello world", all is well.
Other string work well too (eg, "hello-world", "hello#world").
However, some characters trigger errors.  For example,
"hello_world" causes this:

  expecting ''"'', found ''_''

I don't have any rules that mention '_' and I don't know why
it would be treated differently than any other ~'"' character.
I get similar errors with other chars, like '*' and '&', in
that position.  Any idea what I'm missing?





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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





More information about the antlr-interest mailing list