[m-rev.] for review: treat '\r' as whitespace

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 20 06:00:45 AEDT 2001


On 19-Mar-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> 
> Estimated hours taken: 0.5
> Branches: main, release
> 
> library/lexer.m:
>     Fix a bug where the lexer library wasn't treating '\r' as a
>     whitespace character.

That was actually a deliberate decision.  The Mercury lexer is intended
to be compatible with ISO Prolog (modulo some deliberate Mercury extensions),
and the ISO Prolog standard says that only '\n', ' ' , and '\t' should be
treated as whitespace characters, I'm fairly sure.

Why do you want '\r' to be treated as a whitespace character?
I guess it is so that the Mercury compiler will be able to compile
Mercury code that is in DOS format even on a Unix file system
(or a Cygwin binary mode file system).  But there are some cases
where that will give compile errors or even wrong results.
E.g.

	main --> print("
		A long string.
		Split over multiple lines.
	").

	:- pragma c_code("
		#define macro \\
			this is the definition of the macro
	").

So I'm not certain that this is a good idea.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list