Haskell 98 lexical syntax again

Simon Peyton-Jones simonpj@microsoft.com
Wed, 13 Feb 2002 09:00:00 -0800


To meet Ian's observation below, I propose to replace the=20
lexical production

	newline      -> a newline (system dependent)

by

	newline -> return linefeed | return | linefeed

which, given maximal munch, will behave decently on=20
any normal system.

Any objections?

Simon


| -----Original Message-----
| From: Ian Lynagh [mailto:igloo@earth.li]=20

| The report says
|=20
| whitechar    -> newline | return | linefeed | vertab | formfeed
|              |  space | tab | uniWhite
| newline      -> a newline (system dependent)
| return       -> a carriage return
| linefeed     -> a line feed
|=20
| so, if your system defines a newline to be a line feed, an=20
| implementation is free to choose whether to lex a line feed=20
| as a whitechar or a newline, which makes quite a difference=20
| when you consider the layout rule!
|=20
| newline can't be arbitrarily determined by the system -=20
| certainly "x" or "let" would not be acceptable - and having=20
| it system dependent means that Haskell scripts are not=20
| portable between different systems. I haven't looked but I=20
| would be surprised if current implementations behaved=20
| differently on different platforms - I assume they all look=20
| for something matching (<CR><LF>?)|<LF> everywhere.