#ifndef SYNTAXHIGHLIGHTER_H #define SYNTAXHIGHLIGHTER_H #include class SyntaxHighlighter : public QSyntaxHighlighter { Q_OBJECT public: SyntaxHighlighter(QTextDocument *parent = 0); protected: void highlightBlock(const QString &text) Q_DECL_OVERRIDE; private: struct HighlightingRule { QRegExp pattern; QTextCharFormat format; }; QVector highlightingRules; QRegExp commentStartExpression; QRegExp commentEndExpression; QTextCharFormat keywordFormat; QTextCharFormat bankFormat; QTextCharFormat singleLineCommentFormat; QTextCharFormat multiLineCommentFormat; }; #endif // SYNTAXHIGHLIGHTER_H