KSeExpr 6.0.0.0
ExprHighlighter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2011-2019 Disney Enterprises, Inc.
2// SPDX-License-Identifier: LicenseRef-Apache-2.0
3// SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
4// SPDX-License-Identifier: GPL-3.0-or-later
5/*
6 * @file ExprHighlighter.h
7 * @brief A Qt syntax highlighter for the SeExpr language
8 * @author aselle, amyspark
9 */
10
11#pragma once
12
13#include <QPalette>
14#include <QSyntaxHighlighter>
15#include <QTextDocument>
16#include <QTextEdit>
17#include <QRegularExpression>
18
19
20class ExprHighlighter : public QSyntaxHighlighter
21{
23 QRegularExpression pattern;
24 QTextCharFormat format;
25 };
26 QVector<HighlightingRule> highlightingRules;
27 QTextCharFormat singleLineCommentFormat;
28 QTextCharFormat variableFormat;
29 QTextCharFormat numberFormat;
30 QTextCharFormat operatorFormat;
31
33
34public:
35 ExprHighlighter(QTextDocument *parent);
36 ExprHighlighter(QTextEdit *edit);
37
38 void fixStyle(const QPalette &palette);
39
40 void init();
41 void highlightBlock(const QString &text) override;
42};
void fixStyle(const QPalette &palette)
QTextCharFormat numberFormat
QTextCharFormat operatorFormat
QTextCharFormat variableFormat
void highlightBlock(const QString &text) override
QVector< HighlightingRule > highlightingRules
QTextCharFormat singleLineCommentFormat