@@ -1206,12 +1206,13 @@ static bool maybeConsumeNewlineEscape(const char *&CurPtr, ssize_t Offset) {
1206
1206
}
1207
1207
}
1208
1208
1209
- // / diagnoseZeroWidthMatchAndAdvance - Error zerowidth characters in delimiters.
1210
- // / A non visible character in the middle of a delimter can be used to extend
1209
+ // / diagnoseZeroWidthMatchAndAdvance - Error invisible characters in delimiters.
1210
+ // / An invisible character in the middle of a delimiter can be used to extend
1211
1211
// / the literal beyond what it would appear creating potential security bugs.
1212
1212
static bool diagnoseZeroWidthMatchAndAdvance (char Target, const char *&CurPtr,
1213
1213
DiagnosticEngine *Diags) {
1214
- // Detect, diagnose and skip over zero-width characters here if required.
1214
+ // TODO: Detect, diagnose and skip over zero-width characters if required.
1215
+ // See https://github.com/apple/swift/pull/17668 for possible implementation.
1215
1216
return *CurPtr == Target && CurPtr++;
1216
1217
}
1217
1218
@@ -1244,10 +1245,10 @@ static unsigned advanceIfCustomDelimiter(const char *&CurPtr,
1244
1245
return 0 ;
1245
1246
}
1246
1247
1247
- // / delimiterMatches - Does custom delimiter (# characters surrounding quotes)
1248
- // / match the number of # characters after \ inside the string? This allows
1248
+ // / delimiterMatches - Does custom delimiter ('#' characters surrounding quotes)
1249
+ // / match the number of '#' characters after '\' inside the string? This allows
1249
1250
// / interpolation inside a "raw" string. Normal/cooked string processing is
1250
- // / the degenerate case of there being no # characters surrounding the quotes.
1251
+ // / the degenerate case of there being no '#' characters surrounding the quotes.
1251
1252
// / If delimiter matches, advances byte pointer passed in and returns true.
1252
1253
// / Also used to detect the final delimiter of a string when IsClosing == true.
1253
1254
static bool delimiterMatches (unsigned CustomDelimiterLen, const char *&BytesPtr,
@@ -2106,7 +2107,7 @@ StringRef Lexer::getEncodedStringSegment(StringRef Bytes,
2106
2107
if (IndentToStrip == ~0u && CustomDelimiterLen == ~0u ) {
2107
2108
IndentToStrip = CustomDelimiterLen = 0 ;
2108
2109
2109
- // restore trailing indent removal for multiline
2110
+ // Restore trailing indent removal for multiline.
2110
2111
const char *Backtrack = BytesPtr - 1 ;
2111
2112
if (Backtrack[-1 ] == ' "' && Backtrack[-2 ] == ' "' ) {
2112
2113
Backtrack -= 2 ;
@@ -2115,7 +2116,7 @@ StringRef Lexer::getEncodedStringSegment(StringRef Bytes,
2115
2116
IndentToStrip++;
2116
2117
}
2117
2118
2118
- // restore delimiter if any
2119
+ // Restore delimiter if any.
2119
2120
while (*--Backtrack == ' #' )
2120
2121
CustomDelimiterLen++;
2121
2122
}
0 commit comments