Add syntax highlighting for preprocessor macros in C highlighter
MODIFY
src/editor/csyntaxhighlighter.cpp
src/editor/csyntaxhighlighter.cpp
@@ -46,6 +46,11 @@ CSyntaxHighlighter::CSyntaxHighlighter(QTextDocument* parent) : SyntaxHighlighte
multiLineCommentFormat.setForeground(QColor(Colors::Medalist));
+ preprocessorFormat.setForeground(Qt::magenta);
+ rule.pattern = QRegularExpression(QStringLiteral("^\\ *#[^ ]*"));
+ rule.format = preprocessorFormat;
+ highlightingRules.append(rule);
+
quotationFormat.setForeground(QColor(0x800000));
rule.pattern = QRegularExpression(QStringLiteral("\".*\""));
rule.format = quotationFormat;

MODIFY
src/editor/csyntaxhighlighter.h
src/editor/csyntaxhighlighter.h
@@ -35,6 +35,7 @@ private:
QTextCharFormat typeFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
+ QTextCharFormat preprocessorFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
};

Add syntax highlighting for preprocessor macros in C highlighter