#pragma once #include #define INI_WITH_JSON class CIniHighlighter : public QSyntaxHighlighter { Q_OBJECT public: explicit CIniHighlighter(bool bDarkMode, QTextDocument *parent = nullptr); ~CIniHighlighter(); protected: void highlightBlock(const QString &text) override; private: struct HighlightRule { QRegularExpression pattern; QTextCharFormat format; }; QVector highlightRules; QTextCharFormat sectionFormat; QTextCharFormat keyFormat; QTextCharFormat valueFormat; QTextCharFormat commentFormat; QTextCharFormat equalsFormat; // New format for '=' character QTextCharFormat valuePrefixFormat; // Format for text before first comma in value QTextCharFormat firstCommaFormat; // Format for the first comma in value #ifdef INI_WITH_JSON // JSON-specific formats QTextCharFormat jsonKeyFormat; QTextCharFormat jsonStringFormat; QTextCharFormat jsonNumberFormat; QTextCharFormat jsonBoolNullFormat; QTextCharFormat jsonBracesFormat; QTextCharFormat jsonColonFormat; QTextCharFormat jsonCommaFormat; // JSON highlighting rules QVector jsonHighlightRules; #endif };