[Patches] Parsing strings with \r\n or \r
Greg Stein
gstein@lyra.org
Mon, 29 May 2000 17:43:03 -0700 (PDT)
On Sun, 28 May 2000, Tim Peters wrote:
> [Greg Ward, fighting with line ends while Python is parsing]
>
> > ...
> > Well, I'd like to hear if this sounds like the right solution
> > before worrying about that -- let me know what you think and
> > I'll refine the patch.
>
> IMO there should be *no* #ifdefs in any of this logic: regardless of
> platform, and regardless of program source (be it file, string, file-like
> object, ...), Python tokenizers should recognize all of \r\n, \n, and \r as
> terminating a line (with \r\n viewed as a single line terminator when it
> appears, rather than as \r first and then an empty line ending with \n).
> Note that Java compilers are required to do this for Java source code, and
> it's a workaround that actually works. Somebody else will have to consider
> the 3,017 other ways Unicde spells end-of-line <0.9 wink>.
I'm with little Timmy on this one. Just make all platforms deal with all
newline types.
And then, yah: make that available to the string-based parsing, too.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/