Stream: t-compiler

Topic: Converting \r\n -> \n at file load time


matklad (Jul 21 2019 at 20:20, on Zulip):

@Vadim Petrochenkov do we have an issue for normalizing newlines at file load time? I'd like to look into that. I've actually tried it already and I have questions about the expected behavior of "\r\r\n" :)

Vadim Petrochenkov (Jul 21 2019 at 20:35, on Zulip):

I assumed https://github.com/rust-lang/rust/issues/60604 is the issue.

matklad (Jul 21 2019 at 20:39, on Zulip):

Ah, that one, about raw byte strings, was closed by https://github.com/rust-lang/rust/pull/60793

Vadim Petrochenkov (Jul 21 2019 at 20:41, on Zulip):

expected behavior of "\r\r\n"

Let me check what VC++ does when reading a file with Windows EOL in text mode.

Vadim Petrochenkov (Jul 21 2019 at 21:20, on Zulip):

^^ \r\r\n is read as \r\n

Vadim Petrochenkov (Jul 21 2019 at 21:23, on Zulip):

Which seems reasonable since it's the simplest and fastest variant.
And if you have things like \r\r\n in a text file, it's understandable if the compiler considers it your problem.

Vadim Petrochenkov (Jul 22 2019 at 09:10, on Zulip):

The option with erroring on isolated \rs at load time also looks good to me.
It would allow to do some cleanup in the lexer too.

matklad (Jul 22 2019 at 09:14, on Zulip):

issue filed, by the way: https://github.com/rust-lang/rust/issues/62865

Yeah, I think I'll go with making this a hard error. This will make handling of "file > 4GB" somewhat cleaner as well.

Last update: Nov 20 2019 at 01:55UTC