ProvableHQ / leo

🦁 The Leo Programming Language. A Programming Language for Formally Verified, Zero-Knowledge Applications
https://leo-lang.org/
GNU General Public License v3.0
4.8k stars 655 forks source link

[Feature] Consider restricting line terminators to just LF or CR LF #1721

Open acoglio opened 2 years ago

acoglio commented 2 years ago

🚀 Feature

LF is used on Unix/Linux/macOS.

CR LF is used on Windows, as well as in some Internet standards like ABNF itself.

CR was used in Classic Mac OS, whose last release is over 20 years ago.

Unless there's a good reason to support CR, we could decide to support just LF or CR LF.

Aside from the slight simplification and increased minimalism, this may make some current bugs (#1716 and #1718) go away. In particular, it makes LF a reliable indicator of a line terminator, whether it is preceded by CR or not.

acoglio commented 2 years ago

If we do this, we may also want to prohibit isolated CR, i.e. CR not followed by LF.

In the grammar, this can be done by re-arranging a few rules to be more explicit about line terminators vs. other kinds of characters.

gluax commented 2 years ago

I'm in favor of this change.

acoglio commented 1 year ago

This issue is still relevant. We need to make a decision, also because currently there is a discrepancy between the grammar's notion of line terminators and the span file analyzer's notion of line terminator.