-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnasyntax.h
executable file
·66 lines (51 loc) · 2.11 KB
/
nasyntax.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*-----------------------------------------------------------------------------
| This file is part of Notatio Antiqua (c) 2009-2024 David Gippner |
-------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-----------------------------------------------------------------------------*/
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef NASYNTAX_H
#define NASYNTAX_H
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
#include <QRegularExpression>
QT_BEGIN_NAMESPACE
class QTextDocument;
QT_END_NAMESPACE
//! [0]
class Highlighter : public QSyntaxHighlighter
/**
* @class Highlighter
* @brief Syntax highlighter with specialities of gabc, nabc and lilypond
*/
{
Q_OBJECT
public:
Highlighter(QTextDocument *parent = nullptr);
protected:
void highlightBlock(const QString &text) override;
private:
struct HighlightingRule
{
QRegularExpression pattern;
QTextCharFormat format;
};
QList<HighlightingRule> highlightingRules;
QRegularExpression spcharStartExpression;
QRegularExpression spcharEndExpression;
QRegularExpression translationStartExpression;
QRegularExpression translationEndExpression;
QTextCharFormat keywordFormat;
QTextCharFormat classFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat gabcCodeFormat;
QTextCharFormat spcharFormat;
QTextCharFormat translationFormat;
QTextCharFormat nabcCodeFormat;
QTextCharFormat quotationFormat;
};
//! [0]
#endif // NASYNTAX_H