Skip to content

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

Closed
@johnno1962

Description

@johnno1962
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.

Metadata

Metadata

Assignees

Labels

compilerThe Swift compiler itselffeatureA feature request or implementationliteralsFeature → expressions: Literals such as an integer or string literalraw string literalsFeature → expressions → literals → string literals: Raw string literalsswift evolution implementedFlag → feature: A feature that was approved through the Swift evolution process and implemented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions