-
-
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
move triple-quoted string processing into parser #11815
Conversation
Strip out triple-quoted string indentation in the parser, instead of using the mstr macro. Also, no longer treat tabs as 8 spaces. Instead, remove the longest common prefix of spaces and tabs. Fixes #2682
:yay: |
I wish I knew you were working on this. I ended up wasting time then. |
@@ -1027,7 +1027,7 @@ | |||
(parse-string-literal s #t))) | |||
(nxt (peek-token s)) | |||
(macname (symbol (string #\@ ex '_str))) | |||
(macstr (if (triplequote-string-literal? str) str (cadr str)))) |
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.
Is this a typo here? This is changing it from picking up the 2nd element of str
(cadr str)
, to picking up the first (car str)
.
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.
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.
Over terseness can be an impediment to communication. In-line comments explaining the structure that you are processing might have made the change clear (not just for me, but for anybody else who needs to maintain this in the future).
What does this do when there is a there is no common prefix? """
a
$var
b""" work correctly. The interpolation part may not be an issue, because this code is happening before the code splits the string up into a vector, however the ignoring the indentation of totally blank lines still needs to be handled. |
cancelled appveyor, it will probably time out due to #11818 - we can restart the build later if that gets fixed, though there's likely to be a worse-than-usual backlog for the next few days |
Nothing.
Lines 895 to 900 in 5651bba
|
Good, that was one of the problems I was trying to fix, to make it act like Python's |
I think this is fine to merge as-is, but I wonder if we shouldn't do those tests by calling parse on strings – it seems quite likely that the test files will get whitespace cleaned at some point, which would rather confusingly break the tests. |
move triple-quoted string processing into parser
Before: julia> s = """ $("\n ") """ "\n\n" After: julia> s = """ $("\n ") """ "\n \n" Plus some minor cleanup of 333bb87.
Strip out triple-quoted string indentation in the parser, instead of using the mstr macro.
Also, no longer treat tabs as 8 spaces. Instead, remove the longest common prefix of spaces and tabs.
Fixes #2682