Skip to content

Commit 9208c5b

Browse files
committed
Final nits in comments.
1 parent f0f08e1 commit 9208c5b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/Parse/Lexer.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,12 +1206,13 @@ static bool maybeConsumeNewlineEscape(const char *&CurPtr, ssize_t Offset) {
12061206
}
12071207
}
12081208

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
12111211
/// the literal beyond what it would appear creating potential security bugs.
12121212
static bool diagnoseZeroWidthMatchAndAdvance(char Target, const char *&CurPtr,
12131213
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.
12151216
return *CurPtr == Target && CurPtr++;
12161217
}
12171218

@@ -1244,10 +1245,10 @@ static unsigned advanceIfCustomDelimiter(const char *&CurPtr,
12441245
return 0;
12451246
}
12461247

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
12491250
/// 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.
12511252
/// If delimiter matches, advances byte pointer passed in and returns true.
12521253
/// Also used to detect the final delimiter of a string when IsClosing == true.
12531254
static bool delimiterMatches(unsigned CustomDelimiterLen, const char *&BytesPtr,
@@ -2106,7 +2107,7 @@ StringRef Lexer::getEncodedStringSegment(StringRef Bytes,
21062107
if (IndentToStrip == ~0u && CustomDelimiterLen == ~0u) {
21072108
IndentToStrip = CustomDelimiterLen = 0;
21082109

2109-
// restore trailing indent removal for multiline
2110+
// Restore trailing indent removal for multiline.
21102111
const char *Backtrack = BytesPtr - 1;
21112112
if (Backtrack[-1] == '"' && Backtrack[-2] == '"') {
21122113
Backtrack -= 2;
@@ -2115,7 +2116,7 @@ StringRef Lexer::getEncodedStringSegment(StringRef Bytes,
21152116
IndentToStrip++;
21162117
}
21172118

2118-
// restore delimiter if any
2119+
// Restore delimiter if any.
21192120
while (*--Backtrack == '#')
21202121
CustomDelimiterLen++;
21212122
}

0 commit comments

Comments
 (0)