tageditor/gui/javascripthighlighter.h

40 lines
831 B
C
Raw Normal View History

2015-04-22 19:33:53 +02:00
#ifndef JAVASCRIPTHIGHLIGHTER_H
#define JAVASCRIPTHIGHLIGHTER_H
#include <QSyntaxHighlighter>
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<HighlightingRule> 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;
};
}
#endif // JAVASCRIPTHIGHLIGHTER_H