46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
|
|
#ifndef HIGHLIGHTER_CFG_H
|
||
|
|
#define HIGHLIGHTER_CFG_H
|
||
|
|
|
||
|
|
#include <QSyntaxHighlighter>
|
||
|
|
#include <QRegularExpression>
|
||
|
|
|
||
|
|
class Highlighter_CFG : public QSyntaxHighlighter
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
Highlighter_CFG(QTextDocument *parent = nullptr);
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void highlightBlock(const QString &text) override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
struct HighlightingRule
|
||
|
|
{
|
||
|
|
QRegularExpression pattern;
|
||
|
|
QTextCharFormat format;
|
||
|
|
};
|
||
|
|
QList<HighlightingRule> highlightingRules;
|
||
|
|
|
||
|
|
QRegularExpression commentStartExpression;
|
||
|
|
QRegularExpression commentEndExpression;
|
||
|
|
QRegularExpression bindSetVariablePattern;
|
||
|
|
QTextCharFormat buttonFormat;
|
||
|
|
QTextCharFormat operatorFormat;
|
||
|
|
QTextCharFormat keywordFormat;
|
||
|
|
QTextCharFormat classFormat;
|
||
|
|
QTextCharFormat quotationFormat;
|
||
|
|
QTextCharFormat functionFormat;
|
||
|
|
QTextCharFormat singleLineCommentFormat;
|
||
|
|
QTextCharFormat multiLineCommentFormat;
|
||
|
|
QTextCharFormat preprocessorFormat;
|
||
|
|
QTextCharFormat variableFormat;
|
||
|
|
QTextCharFormat numberFormat;
|
||
|
|
QTextCharFormat devBlockCommentFormat;
|
||
|
|
|
||
|
|
QRegularExpression devCommentStart;
|
||
|
|
QRegularExpression devCommentEnd;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // HIGHLIGHTER_CFG_H
|