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

Extended string literal delimiters #7

Closed
alex-pinkus opened this issue Aug 28, 2021 · 0 comments · Fixed by #12
Closed

Extended string literal delimiters #7

alex-pinkus opened this issue Aug 28, 2021 · 0 comments · Fixed by #12
Labels
missing-language-feature A Swift language feature is not supported by the grammar

Comments

@alex-pinkus
Copy link
Owner

See swift grammar, SE-0200 blog post

Apparently, #"Hello"# is a legal way of delimiting strings in Swift 5. This is similar to Rust's raw string syntax, in that the opening and closing # must be matched, but differs in a few important ways such as interpolation.

Unfortunately, this might have to live in externals, like the Rust implementation does. I'm not sure how that could be done and still handle interpolation.

@alex-pinkus alex-pinkus added the missing-language-feature A Swift language feature is not supported by the grammar label Aug 28, 2021
alex-pinkus added a commit that referenced this issue Oct 10, 2021
Uses a custom scanner and ongoing state to parse code like:
```
extension URL {
    func html(withTitle title: String) -> String {
        return #"<a href="\#(absoluteString)">\#(title)</a>"#
    }
}
```

Fixes #7, #11
alex-pinkus added a commit that referenced this issue Oct 10, 2021
Uses a custom scanner and ongoing state to parse code like:
```
extension URL {
    func html(withTitle title: String) -> String {
        return #"<a href="\#(absoluteString)">\#(title)</a>"#
    }
}
```

Fixes #7, #11
alex-pinkus added a commit that referenced this issue Oct 12, 2021
Uses a custom scanner and ongoing state to parse code like:
```
extension URL {
    func html(withTitle title: String) -> String {
        return #"<a href="\#(absoluteString)">\#(title)</a>"#
    }
}
```

Fixes #7, #11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing-language-feature A Swift language feature is not supported by the grammar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant