Skip to content
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-6362] Raw escaping in string literals #48912

Closed
johnno1962 opened this issue Nov 11, 2017 · 4 comments
Closed

[SR-6362] Raw escaping in string literals #48912

johnno1962 opened this issue Nov 11, 2017 · 4 comments
Assignees
Labels
compiler The Swift compiler in itself feature A feature request or implementation literals Feature → expressions: Literals such as an integer or string literal raw string literals Feature → expressions → literals → string literals: Raw string literals swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented

Comments

@johnno1962
Copy link
Contributor

Previous ID SR-6362
Radar rdar://problem/47725014
Original Reporter @johnno1962
Type New Feature
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels New Feature, LanguageFeatureRequest
Assignee @johnno1962
Priority Medium

md5: 0d6a3785983c156c861de08a567e4986

Issue Description:

Often it is inconvenient and opaque entering string literals that are in tended as regex patterns into a swift source.

Taking the lead from python it perhaps a new syntax r"\w+\s+\w" could be added to the swift language. This would be equivalent to " w+ s+ w". The specification required would be that if a string literal is preceded by r then unknown escapes are passed though to the literal as-is including the back-slash character rather than going an error. This would be a very minor change confined to Lexer.cpp that I'll work on tomorrow and present to swift-evolution.

@belkadan
Copy link
Contributor

I think the "r" stands for "raw", not "regex".

@johnno1962
Copy link
Contributor Author

@beccadax
Copy link
Contributor

beccadax commented Feb 1, 2019

Just adding a radar number; nothing to see here.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis
Copy link
Collaborator

Proposal: SE-0200

@AnthonyLatsis AnthonyLatsis added swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented and removed new feature labels Nov 11, 2022
@AnthonyLatsis AnthonyLatsis added the literals Feature → expressions: Literals such as an integer or string literal label Mar 22, 2023
@AnthonyLatsis AnthonyLatsis added the raw string literals Feature → expressions → literals → string literals: Raw string literals label Mar 22, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation literals Feature → expressions: Literals such as an integer or string literal raw string literals Feature → expressions → literals → string literals: Raw string literals swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented
Projects
None yet
Development

No branches or pull requests

4 participants