Skip to content

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Jun 26, 2024

This re-implements the indented string parser to fully preserve the input, while matching behavior to the Nix one. This fixes #197 as an alternative to #208.

In addition to fixing that issue though, this also fixes cases like

''
  ''\a
  ''\
  ''\b
''

which was previously reformatted as

''
  a

    b
''

This work is sponsored by Antithesis

Copy link

github-actions bot commented Jun 26, 2024

Nixpkgs diff

@infinisil infinisil force-pushed the match-nix-str-parsing branch from d6ec6f5 to 086f0bc Compare June 26, 2024 19:10
@infinisil infinisil mentioned this pull request Jun 26, 2024
@infinisil infinisil force-pushed the match-nix-str-parsing branch from 086f0bc to 72361ab Compare June 26, 2024 19:38
@infinisil
Copy link
Member Author

Whether something like ''\a should actually be preserved or not could be debated, but for now I think it's best to just stick to the standard, which specifies that everything in a string should be preserved.

This should make sure that:
- No sequences of characters get modified during parsing,
  indented strings are left exactly as is
- We won't have any parsing bugs

Also added a ton of docs to explain how it works and more tests
@infinisil infinisil force-pushed the match-nix-str-parsing branch from 72361ab to ea74366 Compare June 26, 2024 19:40
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-57/47823/1

@infinisil infinisil merged commit 6989547 into master Jul 3, 2024
@infinisil infinisil deleted the match-nix-str-parsing branch July 3, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Formatting unquotes interpolation

3 participants