Open huntc opened 2 years ago
that a nope for me, if you need special line ending handle use your own combinator, line ending of nom should follow standard and standard say \n
or at worse \r\n
, that also what rust std do. Mixing convention is a bad idea.
According to Wikipedia at least, line endings can be a single return character. Also, and what motivated me to raise this, the W3C spec for server sent events includes a single return character as a line ending in its ABNF.
Yes I know, what I mean is that 99% of the time \r
alone is not a valid new line. \n
should be used everywhere. Since \n
is become the "newline" back in time considering \r
as a newline introduce an ambiguous syntax. For complete input it's fine but for streaming you would always need input to confirm it. Thus streaming parser could never succeed if input end with a \r
. Handle \r\n
is already performance hit in all industry.
rustc 1.54.0 (a178d0322 2021-07-26)
7.0.0
None
As I understand things,
CR
on its own is also a valid line ending, along withCR+LF
andLF
.EDIT: According to Wikipedia at least, line endings can be a single return character. Also, and what motivated me to raise this, the W3C spec for server sent events includes a single return character as a line ending in its ABNF.
Happy to contribute a PR on an agreement. Thanks for providing nom!