[antlr-interest] Newlines (yet again)

Paul J. Lucas pauljlucas at mac.com
Tue Jan 18 10:45:52 PST 2005

On Tue, 18 Jan 2005, David Wigg wrote:

> Admittedly I have not seen any previous correspondence on this 
> subject but I don't see how you can ignore the possibility of a 
> '\r' appearing here.
> In any case I don't think it will work on a Mac file, or has 
> this been changed now?

	MacOS is now Unix.  Only really old MacOS 9 files use '\r'.

> 		// handle newlines
> 	|	(	"\r\n"  // MS
> 		|	'\r'    // Mac
> 		|	'\n'    // Unix
> 		)	{newline();}

	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.

	- Paul

More information about the antlr-interest mailing list