Syntax highlighting: Add patches for KSyntaxHighlighting adaptation

The patches which lead from "syntax-highlighting"'s SHA
    e07306d9c22f6426d6b50287eee532555d74ac75
to the current state in qtcreator's repo

This is useful to document what changed, and to ease further code
merges from "syntax-highlighting".

Change-Id: I4be45d12aa4237558b6e381a70947326829e79cb
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Alessandro Portale
2019-02-12 20:08:55 +01:00
parent 4b8200086b
commit e985290444
6 changed files with 5082 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,389 @@
From c9f4bdaa0902c0fdb5ea750d11935e15777a090d Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@qt.io>
Date: Tue, 12 Feb 2019 19:45:08 +0100
Subject: [PATCH 3/6] Add qmake/Qbs files and files generated by CMake
---
autogenerated/autogenerated.pri | 9 ++
autogenerated/ksyntaxhighlighting_version.h | 12 +++
autogenerated/src/lib/AbstractHighlighter | 1 +
autogenerated/src/lib/Definition | 1 +
autogenerated/src/lib/FoldingRegion | 1 +
autogenerated/src/lib/Format | 1 +
autogenerated/src/lib/Repository | 1 +
autogenerated/src/lib/State | 1 +
autogenerated/src/lib/SyntaxHighlighter | 1 +
autogenerated/src/lib/Theme | 1 +
.../src/lib/ksyntaxhighlighting_logging.cpp | 11 +++
.../src/lib/ksyntaxhighlighting_logging.h | 11 +++
data/data.pro | 11 +++
src/lib/ksyntaxhighlighting_export.h | 34 +++++++
syntax-highlighting.pro | 55 ++++++++++++
syntax-highlighting.qbs | 88 +++++++++++++++++++
syntax-highlighting_dependencies.pri | 3 +
17 files changed, 242 insertions(+)
create mode 100644 autogenerated/autogenerated.pri
create mode 100644 autogenerated/ksyntaxhighlighting_version.h
create mode 100644 autogenerated/src/lib/AbstractHighlighter
create mode 100644 autogenerated/src/lib/Definition
create mode 100644 autogenerated/src/lib/FoldingRegion
create mode 100644 autogenerated/src/lib/Format
create mode 100644 autogenerated/src/lib/Repository
create mode 100644 autogenerated/src/lib/State
create mode 100644 autogenerated/src/lib/SyntaxHighlighter
create mode 100644 autogenerated/src/lib/Theme
create mode 100644 autogenerated/src/lib/ksyntaxhighlighting_logging.cpp
create mode 100644 autogenerated/src/lib/ksyntaxhighlighting_logging.h
create mode 100644 data/data.pro
create mode 100644 src/lib/ksyntaxhighlighting_export.h
create mode 100644 syntax-highlighting.pro
create mode 100644 syntax-highlighting.qbs
create mode 100644 syntax-highlighting_dependencies.pri
diff --git a/autogenerated/autogenerated.pri b/autogenerated/autogenerated.pri
new file mode 100644
index 0000000..aee620a
--- /dev/null
+++ b/autogenerated/autogenerated.pri
@@ -0,0 +1,9 @@
+INCLUDEPATH *= $$PWD/src/lib
+INCLUDEPATH *= $$PWD
+
+SOURCES += \
+ $$PWD/src/lib/ksyntaxhighlighting_logging.cpp
+
+HEADERS += \
+ $$PWD/ksyntaxhighlighting_version.h \
+ $$PWD/src/lib/ksyntaxhighlighting_logging.h
diff --git a/autogenerated/ksyntaxhighlighting_version.h b/autogenerated/ksyntaxhighlighting_version.h
new file mode 100644
index 0000000..bd31a4d
--- /dev/null
+++ b/autogenerated/ksyntaxhighlighting_version.h
@@ -0,0 +1,12 @@
+// This file was generated by ecm_setup_version(): DO NOT EDIT!
+
+#ifndef SyntaxHighlighting_VERSION_H
+#define SyntaxHighlighting_VERSION_H
+
+#define SyntaxHighlighting_VERSION_STRING "5.52.0"
+#define SyntaxHighlighting_VERSION_MAJOR 5
+#define SyntaxHighlighting_VERSION_MINOR 52
+#define SyntaxHighlighting_VERSION_PATCH 0
+#define SyntaxHighlighting_VERSION ((5<<16)|(52<<8)|(0))
+
+#endif
diff --git a/autogenerated/src/lib/AbstractHighlighter b/autogenerated/src/lib/AbstractHighlighter
new file mode 100644
index 0000000..b787873
--- /dev/null
+++ b/autogenerated/src/lib/AbstractHighlighter
@@ -0,0 +1 @@
+#include "abstracthighlighter.h"
diff --git a/autogenerated/src/lib/Definition b/autogenerated/src/lib/Definition
new file mode 100644
index 0000000..2c3241f
--- /dev/null
+++ b/autogenerated/src/lib/Definition
@@ -0,0 +1 @@
+#include "definition.h"
diff --git a/autogenerated/src/lib/FoldingRegion b/autogenerated/src/lib/FoldingRegion
new file mode 100644
index 0000000..005b829
--- /dev/null
+++ b/autogenerated/src/lib/FoldingRegion
@@ -0,0 +1 @@
+#include "foldingregion.h"
diff --git a/autogenerated/src/lib/Format b/autogenerated/src/lib/Format
new file mode 100644
index 0000000..b0d6a10
--- /dev/null
+++ b/autogenerated/src/lib/Format
@@ -0,0 +1 @@
+#include "format.h"
diff --git a/autogenerated/src/lib/Repository b/autogenerated/src/lib/Repository
new file mode 100644
index 0000000..189dbc2
--- /dev/null
+++ b/autogenerated/src/lib/Repository
@@ -0,0 +1 @@
+#include "repository.h"
diff --git a/autogenerated/src/lib/State b/autogenerated/src/lib/State
new file mode 100644
index 0000000..e148d70
--- /dev/null
+++ b/autogenerated/src/lib/State
@@ -0,0 +1 @@
+#include "state.h"
diff --git a/autogenerated/src/lib/SyntaxHighlighter b/autogenerated/src/lib/SyntaxHighlighter
new file mode 100644
index 0000000..b429824
--- /dev/null
+++ b/autogenerated/src/lib/SyntaxHighlighter
@@ -0,0 +1 @@
+#include "syntaxhighlighter.h"
diff --git a/autogenerated/src/lib/Theme b/autogenerated/src/lib/Theme
new file mode 100644
index 0000000..34a3e98
--- /dev/null
+++ b/autogenerated/src/lib/Theme
@@ -0,0 +1 @@
+#include "theme.h"
diff --git a/autogenerated/src/lib/ksyntaxhighlighting_logging.cpp b/autogenerated/src/lib/ksyntaxhighlighting_logging.cpp
new file mode 100644
index 0000000..4082ac4
--- /dev/null
+++ b/autogenerated/src/lib/ksyntaxhighlighting_logging.cpp
@@ -0,0 +1,11 @@
+// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT!
+
+#include "ksyntaxhighlighting_logging.h"
+
+ namespace KSyntaxHighlighting {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
+Q_LOGGING_CATEGORY(Log, "org.kde.ksyntaxhighlighting", QtInfoMsg)
+#else
+Q_LOGGING_CATEGORY(Log, "org.kde.ksyntaxhighlighting")
+#endif
+}
diff --git a/autogenerated/src/lib/ksyntaxhighlighting_logging.h b/autogenerated/src/lib/ksyntaxhighlighting_logging.h
new file mode 100644
index 0000000..c351b2c
--- /dev/null
+++ b/autogenerated/src/lib/ksyntaxhighlighting_logging.h
@@ -0,0 +1,11 @@
+// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT!
+
+#ifndef ECM_QLOGGINGCATEGORY_KSYNTAXHIGHLIGHTING_LOG_KSYNTAXHIGHLIGHTING_LOGGING_H
+#define ECM_QLOGGINGCATEGORY_KSYNTAXHIGHLIGHTING_LOG_KSYNTAXHIGHLIGHTING_LOGGING_H
+
+#include <QLoggingCategory>
+ namespace KSyntaxHighlighting {
+Q_DECLARE_LOGGING_CATEGORY(Log)
+}
+
+#endif
diff --git a/data/data.pro b/data/data.pro
new file mode 100644
index 0000000..1028ea1
--- /dev/null
+++ b/data/data.pro
@@ -0,0 +1,11 @@
+TEMPLATE = aux
+
+include(../../../../../qtcreator.pri)
+
+STATIC_BASE = $$PWD
+STATIC_OUTPUT_BASE = $$IDE_DATA_PATH/generic-highlighter
+STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH/generic-highlighter
+
+STATIC_FILES += $$files($$PWD/syntax/*, true)
+
+include(../../../../../qtcreatordata.pri)
diff --git a/src/lib/ksyntaxhighlighting_export.h b/src/lib/ksyntaxhighlighting_export.h
new file mode 100644
index 0000000..a39adb5
--- /dev/null
+++ b/src/lib/ksyntaxhighlighting_export.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtGlobal>
+
+#if defined(KSYNTAXHIGHLIGHTING_LIBRARY)
+# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_EXPORT
+#else
+# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_IMPORT
+#endif
diff --git a/syntax-highlighting.pro b/syntax-highlighting.pro
new file mode 100644
index 0000000..38127e1
--- /dev/null
+++ b/syntax-highlighting.pro
@@ -0,0 +1,55 @@
+include(../../../qtcreatorlibrary.pri)
+include(autogenerated/autogenerated.pri)
+
+QT += network
+
+DEFINES += KSYNTAXHIGHLIGHTING_LIBRARY
+
+RESOURCES += \
+ data/themes/theme-data.qrc
+
+HEADERS += \
+ src/lib/abstracthighlighter.h \
+ src/lib/abstracthighlighter_p.h \
+ src/lib/context_p.h \
+ src/lib/contextswitch_p.h \
+ src/lib/definition.h \
+ src/lib/definition_p.h \
+ src/lib/definitiondownloader.h \
+ src/lib/definitionref_p.h \
+ src/lib/foldingregion.h \
+ src/lib/format.h \
+ src/lib/format_p.h \
+ src/lib/htmlhighlighter.h \
+ src/lib/keywordlist_p.h \
+ src/lib/ksyntaxhighlighting_export.h \
+ src/lib/matchresult_p.h \
+ src/lib/repository.h \
+ src/lib/repository_p.h \
+ src/lib/rule_p.h \
+ src/lib/state.h \
+ src/lib/state_p.h \
+ src/lib/syntaxhighlighter.h \
+ src/lib/textstyledata_p.h \
+ src/lib/theme.h \
+ src/lib/themedata_p.h \
+ src/lib/wildcardmatcher_p.h \
+ src/lib/xml_p.h \
+
+SOURCES += \
+ src/lib/abstracthighlighter.cpp \
+ src/lib/context.cpp \
+ src/lib/contextswitch.cpp \
+ src/lib/definition.cpp \
+ src/lib/definitiondownloader.cpp \
+ src/lib/foldingregion.cpp \
+ src/lib/format.cpp \
+ src/lib/htmlhighlighter.cpp \
+ src/lib/keywordlist.cpp \
+ src/lib/repository.cpp \
+ src/lib/rule.cpp \
+ src/lib/state.cpp \
+ src/lib/syntaxhighlighter.cpp \
+ src/lib/theme.cpp \
+ src/lib/themedata.cpp \
+ src/lib/wildcardmatcher.cpp \
diff --git a/syntax-highlighting.qbs b/syntax-highlighting.qbs
new file mode 100644
index 0000000..248ebe0
--- /dev/null
+++ b/syntax-highlighting.qbs
@@ -0,0 +1,88 @@
+import qbs 1.0
+import qbs.File
+import qbs.FileInfo
+import qbs.Environment
+
+Project {
+ QtcDevHeaders {
+ productName: "syntax-highlighting (3rd party)"
+ baseDir: sourceDirectory + "/src/lib"
+ }
+ QtcDevHeaders {
+ productName: "syntax-highlighting autogenerated (3rd party)"
+ baseDir: sourceDirectory + "/autogenerated/src/lib"
+ Group {
+ prefix: baseDir + '/'
+ files: [
+ "AbstractHighlighter",
+ "Definition",
+ "FoldingRegion",
+ "Format",
+ "Repository",
+ "State",
+ "SyntaxHighlighter",
+ "Theme"
+ ]
+ qbs.install: true
+ qbs.installDir: qtc.ide_include_path + '/' + FileInfo.fileName(product.sourceDirectory)
+ qbs.installSourceBase: baseDir
+ }
+ }
+
+ QtcLibrary {
+ name: "KSyntaxHighlighting"
+
+ cpp.defines: base.concat("KSYNTAXHIGHLIGHTING_LIBRARY")
+ cpp.includePaths: [
+ product.sourceDirectory + "/src/lib/",
+ product.sourceDirectory + "/autogenerated/src/lib/",
+ product.sourceDirectory + "/autogenerated/"
+ ]
+
+ Depends { name: "Qt.gui" }
+ Depends { name: "Qt.network" }
+
+ Group {
+ name: "lib"
+ prefix: "src/lib/"
+ files: [
+ "*.h",
+ "*.cpp"
+ ]
+ }
+
+ Group {
+ name: "KSyntaxHighlighting data"
+ qbs.install: true
+ qbs.installDir: qtc.ide_data_path + "/generic-highlighter/"
+ qbs.installSourceBase: project.ide_source_tree + "/src/libs/3rdparty/syntax-highlighting/data/"
+ prefix: project.ide_source_tree + "/src/libs/3rdparty/syntax-highlighting/data/"
+ files: [
+ "syntax/**/*"
+ ]
+ }
+
+ Group {
+ name: "autogenerated lib"
+ prefix: "autogenerated/src/lib/"
+ files: [
+ "*.h",
+ "*.cpp"
+ ]
+ }
+
+ Group {
+ name: "theme data"
+ prefix: "data/themes/"
+ files: [ "theme-data.qrc" ]
+ }
+
+ Export {
+ Depends { name: "cpp" }
+ cpp.includePaths: [
+ product.sourceDirectory + "/src/lib/",
+ product.sourceDirectory + "/autogenerated/src/lib/",
+ ]
+ }
+ }
+}
diff --git a/syntax-highlighting_dependencies.pri b/syntax-highlighting_dependencies.pri
new file mode 100644
index 0000000..f2fd3e6
--- /dev/null
+++ b/syntax-highlighting_dependencies.pri
@@ -0,0 +1,3 @@
+QTC_LIB_NAME = KSyntaxHighlighting
+INCLUDEPATH *= $$PWD/src/lib
+INCLUDEPATH *= $$PWD/autogenerated/src/lib
--
2.20.1.windows.1

