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

Allow escaping arbitrary characters in double-quoted strings #2359

Closed
laniakea64 opened this issue Sep 10, 2024 · 1 comment · Fixed by #2360
Closed

Allow escaping arbitrary characters in double-quoted strings #2359

laniakea64 opened this issue Sep 10, 2024 · 1 comment · Fixed by #2360

Comments

@laniakea64
Copy link
Contributor

Currently just strings delimited with " " or """ """ only support escaping a limited set of characters - https://just.systems/man/en/chapter_30.html

Most other languages have a syntax for escaping arbitrary Unicode characters. Having such syntax in just would make some justfiles easier to work with:

  • Not all valid Unicode characters are printable. And even within the set of printable characters, some text editors don't always do a good job of displaying some printable Unicode characters. Representing these characters as sequence of ASCII characters is not subject to such problems.
  • If you know the escape sequence of a character you want to use, having escape syntax means you can just type the character rather than needing to find the character in a character map and copy+paste.

Additionally, such syntax would be helpful if the recipe attribute suggested in #647 (comment) gets implemented.

Thinking about just's backwards-compatibility guarantee, maybe the best syntax would be copying Rust's \u{...}, since it allows a flexible and unambiguous number of hex digits?

@casey
Copy link
Owner

casey commented Sep 10, 2024

This would be great, and I agree that \u{…} is the ideal syntax. It'll require modifying Parser::parse_string_literal, which will be a bit of work to make it process multi-line escape sequences.

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

Successfully merging a pull request may close this issue.

2 participants