@@ -1064,7 +1064,8 @@ extension Parser {
1064
1064
/// Parse open quote.
1065
1065
let openQuote = self . parseStringLiteralQuote (
1066
1066
at: openDelimiter != nil ? . leadingRaw : . leading,
1067
- text: text
1067
+ text: text,
1068
+ wantsMultiline: self . currentToken. isMultilineStringLiteral
1068
1069
) ?? RawTokenSyntax ( missing: . stringQuote, arena: arena)
1069
1070
if !openQuote. isMissing {
1070
1071
text = text. dropFirst ( openQuote. tokenText. count)
@@ -1078,7 +1079,8 @@ extension Parser {
1078
1079
/// Parse close quote.
1079
1080
let closeQuote = self . parseStringLiteralQuote (
1080
1081
at: openDelimiter != nil ? . trailingRaw : . trailing,
1081
- text: text
1082
+ text: text,
1083
+ wantsMultiline: self . currentToken. isMultilineStringLiteral
1082
1084
) ?? RawTokenSyntax ( missing: openQuote. tokenKind, arena: arena)
1083
1085
if !closeQuote. isMissing {
1084
1086
text = text. dropFirst ( closeQuote. tokenText. count)
@@ -1209,7 +1211,8 @@ extension Parser {
1209
1211
1210
1212
mutating func parseStringLiteralQuote(
1211
1213
at position: QuotePosition ,
1212
- text: Slice < SyntaxText >
1214
+ text: Slice < SyntaxText > ,
1215
+ wantsMultiline: Bool
1213
1216
) -> RawTokenSyntax ? {
1214
1217
// Single quote. We only support single line literal.
1215
1218
if let first = text. first, first == UInt8 ( ascii: " ' " ) {
@@ -1223,6 +1226,9 @@ extension Parser {
1223
1226
while index < text. endIndex && text [ index] == UInt8 ( ascii: " \" " ) {
1224
1227
quoteCount += 1
1225
1228
index = text. index ( after: index)
1229
+ guard wantsMultiline else {
1230
+ break
1231
+ }
1226
1232
}
1227
1233
1228
1234
// Empty single line string. Return only the first quote.
0 commit comments