Sanguine_Studio/app/gschighlighter.h
2025-12-14 21:37:14 -05:00

39 lines
1.0 KiB
C++

#ifndef GSCHIGHLIGHTER_H
#define GSCHIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QRegularExpression>
class GSCHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
GSCHighlighter(QTextDocument* aParent = nullptr);
protected:
void highlightBlock(const QString &aText) override;
void highlightCommentBlock(const QString &aText, const QRegularExpression &aStartExp, const QRegularExpression &aEndExp);
private:
struct HighlightingRule
{
QRegularExpression pattern;
QTextCharFormat format;
};
QList<HighlightingRule> highlightingRules;
QRegularExpression commentStartExpressionA;
QRegularExpression commentEndExpressionA;
QRegularExpression commentStartExpressionB;
QRegularExpression commentEndExpressionB;
QTextCharFormat keywordFormat;
QTextCharFormat classFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
};
#endif // GSCHIGHLIGHTER_H