File tree 1 file changed +11
-16
lines changed
compiler/src/dotty/tools/dotc/parsing 1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ object Scanners {
340
340
if (next.token == EMPTY ) {
341
341
lastOffset = lastCharOffset
342
342
currentRegion match {
343
- case InString (multiLine, _) => fetchStringPart(multiLine)
343
+ case InString (multiLine, _) if lastToken != STRINGPART => fetchStringPart(multiLine)
344
344
case _ => fetchToken()
345
345
}
346
346
if (token == ERROR ) adjustSepRegions(STRINGLIT ) // make sure we exit enclosing string literal
@@ -1097,13 +1097,7 @@ object Scanners {
1097
1097
getRawStringLit()
1098
1098
}
1099
1099
1100
- @ annotation.tailrec private def getStringPart (multiLine : Boolean ): Unit = {
1101
- def finishStringPart () = {
1102
- setStrVal()
1103
- token = STRINGPART
1104
- next.lastOffset = charOffset - 1
1105
- next.offset = charOffset - 1
1106
- }
1100
+ @ annotation.tailrec private def getStringPart (multiLine : Boolean ): Unit =
1107
1101
if (ch == '"' )
1108
1102
if (multiLine) {
1109
1103
nextRawChar()
@@ -1127,18 +1121,19 @@ object Scanners {
1127
1121
getStringPart(multiLine)
1128
1122
}
1129
1123
else if (ch == '{' ) {
1130
- finishStringPart()
1131
- nextRawChar()
1132
- next.token = LBRACE
1124
+ setStrVal()
1125
+ token = STRINGPART
1133
1126
}
1134
1127
else if (Character .isUnicodeIdentifierStart(ch) || ch == '_' ) {
1135
- finishStringPart()
1136
- while ({
1128
+ setStrVal()
1129
+ token = STRINGPART
1130
+ next.lastOffset = charOffset - 1
1131
+ next.offset = charOffset - 1
1132
+ while
1137
1133
putChar(ch)
1138
1134
nextRawChar()
1139
1135
ch != SU && Character .isUnicodeIdentifierPart(ch)
1140
- })
1141
- ()
1136
+ do ()
1142
1137
finishNamed(target = next)
1143
1138
}
1144
1139
else
@@ -1157,7 +1152,7 @@ object Scanners {
1157
1152
getStringPart(multiLine)
1158
1153
}
1159
1154
}
1160
- }
1155
+ end getStringPart
1161
1156
1162
1157
private def fetchStringPart (multiLine : Boolean ) = {
1163
1158
offset = charOffset - 1
You can’t perform that action at this time.
0 commit comments