-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-10011] [Lexer] Raw Strings escape character sequence resembling multiline delimiter #34414
Conversation
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
@swift-ci Please smoke test |
Error from the CI:
This doesn't seem to be related to my PR. On my machine, the compiler builds and passes all tests using ninja. Did a recent merge break the compiler? Or, is this from my PR? |
A recent merge; should be reverted now. Let's try again: @swift-ci Please smoke test |
@swift-ci Please test Windows |
1 similar comment
@swift-ci Please test Windows |
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.
Thank you!
Summary
The Lexer currently treats triple-quotes as a multiline delimiter for Strings. This PR allows the multiline delimiter (
"""
) to be escaped in raw Strings when a valid closing custom delimiter (e.g.#
) is found before a newline.Problem
The Lexer does not register some strings that are technically valid according to the documented regex on string literals.
For example:
#"""#
Gives the errors:
Multi-line string literal content must begin on a new line & Unterminated string literal
Impact
This change does not impact any Strings that are already valid, rather, this PR enables a new set of String literals to be considered valid.
After merging this PR:
#"""#
is now equivalent to"\""
#"""text"#
equates to"\"\"text"
#"""
is still the beginning of a multiline raw string.Links
Resolves SR-10011.
Replaces my previous PR attempt: #23115
Tagging @rintaro and @xwu from activity in my previous PR #23115.