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

Fix 197 #208

Closed
wants to merge 1 commit into from
Closed

Fix 197 #208

wants to merge 1 commit into from

Conversation

dasJ
Copy link
Member

@dasJ dasJ commented Jun 26, 2024

Closes #197

@dasJ dasJ requested a review from infinisil June 26, 2024 08:07
Copy link

github-actions bot commented Jun 26, 2024

Nixpkgs diff

@dasJ dasJ closed this Jun 26, 2024
@dasJ dasJ deleted the fix/197 branch June 26, 2024 08:12
@dasJ dasJ restored the fix/197 branch June 26, 2024 08:13
@dasJ dasJ reopened this Jun 26, 2024
@dasJ
Copy link
Member Author

dasJ commented Jun 26, 2024

Diff looks like this is now in line with what we currently have in nixpkgs and nix now properly parses the string rather than failing to parse the file.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's simpler than I'd have expected, neat!

@infinisil
Copy link
Member

@dasJ Since you seem to have understood the code, can you explain why this fixes it in the commit message? Would be great to also briefly describe the problem in the commit message for future readers :)

@piegamesde
Copy link
Member

Better put in some code comments as well, they are more visible than the git log

@dasJ
Copy link
Member Author

dasJ commented Jun 26, 2024

I actually don't understand why it fixes that 🥲

@@ -196,6 +196,7 @@ indentedStringPart =
( chunk "''\\n"
<|> chunk "''\\r"
<|> chunk "''\\t"
<|> chunk "''\\'"
<|> chunk "''\\"
*> (Text.singleton <$> anySingle)
<|> chunk "''$"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, I'm now seeing the problem: The formatting here is very misleading, because it makes me believe that <|> binds stronger than *>, but in reality it's the other way around: <|> is infixl 3, while *> is infixl 4.

It makes more sense when we format it this way, also added a comment:

chunk "''\\n"
<|> chunk "''\\r"
<|> chunk "''\\t"
<|> chunk "''\\'"
-- ''\ followed by any char throws away the ''\ part, leaving just the char
<|> chunk "''\\" *> (Text.singleton <$> anySingle)
<|> chunk "''$"
<|> chunk "'''"
<|> chunk "$$"
<|> try (chunk "$" <* notFollowedBy (char '{'))
<|> try (chunk "'" <* notFollowedBy (char '\''))
<|> someP (\t -> t /= '\'' && t /= '$' && t /= '\n')

@dasJ dasJ force-pushed the fix/197 branch 2 times, most recently from 56b6379 to 46a6d2a Compare June 26, 2024 18:08
Closes #197
@infinisil
Copy link
Member

You nerdsniped me into fully re-implementing it 😅: #210

@infinisil infinisil closed this Jul 3, 2024
@infinisil infinisil deleted the fix/197 branch July 3, 2024 02:50
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