src/ldrawsyntaxhighlighter.h

Sat, 08 Apr 2023 16:41:40 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 16:41:40 +0300
changeset 354
91053052bb28
parent 331
638a7458ef5e
permissions
-rw-r--r--

Readd the MainWindow class and renderstyle button handling to it

331
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
1 #pragma once
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
2 #include <QSyntaxHighlighter>
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
3 #include <QRegularExpression>
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
4
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
5 class LDrawSyntaxHighlighter final : public QSyntaxHighlighter
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
6 {
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
7 Q_OBJECT
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
8 QRegularExpression commentPattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
9 QRegularExpression bfcPattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
10 QRegularExpression refPattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
11 QRegularExpression trianglePattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
12 QRegularExpression quadrilateralPattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
13 QRegularExpression cedgePattern;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
14 QTextCharFormat lineTypeFormat;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
15 QTextCharFormat colorFormat;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
16 QTextCharFormat point1Format;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
17 QTextCharFormat point2Format;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
18 QTextCharFormat point3Format;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
19 QTextCharFormat point4Format;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
20 QTextCharFormat bfcFormat;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
21 QTextCharFormat nameFormat;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
22 QTextCharFormat errorFormat;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
23 public:
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
24 LDrawSyntaxHighlighter(QTextDocument* parent = nullptr);
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
25
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
26 // QSyntaxHighlighter interface
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
27 protected:
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
28 void highlightBlock(const QString& text) override;
638a7458ef5e Add basic syntax highlighting
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
29 };

mercurial