#ifndef JAVASCRIPTHIGHLIGHTER_H #define JAVASCRIPTHIGHLIGHTER_H #include namespace QtGui { class JavaScriptHighlighter : public QSyntaxHighlighter { Q_OBJECT public: JavaScriptHighlighter(QTextDocument *parent = nullptr); protected: void highlightBlock(const QString &text); private: struct HighlightingRule { QRegExp pattern; QTextCharFormat format; }; QVector m_highlightingRules; QRegExp m_commentStartExpression; QRegExp m_commentEndExpression; QTextCharFormat m_keywordFormat; QTextCharFormat m_classFormat; QTextCharFormat m_singleLineCommentFormat; QTextCharFormat m_multiLineCommentFormat; QTextCharFormat m_quotationFormat; QTextCharFormat m_functionFormat; }; } // namespace QtGui #endif // JAVASCRIPTHIGHLIGHTER_H