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

Valid escapes in '' string are parsed as an error #417

Open
me-and opened this issue Jul 17, 2024 · 1 comment
Open

Valid escapes in '' string are parsed as an error #417

me-and opened this issue Jul 17, 2024 · 1 comment
Labels
component | third-party dependency Third party dependency status | it is a good thing We agree it is good to implement this type | bug Something isn't working

Comments

@me-and
Copy link

me-and commented Jul 17, 2024

The following is a valid Nix file:

{
  value = ''
    ''\'''${
  '';
}

This file produces an error with Alejandra:

$ alejandra test.nix
Checking style in 1 file using 9 threads.


Failed! 1 error found at:
- test.nix: unexpected end of file, wanted any of [TOKEN_STRING_END, TOKEN_STRING_CONTENT, TOKEN_INTERPOL_START]

But it's parsed as expected by nix:

$ nix --extra-experimental-features nix-command eval --read-only --file ./test.nix --raw value
'${

As a workaround, I can use ${"'"} to escape the single quote, rather than ''\', but this shouldn't be necessary as both are valid syntax.

@me-and
Copy link
Author

me-and commented Jul 17, 2024

This is possibly related to #194, although I'm not sure if it's fundamentally the same problem or a different problem in a related area.

@kamadorueda kamadorueda added type | bug Something isn't working status | it is a good thing We agree it is good to implement this component | third-party dependency Third party dependency labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component | third-party dependency Third party dependency status | it is a good thing We agree it is good to implement this type | bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants