Align keywords with c++20 standard for CodeEditor (#3247)

This commit is contained in:
Maksim Derbasov 2021-05-05 08:35:13 +03:00 committed by GitHub
parent b8de69489d
commit 14ea8d7e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 2 deletions

View File

@ -15,45 +15,83 @@ Highlighter::Highlighter(QTextDocument *parent,
mKeywordFormat.setForeground(mWidgetStyle->keywordColor); mKeywordFormat.setForeground(mWidgetStyle->keywordColor);
mKeywordFormat.setFontWeight(mWidgetStyle->keywordWeight); mKeywordFormat.setFontWeight(mWidgetStyle->keywordWeight);
QStringList keywordPatterns; QStringList keywordPatterns;
keywordPatterns << "bool" keywordPatterns << "alignas"
<< "alignof"
<< "asm"
<< "auto"
<< "bool"
<< "break" << "break"
<< "case" << "case"
<< "catch"
<< "char" << "char"
<< "char8_­t"
<< "char16_­t"
<< "char32_­t"
<< "class" << "class"
<< "concept"
<< "const" << "const"
<< "consteval"
<< "constexpr"
<< "constinit"
<< "const_­cast"
<< "continue" << "continue"
<< "co_­await"
<< "co_­return"
<< "co_­yield"
<< "decltype"
<< "default" << "default"
<< "delete"
<< "do" << "do"
<< "double" << "double"
<< "dynamic_­cast"
<< "else" << "else"
<< "enum" << "enum"
<< "explicit" << "explicit"
<< "export"
<< "extern"
<< "false"
<< "float"
<< "for" << "for"
<< "friend" << "friend"
<< "goto"
<< "if" << "if"
<< "inline" << "inline"
<< "int" << "int"
<< "long" << "long"
<< "mutable"
<< "namespace" << "namespace"
<< "new"
<< "noexcept"
<< "nullptr"
<< "operator" << "operator"
<< "private" << "private"
<< "protected" << "protected"
<< "public" << "public"
<< "reinterpret_­cast"
<< "requires"
<< "return" << "return"
<< "short" << "short"
<< "signed" << "signed"
<< "static" << "static"
<< "static_­assert"
<< "static_­cast"
<< "struct" << "struct"
<< "switch" << "switch"
<< "template" << "template"
<< "this"
<< "thread_­local"
<< "throw" << "throw"
<< "true"
<< "try"
<< "typedef" << "typedef"
<< "typeid"
<< "typename" << "typename"
<< "union" << "union"
<< "unsigned" << "unsigned"
<< "virtual" << "virtual"
<< "void" << "void"
<< "volatile" << "volatile"
<< "wchar_­t"
<< "while"; << "while";
foreach (const QString &pattern, keywordPatterns) { foreach (const QString &pattern, keywordPatterns) {
rule.pattern = QRegularExpression("\\b" + pattern + "\\b"); rule.pattern = QRegularExpression("\\b" + pattern + "\\b");

View File

@ -228,7 +228,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
stditem->setData(QVariant(data)); stditem->setData(QVariant(data));
//Add backtrace files as children //Add backtrace files as children
if (item.errorPath.size() > 1U) { if (item.errorPath.size() > 1) {
for (int i = 0; i < item.errorPath.size(); i++) { for (int i = 0; i < item.errorPath.size(); i++) {
const QErrorPathItem &e = item.errorPath[i]; const QErrorPathItem &e = item.errorPath[i];
line.file = e.file; line.file = e.file;