View File

@@ -0,0 +1,281 @@
From 916af0204a45c91092e53241e6a867cadb9dedec Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@qt.io>
Date: Tue, 12 Feb 2019 19:21:57 +0100
Subject: [PATCH 4/6] Compile with namespaced Qt
---
src/lib/abstracthighlighter.h | 4 ++++
src/lib/abstracthighlighter_p.h | 2 ++
src/lib/context_p.h | 2 ++
src/lib/definition.h | 4 ++++
src/lib/foldingregion.h | 2 ++
src/lib/format.h | 5 ++++-
src/lib/htmlhighlighter.h | 2 ++
src/lib/keywordlist_p.h | 2 ++
src/lib/repository.h | 2 ++
src/lib/repository_p.h | 2 ++
src/lib/rule_p.h | 2 ++
src/lib/state.h | 2 ++
src/lib/theme.h | 2 ++
src/lib/themedata_p.h | 2 ++
src/lib/wildcardmatcher.cpp | 2 +-
src/lib/wildcardmatcher_p.h | 4 ++++
16 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/src/lib/abstracthighlighter.h b/src/lib/abstracthighlighter.h
index 056f65b..2b88729 100644
--- a/src/lib/abstracthighlighter.h
+++ b/src/lib/abstracthighlighter.h
@@ -30,7 +30,9 @@
#include <memory>
+QT_BEGIN_NAMESPACE
class QString;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
@@ -186,6 +188,8 @@ private:
};
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(KSyntaxHighlighting::AbstractHighlighter, "org.kde.SyntaxHighlighting.AbstractHighlighter")
+QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_H
diff --git a/src/lib/abstracthighlighter_p.h b/src/lib/abstracthighlighter_p.h
index 1690eb0..bdfdf23 100644
--- a/src/lib/abstracthighlighter_p.h
+++ b/src/lib/abstracthighlighter_p.h
@@ -27,7 +27,9 @@
#include "definition.h"
#include "theme.h"
+QT_BEGIN_NAMESPACE
class QStringList;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/context_p.h b/src/lib/context_p.h
index 3e3ab97..a034d0e 100644
--- a/src/lib/context_p.h
+++ b/src/lib/context_p.h
@@ -34,7 +34,9 @@
#include <vector>
+QT_BEGIN_NAMESPACE
class QXmlStreamReader;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/definition.h b/src/lib/definition.h
index 25996dd..6f0dba9 100644
--- a/src/lib/definition.h
+++ b/src/lib/definition.h
@@ -31,10 +31,12 @@
#include <memory>
+QT_BEGIN_NAMESPACE
class QChar;
class QString;
class QStringList;
template <typename T> class QVector;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
@@ -391,6 +393,8 @@ private:
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Definition, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
#endif
diff --git a/src/lib/foldingregion.h b/src/lib/foldingregion.h
index baf65d1..074b947 100644
--- a/src/lib/foldingregion.h
+++ b/src/lib/foldingregion.h
@@ -101,6 +101,8 @@ private:
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::FoldingRegion, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
#endif
diff --git a/src/lib/format.h b/src/lib/format.h
index ba85f0d..24c58e7 100644
--- a/src/lib/format.h
+++ b/src/lib/format.h
@@ -30,10 +30,11 @@
#include <QExplicitlySharedDataPointer>
#include <QTypeInfo>
-
+QT_BEGIN_NAMESPACE
class QColor;
class QString;
class QXmlStreamReader;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
@@ -144,6 +145,8 @@ private:
};
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Format, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_FORMAT_H
diff --git a/src/lib/htmlhighlighter.h b/src/lib/htmlhighlighter.h
index 22d33ad..b7eda02 100644
--- a/src/lib/htmlhighlighter.h
+++ b/src/lib/htmlhighlighter.h
@@ -32,8 +32,10 @@
#include <memory>
+QT_BEGIN_NAMESPACE
class QFile;
class QTextStream;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/keywordlist_p.h b/src/lib/keywordlist_p.h
index fa70f11..8c41aab 100644
--- a/src/lib/keywordlist_p.h
+++ b/src/lib/keywordlist_p.h
@@ -30,7 +30,9 @@
#include <vector>
+QT_BEGIN_NAMESPACE
class QXmlStreamReader;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/repository.h b/src/lib/repository.h
index 2c32d02..c35da5e 100644
--- a/src/lib/repository.h
+++ b/src/lib/repository.h
@@ -29,8 +29,10 @@
#include <qglobal.h>
#include <memory>
+QT_BEGIN_NAMESPACE
class QString;
template <typename T> class QVector;
+QT_END_NAMESPACE
/**
* @namespace KSyntaxHighlighting
diff --git a/src/lib/repository_p.h b/src/lib/repository_p.h
index da765a2..9db876b 100644
--- a/src/lib/repository_p.h
+++ b/src/lib/repository_p.h
@@ -27,7 +27,9 @@
#include <QHash>
#include <QVector>
+QT_BEGIN_NAMESPACE
class QString;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/rule_p.h b/src/lib/rule_p.h
index eccf0df..538fded 100644
--- a/src/lib/rule_p.h
+++ b/src/lib/rule_p.h
@@ -38,7 +38,9 @@
#include <memory>
+QT_BEGIN_NAMESPACE
class QXmlStreamReader;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
diff --git a/src/lib/state.h b/src/lib/state.h
index c6e5344..fce4bc7 100644
--- a/src/lib/state.h
+++ b/src/lib/state.h
@@ -79,6 +79,8 @@ private:
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::State, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_STATE_H
diff --git a/src/lib/theme.h b/src/lib/theme.h
index 5277429..adb8431 100644
--- a/src/lib/theme.h
+++ b/src/lib/theme.h
@@ -371,6 +371,8 @@ private:
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Theme, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_THEME_H
diff --git a/src/lib/themedata_p.h b/src/lib/themedata_p.h
index 68cb873..3b5f463 100644
--- a/src/lib/themedata_p.h
+++ b/src/lib/themedata_p.h
@@ -163,6 +163,8 @@ private:
}
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::TextStyleData, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_THEMEDATA_P_H
diff --git a/src/lib/wildcardmatcher.cpp b/src/lib/wildcardmatcher.cpp
index 963e78d..167295a 100644
--- a/src/lib/wildcardmatcher.cpp
+++ b/src/lib/wildcardmatcher.cpp
@@ -79,5 +79,5 @@ static bool exactMatch(const QString &candidate, const QString &wildcard, int ca
bool WildcardMatcher::exactMatch(const QString &candidate, const QString &wildcard,
bool caseSensitive)
{
- return exactMatch(candidate, wildcard, candidate.length() - 1, wildcard.length() - 1, caseSensitive);
+ return ::exactMatch(candidate, wildcard, candidate.length() - 1, wildcard.length() - 1, caseSensitive);
}
diff --git a/src/lib/wildcardmatcher_p.h b/src/lib/wildcardmatcher_p.h
index 823dbd5..016b10f 100644
--- a/src/lib/wildcardmatcher_p.h
+++ b/src/lib/wildcardmatcher_p.h
@@ -24,7 +24,11 @@
#ifndef KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_P_H
#define KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_P_H
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
class QString;
+QT_END_NAMESPACE
namespace KSyntaxHighlighting {
--
2.20.1.windows.1

View File

@@ -0,0 +1,29 @@
From 3c05e92c71f6675fa2071036dafbc8d337bd2d01 Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@qt.io>
Date: Tue, 12 Feb 2019 19:27:46 +0100
Subject: [PATCH 5/6] Prevent assertion in RegExpr::doLoad
---
src/lib/rule.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lib/rule.cpp b/src/lib/rule.cpp
index a201375..c48753b 100644
--- a/src/lib/rule.cpp
+++ b/src/lib/rule.cpp
@@ -575,7 +575,11 @@ bool RegExpr::doLoad(QXmlStreamReader& reader)
}
// always using m_regexp.isValid() would be better, but parses the regexp and thus is way too expensive for release builds
- Q_ASSERT(m_regexp.isValid());
+
+ if (Log().isDebugEnabled()) {
+ if (!m_regexp.isValid())
+ qCDebug(Log) << "Invalid regexp:" << m_regexp.pattern();
+ }
return !m_regexp.pattern().isEmpty();
}
--
2.20.1.windows.1

View File

@@ -0,0 +1,101 @@
From 4b64058fe7d788ac79c16a08b280ce05d500e9fb Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@qt.io>
Date: Tue, 12 Feb 2019 19:32:54 +0100
Subject: [PATCH 6/6] Syntax Highlighter: return all definitions for a file
name/mimetype
Can be used to create user controls to switch between
multiple definitions for a file or mime type.
Change-Id: I5fd3744db1e819d0d6f8448a53adaf9d2c7c168d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
---
src/lib/repository.cpp | 17 +++++++++++++----
src/lib/repository.h | 12 ++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/lib/repository.cpp b/src/lib/repository.cpp
index 6b2fabd..922225a 100644
--- a/src/lib/repository.cpp
+++ b/src/lib/repository.cpp
@@ -78,7 +78,7 @@ Definition Repository::definitionForName(const QString& defName) const
return d->m_defs.value(defName);
}
-static Definition bestCandidate(QVector<Definition>& candidates)
+static Definition bestCandidate(QVector<Definition> &&candidates)
{
if (candidates.isEmpty())
return Definition();
@@ -91,6 +91,11 @@ static Definition bestCandidate(QVector<Definition>& candidates)
}
Definition Repository::definitionForFileName(const QString& fileName) const
+{
+ return bestCandidate(definitionsForFileName(fileName));
+}
+
+QVector<Definition> Repository::definitionsForFileName(const QString &fileName) const
{
QFileInfo fi(fileName);
const auto name = fi.fileName();
@@ -106,10 +111,15 @@ Definition Repository::definitionForFileName(const QString& fileName) const
}
}
- return bestCandidate(candidates);
+ return candidates;
}
Definition Repository::definitionForMimeType(const QString& mimeType) const
+{
+ return bestCandidate(definitionsForMimeType(mimeType));
+}
+
+QVector<Definition> Repository::definitionsForMimeType(const QString &mimeType) const
{
QVector<Definition> candidates;
for (auto it = d->m_defs.constBegin(); it != d->m_defs.constEnd(); ++it) {
@@ -121,8 +131,7 @@ Definition Repository::definitionForMimeType(const QString& mimeType) const
}
}
}
-
- return bestCandidate(candidates);
+ return candidates;
}
QVector<Definition> Repository::definitions() const
diff --git a/src/lib/repository.h b/src/lib/repository.h
index c35da5e..e4e9bed 100644
--- a/src/lib/repository.h
+++ b/src/lib/repository.h
@@ -166,6 +166,13 @@ public:
*/
Definition definitionForFileName(const QString &fileName) const;
+ /**
+ * Returns all Definition%s for the file named @p fileName.
+ * The match is performed based on the \e extensions and @e mimetype of
+ * the definition files.
+ */
+ QVector<Definition> definitionsForFileName(const QString &fileName) const;
+
/**
* Returns the best matching Definition to the type named @p mimeType
*
@@ -176,6 +183,11 @@ public:
*/
Definition definitionForMimeType(const QString &mimeType) const;
+ /**
+ * Returns all Definition%s to the type named @p mimeType
+ */
+ QVector<Definition> definitionsForMimeType(const QString &mimeType) const;
+
/**
* Returns all available Definition%s.
* Definition%ss are ordered by translated section and translated names,
--
2.20.1.windows.1