Codeeditor: multiline comment fix (#4253)
This commit is contained in:
parent
89a9e5ecc6
commit
a65f6952dc
|
@ -45,26 +45,26 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
<< "case"
|
<< "case"
|
||||||
<< "catch"
|
<< "catch"
|
||||||
<< "char"
|
<< "char"
|
||||||
<< "char8_t"
|
<< "char8_t"
|
||||||
<< "char16_t"
|
<< "char16_t"
|
||||||
<< "char32_t"
|
<< "char32_t"
|
||||||
<< "class"
|
<< "class"
|
||||||
<< "concept"
|
<< "concept"
|
||||||
<< "const"
|
<< "const"
|
||||||
<< "consteval"
|
<< "consteval"
|
||||||
<< "constexpr"
|
<< "constexpr"
|
||||||
<< "constinit"
|
<< "constinit"
|
||||||
<< "const_cast"
|
<< "const_cast"
|
||||||
<< "continue"
|
<< "continue"
|
||||||
<< "co_await"
|
<< "co_await"
|
||||||
<< "co_return"
|
<< "co_return"
|
||||||
<< "co_yield"
|
<< "co_yield"
|
||||||
<< "decltype"
|
<< "decltype"
|
||||||
<< "default"
|
<< "default"
|
||||||
<< "delete"
|
<< "delete"
|
||||||
<< "do"
|
<< "do"
|
||||||
<< "double"
|
<< "double"
|
||||||
<< "dynamic_cast"
|
<< "dynamic_cast"
|
||||||
<< "else"
|
<< "else"
|
||||||
<< "enum"
|
<< "enum"
|
||||||
<< "explicit"
|
<< "explicit"
|
||||||
|
@ -92,19 +92,19 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
<< "private"
|
<< "private"
|
||||||
<< "protected"
|
<< "protected"
|
||||||
<< "public"
|
<< "public"
|
||||||
<< "reinterpret_cast"
|
<< "reinterpret_cast"
|
||||||
<< "requires"
|
<< "requires"
|
||||||
<< "return"
|
<< "return"
|
||||||
<< "short"
|
<< "short"
|
||||||
<< "signed"
|
<< "signed"
|
||||||
<< "static"
|
<< "static"
|
||||||
<< "static_assert"
|
<< "static_assert"
|
||||||
<< "static_cast"
|
<< "static_cast"
|
||||||
<< "struct"
|
<< "struct"
|
||||||
<< "switch"
|
<< "switch"
|
||||||
<< "template"
|
<< "template"
|
||||||
<< "this"
|
<< "this"
|
||||||
<< "thread_local"
|
<< "thread_local"
|
||||||
<< "throw"
|
<< "throw"
|
||||||
<< "true"
|
<< "true"
|
||||||
<< "try"
|
<< "try"
|
||||||
|
@ -116,7 +116,7 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
<< "virtual"
|
<< "virtual"
|
||||||
<< "void"
|
<< "void"
|
||||||
<< "volatile"
|
<< "volatile"
|
||||||
<< "wchar_t"
|
<< "wchar_t"
|
||||||
<< "while";
|
<< "while";
|
||||||
for (const QString &pattern : keywordPatterns) {
|
for (const QString &pattern : keywordPatterns) {
|
||||||
rule.pattern = QRegularExpression("\\b" + pattern + "\\b");
|
rule.pattern = QRegularExpression("\\b" + pattern + "\\b");
|
||||||
|
@ -157,7 +157,9 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
mSymbolFormat.setBackground(mWidgetStyle->symbolBGColor);
|
mSymbolFormat.setBackground(mWidgetStyle->symbolBGColor);
|
||||||
mSymbolFormat.setFontWeight(mWidgetStyle->symbolWeight);
|
mSymbolFormat.setFontWeight(mWidgetStyle->symbolWeight);
|
||||||
|
|
||||||
mCommentStartExpression = QRegularExpression("/\\*");
|
// We use negative lookbehind assertion `(?<!/)`
|
||||||
|
// to ignore case: single line comment and line of asterisk
|
||||||
|
mCommentStartExpression = QRegularExpression("(?<!/)/\\*");
|
||||||
mCommentEndExpression = QRegularExpression("\\*/");
|
mCommentEndExpression = QRegularExpression("\\*/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue