-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Conversation
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. |
There was a problem hiding this 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!
@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 :) |
Better put in some code comments as well, they are more visible than the git log |
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 "''$" |
There was a problem hiding this comment.
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')
56b6379
to
46a6d2a
Compare
You nerdsniped me into fully re-implementing it 😅: #210 |
Closes #197