[antlr-interest] Easier way to do string literals?

Vaclav Barta vbar at comp.cz
Mon Oct 15 12:32:19 PDT 2007


On Monday 15 October 2007 21:08:55 Gavin Lambert wrote:
> At 21:37 15/10/2007, Vaclav Barta wrote:
>  >Is there really no way to parse C-like string literals in one
>  >pass?
> Not no way, it's just tricky :)
Indeed.

> I seem to vaguely recall ANTLR not liking something similar to the
> syntax I've used in StringChar, so you might need to move the
> action code for that up into the STRING rule.
> I also don't recall if you need to escape the backslashes in the
> append calls in EscapeSequence or not.  So you'll probably need to
> experiment a bit.
OK, thanks for the explanation. Next time I'm implementing C, I'll surely give 
it a try. :-)

	Bye
		Vasek


More information about the antlr-interest mailing list