forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTHighlighter.h
45 lines (36 loc) · 1.2 KB
/
THighlighter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef THIGHLIGHTER_H
#define THIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QHash>
#include <QTextCharFormat>
class QTextDocument;
class THighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
THighlighter(QTextDocument *parent = 0);
void setSearchPattern( QString p );
protected:
void highlightBlock(const QString &text);
private:
struct HighlightingRule
{
QRegExp pattern;
QTextCharFormat format;
};
QString mSearchPattern;
QVector<HighlightingRule> highlightingRules;
QRegExp commentStartExpression;
QRegExp commentEndExpression;
QRegExp stringStart;
QRegExp stringEnd;
QTextCharFormat keywordFormat;
QTextCharFormat searchFormat;
QTextCharFormat classFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
//bool isString;
};
#endif // THIGHLIGHTER_H