[antlr-interest] new line character rule

Paul J. Lucas pauljlucas at mac.com
Wed Nov 24 08:45:26 PST 2004


On Wed, 24 Nov 2004, dsfsdf fdsfdsf wrote:

> NL: ( '\n' | '\r');

	I believe that should be:

		NL: ('\r')? '\n' ;

	Unix newlines are just '\n', so having '\r' optional works fine.
	Windows newlines are "\r\n", so, again, the above works fine.

	Or, since both have '\n' in them, you can treat '\r' as any
	other whitespace and not as part of a newline, i.e., a newline
	only is '\n'.

	Hence, I don't think the example in the ANTLR documentation is
	optimal.

	- Paul

	P.S.: Mac newlines back in the OS9 days were just '\r', but
	since OSX and the fact that OSX is *nix, IMHO coding for just
	'\r' is no longer necessary.



 
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