|
1 #pragma once |
|
2 #include <QSyntaxHighlighter> |
|
3 #include <QRegularExpression> |
|
4 |
|
5 class LDrawSyntaxHighlighter final : public QSyntaxHighlighter |
|
6 { |
|
7 Q_OBJECT |
|
8 QRegularExpression commentPattern; |
|
9 QRegularExpression bfcPattern; |
|
10 QRegularExpression refPattern; |
|
11 QRegularExpression trianglePattern; |
|
12 QRegularExpression quadrilateralPattern; |
|
13 QRegularExpression cedgePattern; |
|
14 QTextCharFormat lineTypeFormat; |
|
15 QTextCharFormat colorFormat; |
|
16 QTextCharFormat point1Format; |
|
17 QTextCharFormat point2Format; |
|
18 QTextCharFormat point3Format; |
|
19 QTextCharFormat point4Format; |
|
20 QTextCharFormat bfcFormat; |
|
21 QTextCharFormat nameFormat; |
|
22 QTextCharFormat errorFormat; |
|
23 public: |
|
24 LDrawSyntaxHighlighter(QTextDocument* parent = nullptr); |
|
25 |
|
26 // QSyntaxHighlighter interface |
|
27 protected: |
|
28 void highlightBlock(const QString& text) override; |
|
29 }; |