[swift-dev] Nested multi-line string literals
nhawes at apple.com
Wed May 31 15:59:39 CDT 2017
I’ve been playing with multi-line string literals recently and was wondering, are the below cases supported intentionally or did they just fall out of the implementation?
1) Nested multi-line strings:
let x = """
2) Multi-line strings nested in "single-line" strings:
let x = "outer string \( """
""") outer string"
I’ve been looking at still syntax highlighting strings in the invalid states they pass through while writing or editing them, and trying to keep any changes to the file’s highlighted ranges as localized as possible. At the moment when you open an interpolation in an otherwise terminated multi-line string literal you get one giant unknown token – an unterminated string – from the opening triple quotes, past the ‘closing’ triple quotes (that we treat as nested opening quotes), to the end of the file.
It’d be great to be able to bound the unknown token to what were more likely intended to be closing quotes, so we still produce tokens for (and syntax highlight) the rest of the file. Of course with nesting you can’t be sure they’re closing quotes though, so I wanted to check if the nesting support was intentional.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev