<div dir="ltr">Looks like both those cases are supported based on similar tests here: <a href="https://github.com/apple/swift/blob/master/test/Parse/multiline_string.swift">https://github.com/apple/swift/blob/master/test/Parse/multiline_string.swift</a><div><br></div><div>Should be available in snapshots `swift-4.0-DEVELOPMENT-SNAPSHOT-2017-05-09-a` onwards.</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 31 May 2017 at 13:59 Nathan Hawes via swift-dev &lt;<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hey all,<div><br></div><div>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?</div><div><br></div><div>1) Nested multi-line strings:</div><div><br></div><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><div style="margin:0px;line-height:normal"><span style="color:#ba2da2">let</span> x = <span style="color:#d12f1b">&quot;&quot;&quot;</span></div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">outer multi-line</div><div style="margin:0px;line-height:normal">\<span style="color:#d12f1b">(</span></div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)"><span style="color:#000000">  </span>&quot;&quot;&quot;</div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">    inner multiline</div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">  &quot;&quot;&quot;</div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">)</div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">outer multi-line</div><div style="margin:0px;line-height:normal;color:rgb(209,47,27)">&quot;&quot;&quot;</div><div style="margin:0px;line-height:normal;color:rgb(62,30,129)">print<span style="color:#000000">(</span><span style="color:#4f8187">x</span><span style="color:#000000">)</span></div></div></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(209,47,27);background-color:rgb(255,255,255)"><br></div><div><br></div><div>2) Multi-line strings nested in &quot;single-line&quot; strings:</div><div><br></div><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(209,47,27);background-color:rgb(255,255,255)"><div style="margin:0px;line-height:normal"><span style="color:#ba2da2">let</span><span style="color:#000000"> x = </span>&quot;outer string <span style="color:#000000">\</span>(<span style="color:#000000"> </span>&quot;&quot;&quot;</div><div style="margin:0px;line-height:normal">    inner multiline</div><div style="margin:0px;line-height:normal">  &quot;&quot;&quot;) outer string&quot;</div><div style="margin:0px;line-height:normal;color:rgb(62,30,129)">print<span style="color:#000000">(</span><span style="color:#4f8187">x</span><span style="color:#000000">)</span></div></div></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(62,30,129);background-color:rgb(255,255,255)"><span style="color:#000000"><br></span></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Thanks!</div><div>Nathan</div></div>_______________________________________________<br>
swift-dev mailing list<br>
<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br>
</blockquote></div>