43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
|
|
#ifndef HIGHLIGHTER_GSC_H
|
||
|
|
#define HIGHLIGHTER_GSC_H
|
||
|
|
|
||
|
|
#include <QSyntaxHighlighter>
|
||
|
|
#include <QRegularExpression>
|
||
|
|
|
||
|
|
class Highlighter_GSC : public QSyntaxHighlighter
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
Highlighter_GSC(QTextDocument *parent = nullptr);
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void highlightBlock(const QString &text) override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
struct HighlightingRule
|
||
|
|
{
|
||
|
|
QRegularExpression pattern;
|
||
|
|
QTextCharFormat format;
|
||
|
|
};
|
||
|
|
QList<HighlightingRule> highlightingRules;
|
||
|
|
|
||
|
|
QRegularExpression commentStartExpression;
|
||
|
|
QRegularExpression commentEndExpression;
|
||
|
|
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_GSC_H
|