Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newlines mishandled? #7

Open
PuppyPi opened this issue May 27, 2021 · 2 comments
Open

Newlines mishandled? #7

PuppyPi opened this issue May 27, 2021 · 2 comments

Comments

@PuppyPi
Copy link
Owner

PuppyPi commented May 27, 2021

The parser converts my CR LF line endings in CAOS String Literals into just LF line endings!

( /pretends to be a user XD )

@PuppyPi
Copy link
Owner Author

PuppyPi commented May 27, 2021

We can certainly fix this if it causes problems!

But the reasoning is:

• Doing this (which is called "Universal Newlines" in Python) is often considered a feature, and line endings being invisibly different and causing different effects is often a source of bugs and annoyances. (This way, source code is handled the same regardless of whether it was written in Windows Notepad or Linux Leafpad or etc., it's all converted to the Everything-but-Windows convention XD )

• You can still use explicit \r\n escapes in string literals and they're handled fine and turn into what you expect! (And this way they're explicit and visible! Meaning it's not an invisible weirdness people might forget about)

• Newlines are altered by programs often so they're not terribly reliable anyway. Say someone opens a .cos file in notepad on Windows and saves it again (or vice versa with leafpad/etc. on Linux). That will usually convert all the line endings to that operating system's format. So this way, that won't affect anything at all in the CaoticDreams engine because it just converts the line endings before parsing any caos, from a cos file or the dynamic CAOS function!

• It makes parsing a heck of a lot easier and less bug prone and I'm doing this for fun in my spare time XD

• It makes testing for bugs easier because we know that line endings can't affect anything so we don't have to worry about having multiple versions of every test case for the three types of line endings to achieve proper coverage! XD

@PuppyPi
Copy link
Owner Author

PuppyPi commented May 27, 2021

Aaaand I just remembered that multiline string literals are considered a weird and unused feature (Creatures-Developer-Network/c2e-quirks#22), so this is almost certainly all moot anyway (at least in CAOS!) because anytime anyone wants line terminators they use escapes no matter what XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant