File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -71,20 +71,24 @@ Highlighter::Highlighter(QTextDocument *parent,
7171 << " export"
7272 << " extern"
7373 << " false"
74+ << " final"
7475 << " float"
7576 << " for"
7677 << " friend"
7778 << " goto"
7879 << " if"
80+ << " import"
7981 << " inline"
8082 << " int"
8183 << " long"
84+ << " module"
8285 << " mutable"
8386 << " namespace"
8487 << " new"
8588 << " noexcept"
8689 << " nullptr"
8790 << " operator"
91+ << " override"
8892 << " private"
8993 << " protected"
9094 << " public"
@@ -130,7 +134,9 @@ Highlighter::Highlighter(QTextDocument *parent,
130134
131135 mQuotationFormat .setForeground (mWidgetStyle ->quoteColor );
132136 mQuotationFormat .setFontWeight (mWidgetStyle ->quoteWeight );
133- rule.pattern = QRegularExpression (" \" .*\" " );
137+ // We use lazy `*?` instead greed `*` quantifier to find the real end of the c-string.
138+ // We use negative lookbehind assertion `(?<!\)` to ignore `\"` sequience in the c-string.
139+ rule.pattern = QRegularExpression (" \" .*?(?<!\\\\ )\" " );
134140 rule.format = mQuotationFormat ;
135141 rule.ruleRole = RuleRole::Quote;
136142 mHighlightingRules .append (rule);
You can’t perform that action at this time.
0 commit comments