[antlr-interest] Newlines (yet again)

Paul J. Lucas pauljlucas at mac.com
Tue Jan 18 11:21:19 PST 2005


On Tue, 18 Jan 2005, Terence Parr wrote:

> On Jan 18, 2005, at 10:45 AM, Paul J. Lucas wrote:
> > 	You definitely do not need "\r\n" for Windows.  Since the '\n'
> > 	is always present and required for a newline, why do you care
> > 	whether a '\r' came before it?  Answer: you don't care what
> > 	came before it.
> 
> You still have to consume it.  The implicit assumption here is that some
> other construct matches it.

	Yes, and typically it's the '.' in the very same rule as in:

		"//"
		    ( options { greedy = false; }
		    : '\n' { newline(); }
		    | '.'
		    )
		;

	So it's part of the comment just like the '\n' is.

	- Paul



More information about the antlr-interest mailing list