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. |
infinisil
left a comment
There was a problem hiding this comment.
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 🥲 |
| <|> chunk "''\\'" | ||
| <|> chunk "''\\" | ||
| *> (Text.singleton <$> anySingle) | ||
| <|> chunk "''$" |
There was a problem hiding this comment.
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