XPlor/libs/core/highlighter_shock.h

31 lines
651 B
C
Raw Permalink Normal View History

#ifndef HIGHLIGHTER_SHOCK_H
#define HIGHLIGHTER_SHOCK_H
#include <QSyntaxHighlighter>
#include <QRegularExpression>
class Highlighter_Shock : public QSyntaxHighlighter
{
Q_OBJECT
public:
Highlighter_Shock(QTextDocument *parent = nullptr);
protected:
void highlightBlock(const QString &text) override;
private:
struct HighlightingRule {
QRegularExpression pattern;
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;
QTextCharFormat keyFormat;
QTextCharFormat stringFormat;
QTextCharFormat numberFormat;
QTextCharFormat subgroupFormat;
};
#endif // HIGHLIGHTER_SHOCK_H