Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
JsHighlighter.h
Go to the documentation of this file.
1#pragma once
2
3#include <QSyntaxHighlighter>
4#include <QTextCharFormat>
5#include <QRegularExpression>
6
7class QTextDocument;
8
9namespace sf
10{
11
12class JsHighlighter :public QSyntaxHighlighter
13{
14 Q_OBJECT
15
16 public:
17 explicit JsHighlighter(QTextDocument* parent = nullptr, bool dark_mode = false);
18
19 protected:
20 void highlightBlock(const QString& text) override;
21
22 private:
23 struct HighlightingRule
24 {
25 QRegularExpression pattern;
26 QTextCharFormat format;
27 };
28 QVector<HighlightingRule> highlightingRules;
29
30 QRegularExpression commentStartExpression;
31 QRegularExpression commentEndExpression;
32
33 QTextCharFormat keywordFormat;
34 QTextCharFormat singleLineCommentFormat;
35 QTextCharFormat multiLineCommentFormat;
36 QTextCharFormat doubleQuotationFormat;
37 QTextCharFormat quotationFormat;
38 QTextCharFormat functionFormat;
39};
40
41}
Definition JsHighlighter.h:13
JsHighlighter(QTextDocument *parent=nullptr, bool dark_mode=false)
void highlightBlock(const QString &text) override
Definition Application.h:10