mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-22 21:06:10 +00:00
4330b7ddaa
* Implemented syntaxHighLighter * removed PseudoWidget.ui * buildfix * reverted r2-submodule * Added nowrap to the pseudocodeWidget * changed color of functions in the pseudocode highlighter
35 lines
700 B
C++
35 lines
700 B
C++
#pragma once
|
|
|
|
#include <QSyntaxHighlighter>
|
|
#include <QVector>
|
|
#include <QTextDocument>
|
|
#include <QRegularExpression>
|
|
#include <QTextCharFormat>
|
|
|
|
|
|
class SyntaxHighlighter : public QSyntaxHighlighter
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
SyntaxHighlighter(QTextDocument *parent = nullptr);
|
|
virtual ~SyntaxHighlighter() = default;
|
|
|
|
protected:
|
|
void highlightBlock(const QString &text) override;
|
|
|
|
private:
|
|
struct HighlightingRule
|
|
{
|
|
QRegularExpression pattern;
|
|
QTextCharFormat format;
|
|
};
|
|
|
|
QVector<HighlightingRule> highlightingRules;
|
|
|
|
QRegularExpression commentStartExpression;
|
|
QRegularExpression commentEndExpression;
|
|
|
|
QTextCharFormat multiLineCommentFormat;
|
|
};
|