#ifndef GSCHIGHLIGHTER_H #define GSCHIGHLIGHTER_H #include #include class GSCHighlighter : public QSyntaxHighlighter { Q_OBJECT public: GSCHighlighter(QTextDocument* aParent = nullptr); protected: void highlightBlock(const QString &aText) override; void highlightCommentBlock(const QString &aText, const QRegularExpression &aStartExp, const QRegularExpression &aEndExp); private: struct HighlightingRule { QRegularExpression pattern; QTextCharFormat format; }; QList highlightingRules; QRegularExpression commentStartExpressionA; QRegularExpression commentEndExpressionA; QRegularExpression commentStartExpressionB; QRegularExpression commentEndExpressionB; QTextCharFormat keywordFormat; QTextCharFormat classFormat; QTextCharFormat singleLineCommentFormat; QTextCharFormat multiLineCommentFormat; QTextCharFormat quotationFormat; QTextCharFormat functionFormat; }; #endif // GSCHIGHLIGHTER_H