mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:01:05 +01:00
Update basic diagnostic capitalization/punctuation (#4328)
This is a primarily automated change:
- Search & replace for capitalization
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s")([A-Z])`
- `$1\L$2`
- Search & replace for period
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s"(?:[^)]|\n)+)\.("[,)])`
- `$1$2`
- Limited search & replace for `ERROR: ` -> `error: ` in streamed things
- Leaving a TODO for command_line because there's more cleanup that can
be done there
- Modify diagnostic_consumer.cpp
- ERROR -> error
- WARNING -> warning
---------
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
7f6d684b29
commit
e7aebbe581
@@ -213,8 +213,8 @@ static auto CheckIndent(LexerDiagnosticEmitter& emitter, llvm::StringRef text,
|
||||
if (indent.end() != content.end()) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ContentBeforeStringTerminator, Error,
|
||||
"Only whitespace is permitted before the closing `'''` of a "
|
||||
"multi-line string.");
|
||||
"only whitespace is permitted before the closing `'''` of a "
|
||||
"multi-line string");
|
||||
emitter.Emit(indent.end(), ContentBeforeStringTerminator);
|
||||
}
|
||||
|
||||
@@ -231,16 +231,16 @@ static auto ExpandUnicodeEscapeSequence(LexerDiagnosticEmitter& emitter,
|
||||
}
|
||||
if (digits.getAsInteger(16, code_point) || code_point > 0x10FFFF) {
|
||||
CARBON_DIAGNOSTIC(UnicodeEscapeTooLarge, Error,
|
||||
"Code point specified by `\\u{{...}}` escape is greater "
|
||||
"than 0x10FFFF.");
|
||||
"code point specified by `\\u{{...}}` escape is greater "
|
||||
"than 0x10FFFF");
|
||||
emitter.Emit(digits.begin(), UnicodeEscapeTooLarge);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (code_point >= 0xD800 && code_point < 0xE000) {
|
||||
CARBON_DIAGNOSTIC(UnicodeEscapeSurrogate, Error,
|
||||
"Code point specified by `\\u{{...}}` escape is a "
|
||||
"surrogate character.");
|
||||
"code point specified by `\\u{{...}}` escape is a "
|
||||
"surrogate character");
|
||||
emitter.Emit(digits.begin(), UnicodeEscapeSurrogate);
|
||||
return false;
|
||||
}
|
||||
@@ -310,8 +310,8 @@ static auto ExpandAndConsumeEscapeSequence(LexerDiagnosticEmitter& emitter,
|
||||
if (!content.empty() && IsDecimalDigit(content.front())) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
DecimalEscapeSequence, Error,
|
||||
"Decimal digit follows `\\0` escape sequence. Use `\\x00` instead "
|
||||
"of `\\0` if the next character is a digit.");
|
||||
"decimal digit follows `\\0` escape sequence. Use `\\x00` instead "
|
||||
"of `\\0` if the next character is a digit");
|
||||
emitter.Emit(content.begin(), DecimalEscapeSequence);
|
||||
return;
|
||||
}
|
||||
@@ -325,8 +325,8 @@ static auto ExpandAndConsumeEscapeSequence(LexerDiagnosticEmitter& emitter,
|
||||
return;
|
||||
}
|
||||
CARBON_DIAGNOSTIC(HexadecimalEscapeMissingDigits, Error,
|
||||
"Escape sequence `\\x` must be followed by two "
|
||||
"uppercase hexadecimal digits, for example `\\x0F`.");
|
||||
"escape sequence `\\x` must be followed by two "
|
||||
"uppercase hexadecimal digits, for example `\\x0F`");
|
||||
emitter.Emit(content.begin(), HexadecimalEscapeMissingDigits);
|
||||
break;
|
||||
case 'u': {
|
||||
@@ -344,14 +344,14 @@ static auto ExpandAndConsumeEscapeSequence(LexerDiagnosticEmitter& emitter,
|
||||
}
|
||||
CARBON_DIAGNOSTIC(
|
||||
UnicodeEscapeMissingBracedDigits, Error,
|
||||
"Escape sequence `\\u` must be followed by a braced sequence of "
|
||||
"uppercase hexadecimal digits, for example `\\u{{70AD}}`.");
|
||||
"escape sequence `\\u` must be followed by a braced sequence of "
|
||||
"uppercase hexadecimal digits, for example `\\u{{70AD}}`");
|
||||
emitter.Emit(content.begin(), UnicodeEscapeMissingBracedDigits);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CARBON_DIAGNOSTIC(UnknownEscapeSequence, Error,
|
||||
"Unrecognized escape sequence `{0}`.", char);
|
||||
"unrecognized escape sequence `{0}`", char);
|
||||
emitter.Emit(content.begin() - 1, UnknownEscapeSequence, first);
|
||||
break;
|
||||
}
|
||||
@@ -382,8 +382,8 @@ static auto ExpandEscapeSequencesAndRemoveIndent(
|
||||
if (!contents.starts_with("\n")) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
MismatchedIndentInString, Error,
|
||||
"Indentation does not match that of the closing `'''` in "
|
||||
"multi-line string literal.");
|
||||
"indentation does not match that of the closing `'''` in "
|
||||
"multi-line string literal");
|
||||
emitter.Emit(line_start, MismatchedIndentInString);
|
||||
}
|
||||
}
|
||||
@@ -433,8 +433,8 @@ static auto ExpandEscapeSequencesAndRemoveIndent(
|
||||
// `contents.begin() + after_space` in the diagnostic.
|
||||
CARBON_DIAGNOSTIC(
|
||||
InvalidHorizontalWhitespaceInString, Error,
|
||||
"Whitespace other than plain space must be expressed with an "
|
||||
"escape sequence in a string literal.");
|
||||
"whitespace other than plain space must be expressed with an "
|
||||
"escape sequence in a string literal");
|
||||
emitter.Emit(contents.begin(), InvalidHorizontalWhitespaceInString);
|
||||
// Include the whitespace in the string contents for error recovery.
|
||||
AppendFrontOfContents(buffer_cursor, contents, after_space);
|
||||
@@ -472,7 +472,7 @@ auto StringLiteral::ComputeValue(llvm::BumpPtrAllocator& allocator,
|
||||
if (multi_line_ == MultiLineWithDoubleQuotes) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
MultiLineStringWithDoubleQuotes, Error,
|
||||
"Use `'''` delimiters for a multi-line string literal, not `\"\"\"`.");
|
||||
"use `'''` delimiters for a multi-line string literal, not `\"\"\"`");
|
||||
emitter.Emit(text_.begin(), MultiLineStringWithDoubleQuotes);
|
||||
}
|
||||
llvm::StringRef indent =
|
||||
|
||||
Reference in New Issue
Block a user