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

Newline Escapes #257

Open
enderger opened this issue Jul 7, 2022 · 3 comments
Open

Newline Escapes #257

enderger opened this issue Jul 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@enderger
Copy link

enderger commented Jul 7, 2022

Feature Description

Currently, DuckScript appears to lack any means to split up long lines. A simple \ before a newline probably is a good yet simple solution to the problem.

Describe The Solution You'd Like

At the end of lines, including a \ character should tell the parser to ignore the newline and continue parsing the command on the previous line.

Code Sample

exec --fail-on-error nix build ".#docker-image" \
  --arg foo true \
  --arg bar ${var} \
  --arg baz "Lorem ipsum"
@sagiegurari
Copy link
Owner

@enderger thanks for the suggestion.
i made duckscript stupid simple on purpose, but i get your point that this might hurt readability for long lines.
let me think of something here....

@sagiegurari sagiegurari added the enhancement New feature or request label Jul 11, 2022
@enderger
Copy link
Author

We are aware that it is intentionally simple, and find that a strong quality. Looking into the source, it seems that there would need a modification to line splitting (the solution with the least code would be changing the delimiter, but that would require something like semicolons), perhaps using replace before splitting into lines (those followed by a space would be implicitly escaped).

@sagiegurari
Copy link
Owner

@enderger i'm not worried about parsing. The technical issue is actually the parsed line metadata (such as a command line) that has which file and line number it came from). for that i'm not going to support the right line, only define it as the first line. i think its good enough but not as amazing as i would hope.
also since the next line would actually be not available, gotos would have to skip to next available line... this might happen already. need to check.

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

No branches or pull requests

2 participants