-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 #34105, unescape triple-quoted strings after dedenting #35001
Conversation
Yes, I'm in favor. I came across this when implementing the unindenting in one of the pure Julia parsers (can't remember which one) and thought it was an odd behavior. I concur with your assessment that this needs to happen in the opposite order. |
While this is a behavior change, it's hard to argue that this wasn't a bug. 💯 |
f854f9f
to
a723195
Compare
@ZacLN probably something we need to replicate in CSTParser as well? |
This PR changed the parsing of
from Is this unavoidable collateral damage or something that should be fixed? (Real code example that gets an extra newline: https://github.com/JuliaRegistries/RegistryTools.jl/blob/cbebbed17e13e7a18556a7dd62346d8610e867ea/src/types.jl#L126) |
It's unclear to me why that had the |
It's unclear to me too, but one reason might be that
before this PR. That's another thing that has changed, probably for the better. |
It seems clear to me that triple-quoted strings should only specially handle whitespace that directly occurs in the source text, not including escape sequences. This also makes it easier to fix #34967, since if unescaping is done first then you get a UTF-8 error when we try to strip whitespace if you write invalid UTF-8 strings using escape sequences (which is allowed of course).
But, this could be breaking since it obviously changes the values of some string literals.
fix #34105