diff options
Diffstat (limited to 'src/libs')
119 files changed, 2934 insertions, 880 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/.git-blame-ignore-revs b/src/libs/3rdparty/syntax-highlighting/.git-blame-ignore-revs new file mode 100644 index 0000000000..8b2ba6d3d5 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/.git-blame-ignore-revs @@ -0,0 +1,4 @@ +# clang-format +56ed6f3f5f505eb0dbffc630729d67c3fb510546 +#clang-tidy +0960472cc3f57831a97697a4ae0cd139e2cc5551 diff --git a/src/libs/3rdparty/syntax-highlighting/.gitignore b/src/libs/3rdparty/syntax-highlighting/.gitignore index 4d50e82c2d..a29428fe5e 100644 --- a/src/libs/3rdparty/syntax-highlighting/.gitignore +++ b/src/libs/3rdparty/syntax-highlighting/.gitignore @@ -9,6 +9,11 @@ callgrind.* heaptrack.* /build*/ *.unc-backup* -.clang-format -.cmake/ -*.code-workspace
\ No newline at end of file +/.clang-format +/.cmake/ +/*.code-workspace +/compile_commands.json +.clangd +.idea +/cmake-build* +.cache diff --git a/src/libs/3rdparty/syntax-highlighting/.gitlab-ci.yml b/src/libs/3rdparty/syntax-highlighting/.gitlab-ci.yml new file mode 100644 index 0000000000..8950fb6d61 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/.gitlab-ci.yml @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> +# SPDX-License-Identifier: CC0-1.0 + +include: + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml diff --git a/src/libs/3rdparty/syntax-highlighting/.kde-ci.yml b/src/libs/3rdparty/syntax-highlighting/.kde-ci.yml new file mode 100644 index 0000000000..cf1d3363f9 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/.kde-ci.yml @@ -0,0 +1,7 @@ +Dependencies: +- 'on': ['@all'] + 'require': + 'frameworks/extra-cmake-modules': '@same' + +Options: + test-before-installing: True diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index 8dc268071a..25f1af3573 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -10,11 +10,12 @@ add_qtc_library(KSyntaxHighlighting SHARED PUBLIC_INCLUDES src/lib autogenerated/src/lib - DEFINES KSYNTAXHIGHLIGHTING_LIBRARY + DEFINES KF5SyntaxHighlighting_EXPORTS DEPENDS Qt5::Network Qt5::Widgets SOURCES autogenerated/src/lib/ksyntaxhighlighting_logging.cpp autogenerated/src/lib/ksyntaxhighlighting_logging.h autogenerated/ksyntaxhighlighting_version.h + autogenerated/src/lib/ksyntaxhighlighting_export.h data/themes/theme-data.qrc @@ -29,7 +30,6 @@ add_qtc_library(KSyntaxHighlighting SHARED src/lib/format.cpp src/lib/format.h src/lib/format_p.h src/lib/htmlhighlighter.cpp src/lib/htmlhighlighter.h src/lib/keywordlist.cpp src/lib/keywordlist_p.h - src/lib/ksyntaxhighlighting_export.h src/lib/matchresult_p.h src/lib/repository.cpp src/lib/repository.h src/lib/repository_p.h src/lib/rule.cpp src/lib/rule_p.h diff --git a/src/libs/3rdparty/syntax-highlighting/README.md b/src/libs/3rdparty/syntax-highlighting/README.md index 2acff73b18..2e668dd3da 100644 --- a/src/libs/3rdparty/syntax-highlighting/README.md +++ b/src/libs/3rdparty/syntax-highlighting/README.md @@ -23,6 +23,8 @@ It's meant as a building block for text editors as well as for simple highlighte text rendering (e.g. as HTML), supporting both integration with a custom editor as well as a ready-to-use QSyntaxHighlighter sub-class. +Besides a C++ API, a [QML API](@ref qml_api) is also provided. + ## Out of scope To not turn this into yet another text editor, the following things are considered @@ -46,7 +48,7 @@ in **data/syntax/** and have the **.xml** extension. Additional ones are picked up from the file system if present, so you can easily extend this by application-specific syntax definitions for example. -To install or test a syntax definiton file locally, place it in +To install or test a syntax definition file locally, place it in **org.kde.syntax-highlighting/syntax/**, which is located in your user directory. Usually it is: @@ -56,47 +58,56 @@ Usually it is: <td>$HOME/.local/share/org.kde.syntax-highlighting/syntax/</td> </tr> <tr> - <td>For <a href="https://flathub.org/apps/details/org.kde.kate">Kate's Flatpak package</a></td> - <td>$HOME/.var/app/org.kde.kate/data/org.kde.syntax-highlighting/syntax/</td> + <td>For Flatpak packages</td> + <td>$HOME/.var/app/<em>package-name</em>/data/org.kde.syntax-highlighting/syntax/</td> </tr> <tr> - <td>For <a href="https://snapcraft.io/kate">Kate's Snap package</a></td> - <td>$HOME/snap/kate/current/.local/share/org.kde.syntax-highlighting/syntax/</td> + <td>For Snap packages</a></td> + <td>$HOME/snap/<em>package-name</em>/current/.local/share/org.kde.syntax-highlighting/syntax/</td> </tr> <tr> <td>On Windows®</td> <td>%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\</td> </tr> + <tr> + <td>On macOS®</td> + <td>$HOME/Library/Application Support/org.kde.syntax-highlighting/syntax/</td> + </tr> </table> For more details, see ["The Highlight Definition XML Format" (Working with Syntax Highlighting, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=trunk5&path=highlight.html#katehighlight-xml-format). -Also, in **data/schema/** there is a script to validate the syntax definiton XML +Also, in **data/schema/** there is a script to validate the syntax definition XML files. Use the command `validatehl.sh mySyntax.xml`. ## Color theme files -This library includes the color themes, the theme files use the **JSON** -format and are located in **data/themes/** with the **.theme** extension. +This library includes the color themes, which are documented +[here](https://docs.kde.org/?application=katepart&branch=trunk5&path=color-themes.html). +The color theme files use the JSON format and are located in **data/themes/** +with the **.theme** extension. Additional ones are also picked up from the file system if present, in the **org.kde.syntax-highlighting/themes/** folder of your user directory, -allowing you to easily add custom color theme files. -The location of **org.kde.syntax-highlighting/themes/** is the same +allowing you to easily add custom color theme files. This location is the same as shown in the table of the [previous section](#syntax-definition-files), replacing the **syntax** folder with **themes**. +For more details, see ["The Color Themes JSON Format" (Working with Color Themes, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=trunk5&path=color-themes.html#color-themes-json). The [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/) library -(used by Kate, Kile and KDevelop, for example) provides -a user interface for editing and creating KSyntaxHighlighting color themes, including +(used by Kate, Kile and KDevelop, for example) provides a +[user interface](https://docs.kde.org/?application=katepart&branch=trunk5&path=color-themes.html#color-themes-gui) +for editing and creating KSyntaxHighlighting color themes, including a tool for exporting and importing the JSON theme files. + +Note that in KDE text editors, the KSyntaxHighlighting color themes are used +[since KDE Frameworks 5.75](https://kate-editor.org/post/2020/2020-09-13-kate-color-themes-5.75/), +released on October 10, 2020. Previously, Kate's color schemes +(KConfig based schema config) were used and are now deprecated. The tool **utils/schema-converter/** and the script **utils/kateschema_to_theme_converter.py** convert the old Kate schemas to KSyntaxHighlighting themes. -For more information, see: - -* [Kate - Color Themes with Frameworks 5.75 (Kate Editor Website)](https://kate-editor.org/post/2020/2020-09-13-kate-color-themes-5.75/) -* [Submit a KSyntaxHighlighting Color Theme (Kate Editor Website)](https://kate-editor.org/post/2020/2020-09-18-submit-a-ksyntaxhighlighting-color-theme/) +Also see ["Submit a KSyntaxHighlighting Color Theme" (Kate Editor Website)](https://kate-editor.org/post/2020/2020-09-18-submit-a-ksyntaxhighlighting-color-theme/). ## Build it diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/autogenerated.pri b/src/libs/3rdparty/syntax-highlighting/autogenerated/autogenerated.pri index aee620add9..1c540d45be 100644 --- a/src/libs/3rdparty/syntax-highlighting/autogenerated/autogenerated.pri +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/autogenerated.pri @@ -6,4 +6,5 @@ SOURCES += \ HEADERS += \ $$PWD/ksyntaxhighlighting_version.h \ - $$PWD/src/lib/ksyntaxhighlighting_logging.h + $$PWD/src/lib/ksyntaxhighlighting_logging.h \ + $$PWD/src/lib/ksyntaxhighlighting_export.h diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h index 32e5aa62a7..a8c5d74235 100644 --- a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h @@ -3,10 +3,10 @@ #ifndef SyntaxHighlighting_VERSION_H #define SyntaxHighlighting_VERSION_H -#define SyntaxHighlighting_VERSION_STRING "5.80.0" +#define SyntaxHighlighting_VERSION_STRING "5.87.0" #define SyntaxHighlighting_VERSION_MAJOR 5 -#define SyntaxHighlighting_VERSION_MINOR 80 +#define SyntaxHighlighting_VERSION_MINOR 87 #define SyntaxHighlighting_VERSION_PATCH 0 -#define SyntaxHighlighting_VERSION ((5<<16)|(80<<8)|(0)) +#define SyntaxHighlighting_VERSION ((5<<16)|(87<<8)|(0)) #endif diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/WildcardMatcher b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/WildcardMatcher new file mode 100644 index 0000000000..ecea1b09bd --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/WildcardMatcher @@ -0,0 +1 @@ +#include "wildcardmatcher.h" diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h new file mode 100644 index 0000000000..1213499635 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h @@ -0,0 +1,218 @@ + +#ifndef KSYNTAXHIGHLIGHTING_EXPORT_H +#define KSYNTAXHIGHLIGHTING_EXPORT_H + +#include <QtGlobal> + +#ifdef KSYNTAXHIGHLIGHTING_STATIC_DEFINE +# define KSYNTAXHIGHLIGHTING_EXPORT +# define KSYNTAXHIGHLIGHTING_NO_EXPORT +#else +# ifndef KSYNTAXHIGHLIGHTING_EXPORT +# ifdef KF5SyntaxHighlighting_EXPORTS + /* We are building this library */ +# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_EXPORT +# else + /* We are using this library */ +# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_IMPORT +# endif +# endif + +# ifndef KSYNTAXHIGHLIGHTING_NO_EXPORT +# define KSYNTAXHIGHLIGHTING_NO_EXPORT +# endif +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DECL_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DECL_DEPRECATED __declspec(deprecated) +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_EXPORT +# define KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_NO_EXPORT +# define KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_NO_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# define KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# endif +#endif + +#define KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_TEXT(text) __declspec(deprecated(text)) + +#define ECM_GENERATEEXPORTHEADER_VERSION_VALUE(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) + +/* Take any defaults from group settings */ +#if !defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED) && !defined(KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) +# ifdef KF_NO_DEPRECATED +# define KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# elif defined(KF_DISABLE_DEPRECATED_BEFORE_AND_AT) +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT KF_DISABLE_DEPRECATED_BEFORE_AND_AT +# endif +#endif +#if !defined(KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) && defined(KF_DISABLE_DEPRECATED_BEFORE_AND_AT) +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT KF_DISABLE_DEPRECATED_BEFORE_AND_AT +#endif + +#if !defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS) && !defined(KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE) +# ifdef KF_NO_DEPRECATED_WARNINGS +# define KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS +# elif defined(KF_DEPRECATED_WARNINGS_SINCE) +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KF_DEPRECATED_WARNINGS_SINCE +# endif +#endif +#if !defined(KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE) && defined(KF_DEPRECATED_WARNINGS_SINCE) +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KF_DEPRECATED_WARNINGS_SINCE +#endif + +#if defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED) +# undef KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_NO_EXPORT +#elif defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS) +# define KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_NO_EXPORT +#else +# define KSYNTAXHIGHLIGHTING_DEPRECATED KSYNTAXHIGHLIGHTING_DECL_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_NO_EXPORT +#endif + +/* No deprecated API had been removed from build */ +#define KSYNTAXHIGHLIGHTING_EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 + +#define KSYNTAXHIGHLIGHTING_BUILD_DEPRECATED_SINCE(major, minor) 1 + +#ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55700 +#endif +#ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0 +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE +# ifdef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# else +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55700 +# endif +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0 +#endif + +#ifdef KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_ENABLE_DEPRECATED_SINCE(major, minor) (ECM_GENERATEEXPORTHEADER_VERSION_VALUE(major, minor, 0) > KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) +#else +# define KSYNTAXHIGHLIGHTING_ENABLE_DEPRECATED_SINCE(major, minor) 0 +#endif + +#if KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE >= 0x55700 +# define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_87(text) KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_TEXT(text) +#else +# define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_87(text) +#endif +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5(minor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_##minor(text) +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION(major, minor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_##major(minor, "Since "#major"."#minor". " text) +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_##major(minor, "Since "#textmajor"."#textminor". " text) +// Not yet implemented for MSVC +#define KSYNTAXHIGHLIGHTING_ENUMERATOR_DEPRECATED_VERSION(major, minor, text) +#define KSYNTAXHIGHLIGHTING_ENUMERATOR_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text) + +#endif /* KSYNTAXHIGHLIGHTING_EXPORT_H */ + + +#ifndef ECM_GENERATEEXPORTHEADER_KSYNTAXHIGHLIGHTING_EXPORT_H +#define ECM_GENERATEEXPORTHEADER_KSYNTAXHIGHLIGHTING_EXPORT_H + + +#define KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_TEXT(text) __declspec(deprecated(text)) + +#define ECM_GENERATEEXPORTHEADER_VERSION_VALUE(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) + +/* Take any defaults from group settings */ +#if !defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED) && !defined(KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) +# ifdef KF_NO_DEPRECATED +# define KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# elif defined(KF_DISABLE_DEPRECATED_BEFORE_AND_AT) +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT KF_DISABLE_DEPRECATED_BEFORE_AND_AT +# endif +#endif +#if !defined(KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) && defined(KF_DISABLE_DEPRECATED_BEFORE_AND_AT) +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT KF_DISABLE_DEPRECATED_BEFORE_AND_AT +#endif + +#if !defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS) && !defined(KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE) +# ifdef KF_NO_DEPRECATED_WARNINGS +# define KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS +# elif defined(KF_DEPRECATED_WARNINGS_SINCE) +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KF_DEPRECATED_WARNINGS_SINCE +# endif +#endif +#if !defined(KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE) && defined(KF_DEPRECATED_WARNINGS_SINCE) +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KF_DEPRECATED_WARNINGS_SINCE +#endif + +#if defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED) +# undef KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_NO_EXPORT +#elif defined(KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS) +# define KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_NO_EXPORT +#else +# define KSYNTAXHIGHLIGHTING_DEPRECATED KSYNTAXHIGHLIGHTING_DECL_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DEPRECATED_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_EXPORT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_NO_EXPORT KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_NO_EXPORT +#endif + +/* No deprecated API had been removed from build */ +#define KSYNTAXHIGHLIGHTING_EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 + +#define KSYNTAXHIGHLIGHTING_BUILD_DEPRECATED_SINCE(major, minor) 1 + +#ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55700 +#endif +#ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0 +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE +# ifdef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# else +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55700 +# endif +#endif + +#ifndef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0 +#endif + +#ifdef KSYNTAXHIGHLIGHTING_DEPRECATED +# define KSYNTAXHIGHLIGHTING_ENABLE_DEPRECATED_SINCE(major, minor) (ECM_GENERATEEXPORTHEADER_VERSION_VALUE(major, minor, 0) > KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT) +#else +# define KSYNTAXHIGHLIGHTING_ENABLE_DEPRECATED_SINCE(major, minor) 0 +#endif + +#if KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE >= 0x55700 +# define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_87(text) KSYNTAXHIGHLIGHTING_DECL_DEPRECATED_TEXT(text) +#else +# define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_87(text) +#endif +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5(minor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_5_##minor(text) +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION(major, minor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_##major(minor, "Since "#major"."#minor". " text) +#define KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text) KSYNTAXHIGHLIGHTING_DEPRECATED_VERSION_##major(minor, "Since "#textmajor"."#textminor". " text) +// Not yet implemented for MSVC +#define KSYNTAXHIGHLIGHTING_ENUMERATOR_DEPRECATED_VERSION(major, minor, text) +#define KSYNTAXHIGHLIGHTING_ENUMERATOR_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text) + + +#endif /* ECM_GENERATEEXPORTHEADER_KSYNTAXHIGHLIGHTING_EXPORT_H */ diff --git a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt index 8b923c4795..acc2429ec8 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt @@ -38,8 +38,11 @@ generate_syntax_definition(generate-doxygenlua.pl doxygenlua.xml doxygen.xml) file(GLOB src_defs "${CMAKE_CURRENT_SOURCE_DIR}/syntax/*.xml") set(defs ${src_defs} ${gen_defs}) +# object library to make cross-folder dependencies work +add_library(SyntaxHighlightingData OBJECT) + # theme data resource -qt5_add_resources(themes_QRC ${CMAKE_CURRENT_SOURCE_DIR}/themes/theme-data.qrc) +target_sources(SyntaxHighlightingData PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/themes/theme-data.qrc) # do we want syntax files bundled in the library? if (QRC_SYNTAX) @@ -66,14 +69,10 @@ if (QRC_SYNTAX) ) set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp" PROPERTIES SKIP_AUTOMOC ON) - # object library to make cross-folder dependencies work, themes + syntax files - add_library(SyntaxHighlightingData OBJECT ${themes_QRC} ${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp) + target_sources(SyntaxHighlightingData PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp) else() # install the syntax files as normal files into the prefix install (FILES ${defs} DESTINATION ${KDE_INSTALL_DATADIR}/org.kde.syntax-highlighting/syntax) - - # object library to make cross-folder dependencies work, only themes - add_library(SyntaxHighlightingData OBJECT ${themes_QRC}) endif() # set PIC to allow use in static and shared libs diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl index 8e8d37d266..1c1a3da4ba 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl @@ -22,7 +22,7 @@ <language name="CMake" - version="31" + version="<!--{version}-->" kateversion="5.0" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml index 7d4f113cba..ab26c2153b 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml @@ -1,3 +1,5 @@ +version: 34 + global-properties: - ALLOW_DUPLICATE_CUSTOM_TARGETS - AUTOGEN_SOURCE_GROUP @@ -56,6 +58,7 @@ directory-properties: - DEFINITIONS - EXCLUDE_FROM_ALL - IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + - IMPORTED_TARGETS # Since 3.21 - INCLUDE_DIRECTORIES - INCLUDE_REGULAR_EXPRESSION - INTERPROCEDURAL_OPTIMIZATION_<CONFIG> @@ -172,6 +175,7 @@ target-properties: - EXCLUDE_FROM_ALL - EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> - EXCLUDE_FROM_DEFAULT_BUILD + - EXPORT_COMPILE_COMMANDS # Since 3.20 - EXPORT_NAME - EXPORT_PROPERTIES # Since 3.12 - FOLDER @@ -243,6 +247,7 @@ target-properties: - <LANG>_CPPCHECK # Since 3.10 - <LANG>_CPPLINT - <LANG>_INCLUDE_WHAT_YOU_USE + - <LANG>_LINKER_LAUNCHER # Sine 3.21 - <LANG>_VISIBILITY_PRESET - LIBRARY_OUTPUT_DIRECTORY_<CONFIG> - LIBRARY_OUTPUT_DIRECTORY @@ -284,7 +289,6 @@ target-properties: - OBJCXX_STANDARD # Since 3.16 - OBJCXX_STANDARD_REQUIRED # Since 3.16 - OPTIMIZE_DEPENDENCIES # Since 3.19 - - OBJC_STANDARD - OSX_ARCHITECTURES_<CONFIG> - OSX_ARCHITECTURES - OSX_CURRENT_VERSION # Since 3.17 @@ -329,6 +333,7 @@ target-properties: - UNITY_BUILD_CODE_AFTER_INCLUDE # Since 3.16 - UNITY_BUILD_CODE_BEFORE_INCLUDE # Since 3.16 - UNITY_BUILD_MODE # Since 3.18 + - UNITY_BUILD_UNIQUE_ID # Since 3.20 - VERSION - VISIBILITY_INLINES_HIDDEN - VS_CONFIGURATION_TYPE @@ -372,6 +377,10 @@ target-properties: - WIN32_EXECUTABLE - WINDOWS_EXPORT_ALL_SYMBOLS - XCODE_ATTRIBUTE_<an-attribute> + - XCODE_EMBED_<type>_CODE_SIGN_ON_COPY # Since 3.20 + - XCODE_EMBED_<type>_PATH # Since 3.20 + - XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY # Since 3.20 + - XCODE_EMBED_<type> # Since 3.20 - XCODE_EXPLICIT_FILE_TYPE - XCODE_GENERATE_SCHEME # Since 3.15 - XCODE_LINK_BUILD_PHASE_MODE # Since 3.19 @@ -572,6 +581,7 @@ generator-expressions: - TARGET_BUNDLE_DIR - TARGET_BUNDLE_CONTENT_DIR - TARGET_PROPERTY + - TARGET_RUNTIME_DLLS # Since 3.21 - INSTALL_PREFIX # Output-Related Expressions - TARGET_NAME @@ -581,6 +591,8 @@ generator-expressions: - MAKE_C_IDENTIFIER - TARGET_OBJECTS - SHELL_PATH + - OUTPUT_CONFIG # Since 3.20 + - COMMAND_CONFIG # Since 3.20 variables: # Variables that Provide Information @@ -687,6 +699,7 @@ variables: - CMAKE_XCODE_PLATFORM_TOOLSET - <PROJECT-NAME>_BINARY_DIR - <PROJECT-NAME>_DESCRIPTION # Since 3.12 + - <PROJECT-NAME>_IS_TOP_LEVEL # Since 3.21 - <PROJECT-NAME>_HOMEPAGE_URL # Since 3.12 - <PROJECT-NAME>_SOURCE_DIR - <PROJECT-NAME>_VERSION @@ -696,6 +709,7 @@ variables: - <PROJECT-NAME>_VERSION_TWEAK - PROJECT_BINARY_DIR - PROJECT_DESCRIPTION # Since 3.9 + - PROJECT_IS_TOP_LEVEL # Since 3.21 - PROJECT_HOMEPAGE_URL # Since 3.12 - PROJECT_NAME - PROJECT_SOURCE_DIR @@ -819,6 +833,7 @@ variables: - ANDROID - APPLE - BORLAND + - CMAKE_ANDROID_NDK_VERSION # Since 3.20 - CMAKE_CL_64 - CMAKE_COMPILER_2005 - CMAKE_HOST_APPLE @@ -949,6 +964,9 @@ variables: - CMAKE_<LANG>_CPPCHECK # Since 3.10 - CMAKE_<LANG>_CPPLINT - CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE + - CMAKE_<LANG>_LINKER_LAUNCHER # Sine 3.21 + - CMAKE_<LANG>_LINK_LIBRARY_FILE_FLAG # Sine 3.16 + - CMAKE_<LANG>_LINK_LIBRARY_FLAG # Sine 3.16 - CMAKE_<LANG>_VISIBILITY_PRESET - CMAKE_LIBRARY_OUTPUT_DIRECTORY - CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> @@ -1046,6 +1064,7 @@ variables: - CMAKE_<LANG>_ARCHIVE_APPEND - CMAKE_<LANG>_ARCHIVE_CREATE - CMAKE_<LANG>_ARCHIVE_FINISH + - CMAKE_<LANG>_BYTE_ORDER # Since 3.20 - CMAKE_<LANG>_COMPILER - CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN - CMAKE_<LANG>_COMPILER_ID @@ -1173,6 +1192,7 @@ variables: # Variables for CPack - CPACK_ABSOLUTE_DESTINATION_FILES - CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY + - CPACK_CUSTOM_INSTALL_VARIABLES # Since 3.21 - CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION - CPACK_INCLUDE_TOPLEVEL_DIRECTORY - CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS # Since 3.11 @@ -1182,32 +1202,57 @@ variables: - CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION # Variables for `find_package()` - PACKAGE_FIND_NAME - - PACKAGE_FIND_VERSION - - PACKAGE_FIND_VERSION_MAJOR - - PACKAGE_FIND_VERSION_MINOR - - PACKAGE_FIND_VERSION_PATCH - - PACKAGE_FIND_VERSION_TWEAK + # NOTE <SMTH>_VERSION and components already defined above, so skipped here - PACKAGE_FIND_VERSION_COUNT + - PACKAGE_FIND_VERSION_RANGE + - PACKAGE_FIND_VERSION_RANGE_MIN + - PACKAGE_FIND_VERSION_RANGE_MAX + - PACKAGE_FIND_VERSION_MIN + - PACKAGE_FIND_VERSION_MIN_MAJOR + - PACKAGE_FIND_VERSION_MIN_MINOR + - PACKAGE_FIND_VERSION_MIN_PATCH + - PACKAGE_FIND_VERSION_MIN_TWEAK + - PACKAGE_FIND_VERSION_MIN_COUNT + - PACKAGE_FIND_VERSION_MAX + - PACKAGE_FIND_VERSION_MAX_MAJOR + - PACKAGE_FIND_VERSION_MAX_MINOR + - PACKAGE_FIND_VERSION_MAX_PATCH + - PACKAGE_FIND_VERSION_MAX_TWEAK + - PACKAGE_FIND_VERSION_MAX_COUNT + - PACKAGE_FIND_VERSION_COMPLETE - PACKAGE_VERSION - PACKAGE_VERSION_EXACT - PACKAGE_VERSION_COMPATIBLE - PACKAGE_VERSION_UNSUITABLE - # NOTE <SMTH>_VERSION and components already defined above, so skipped here + # Package File Interface Variables - <package>_FOUND - - <package>_VERSION_COUNT - <package>_FIND_REQUIRED - <package>_FIND_QUIETLY - - <package>_FIND_VERSION - - <package>_FIND_VERSION_MAJOR - - <package>_FIND_VERSION_MINOR - - <package>_FIND_VERSION_PATCH - - <package>_FIND_VERSION_TWEAK - - <package>_FIND_VERSION_COUNT - - <package>_FIND_VERSION_EXACT - - <package>_FIND_COMPONENTS - - <package>_FIND_REQUIRED_<c> - - <package>_CONSIDERED_CONFIGS - - <package>_CONSIDERED_VERSIONS + - <package>_VERSION_COUNT + # NOTE <SMTH>_VERSION and components already defined above, so skipped here + - <PackageName>_FIND_VERSION_COUNT + - <PackageName>_FIND_VERSION_EXACT + - <PackageName>_FIND_COMPONENTS + - <PackageName>_FIND_REQUIRED_<c> + - <PackageName>_FIND_VERSION_RANGE + - <PackageName>_FIND_VERSION_RANGE_MIN + - <PackageName>_FIND_VERSION_RANGE_MAX + - <PackageName>_FIND_VERSION_MIN + - <PackageName>_FIND_VERSION_MIN_MAJOR + - <PackageName>_FIND_VERSION_MIN_MINOR + - <PackageName>_FIND_VERSION_MIN_PATCH + - <PackageName>_FIND_VERSION_MIN_TWEAK + - <PackageName>_FIND_VERSION_MIN_COUNT + - <PackageName>_FIND_VERSION_MAX + - <PackageName>_FIND_VERSION_MAX_MAJOR + - <PackageName>_FIND_VERSION_MAX_MINOR + - <PackageName>_FIND_VERSION_MAX_PATCH + - <PackageName>_FIND_VERSION_MAX_TWEAK + - <PackageName>_FIND_VERSION_MAX_COUNT + - <PackageName>_FIND_VERSION_COMPLETE + - <PackageName>_CONFIG + - <PackageName>_CONSIDERED_CONFIGS + - <PackageName>_CONSIDERED_VERSIONS - <PackageName>_ROOT # Since 3.12 # Other standard variables/patterns # - `try_run` @@ -1220,6 +1265,10 @@ variables: # - `cmake_parse_arguments` - <pfx>_UNPARSED_ARGUMENTS - <pfx>_KEYWORDS_MISSING_VALUES + # Variables that control `file(GET_RUNTIME_DEPENDENCIES)` behavior + - CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM + - CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL + - CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND # Well known CMake's official module's variables # - CheckCompilerFlag # - CheckCCompilerFlag @@ -1327,6 +1376,7 @@ variables: - CPACK_DEBIAN_PACKAGE_HOMEPAGE - CPACK_DEBIAN_PACKAGE_SHLIBDEPS - CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS + - CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS # Since 3.20 - CPACK_DEBIAN_PACKAGE_DEBUG - CPACK_DEBIAN_PACKAGE_PREDEPENDS - CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS @@ -1364,6 +1414,7 @@ variables: - CPACK_DMG_SLA_DIR - CPACK_DMG_SLA_LANGUAGES - CPACK_DMG_<component>_FILE_NAME # Since 3.17 + - CPACK_DMG_FILESYSTEM # Since 3.21 - CPACK_COMMAND_HDIUTIL - CPACK_COMMAND_SETFILE - CPACK_COMMAND_REZ @@ -1389,6 +1440,7 @@ variables: - CPACK_IFW_PACKAGE_STYLE_SHEET # Since 3.15 - CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH - CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT + - CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST # Since 3.20 - CPACK_IFW_PACKAGE_TITLE_COLOR - CPACK_IFW_PACKAGE_START_MENU_DIRECTORY - CPACK_IFW_TARGET_DIRECTORY @@ -1443,6 +1495,9 @@ variables: - CPACK_NSIS_FINISH_TITLE_3LINES # Since 3.17 - CPACK_NSIS_MUI_HEADERIMAGE # Since 3.17 - CPACK_NSIS_MANIFEST_DPI_AWARE # Since 3.18 + - CPACK_NSIS_BRANDING_TEXT # Since 3.20 + - CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION # Since 3.20 + - CPACK_NSIS_EXECUTABLE # Since 3.21 # - CPackNuGet (since 3.12) - CPACK_NUGET_COMPONENT_INSTALL - CPACK_NUGET_PACKAGE_NAME @@ -1461,14 +1516,22 @@ variables: - CPACK_NUGET_<compName>_PACKAGE_HOMEPAGE_URL - CPACK_NUGET_PACKAGE_LICENSEURL - CPACK_NUGET_<compName>_PACKAGE_LICENSEURL + - CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION # Since 3.20 + - CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION # Since 3.20 + - CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME # Since 3.20 + - CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME # Since 3.20 - CPACK_NUGET_PACKAGE_ICONURL - CPACK_NUGET_<compName>_PACKAGE_ICONURL + - CPACK_NUGET_PACKAGE_ICON # Since 3.20 + - CPACK_NUGET_<compName>_PACKAGE_ICON # Since 3.20 - CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY - CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION_SUMMARY - CPACK_NUGET_PACKAGE_RELEASE_NOTES - CPACK_NUGET_<compName>_PACKAGE_RELEASE_NOTES - CPACK_NUGET_PACKAGE_COPYRIGHT - CPACK_NUGET_<compName>_PACKAGE_COPYRIGHT + - CPACK_NUGET_PACKAGE_LANGUAGE # Since 3.20 + - CPACK_NUGET_<compName>_PACKAGE_LANGUAGE # Since 3.20 - CPACK_NUGET_PACKAGE_TAGS - CPACK_NUGET_<compName>_PACKAGE_TAGS - CPACK_NUGET_PACKAGE_DEPENDENCIES @@ -1617,6 +1680,7 @@ variables: - CPACK_PACKAGE_EXECUTABLES - CPACK_STRIP_FILES - CPACK_VERBATIM_VARIABLES + - CPACK_THREADS # Since 3.20 - CPACK_SOURCE_PACKAGE_FILE_NAME - CPACK_SOURCE_STRIP_FILES - CPACK_SOURCE_GENERATOR @@ -1754,12 +1818,19 @@ variables: - CMAKE_NO_ANSI_STRING_STREAM # - TestForSTDNamespace - CMAKE_NO_STD_NAMESPACE + # - UseJava + - CMAKE_JAVA_COMPILE_FLAGS + - CMAKE_JAVA_INCLUDE_PATH + - CMAKE_JNI_TARGET + - CMAKE_JAR_CLASSES_PREFIX # - UseSWIG + - UseSWIG_MODULE_VERSION # Since 3.12 - CMAKE_SWIG_FLAGS - CMAKE_SWIG_OUTDIR - SWIG_OUTFILE_DIR - SWIG_MODULE_<name>_EXTRA_DEPS - SWIG_SOURCE_FILE_EXTENSIONS # Since 3.14 + - SWIG_USE_SWIG_DEPENDENCIES # Since 3.20 deprecated-or-internal-variables: - CMAKE_HOME_DIRECTORY @@ -1784,6 +1855,10 @@ deprecated-or-internal-variables: - CPACK_TEMPORARY_DIRECTORY - CPACK_TOPLEVEL_DIRECTORY - CPACK_INSTALL_PREFIX + # Mentioned in `file(GET_RUNTIME_DEPENDENCIES)` docs + - CMAKE_OBJDUMP + # Mentioned in "Deprecated and Removed Features" of release notes 3.21 + - CMAKE_SYSTEM_ARCH # https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html # NOTE Added to syntax file version 14 at 3.15.0 version of CMake @@ -1801,6 +1876,7 @@ environment-variables: - CMAKE_MSVCIDE_RUN_PATH - CMAKE_NO_VERBOSE - CMAKE_OSX_ARCHITECTURES + - CMAKE_TOOLCHAIN_FILE # Since 3.21 - DESTDIR - LDFLAGS - MACOSX_DEPLOYMENT_TARGET @@ -1812,6 +1888,7 @@ environment-variables: - CC - CFLAGS - CSFLAGS + - CUDAARCHS # Since 3.20 - CUDACXX - CUDAFLAGS - CUDAHOSTCXX @@ -1897,6 +1974,55 @@ scripting-commands: name: cmake_parse_arguments named-args: [PARSE_ARGV] - + name: cmake_path # Since 3.20 + named-args: [ + # Decomposition + GET + , ROOT_NAME + , ROOT_DIRECTORY + , ROOT_PATH + , FILENAME + , EXTENSION + , LAST_ONLY + , STEM + , RELATIVE_PART + , PARENT_PATH + # Query + , HAS_ROOT_NAME + , HAS_ROOT_DIRECTORY + , HAS_ROOT_PATH + , HAS_FILENAME + , HAS_EXTENSION + , HAS_STEM + , HAS_RELATIVE_PART + , HAS_PARENT_PATH + , IS_ABSOLUTE + , IS_RELATIVE + , IS_PREFIX + , NORMALIZE + # Modification + , SET + , APPEND + , OUTPUT_VARIABLE + , APPEND_STRING + , REMOVE_FILENAME + , REPLACE_FILENAME + , REMOVE_EXTENSION + , REPLACE_EXTENSION + # Generation + , NORMAL_PATH + , RELATIVE_PATH + , BASE_DIRECTORY + , ABSOLUTE_PATH + # Native Conversion + , NATIVE_PATH + , CONVERT + , TO_CMAKE_PATH_LIST + , TO_NATIVE_PATH_LIST + # Hashing + , HASH + ] + - name: cmake_policy named-args: [GET, SET, PUSH, POP, VERSION] special-args: [OLD, NEW] @@ -1908,6 +2034,8 @@ scripting-commands: , NO_SOURCE_PERMISSIONS # Since 3.19 , "@ONLY" , NEWLINE_STYLE + , USE_SOURCE_PERMISSIONS # Since 3.20 + , FILE_PERMISSIONS # Since 3.20 ] special-args: [UNIX, DOS, WIN32, LF, CRLF] - @@ -2098,6 +2226,19 @@ scripting-commands: , SIZE # New sub-options since 3.16 , GET_RUNTIME_DEPENDENCIES + , RESOLVED_DEPENDENCIES_VAR + , UNRESOLVED_DEPENDENCIES_VAR + , EXECUTABLES + , LIBRARIES + , MODULES + , DIRECTORIES + , BUNDLE_EXECUTABLE + , PRE_INCLUDE_REGEXES + , PRE_EXCLUDE_REGEXES + , POST_INCLUDE_REGEXES + , POST_EXCLUDE_REGEXES + , POST_INCLUDE_FILES # Since 3.21 + , POST_EXCLUDE_FILES # Since 3.21 # New sub-options since 3.18 , ARCHIVE_CREATE , FILES @@ -2112,10 +2253,17 @@ scripting-commands: , ESCAPE_QUOTES , "@ONLY" , NEWLINE_STYLE - , CHMOD # Since 3.19 - , CHMOD_RECURSE # Since 3.19 - , REAL_PATH # Since 3.19 - , BASE_DIRECTORY # Since 3.19 + # New sub-options since 3.19 + , CHMOD + , CHMOD_RECURSE + , REAL_PATH + , BASE_DIRECTORY + # New sub-options since 3.21 + , COPY_FILE + , RESULT + , ONLY_IF_DIFFERENT + , EXPAND_TILDE + , NO_REPLACE ] special-args: [ UTF-8 @@ -2169,6 +2317,7 @@ scripting-commands: , PATHS , PATH_SUFFIXES , DOC + , NO_CACHE # Since 3.21 , REQUIRED # Since 3.18 , NO_DEFAULT_PATH , NO_PACKAGE_ROOT_PATH @@ -2189,6 +2338,7 @@ scripting-commands: , PATHS , PATH_SUFFIXES , DOC + , NO_CACHE # Since 3.21 , REQUIRED # Since 3.18 , NO_DEFAULT_PATH , NO_PACKAGE_ROOT_PATH @@ -2595,7 +2745,11 @@ project-commands: name: aux_source_directory - name: build_command - named-args: [CONFIGURATION, TARGET] + named-args: [ + CONFIGURATION + , PARALLEL_LEVEL # Since 3.21 + , TARGET + ] - name: create_test_sourcelist named-args: [EXTRA_INCLUDE, FUNCTION] @@ -2615,6 +2769,7 @@ project-commands: , CSharp , CXX , CUDA + , HIP # Since 3.21 , ISPC # Since 3.19 , Java , OBJC # Since 3.16 @@ -2664,6 +2819,7 @@ project-commands: , EXCLUDE_FROM_ALL , RENAME , OPTIONAL + , TYPE # Since 3.20 # Installing Targets , TARGETS , EXPORT @@ -2679,6 +2835,7 @@ project-commands: , INCLUDES , NAMELINK_ONLY , NAMELINK_SKIP + , RUNTIME_DEPENDENCIES # Since 3.21 # Installing Files , FILES , PROGRAMS @@ -2700,6 +2857,17 @@ project-commands: , FILE , EXPORT_ANDROID_MK , EXPORT_LINK_INTERFACE_LIBRARIES + # Installing Imported Runtime Artifacts (since 3.21) + , IMPORTED_RUNTIME_ARTIFACTS + , RUNTIME_DEPENDENCY_SET + # Installing Runtime Dependencies (since 3.21) + , PRE_INCLUDE_REGEXES + , PRE_EXCLUDE_REGEXES + , POST_INCLUDE_REGEXES + , POST_EXCLUDE_REGEXES + , POST_INCLUDE_FILES + , POST_EXCLUDE_FILES + , DIRECTORIES ] special-args: &valid_permissions [ OWNER_READ @@ -2740,6 +2908,7 @@ project-commands: , CSharp , CXX , CUDA + , HIP # Since 3.21 , ISPC # Since 3.19 , Java , OBJC # Since 3.16 @@ -2787,6 +2956,7 @@ project-commands: , cxx_std_14 , cxx_std_17 , cxx_std_20 # Since 3.12 + , cxx_std_23 # Since 3.20 , cxx_aggregate_default_initializers , cxx_alias_templates , cxx_alignas @@ -2848,6 +3018,8 @@ project-commands: , c_std_90 , c_std_99 , c_std_11 + , c_std_17 # Since 3.21 + , c_std_23 # Since 3.21 , c_function_prototypes , c_restrict , c_static_assert @@ -2858,13 +3030,21 @@ project-commands: , cuda_std_14 , cuda_std_17 , cuda_std_20 + , cuda_std_23 # Since 3.21 ] - name: target_compile_options named-args: &target_compile_options [BEFORE, INTERFACE, PUBLIC, PRIVATE] - name: target_include_directories - named-args: [BEFORE, SYSTEM, INTERFACE, PUBLIC, PRIVATE] + named-args: [ + AFTER # Since 3.20 + , BEFORE + , SYSTEM + , INTERFACE + , PUBLIC + , PRIVATE + ] - # Since 3.13 name: target_link_directories @@ -2910,6 +3090,7 @@ project-commands: , COMPILE_OUTPUT_VARIABLE , RUN_OUTPUT_VARIABLE , OUTPUT_VARIABLE + , WORKING_DIRECTORY # Since 3.20 , ARGS ] diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-doxygenlua.pl b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-doxygenlua.pl new file mode 100644 index 0000000000..ffc38ea17e --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-doxygenlua.pl @@ -0,0 +1,42 @@ +#!/usr/bin/env perl +# SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> +# SPDX-License-Identifier: MIT + +my $file = ""; + +open(my $input, '<:encoding(UTF-8)', $ARGV[0]) + or die "Could not open file '$ARGV[0]': $!"; + +open(my $output, '>:encoding(UTF-8)', $ARGV[1]) + or die "Could not open file '$ARGV[1]': $!"; + +while (<$input>) +{ + $file .= $_; +} + +$warning = "\n\n<!-- ***** THIS FILE WAS GENERATED BY A SCRIPT - DO NOT EDIT ***** -->\n"; +$first_context = " <context attribute=\"Normal Text\" lineEndContext=\"#stay\" name=\"Normal\"> + <RegExpr attribute=\"Comment\" context=\"LineComment\" String=\"--(?:!|(?:-(?=[^-]|\$)))\"/> + <RegExpr attribute=\"Region\" context=\"#stay\" String=\"--\\s*\@\\{\\s*\$\" beginRegion=\"MemberGroup\" /> + <RegExpr attribute=\"Region\" context=\"#stay\" String=\"--\\s*\@\\}\\s*\$\" endRegion=\"MemberGroup\" /> + </context>"; + +$file =~ s/\n\s*<context [^\n]*?(?:name="ML_|name="BlockComment").*?<\/context>//gs; +$file =~ s/\n\s*<context [^\n]*?name="Normal".*?<\/context>/\n$first_context/s; +$file =~ s/\n[^\n]*?(?: ml_word|LineContinue)[^\n]+//gs; +$file =~ s/\/\/\//---/gs; +$file =~ s/\/\/!/--!/gs; + +$language = $file =~ s/.*?(<language[^>]+?>).*/$1/sr; +$language =~ s/ name="[^"]+/ name="DoxygenLua/s; +$language =~ s/ extensions="[^"]+/ extensions="/s; +$language =~ s/ mimetype="[^"]+/ mimetype="/s; +$language =~ s/ priority="[^"]+"//s; +$version = $language =~ s/.*? version="([^"]+).*/$1/sr; +$version = $version+2; +$language =~ s/ version="[^"]+/ version="$version/s; +$file =~ s/<language[^>]+?>/$warning\n$language/s; + +print $output $file; +print $output $warning; diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl index a3b20fb554..a516332ef2 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl @@ -45,6 +45,7 @@ if ($root == 1) $file =~ s/<language([^>]+)section="[^"]*"/<language$1section="Scripts"/s; $file =~ s/<language([^>]+)extensions="[^"]*"/<language$1extensions="*.php;*.php3;*.wml;*.phtml;*.phtm;*.inc;*.ctp"/s; $file =~ s/<language([^>]+)mimetype="[^"]*"/<language$1mimetype="text\/x-php4-src;text\/x-php3-src;text\/vnd.wap.wml;application\/x-php"/s; + $file =~ s/<language([^>]+)*/<language$1 indenter="cstyle"/s; } else { diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-spdx-syntax.py b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-spdx-syntax.py new file mode 100644 index 0000000000..73ff29092c --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-spdx-syntax.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Generate SPDX-Comments syntax file +# +# SPDX-FileCopyrightText: 2020 Alex Turbov <i.zaufi@gmail.com> +# SPDX-License-Identifier: MIT +# +# To install prerequisites: +# +# $ pip install --user click jinja2 +# +# To use: +# +# $ ./generate-spdx-syntax.py > ../syntax/spdx-comments.xml +# + +import json +import pathlib +import urllib.request + +import click +import jinja2 + + +def get_json(url): + with urllib.request.urlopen(url=url) as body: + return json.load(body) + + +@click.command() +@click.argument('template', type=click.File('r'), default='./spdx-comments.xml.tpl') +def cli(template): + + data = { + 'licenses': [ + *filter( + lambda l: not l['licenseId'].endswith('+') + , get_json(url='https://spdx.org/licenses/licenses.json')['licenses'] + ) + ] + , 'exceptions': [ + *filter( + lambda l: not l['licenseExceptionId'].endswith('+') + , get_json(url='https://spdx.org/licenses/exceptions.json')['exceptions'] + ) + ] + } + + env = jinja2.Environment( + keep_trailing_newline=True + ) + env.block_start_string = '<!--[' + env.block_end_string = ']-->' + env.variable_start_string = '<!--{' + env.variable_end_string = '}-->' + env.comment_start_string = '<!--#' + env.comment_end_string = '#-->' + + tpl = env.from_string(template.read()) + result = tpl.render(data) + print(result.strip(), end=None) + + +if __name__ == '__main__': + cli() + # TODO Handle execptions and show errors diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl b/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl new file mode 100644 index 0000000000..58cc80f960 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE language SYSTEM "language.dtd"> +<language + version="4" + kateversion="3.1" + name="SPDX-Comments" + section="Other" + extensions="" + mimetype="" + author="Alex Turbov (i.zaufi@gmail.com)" + license="MIT" + hidden="true" + > + <highlighting> + <list name="tags"> + <item>SPDX-License-Identifier:</item> + <item>SPDX-FileContributor:</item> + <item>SPDX-FileCopyrightText:</item> + <item>SPDX-LicenseInfoInFile:</item> + </list> + + <list name="operators"> + <item>AND</item> + <item>OR</item> + <item>WITH</item> + </list> + + <list name="licenses"> + <!--[- for license in licenses if not license.isDeprecatedLicenseId ]--> + <item><!--{ license.licenseId }--></item> + <!--[- endfor ]--> + </list> + + <list name="deprecated-licenses"> + <!--[- for license in licenses if license.isDeprecatedLicenseId ]--> + <item><!--{ license.licenseId }--></item> + <!--[- endfor ]--> + </list> + + <list name="exceptions"> + <!--[- for exception in exceptions if not exception.isDeprecatedLicenseId ]--> + <item><!--{ exception.licenseExceptionId }--></item> + <!--[- endfor ]--> + </list> + + <list name="deprecated-exceptions"> + <!--[- for exception in exceptions if exception.isDeprecatedLicenseId ]--> + <item><!--{ exception.licenseExceptionId }--></item> + <!--[- endfor ]--> + </list> + + <contexts> + + <context name="Normal" attribute="SPDX Tag" lineEndContext="#pop"> + <WordDetect String="SPDX-License-Identifier:" attribute="SPDX Tag" context="license-expression" /> + <keyword String="tags" attribute="SPDX Tag" /> + </context> + + <context name="license-expression" attribute="SPDX Value" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <DetectSpaces/> + <DetectChar char="(" context="#stay" attribute="SPDX License Expression Operator" /> + <DetectChar char=")" context="#stay" attribute="SPDX License Expression Operator" /> + <DetectChar char="+" context="#stay" attribute="SPDX License Expression Operator" /> + <keyword String="licenses" context="#stay" attribute="SPDX License" /> + <keyword String="deprecated-licenses" context="#stay" attribute="SPDX Deprecated License" /> + <keyword String="exceptions" context="#stay" attribute="SPDX License Exception" /> + <keyword String="deprecated-exceptions" context="#stay" attribute="SPDX Deprecated License Exception" /> + <keyword String="operators" context="#stay" attribute="SPDX License Expression Operator" /> + <RegExpr attribute="SPDX License" context="#stay" String="\bLicenseRef-[^\s]+" /> + </context> + + </contexts> + + <itemDatas> + <itemData name="SPDX Tag" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX Value" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX License" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX License Exception" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX Deprecated License" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX Deprecated License Exception" defStyleNum="dsAnnotation" italic="true" spellChecking="false" /> + <itemData name="SPDX License Expression Operator" defStyleNum="dsOperator" italic="true" spellChecking="false" /> + </itemDatas> + + </highlighting> + + <general> + <keywords casesensitive="1" weakDeliminator=":-." /> + </general> + +</language> +<!-- kate: indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml index d7e4ed3d70..c7b21cb2a0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml @@ -5,7 +5,7 @@ <!ENTITY funcname "([^&_fragpathseps;}=#$]|[+!@](?!\())([^&_fragpathseps;}=$]*+([+!@](?!\())?+)*+"> <!ENTITY varname "[A-Za-z_][A-Za-z0-9_]*"> <!ENTITY eos "(?=$|[ &tab;])"> <!-- eol or space following --> - <!ENTITY eoexpr "(?=$|[ &tab;<>|&;])"> + <!ENTITY eoexpr "(?=$|[ &tab;<>|&;)])"> <!ENTITY substseps "${'"`\\"> <!ENTITY symbolseps "<>|&;()"> <!-- see man bash --> @@ -18,6 +18,13 @@ <!ENTITY opt "(?:[^&_fragpathseps;=/]*+&_fragpathnosep;)*+"> <!ENTITY pathpart "(?:~|\.\.?|&fragpath;)(?:/&path;|(?=[*?]|[+!@]\(|&fragpath;(?:[/*?]|[+!@]\()))|(?:~|\.\.?)(?=[&wordseps;]|$)"> + <!ENTITY _fragpathseps_alt "*?+!@&substseps;}"> + <!ENTITY _fragpathnosep_alt "(?:[+!@](?!\()|\\.)?+"> + <!ENTITY path_alt "(?:[^&_fragpathseps_alt;]*+&_fragpathnosep_alt;)*+"> + <!ENTITY fragpath_alt "(?:[^&_fragpathseps_alt;/]*+&_fragpathnosep_alt;)*+"> + <!ENTITY opt_alt "(?:[^&_fragpathseps_alt;=/]*+&_fragpathnosep_alt;)*+"> + <!ENTITY pathpart_alt "(?:~|\.\.?|&fragpath_alt;)(?:/&path_alt;|(?=[*?]|[+!@]\(|&fragpath_alt;(?:[/*?]|[+!@]\()))|(?:~|\.\.?)(?=\}|$)"> + <!ENTITY _braceexpansion_spe " &tab;<>|&;{}\\`'"$"> <!ENTITY _brace_noexpansion "\{[^&_braceexpansion_spe;,]*+\}"> <!ENTITY _braceexpansion_var "\$(?:\{[^\[\]&_braceexpansion_spe;]*+(?:\[[*@a-zA-Z0-9]\])\})?"> @@ -28,9 +35,11 @@ <!ENTITY braceexpansion "{&_braceexpansion;"> <!ENTITY heredocq "(?|"([^"]+)"|'([^']+)'|\\(.[^&wordseps;&substseps;]*))"> + + <!ENTITY arithmetic_as_subshell "\(((?:[^`'"()$]++|\$\{[^`'"(){}$]+\}|\$(?=[^{`'"()])|`[^`]*+`|\((?1)(?:[)]|(?=['"])))++)(?:[)](?=$|[^)])|["'])"> ]> -<language name="Bash" version="27" kateversion="5.79" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> +<language name="Bash" version="30" kateversion="5.79" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> <!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl) Changes by Matthew Woehlke (mw_triad@users.sourceforge.net) @@ -40,6 +49,7 @@ <highlighting> <list name="keywords"> + <item>break</item> <item>case</item> <item>continue</item> <item>do</item> @@ -66,7 +76,6 @@ <item>alias</item> <item>bg</item> <item>bind</item> - <item>break</item> <item>builtin</item> <item>cd</item> <item>caller</item> @@ -458,7 +467,7 @@ <DetectSpaces attribute="Normal Text" context="#stay"/> <DetectChar attribute="Comment" context="Comment" char="#"/> <!-- start expression in double parentheses --> - <Detect2Chars attribute="Keyword" context="ExprDblParen" char="(" char1="(" beginRegion="expression"/> + <Detect2Chars context="ExprDblParenOrSubShell" char="(" char1="(" lookAhead="1"/> <!-- start a subshell --> <DetectChar attribute="Keyword" context="SubShell" char="(" beginRegion="subshell"/> <!-- start expression in single/double brackets --> @@ -554,8 +563,8 @@ </context> <context attribute="Command" lineEndContext="#pop#pop" name="DispatchSubstVariables"> <Detect2Chars attribute="Parameter Expansion" context="#pop!VarBraceStart" char="$" char1="{"/> - <StringDetect attribute="Parameter Expansion" context="#pop!ExprDblParenSubst" String="$((" beginRegion="expression"/> - <Detect2Chars attribute="Parameter Expansion" context="#pop!SubstCommand" char="$" char1="("/> + <StringDetect context="#pop!ExprDblParenSubstOrSubstCommand" String="$((" lookAhead="1"/> + <Detect2Chars attribute="Parameter Expansion" context="#pop!SubstCommand" char="$" char1="(" beginRegion="subshell"/> </context> <context attribute="Command" lineEndContext="#pop#pop" name="DispatchStringVariables"> <Detect2Chars attribute="String SingleQ" context="#pop!StringEsc" char="$" char1="'"/> @@ -695,27 +704,30 @@ </context> <context attribute="Path" lineEndContext="#stay" name="ExtGlobAndPop"> <DetectChar attribute="Glob" context="#pop!PathThenPop" char=")"/> + <IncludeRules context="FindWord"/> <IncludeRules context="IncExtGlob"/> </context> - <context attribute="Path" lineEndContext="#stay" name="RecursiveExtGlob"> - <DetectChar attribute="Glob" context="#pop" char=")"/> - <IncludeRules context="IncExtGlob"/> - </context> - <context attribute="Path" lineEndContext="#stay" name="IncExtGlob"> + <context attribute="Path" lineEndContext="#stay" name="FindExtGlob"> <Detect2Chars attribute="Glob" context="RecursiveExtGlob" char="?" char1="("/> <Detect2Chars attribute="Glob" context="RecursiveExtGlob" char="*" char1="("/> <Detect2Chars attribute="Glob" context="RecursiveExtGlob" char="+" char1="("/> <Detect2Chars attribute="Glob" context="RecursiveExtGlob" char="@" char1="("/> <Detect2Chars attribute="Glob" context="RecursiveExtGlob" char="!" char1="("/> <AnyChar attribute="Glob" context="#stay" String="|?*"/> + </context> + <context attribute="Path" lineEndContext="#stay" name="RecursiveExtGlob"> + <DetectChar attribute="Glob" context="#pop" char=")"/> <IncludeRules context="FindWord"/> + <IncludeRules context="IncExtGlob"/> + </context> + <context attribute="Path" lineEndContext="#stay" name="IncExtGlob"> + <IncludeRules context="FindExtGlob"/> <DetectChar context="PathMaybeBraceExpansion" char="{" lookAhead="1"/> </context> <context attribute="Path" lineEndContext="#pop#pop" name="PathThenPop"> <AnyChar context="#pop#pop" String="&wordseps;`" lookAhead="1"/> <IncludeRules context="FindWord"/> - <IncludeRules context="FindExtGlobAndPop"/> - <AnyChar attribute="Glob" context="#stay" String="?*"/> + <IncludeRules context="FindExtGlob"/> <DetectChar context="PathMaybeBraceExpansion" char="{" lookAhead="1"/> <RegExpr attribute="Path" context="#stay" String="&path;"/> </context> @@ -724,6 +736,47 @@ <DetectChar attribute="Path" context="#pop" char="{"/> </context> + <!-- FindPathThenPopInAlternateValue consumes path in ${xx:here}--> + <context attribute="Normal Text" lineEndContext="#pop" name="FindPathThenPopInAlternateValue"> + <IncludeRules context="FindExtGlobAndPopInAlternateValue"/> + <AnyChar attribute="Glob" context="PathThenPopInAlternateValue" String="?*"/> + <RegExpr attribute="Path" context="PathThenPopInAlternateValue" String="&pathpart_alt;"/> + </context> + <context attribute="Path" lineEndContext="#stay" name="FindExtGlobAndPopInAlternateValue"> + <Detect2Chars attribute="Glob" context="ExtGlobAndPopInAlternateValue" char="?" char1="("/> + <Detect2Chars attribute="Glob" context="ExtGlobAndPopInAlternateValue" char="*" char1="("/> + <Detect2Chars attribute="Glob" context="ExtGlobAndPopInAlternateValue" char="+" char1="("/> + <Detect2Chars attribute="Glob" context="ExtGlobAndPopInAlternateValue" char="@" char1="("/> + <Detect2Chars attribute="Glob" context="ExtGlobAndPopInAlternateValue" char="!" char1="("/> + </context> + <context attribute="Path" lineEndContext="#stay" name="FindExtGlobInAlternateValue"> + <Detect2Chars attribute="Glob" context="RecursiveExtGlobInAlternateValue" char="?" char1="("/> + <Detect2Chars attribute="Glob" context="RecursiveExtGlobInAlternateValue" char="*" char1="("/> + <Detect2Chars attribute="Glob" context="RecursiveExtGlobInAlternateValue" char="+" char1="("/> + <Detect2Chars attribute="Glob" context="RecursiveExtGlobInAlternateValue" char="@" char1="("/> + <Detect2Chars attribute="Glob" context="RecursiveExtGlobInAlternateValue" char="!" char1="("/> + <AnyChar attribute="Glob" context="#stay" String="|?*"/> + </context> + <context attribute="Path" lineEndContext="#stay" name="RecursiveExtGlobInAlternateValue"> + <DetectChar attribute="Glob" context="#pop" char=")"/> + <DetectChar context="#pop" char="}" lookAhead="1"/> + <IncludeRules context="FindWord"/> + <IncludeRules context="FindExtGlobInAlternateValue"/> + </context> + <context attribute="Path" lineEndContext="#stay" name="ExtGlobAndPopInAlternateValue"> + <DetectChar attribute="Glob" context="#pop!PathThenPopInAlternateValue" char=")"/> + <DetectChar attribute="Error" context="#pop#pop" char="}"/> + <IncludeRules context="FindWord"/> + <IncludeRules context="FindExtGlobInAlternateValue"/> + </context> + <context attribute="Path" lineEndContext="#pop#pop" name="PathThenPopInAlternateValue"> + <DetectChar attribute="Parameter Expansion" context="#pop#pop" char="}"/> + <IncludeRules context="FindWord"/> + <IncludeRules context="FindExtGlobAndPopInAlternateValue"/> + <AnyChar attribute="Glob" context="#stay" String="?*"/> + <RegExpr attribute="Path" context="#stay" String="&path_alt;"/> + </context> + <context attribute="Pattern" lineEndContext="#stay" name="FindPattern"> <Detect2Chars attribute="Glob" context="ExtPattern" char="?" char1="("/> <Detect2Chars attribute="Glob" context="ExtPattern" char="*" char1="("/> @@ -1038,7 +1091,7 @@ <!-- SubstCommand is called after a $( is encountered --> <context attribute="Normal Text" lineEndContext="#stay" name="SubstCommand" fallthroughContext="Command"> - <DetectChar attribute="Parameter Expansion" context="#pop" char=")"/> + <DetectChar attribute="Parameter Expansion" context="#pop" char=")" endRegion="subshell"/> <IncludeRules context="Start"/> </context> @@ -1084,7 +1137,7 @@ <Detect2Chars attribute="Parameter Expansion Operator" context="#pop!AlternatePatternValue" char="," char1=","/> <DetectChar attribute="Parameter Expansion Operator" context="#pop!VarSub" char=":"/> <DetectChar attribute="Parameter Expansion Operator" context="#pop!VarSubst" char="/"/> - <AnyChar attribute="Parameter Expansion Operator" context="#pop!AlternateValue" String="%#"/> + <AnyChar attribute="Parameter Expansion Operator" context="#pop!AlternateValue" String="-+=?#%"/> <AnyChar attribute="Parameter Expansion Operator" context="#pop!AlternatePatternValue" String="^,"/> <DetectChar attribute="Parameter Expansion Operator" context="#pop!VarTransformation" char="@"/> </context> @@ -1109,7 +1162,7 @@ <context attribute="Normal Text" lineEndContext="#stay" name="AlternateValue"> <DetectChar attribute="Parameter Expansion" context="#pop" char="}"/> <IncludeRules context="FindWord"/> - <IncludeRules context="FindPattern"/> + <IncludeRules context="FindPathThenPopInAlternateValue"/> </context> <!-- called as soon as ${xxx^ are ${xxx, are encoutered --> @@ -1125,7 +1178,7 @@ </context> <context attribute="Pattern" lineEndContext="#stay" name="VarSubstPat"> <DetectChar attribute="Parameter Expansion Operator" context="#pop!AlternateValue" char="/"/> - <IncludeRules context="AlternateValue"/> + <IncludeRules context="AlternatePatternValue"/> </context> <!-- called as soon as ${xxx@ is encoutered --> @@ -1164,19 +1217,26 @@ <!-- ====== These are the contexts that can be branched to ======= --> + <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParenOrSubShell"> + <RegExpr attribute="Keyword" context="#pop!SubShell" String="\((?=&arithmetic_as_subshell;)|" beginRegion="subshell"/> + <Detect2Chars attribute="Keyword" context="#pop!ExprDblParen" char="(" char1="(" beginRegion="expression"/> + </context> <!-- ExprDblParen consumes an expression started in command mode till )) --> <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParen"> <DetectSpaces attribute="Normal Text" context="#stay"/> <Detect2Chars attribute="Keyword" context="#pop" char=")" char1=")" endRegion="expression"/> <IncludeRules context="FindExprDblParen"/> + <!-- ((cmd + ) # jump to SubShell context --> + <DetectChar attribute="Keyword" context="#pop!SubShell" char=")" endRegion="expression" beginRegion="subshell"/> </context> <context attribute="Normal Text" lineEndContext="#stay" name="FindExprDblParen"> <Detect2Chars attribute="Control" context="#stay" char="&" char1="&"/> <Detect2Chars attribute="Control" context="#stay" char="|" char1="|"/> <AnyChar attribute="Operator" context="#stay" String="+-!~*/%<>=&^|?:"/> + <AnyChar context="Number" String="0123456789" lookAhead="1"/> <DetectChar attribute="Control" context="#stay" char=","/> <DetectChar attribute="Normal Text" context="ExprSubDblParen" char="("/> - <AnyChar context="Number" String="0123456789" lookAhead="1"/> <DetectChar attribute="Parameter Expansion Operator" context="Subscript" char="["/> <IncludeRules context="FindWord"/> <DetectChar attribute="Error" context="#stay" char="#"/> @@ -1184,8 +1244,9 @@ <DetectIdentifier attribute="Variable" context="#stay"/> </context> <context attribute="Normal Text" lineEndContext="#stay" name="ExprSubDblParen"> + <DetectSpaces attribute="Normal Text" context="#stay"/> <DetectChar attribute="Normal Text" context="#pop" char=")"/> - <IncludeRules context="ExprDblParen"/> + <IncludeRules context="FindExprDblParen"/> </context> <context attribute="Normal Text" lineEndContext="#pop" name="MaybeArithmeticBrace"> <IncludeRules context="DispatchBraceExpansion"/> @@ -1216,11 +1277,18 @@ <AnyChar attribute="Error" context="#stay" String="8901234567"/> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParenSubstOrSubstCommand"> + <RegExpr attribute="Parameter Expansion" context="#pop!SubstCommand" String="\$\((?=&arithmetic_as_subshell;)|" beginRegion="subshell"/> + <StringDetect attribute="Parameter Expansion" context="#pop!ExprDblParenSubst" String="$((" beginRegion="expression"/> + </context> <!-- ExprDblParenSubst like ExprDblParen but matches )) as Variable --> <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParenSubst"> <DetectSpaces attribute="Normal Text" context="#stay"/> <Detect2Chars attribute="Variable" context="#pop" char=")" char1=")" endRegion="expression"/> <IncludeRules context="FindExprDblParen"/> + <!-- $((cmd + ) # jump to SubstCommand context --> + <DetectChar attribute="Parameter Expansion" context="#pop!SubstCommand" char=")" endRegion="expression" beginRegion="subshell"/> </context> <!-- ExprBracket consumes an expression till ] --> @@ -1305,7 +1373,7 @@ </context> <context attribute="Normal Text" lineEndContext="#pop" name="ExprDblBracketValue"> - <Detect2Chars attribute="Keyword" context="ExprDblParen" char="(" char1="(" beginRegion="expression"/> + <Detect2Chars context="ExprDblBracketDblParentOrSubValue" char="(" char1="(" lookAhead="1"/> <DetectChar context="ExprDblBracketSubValue" char="(" lookAhead="1"/> <DetectChar attribute="Operator" context="#pop#pop" char=")"/> <Detect2Chars attribute="Control" context="#pop#pop!ExprDblBracket" char="&" char1="&"/> @@ -1321,6 +1389,18 @@ <DetectChar attribute="Operator" context="ExprDblBracketNot" char="("/> <Detect2Chars context="#pop#pop" char="]" char1="]" lookAhead="1"/> </context> + <context attribute="Normal Text" lineEndContext="#pop" name="ExprDblBracketDblParentOrSubValue"> + <RegExpr context="#pop!ExprDblBracketSubValue" String="\((?=&arithmetic_as_subshell;)|" lookAhead="1"/> + <Detect2Chars attribute="Keyword" context="#pop!ExprDblBracketExprDblParen" char="(" char1="(" beginRegion="expression"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketExprDblParen"> + <DetectSpaces attribute="Normal Text" context="#stay"/> + <Detect2Chars attribute="Keyword" context="#pop" char=")" char1=")" endRegion="expression"/> + <IncludeRules context="FindExprDblParen"/> + <!-- ((cmd + ) # jump to ExprDblBracketValue context --> + <DetectChar attribute="Operator" context="ExprDblBracketValue" char=")" endRegion="expression" beginRegion="subshell"/> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2" fallthroughContext="ExprDblBracketValue"> <DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketParam3"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml index 7f3920bfb6..d8676a250d 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml @@ -22,7 +22,7 @@ <language name="CMake" - version="31" + version="34" kateversion="5.0" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" @@ -39,6 +39,7 @@ <item>cmake_language</item> <item>cmake_minimum_required</item> <item>cmake_parse_arguments</item> + <item>cmake_path</item> <item>cmake_policy</item> <item>configure_file</item> <item>continue</item> @@ -196,6 +197,47 @@ <list name="cmake_parse_arguments_nargs"> <item>PARSE_ARGV</item> </list> + <list name="cmake_path_nargs"> + <item>ABSOLUTE_PATH</item> + <item>APPEND</item> + <item>APPEND_STRING</item> + <item>BASE_DIRECTORY</item> + <item>CONVERT</item> + <item>EXTENSION</item> + <item>FILENAME</item> + <item>GET</item> + <item>HASH</item> + <item>HAS_EXTENSION</item> + <item>HAS_FILENAME</item> + <item>HAS_PARENT_PATH</item> + <item>HAS_RELATIVE_PART</item> + <item>HAS_ROOT_DIRECTORY</item> + <item>HAS_ROOT_NAME</item> + <item>HAS_ROOT_PATH</item> + <item>HAS_STEM</item> + <item>IS_ABSOLUTE</item> + <item>IS_PREFIX</item> + <item>IS_RELATIVE</item> + <item>LAST_ONLY</item> + <item>NATIVE_PATH</item> + <item>NORMALIZE</item> + <item>NORMAL_PATH</item> + <item>OUTPUT_VARIABLE</item> + <item>PARENT_PATH</item> + <item>RELATIVE_PART</item> + <item>RELATIVE_PATH</item> + <item>REMOVE_EXTENSION</item> + <item>REMOVE_FILENAME</item> + <item>REPLACE_EXTENSION</item> + <item>REPLACE_FILENAME</item> + <item>ROOT_DIRECTORY</item> + <item>ROOT_NAME</item> + <item>ROOT_PATH</item> + <item>SET</item> + <item>STEM</item> + <item>TO_CMAKE_PATH_LIST</item> + <item>TO_NATIVE_PATH_LIST</item> + </list> <list name="cmake_policy_nargs"> <item>GET</item> <item>POP</item> @@ -211,8 +253,10 @@ <item>@ONLY</item> <item>COPYONLY</item> <item>ESCAPE_QUOTES</item> + <item>FILE_PERMISSIONS</item> <item>NEWLINE_STYLE</item> <item>NO_SOURCE_PERMISSIONS</item> + <item>USE_SOURCE_PERMISSIONS</item> </list> <list name="configure_file_sargs"> <item>CRLF</item> @@ -291,6 +335,7 @@ <item>ARCHIVE_CREATE</item> <item>ARCHIVE_EXTRACT</item> <item>BASE_DIRECTORY</item> + <item>BUNDLE_EXECUTABLE</item> <item>CHMOD</item> <item>CHMOD_RECURSE</item> <item>COMPRESSION</item> @@ -300,13 +345,17 @@ <item>CONFIGURE_DEPENDS</item> <item>CONTENT</item> <item>COPY</item> + <item>COPY_FILE</item> <item>DESTINATION</item> + <item>DIRECTORIES</item> <item>DIRECTORY</item> <item>DIRECTORY_PERMISSIONS</item> <item>DOWNLOAD</item> <item>ENCODING</item> <item>ESCAPE_QUOTES</item> <item>EXCLUDE</item> + <item>EXECUTABLES</item> + <item>EXPAND_TILDE</item> <item>EXPECTED_HASH</item> <item>EXPECTED_MD5</item> <item>FILES</item> @@ -327,6 +376,7 @@ <item>INSTALL</item> <item>LENGTH_MAXIMUM</item> <item>LENGTH_MINIMUM</item> + <item>LIBRARIES</item> <item>LIMIT</item> <item>LIMIT_COUNT</item> <item>LIMIT_INPUT</item> @@ -337,17 +387,26 @@ <item>LOG</item> <item>MAKE_DIRECTORY</item> <item>MD5</item> + <item>MODULES</item> <item>MTIME</item> <item>NETRC</item> <item>NETRC_FILE</item> <item>NEWLINE_CONSUME</item> <item>NEWLINE_STYLE</item> <item>NO_HEX_CONVERSION</item> + <item>NO_REPLACE</item> <item>NO_SOURCE_PERMISSIONS</item> <item>OFFSET</item> + <item>ONLY_IF_DIFFERENT</item> <item>OUTPUT</item> <item>PATTERN</item> <item>PERMISSIONS</item> + <item>POST_EXCLUDE_FILES</item> + <item>POST_EXCLUDE_REGEXES</item> + <item>POST_INCLUDE_FILES</item> + <item>POST_INCLUDE_REGEXES</item> + <item>PRE_EXCLUDE_REGEXES</item> + <item>PRE_INCLUDE_REGEXES</item> <item>READ</item> <item>READ_SYMLINK</item> <item>REAL_PATH</item> @@ -358,6 +417,8 @@ <item>REMOVE</item> <item>REMOVE_RECURSE</item> <item>RENAME</item> + <item>RESOLVED_DEPENDENCIES_VAR</item> + <item>RESULT</item> <item>RESULT_VARIABLE</item> <item>SHA1</item> <item>SHA224</item> @@ -381,6 +442,7 @@ <item>TOUCH_NOCREATE</item> <item>TO_CMAKE_PATH</item> <item>TO_NATIVE_PATH</item> + <item>UNRESOLVED_DEPENDENCIES_VAR</item> <item>UPLOAD</item> <item>USERPWD</item> <item>USE_SOURCE_PERMISSIONS</item> @@ -433,6 +495,7 @@ <item>DOC</item> <item>HINTS</item> <item>NAMES</item> + <item>NO_CACHE</item> <item>NO_CMAKE_ENVIRONMENT_PATH</item> <item>NO_CMAKE_FIND_ROOT_PATH</item> <item>NO_CMAKE_PATH</item> @@ -451,6 +514,7 @@ <item>HINTS</item> <item>NAMES</item> <item>NAMES_PER_DIR</item> + <item>NO_CACHE</item> <item>NO_CMAKE_ENVIRONMENT_PATH</item> <item>NO_CMAKE_FIND_ROOT_PATH</item> <item>NO_CMAKE_PATH</item> @@ -495,6 +559,7 @@ <item>DOC</item> <item>HINTS</item> <item>NAMES</item> + <item>NO_CACHE</item> <item>NO_CMAKE_ENVIRONMENT_PATH</item> <item>NO_CMAKE_FIND_ROOT_PATH</item> <item>NO_CMAKE_PATH</item> @@ -513,6 +578,7 @@ <item>HINTS</item> <item>NAMES</item> <item>NAMES_PER_DIR</item> + <item>NO_CACHE</item> <item>NO_CMAKE_ENVIRONMENT_PATH</item> <item>NO_CMAKE_FIND_ROOT_PATH</item> <item>NO_CMAKE_PATH</item> @@ -883,6 +949,7 @@ </list> <list name="build_command_nargs"> <item>CONFIGURATION</item> + <item>PARALLEL_LEVEL</item> <item>TARGET</item> </list> <list name="create_test_sourcelist_nargs"> @@ -914,6 +981,7 @@ <item>CUDA</item> <item>CXX</item> <item>Fortran</item> + <item>HIP</item> <item>ISPC</item> <item>Java</item> <item>OBJC</item> @@ -951,6 +1019,7 @@ <item>COMPONENT</item> <item>CONFIGURATIONS</item> <item>DESTINATION</item> + <item>DIRECTORIES</item> <item>DIRECTORY</item> <item>DIRECTORY_PERMISSIONS</item> <item>EXCLUDE</item> @@ -963,6 +1032,7 @@ <item>FILES_MATCHING</item> <item>FILE_PERMISSIONS</item> <item>FRAMEWORK</item> + <item>IMPORTED_RUNTIME_ARTIFACTS</item> <item>INCLUDES</item> <item>LIBRARY</item> <item>MESSAGE_NEVER</item> @@ -974,6 +1044,12 @@ <item>OPTIONAL</item> <item>PATTERN</item> <item>PERMISSIONS</item> + <item>POST_EXCLUDE_FILES</item> + <item>POST_EXCLUDE_REGEXES</item> + <item>POST_INCLUDE_FILES</item> + <item>POST_INCLUDE_REGEXES</item> + <item>PRE_EXCLUDE_REGEXES</item> + <item>PRE_INCLUDE_REGEXES</item> <item>PRIVATE_HEADER</item> <item>PROGRAMS</item> <item>PUBLIC_HEADER</item> @@ -981,8 +1057,11 @@ <item>RENAME</item> <item>RESOURCE</item> <item>RUNTIME</item> + <item>RUNTIME_DEPENDENCIES</item> + <item>RUNTIME_DEPENDENCY_SET</item> <item>SCRIPT</item> <item>TARGETS</item> + <item>TYPE</item> <item>USE_SOURCE_PERMISSIONS</item> </list> <list name="install_sargs"> @@ -1028,6 +1107,7 @@ <item>CUDA</item> <item>CXX</item> <item>Fortran</item> + <item>HIP</item> <item>ISPC</item> <item>Java</item> <item>NONE</item> @@ -1068,6 +1148,8 @@ <item>c_restrict</item> <item>c_static_assert</item> <item>c_std_11</item> + <item>c_std_17</item> + <item>c_std_23</item> <item>c_std_90</item> <item>c_std_99</item> <item>c_variadic_macros</item> @@ -1076,6 +1158,7 @@ <item>cuda_std_14</item> <item>cuda_std_17</item> <item>cuda_std_20</item> + <item>cuda_std_23</item> <item>cxx_aggregate_default_initializers</item> <item>cxx_alias_templates</item> <item>cxx_alignas</item> @@ -1126,6 +1209,7 @@ <item>cxx_std_14</item> <item>cxx_std_17</item> <item>cxx_std_20</item> + <item>cxx_std_23</item> <item>cxx_std_98</item> <item>cxx_strong_enums</item> <item>cxx_template_template_parameters</item> @@ -1146,6 +1230,7 @@ <item>PUBLIC</item> </list> <list name="target_include_directories_nargs"> + <item>AFTER</item> <item>BEFORE</item> <item>INTERFACE</item> <item>PRIVATE</item> @@ -1201,6 +1286,7 @@ <item>OUTPUT_VARIABLE</item> <item>RUN_OUTPUT_VARIABLE</item> <item>RUN_RESULT_VAR</item> + <item>WORKING_DIRECTORY</item> </list> <list name="ctest_build_nargs"> <item>APPEND</item> @@ -1342,6 +1428,7 @@ <item>CMAKE_ANDROID_NDK_DEPRECATED_HEADERS</item> <item>CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG</item> <item>CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION</item> + <item>CMAKE_ANDROID_NDK_VERSION</item> <item>CMAKE_ANDROID_PROCESS_MAX</item> <item>CMAKE_ANDROID_PROGUARD</item> <item>CMAKE_ANDROID_PROGUARD_CONFIG_PATH</item> @@ -1497,6 +1584,9 @@ <item>CMAKE_GENERATOR_NO_COMPILER_ENV</item> <item>CMAKE_GENERATOR_PLATFORM</item> <item>CMAKE_GENERATOR_TOOLSET</item> + <item>CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND</item> + <item>CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM</item> + <item>CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL</item> <item>CMAKE_GLOBAL_AUTOGEN_TARGET</item> <item>CMAKE_GLOBAL_AUTOGEN_TARGET_NAME</item> <item>CMAKE_GLOBAL_AUTORCC_TARGET</item> @@ -1576,6 +1666,10 @@ <item>CMAKE_ISPC_HEADER_DIRECTORY</item> <item>CMAKE_ISPC_HEADER_SUFFIX</item> <item>CMAKE_ISPC_INSTRUCTION_SETS</item> + <item>CMAKE_JAR_CLASSES_PREFIX</item> + <item>CMAKE_JAVA_COMPILE_FLAGS</item> + <item>CMAKE_JAVA_INCLUDE_PATH</item> + <item>CMAKE_JNI_TARGET</item> <item>CMAKE_JOB_POOLS</item> <item>CMAKE_JOB_POOL_COMPILE</item> <item>CMAKE_JOB_POOL_LINK</item> @@ -1787,6 +1881,7 @@ <item>CPACK_COMPONENTS_GROUPING</item> <item>CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY</item> <item>CPACK_CREATE_DESKTOP_LINKS</item> + <item>CPACK_CUSTOM_INSTALL_VARIABLES</item> <item>CPACK_CYGWIN_BUILD_SCRIPT</item> <item>CPACK_CYGWIN_PATCH_FILE</item> <item>CPACK_CYGWIN_PATCH_NUMBER</item> @@ -1818,6 +1913,7 @@ <item>CPACK_DEBIAN_PACKAGE_REPLACES</item> <item>CPACK_DEBIAN_PACKAGE_SECTION</item> <item>CPACK_DEBIAN_PACKAGE_SHLIBDEPS</item> + <item>CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS</item> <item>CPACK_DEBIAN_PACKAGE_SOURCE</item> <item>CPACK_DEBIAN_PACKAGE_SUGGESTS</item> <item>CPACK_DEBIAN_PACKAGE_VERSION</item> @@ -1826,6 +1922,7 @@ <item>CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK</item> <item>CPACK_DMG_DS_STORE</item> <item>CPACK_DMG_DS_STORE_SETUP_SCRIPT</item> + <item>CPACK_DMG_FILESYSTEM</item> <item>CPACK_DMG_FORMAT</item> <item>CPACK_DMG_SLA_DIR</item> <item>CPACK_DMG_SLA_LANGUAGES</item> @@ -1865,6 +1962,7 @@ <item>CPACK_IFW_PACKAGE_WINDOW_ICON</item> <item>CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT</item> <item>CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH</item> + <item>CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST</item> <item>CPACK_IFW_PACKAGE_WIZARD_STYLE</item> <item>CPACK_IFW_PRODUCT_URL</item> <item>CPACK_IFW_REPOGEN_EXECUTABLE</item> @@ -1880,12 +1978,15 @@ <item>CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS</item> <item>CPACK_INSTALL_SCRIPTS</item> <item>CPACK_MONOLITHIC_INSTALL</item> + <item>CPACK_NSIS_BRANDING_TEXT</item> + <item>CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION</item> <item>CPACK_NSIS_COMPRESSOR</item> <item>CPACK_NSIS_CONTACT</item> <item>CPACK_NSIS_CREATE_ICONS_EXTRA</item> <item>CPACK_NSIS_DELETE_ICONS_EXTRA</item> <item>CPACK_NSIS_DISPLAY_NAME</item> <item>CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL</item> + <item>CPACK_NSIS_EXECUTABLE</item> <item>CPACK_NSIS_EXECUTABLES_DIRECTORY</item> <item>CPACK_NSIS_EXTRA_INSTALL_COMMANDS</item> <item>CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS</item> @@ -1918,8 +2019,12 @@ <item>CPACK_NUGET_PACKAGE_DESCRIPTION</item> <item>CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY</item> <item>CPACK_NUGET_PACKAGE_HOMEPAGE_URL</item> + <item>CPACK_NUGET_PACKAGE_ICON</item> <item>CPACK_NUGET_PACKAGE_ICONURL</item> + <item>CPACK_NUGET_PACKAGE_LANGUAGE</item> <item>CPACK_NUGET_PACKAGE_LICENSEURL</item> + <item>CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION</item> + <item>CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME</item> <item>CPACK_NUGET_PACKAGE_NAME</item> <item>CPACK_NUGET_PACKAGE_OWNERS</item> <item>CPACK_NUGET_PACKAGE_RELEASE_NOTES</item> @@ -2037,6 +2142,7 @@ <item>CPACK_SOURCE_STRIP_FILES</item> <item>CPACK_STRIP_FILES</item> <item>CPACK_SYSTEM_NAME</item> + <item>CPACK_THREADS</item> <item>CPACK_TOPLEVEL_TAG</item> <item>CPACK_VERBATIM_VARIABLES</item> <item>CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION</item> @@ -2180,12 +2286,23 @@ <item>MSVC_TOOLSET_VERSION</item> <item>MSVC_VERSION</item> <item>PACKAGE_FIND_NAME</item> - <item>PACKAGE_FIND_VERSION</item> + <item>PACKAGE_FIND_VERSION_COMPLETE</item> <item>PACKAGE_FIND_VERSION_COUNT</item> - <item>PACKAGE_FIND_VERSION_MAJOR</item> - <item>PACKAGE_FIND_VERSION_MINOR</item> - <item>PACKAGE_FIND_VERSION_PATCH</item> - <item>PACKAGE_FIND_VERSION_TWEAK</item> + <item>PACKAGE_FIND_VERSION_MAX</item> + <item>PACKAGE_FIND_VERSION_MAX_COUNT</item> + <item>PACKAGE_FIND_VERSION_MAX_MAJOR</item> + <item>PACKAGE_FIND_VERSION_MAX_MINOR</item> + <item>PACKAGE_FIND_VERSION_MAX_PATCH</item> + <item>PACKAGE_FIND_VERSION_MAX_TWEAK</item> + <item>PACKAGE_FIND_VERSION_MIN</item> + <item>PACKAGE_FIND_VERSION_MIN_COUNT</item> + <item>PACKAGE_FIND_VERSION_MIN_MAJOR</item> + <item>PACKAGE_FIND_VERSION_MIN_MINOR</item> + <item>PACKAGE_FIND_VERSION_MIN_PATCH</item> + <item>PACKAGE_FIND_VERSION_MIN_TWEAK</item> + <item>PACKAGE_FIND_VERSION_RANGE</item> + <item>PACKAGE_FIND_VERSION_RANGE_MAX</item> + <item>PACKAGE_FIND_VERSION_RANGE_MIN</item> <item>PACKAGE_VERSION</item> <item>PACKAGE_VERSION_COMPATIBLE</item> <item>PACKAGE_VERSION_EXACT</item> @@ -2196,6 +2313,7 @@ <item>PROJECT_BINARY_DIR</item> <item>PROJECT_DESCRIPTION</item> <item>PROJECT_HOMEPAGE_URL</item> + <item>PROJECT_IS_TOP_LEVEL</item> <item>PROJECT_NAME</item> <item>PROJECT_SOURCE_DIR</item> <item>PROJECT_VERSION</item> @@ -2206,8 +2324,10 @@ <item>QTIFWDIR</item> <item>SWIG_OUTFILE_DIR</item> <item>SWIG_SOURCE_FILE_EXTENSIONS</item> + <item>SWIG_USE_SWIG_DEPENDENCIES</item> <item>THREADS_PREFER_PTHREAD_FLAG</item> <item>UNIX</item> + <item>UseSWIG_MODULE_VERSION</item> <item>WIN32</item> <item>WINCE</item> <item>WINDOWS_PHONE</item> @@ -2220,8 +2340,10 @@ <item>CMAKE_HOME_DIRECTORY</item> <item>CMAKE_INTERNAL_PLATFORM_ABI</item> <item>CMAKE_NOT_USING_CONFIG_FLAGS</item> + <item>CMAKE_OBJDUMP</item> <item>CMAKE_SUPPRESS_DEVELOPER_ERRORS</item> <item>CMAKE_SUPPRESS_DEVELOPER_WARNINGS</item> + <item>CMAKE_SYSTEM_ARCH</item> <item>CMAKE_VS_INTEL_Fortran_PROJECT_VERSION</item> <item>CPACK_INSTALL_PREFIX</item> <item>CPACK_INSTALL_SCRIPT</item> @@ -2248,12 +2370,14 @@ <item>CMAKE_NO_VERBOSE</item> <item>CMAKE_OSX_ARCHITECTURES</item> <item>CMAKE_PREFIX_PATH</item> + <item>CMAKE_TOOLCHAIN_FILE</item> <item>CSFLAGS</item> <item>CTEST_INTERACTIVE_DEBUG_MODE</item> <item>CTEST_OUTPUT_ON_FAILURE</item> <item>CTEST_PARALLEL_LEVEL</item> <item>CTEST_PROGRESS_OUTPUT</item> <item>CTEST_USE_LAUNCHERS_DEFAULT</item> + <item>CUDAARCHS</item> <item>CUDACXX</item> <item>CUDAFLAGS</item> <item>CUDAHOSTCXX</item> @@ -2326,6 +2450,7 @@ <item>DEFINITIONS</item> <item>EXCLUDE_FROM_ALL</item> <item>IMPLICIT_DEPENDS_INCLUDE_TRANSFORM</item> + <item>IMPORTED_TARGETS</item> <item>INCLUDE_DIRECTORIES</item> <item>INCLUDE_REGULAR_EXPRESSION</item> <item>INTERPROCEDURAL_OPTIMIZATION</item> @@ -2429,6 +2554,7 @@ <item>ENABLE_EXPORTS</item> <item>EXCLUDE_FROM_ALL</item> <item>EXCLUDE_FROM_DEFAULT_BUILD</item> + <item>EXPORT_COMPILE_COMMANDS</item> <item>EXPORT_NAME</item> <item>EXPORT_PROPERTIES</item> <item>EchoString</item> @@ -2554,6 +2680,7 @@ <item>UNITY_BUILD_CODE_AFTER_INCLUDE</item> <item>UNITY_BUILD_CODE_BEFORE_INCLUDE</item> <item>UNITY_BUILD_MODE</item> + <item>UNITY_BUILD_UNIQUE_ID</item> <item>VERSION</item> <item>VISIBILITY_INLINES_HIDDEN</item> <item>VS_CONFIGURATION_TYPE</item> @@ -2782,6 +2909,7 @@ <item>TARGET_BUNDLE_DIR</item> <item>TARGET_BUNDLE_CONTENT_DIR</item> <item>TARGET_PROPERTY</item> + <item>TARGET_RUNTIME_DLLS</item> <item>INSTALL_PREFIX</item> <item>TARGET_NAME</item> <item>LINK_ONLY</item> @@ -2790,6 +2918,8 @@ <item>MAKE_C_IDENTIFIER</item> <item>TARGET_OBJECTS</item> <item>SHELL_PATH</item> + <item>OUTPUT_CONFIG</item> + <item>COMMAND_CONFIG</item> </list> <contexts> @@ -2801,6 +2931,7 @@ <WordDetect String="cmake_language" insensitive="true" attribute="Command" context="cmake_language_ctx" /> <WordDetect String="cmake_minimum_required" insensitive="true" attribute="Command" context="cmake_minimum_required_ctx" /> <WordDetect String="cmake_parse_arguments" insensitive="true" attribute="Command" context="cmake_parse_arguments_ctx" /> + <WordDetect String="cmake_path" insensitive="true" attribute="Command" context="cmake_path_ctx" /> <WordDetect String="cmake_policy" insensitive="true" attribute="Command" context="cmake_policy_ctx" /> <WordDetect String="configure_file" insensitive="true" attribute="Command" context="configure_file_ctx" /> <WordDetect String="continue" insensitive="true" attribute="Command" context="continue_ctx" /> @@ -2950,6 +3081,14 @@ <keyword attribute="Named Args" context="#stay" String="cmake_parse_arguments_nargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="cmake_path_ctx"> + <DetectChar attribute="Normal Text" context="cmake_path_ctx_op" char="(" /> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="cmake_path_ctx_op"> + <IncludeRules context="EndCmdPop2" /> + <keyword attribute="Named Args" context="#stay" String="cmake_path_nargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="cmake_policy_ctx"> <DetectChar attribute="Normal Text" context="cmake_policy_ctx_op" char="(" /> </context> @@ -3860,7 +3999,7 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect More target-properties"> - <RegExpr attribute="Property" context="#stay" String="\b(?:XCODE_ATTRIBUTE_&id_re;|VS_SOURCE_SETTINGS_&id_re;|VS_GLOBAL_&id_re;|VS_DOTNET_REFERENCE_&id_re;|VS_DOTNET_REFERENCEPROP_&id_re;_TAG_&id_re;|STATIC_LIBRARY_FLAGS_&id_re;|RUNTIME_OUTPUT_NAME_&id_re;|RUNTIME_OUTPUT_DIRECTORY_&id_re;|PDB_OUTPUT_DIRECTORY_&id_re;|PDB_NAME_&id_re;|OUTPUT_NAME_&id_re;|OSX_ARCHITECTURES_&id_re;|MAP_IMPORTED_CONFIG_&id_re;|LOCATION_&id_re;|LINK_INTERFACE_MULTIPLICITY_&id_re;|LINK_INTERFACE_LIBRARIES_&id_re;|LINK_FLAGS_&id_re;|LIBRARY_OUTPUT_NAME_&id_re;|LIBRARY_OUTPUT_DIRECTORY_&id_re;|INTERPROCEDURAL_OPTIMIZATION_&id_re;|IMPORTED_SONAME_&id_re;|IMPORTED_OBJECTS_&id_re;|IMPORTED_NO_SONAME_&id_re;|IMPORTED_LOCATION_&id_re;|IMPORTED_LINK_INTERFACE_MULTIPLICITY_&id_re;|IMPORTED_LINK_INTERFACE_LIBRARIES_&id_re;|IMPORTED_LINK_INTERFACE_LANGUAGES_&id_re;|IMPORTED_LINK_DEPENDENT_LIBRARIES_&id_re;|IMPORTED_LIBNAME_&id_re;|IMPORTED_IMPLIB_&id_re;|FRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;|EXCLUDE_FROM_DEFAULT_BUILD_&id_re;|COMPILE_PDB_OUTPUT_DIRECTORY_&id_re;|COMPILE_PDB_NAME_&id_re;|ARCHIVE_OUTPUT_NAME_&id_re;|ARCHIVE_OUTPUT_DIRECTORY_&id_re;|&id_re;_VISIBILITY_PRESET|&id_re;_POSTFIX|&id_re;_OUTPUT_NAME|&id_re;_INCLUDE_WHAT_YOU_USE|&id_re;_CPPLINT|&id_re;_CPPCHECK|&id_re;_COMPILER_LAUNCHER|&id_re;_CLANG_TIDY)\b" /> + <RegExpr attribute="Property" context="#stay" String="\b(?:XCODE_EMBED_&id_re;_REMOVE_HEADERS_ON_COPY|XCODE_EMBED_&id_re;_PATH|XCODE_EMBED_&id_re;_CODE_SIGN_ON_COPY|XCODE_EMBED_&id_re;|XCODE_ATTRIBUTE_&id_re;|VS_SOURCE_SETTINGS_&id_re;|VS_GLOBAL_&id_re;|VS_DOTNET_REFERENCE_&id_re;|VS_DOTNET_REFERENCEPROP_&id_re;_TAG_&id_re;|STATIC_LIBRARY_FLAGS_&id_re;|RUNTIME_OUTPUT_NAME_&id_re;|RUNTIME_OUTPUT_DIRECTORY_&id_re;|PDB_OUTPUT_DIRECTORY_&id_re;|PDB_NAME_&id_re;|OUTPUT_NAME_&id_re;|OSX_ARCHITECTURES_&id_re;|MAP_IMPORTED_CONFIG_&id_re;|LOCATION_&id_re;|LINK_INTERFACE_MULTIPLICITY_&id_re;|LINK_INTERFACE_LIBRARIES_&id_re;|LINK_FLAGS_&id_re;|LIBRARY_OUTPUT_NAME_&id_re;|LIBRARY_OUTPUT_DIRECTORY_&id_re;|INTERPROCEDURAL_OPTIMIZATION_&id_re;|IMPORTED_SONAME_&id_re;|IMPORTED_OBJECTS_&id_re;|IMPORTED_NO_SONAME_&id_re;|IMPORTED_LOCATION_&id_re;|IMPORTED_LINK_INTERFACE_MULTIPLICITY_&id_re;|IMPORTED_LINK_INTERFACE_LIBRARIES_&id_re;|IMPORTED_LINK_INTERFACE_LANGUAGES_&id_re;|IMPORTED_LINK_DEPENDENT_LIBRARIES_&id_re;|IMPORTED_LIBNAME_&id_re;|IMPORTED_IMPLIB_&id_re;|FRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;|EXCLUDE_FROM_DEFAULT_BUILD_&id_re;|COMPILE_PDB_OUTPUT_DIRECTORY_&id_re;|COMPILE_PDB_NAME_&id_re;|ARCHIVE_OUTPUT_NAME_&id_re;|ARCHIVE_OUTPUT_DIRECTORY_&id_re;|&id_re;_VISIBILITY_PRESET|&id_re;_POSTFIX|&id_re;_OUTPUT_NAME|&id_re;_LINKER_LAUNCHER|&id_re;_INCLUDE_WHAT_YOU_USE|&id_re;_CPPLINT|&id_re;_CPPCHECK|&id_re;_COMPILER_LAUNCHER|&id_re;_CLANG_TIDY)\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect More source-properties"> @@ -3894,7 +4033,7 @@ <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables"> <RegExpr attribute="CMake Internal Variable" context="#stay" String="\b(?:CMAKE_&id_re;_PLATFORM_ID|CMAKE_&id_re;_COMPILER_VERSION_INTERNAL|CMAKE_&id_re;_COMPILER_ARCHITECTURE_ID|CMAKE_&id_re;_COMPILER_ABI)\b" /> - <RegExpr attribute="Builtin Variable" context="#stay" String="\b(?:SWIG_MODULE_&id_re;_EXTRA_DEPS|ExternalData_URL_ALGO_&id_re;_&id_re;|ExternalData_CUSTOM_SCRIPT_&id_re;|DOXYGEN_&id_re;|CPACK_WIX_PROPERTY_&id_re;|CPACK_WIX_&id_re;_EXTRA_FLAGS|CPACK_WIX_&id_re;_EXTENSIONS|CPACK_RPM_NO_&id_re;_INSTALL_PREFIX_RELOCATION|CPACK_RPM_&id_re;_USER_FILELIST|CPACK_RPM_&id_re;_USER_BINARY_SPECFILE|CPACK_RPM_&id_re;_PACKAGE_URL|CPACK_RPM_&id_re;_PACKAGE_SUMMARY|CPACK_RPM_&id_re;_PACKAGE_SUGGESTS|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_PREUN|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_PRE|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_POSTUN|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_POST|CPACK_RPM_&id_re;_PACKAGE_REQUIRES|CPACK_RPM_&id_re;_PACKAGE_PROVIDES|CPACK_RPM_&id_re;_PACKAGE_PREFIX|CPACK_RPM_&id_re;_PACKAGE_OBSOLETES|CPACK_RPM_&id_re;_PACKAGE_NAME|CPACK_RPM_&id_re;_PACKAGE_GROUP|CPACK_RPM_&id_re;_PACKAGE_DESCRIPTION|CPACK_RPM_&id_re;_PACKAGE_CONFLICTS|CPACK_RPM_&id_re;_PACKAGE_AUTOREQPROV|CPACK_RPM_&id_re;_PACKAGE_AUTOREQ|CPACK_RPM_&id_re;_PACKAGE_AUTOPROV|CPACK_RPM_&id_re;_PACKAGE_ARCHITECTURE|CPACK_RPM_&id_re;_FILE_NAME|CPACK_RPM_&id_re;_DEFAULT_USER|CPACK_RPM_&id_re;_DEFAULT_GROUP|CPACK_RPM_&id_re;_DEFAULT_FILE_PERMISSIONS|CPACK_RPM_&id_re;_DEFAULT_DIR_PERMISSIONS|CPACK_RPM_&id_re;_DEBUGINFO_PACKAGE|CPACK_RPM_&id_re;_DEBUGINFO_FILE_NAME|CPACK_RPM_&id_re;_BUILD_SOURCE_DIRS_PREFIX|CPACK_PREFLIGHT_&id_re;_SCRIPT|CPACK_POSTFLIGHT_&id_re;_SCRIPT|CPACK_NUGET_PACKAGE_DEPENDENCIES_&id_re;_VERSION|CPACK_NUGET_&id_re;_PACKAGE_VERSION|CPACK_NUGET_&id_re;_PACKAGE_TITLE|CPACK_NUGET_&id_re;_PACKAGE_TAGS|CPACK_NUGET_&id_re;_PACKAGE_RELEASE_NOTES|CPACK_NUGET_&id_re;_PACKAGE_OWNERS|CPACK_NUGET_&id_re;_PACKAGE_NAME|CPACK_NUGET_&id_re;_PACKAGE_LICENSEURL|CPACK_NUGET_&id_re;_PACKAGE_ICONURL|CPACK_NUGET_&id_re;_PACKAGE_HOMEPAGE_URL|CPACK_NUGET_&id_re;_PACKAGE_DESCRIPTION_SUMMARY|CPACK_NUGET_&id_re;_PACKAGE_DESCRIPTION|CPACK_NUGET_&id_re;_PACKAGE_DEPENDENCIES_&id_re;_VERSION|CPACK_NUGET_&id_re;_PACKAGE_DEPENDENCIES|CPACK_NUGET_&id_re;_PACKAGE_COPYRIGHT|CPACK_NUGET_&id_re;_PACKAGE_AUTHORS|CPACK_NSIS_&id_re;_INSTALL_DIRECTORY|CPACK_DMG_&id_re;_FILE_NAME|CPACK_DEBIAN_&id_re;_PACKAGE_SUGGESTS|CPACK_DEBIAN_&id_re;_PACKAGE_SOURCE|CPACK_DEBIAN_&id_re;_PACKAGE_SHLIBDEPS|CPACK_DEBIAN_&id_re;_PACKAGE_SECTION|CPACK_DEBIAN_&id_re;_PACKAGE_REPLACES|CPACK_DEBIAN_&id_re;_PACKAGE_RECOMMENDS|CPACK_DEBIAN_&id_re;_PACKAGE_PROVIDES|CPACK_DEBIAN_&id_re;_PACKAGE_PRIORITY|CPACK_DEBIAN_&id_re;_PACKAGE_PREDEPENDS|CPACK_DEBIAN_&id_re;_PACKAGE_NAME|CPACK_DEBIAN_&id_re;_PACKAGE_ENHANCES|CPACK_DEBIAN_&id_re;_PACKAGE_DEPENDS|CPACK_DEBIAN_&id_re;_PACKAGE_CONTROL_STRICT_PERMISSION|CPACK_DEBIAN_&id_re;_PACKAGE_CONTROL_EXTRA|CPACK_DEBIAN_&id_re;_PACKAGE_CONFLICTS|CPACK_DEBIAN_&id_re;_PACKAGE_BREAKS|CPACK_DEBIAN_&id_re;_PACKAGE_ARCHITECTURE|CPACK_DEBIAN_&id_re;_FILE_NAME|CPACK_DEBIAN_&id_re;_DESCRIPTION|CPACK_DEBIAN_&id_re;_DEBUGINFO_PACKAGE|CPACK_COMPONENT_&id_re;_REQUIRED|CPACK_COMPONENT_&id_re;_HIDDEN|CPACK_COMPONENT_&id_re;_GROUP|CPACK_COMPONENT_&id_re;_DISPLAY_NAME|CPACK_COMPONENT_&id_re;_DISABLED|CPACK_COMPONENT_&id_re;_DESCRIPTION|CPACK_COMPONENT_&id_re;_DEPENDS|CPACK_BINARY_&id_re;|CPACK_ARCHIVE_&id_re;_FILE_NAME|CPACK_&id_re;_COMPONENT_INSTALL|CMAKE_XCODE_ATTRIBUTE_&id_re;|CMAKE_USER_MAKE_RULES_OVERRIDE_&id_re;|CMAKE_STATIC_LINKER_FLAGS_&id_re;_INIT|CMAKE_STATIC_LINKER_FLAGS_&id_re;|CMAKE_SHARED_LINKER_FLAGS_&id_re;_INIT|CMAKE_SHARED_LINKER_FLAGS_&id_re;|CMAKE_RUNTIME_OUTPUT_DIRECTORY_&id_re;|CMAKE_PROJECT_&id_re;_INCLUDE|CMAKE_POLICY_WARNING_CMP[0-9]{4}|CMAKE_POLICY_DEFAULT_CMP[0-9]{4}|CMAKE_PDB_OUTPUT_DIRECTORY_&id_re;|CMAKE_MODULE_LINKER_FLAGS_&id_re;_INIT|CMAKE_MODULE_LINKER_FLAGS_&id_re;|CMAKE_MATCH_[0-9]+|CMAKE_MAP_IMPORTED_CONFIG_&id_re;|CMAKE_LIBRARY_OUTPUT_DIRECTORY_&id_re;|CMAKE_INTERPROCEDURAL_OPTIMIZATION_&id_re;|CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;|CMAKE_EXE_LINKER_FLAGS_&id_re;_INIT|CMAKE_EXE_LINKER_FLAGS_&id_re;|CMAKE_DISABLE_FIND_PACKAGE_&id_re;|CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_&id_re;|CMAKE_ARGV[0-9]+|CMAKE_ARCHIVE_OUTPUT_DIRECTORY_&id_re;|CMAKE_&id_re;_VISIBILITY_PRESET|CMAKE_&id_re;_STANDARD_LIBRARIES|CMAKE_&id_re;_STANDARD_INCLUDE_DIRECTORIES|CMAKE_&id_re;_SOURCE_FILE_EXTENSIONS|CMAKE_&id_re;_SIZEOF_DATA_PTR|CMAKE_&id_re;_SIMULATE_VERSION|CMAKE_&id_re;_SIMULATE_ID|CMAKE_&id_re;_POSTFIX|CMAKE_&id_re;_OUTPUT_EXTENSION|CMAKE_&id_re;_LINK_EXECUTABLE|CMAKE_&id_re;_LINKER_WRAPPER_FLAG_SEP|CMAKE_&id_re;_LINKER_WRAPPER_FLAG|CMAKE_&id_re;_LINKER_PREFERENCE_PROPAGATES|CMAKE_&id_re;_LINKER_PREFERENCE|CMAKE_&id_re;_LIBRARY_ARCHITECTURE|CMAKE_&id_re;_INCLUDE_WHAT_YOU_USE|CMAKE_&id_re;_IMPLICIT_LINK_LIBRARIES|CMAKE_&id_re;_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES|CMAKE_&id_re;_IMPLICIT_LINK_DIRECTORIES|CMAKE_&id_re;_IMPLICIT_INCLUDE_DIRECTORIES|CMAKE_&id_re;_IGNORE_EXTENSIONS|CMAKE_&id_re;_GHS_KERNEL_FLAGS_RELWITHDEBINFO|CMAKE_&id_re;_GHS_KERNEL_FLAGS_RELEASE|CMAKE_&id_re;_GHS_KERNEL_FLAGS_MINSIZEREL|CMAKE_&id_re;_GHS_KERNEL_FLAGS_DEBUG|CMAKE_&id_re;_FLAGS_RELWITHDEBINFO_INIT|CMAKE_&id_re;_FLAGS_RELWITHDEBINFO|CMAKE_&id_re;_FLAGS_RELEASE_INIT|CMAKE_&id_re;_FLAGS_RELEASE|CMAKE_&id_re;_FLAGS_MINSIZEREL_INIT|CMAKE_&id_re;_FLAGS_MINSIZEREL|CMAKE_&id_re;_FLAGS_INIT|CMAKE_&id_re;_FLAGS_DEBUG_INIT|CMAKE_&id_re;_FLAGS_DEBUG|CMAKE_&id_re;_FLAGS|CMAKE_&id_re;_CREATE_STATIC_LIBRARY|CMAKE_&id_re;_CREATE_SHARED_MODULE|CMAKE_&id_re;_CREATE_SHARED_LIBRARY|CMAKE_&id_re;_CPPLINT|CMAKE_&id_re;_CPPCHECK|CMAKE_&id_re;_COMPILE_OBJECT|CMAKE_&id_re;_COMPILER_VERSION|CMAKE_&id_re;_COMPILER_TARGET|CMAKE_&id_re;_COMPILER_RANLIB|CMAKE_&id_re;_COMPILER_LOADED|CMAKE_&id_re;_COMPILER_LAUNCHER|CMAKE_&id_re;_COMPILER_ID|CMAKE_&id_re;_COMPILER_EXTERNAL_TOOLCHAIN|CMAKE_&id_re;_COMPILER_AR|CMAKE_&id_re;_COMPILER|CMAKE_&id_re;_CLANG_TIDY|CMAKE_&id_re;_ARCHIVE_FINISH|CMAKE_&id_re;_ARCHIVE_CREATE|CMAKE_&id_re;_ARCHIVE_APPEND|CMAKE_&id_re;_ANDROID_TOOLCHAIN_SUFFIX|CMAKE_&id_re;_ANDROID_TOOLCHAIN_PREFIX|CMAKE_&id_re;_ANDROID_TOOLCHAIN_MACHINE|ARGV[0-9]+|&id_re;__TRYRUN_OUTPUT|&id_re;_VERSION_TWEAK|&id_re;_VERSION_STRING|&id_re;_VERSION_PATCH|&id_re;_VERSION_MINOR|&id_re;_VERSION_MAJOR|&id_re;_VERSION_COUNT|&id_re;_VERSION|&id_re;_UNPARSED_ARGUMENTS|&id_re;_SOURCE_DIR|&id_re;_ROOT|&id_re;_MODULE_NAME|&id_re;_LIBRARY_DIRS|&id_re;_LIBRARIES|&id_re;_KEYWORDS_MISSING_VALUES|&id_re;_INCLUDE_DIRS|&id_re;_HOMEPAGE_URL|&id_re;_FOUND|&id_re;_FIND_VERSION_TWEAK|&id_re;_FIND_VERSION_PATCH|&id_re;_FIND_VERSION_MINOR|&id_re;_FIND_VERSION_MAJOR|&id_re;_FIND_VERSION_EXACT|&id_re;_FIND_VERSION_COUNT|&id_re;_FIND_VERSION|&id_re;_FIND_REQUIRED_&id_re;|&id_re;_FIND_REQUIRED|&id_re;_FIND_QUIETLY|&id_re;_FIND_COMPONENTS|&id_re;_DESCRIPTION|&id_re;_CONSIDERED_VERSIONS|&id_re;_CONSIDERED_CONFIGS|&id_re;_BINARY_DIR)\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\b(?:SWIG_MODULE_&id_re;_EXTRA_DEPS|ExternalData_URL_ALGO_&id_re;_&id_re;|ExternalData_CUSTOM_SCRIPT_&id_re;|DOXYGEN_&id_re;|CPACK_WIX_PROPERTY_&id_re;|CPACK_WIX_&id_re;_EXTRA_FLAGS|CPACK_WIX_&id_re;_EXTENSIONS|CPACK_RPM_NO_&id_re;_INSTALL_PREFIX_RELOCATION|CPACK_RPM_&id_re;_USER_FILELIST|CPACK_RPM_&id_re;_USER_BINARY_SPECFILE|CPACK_RPM_&id_re;_PACKAGE_URL|CPACK_RPM_&id_re;_PACKAGE_SUMMARY|CPACK_RPM_&id_re;_PACKAGE_SUGGESTS|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_PREUN|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_PRE|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_POSTUN|CPACK_RPM_&id_re;_PACKAGE_REQUIRES_POST|CPACK_RPM_&id_re;_PACKAGE_REQUIRES|CPACK_RPM_&id_re;_PACKAGE_PROVIDES|CPACK_RPM_&id_re;_PACKAGE_PREFIX|CPACK_RPM_&id_re;_PACKAGE_OBSOLETES|CPACK_RPM_&id_re;_PACKAGE_NAME|CPACK_RPM_&id_re;_PACKAGE_GROUP|CPACK_RPM_&id_re;_PACKAGE_DESCRIPTION|CPACK_RPM_&id_re;_PACKAGE_CONFLICTS|CPACK_RPM_&id_re;_PACKAGE_AUTOREQPROV|CPACK_RPM_&id_re;_PACKAGE_AUTOREQ|CPACK_RPM_&id_re;_PACKAGE_AUTOPROV|CPACK_RPM_&id_re;_PACKAGE_ARCHITECTURE|CPACK_RPM_&id_re;_FILE_NAME|CPACK_RPM_&id_re;_DEFAULT_USER|CPACK_RPM_&id_re;_DEFAULT_GROUP|CPACK_RPM_&id_re;_DEFAULT_FILE_PERMISSIONS|CPACK_RPM_&id_re;_DEFAULT_DIR_PERMISSIONS|CPACK_RPM_&id_re;_DEBUGINFO_PACKAGE|CPACK_RPM_&id_re;_DEBUGINFO_FILE_NAME|CPACK_RPM_&id_re;_BUILD_SOURCE_DIRS_PREFIX|CPACK_PREFLIGHT_&id_re;_SCRIPT|CPACK_POSTFLIGHT_&id_re;_SCRIPT|CPACK_NUGET_PACKAGE_DEPENDENCIES_&id_re;_VERSION|CPACK_NUGET_&id_re;_PACKAGE_VERSION|CPACK_NUGET_&id_re;_PACKAGE_TITLE|CPACK_NUGET_&id_re;_PACKAGE_TAGS|CPACK_NUGET_&id_re;_PACKAGE_RELEASE_NOTES|CPACK_NUGET_&id_re;_PACKAGE_OWNERS|CPACK_NUGET_&id_re;_PACKAGE_NAME|CPACK_NUGET_&id_re;_PACKAGE_LICENSE_FILE_NAME|CPACK_NUGET_&id_re;_PACKAGE_LICENSE_EXPRESSION|CPACK_NUGET_&id_re;_PACKAGE_LICENSEURL|CPACK_NUGET_&id_re;_PACKAGE_LANGUAGE|CPACK_NUGET_&id_re;_PACKAGE_ICONURL|CPACK_NUGET_&id_re;_PACKAGE_ICON|CPACK_NUGET_&id_re;_PACKAGE_HOMEPAGE_URL|CPACK_NUGET_&id_re;_PACKAGE_DESCRIPTION_SUMMARY|CPACK_NUGET_&id_re;_PACKAGE_DESCRIPTION|CPACK_NUGET_&id_re;_PACKAGE_DEPENDENCIES_&id_re;_VERSION|CPACK_NUGET_&id_re;_PACKAGE_DEPENDENCIES|CPACK_NUGET_&id_re;_PACKAGE_COPYRIGHT|CPACK_NUGET_&id_re;_PACKAGE_AUTHORS|CPACK_NSIS_&id_re;_INSTALL_DIRECTORY|CPACK_DMG_&id_re;_FILE_NAME|CPACK_DEBIAN_&id_re;_PACKAGE_SUGGESTS|CPACK_DEBIAN_&id_re;_PACKAGE_SOURCE|CPACK_DEBIAN_&id_re;_PACKAGE_SHLIBDEPS|CPACK_DEBIAN_&id_re;_PACKAGE_SECTION|CPACK_DEBIAN_&id_re;_PACKAGE_REPLACES|CPACK_DEBIAN_&id_re;_PACKAGE_RECOMMENDS|CPACK_DEBIAN_&id_re;_PACKAGE_PROVIDES|CPACK_DEBIAN_&id_re;_PACKAGE_PRIORITY|CPACK_DEBIAN_&id_re;_PACKAGE_PREDEPENDS|CPACK_DEBIAN_&id_re;_PACKAGE_NAME|CPACK_DEBIAN_&id_re;_PACKAGE_ENHANCES|CPACK_DEBIAN_&id_re;_PACKAGE_DEPENDS|CPACK_DEBIAN_&id_re;_PACKAGE_CONTROL_STRICT_PERMISSION|CPACK_DEBIAN_&id_re;_PACKAGE_CONTROL_EXTRA|CPACK_DEBIAN_&id_re;_PACKAGE_CONFLICTS|CPACK_DEBIAN_&id_re;_PACKAGE_BREAKS|CPACK_DEBIAN_&id_re;_PACKAGE_ARCHITECTURE|CPACK_DEBIAN_&id_re;_FILE_NAME|CPACK_DEBIAN_&id_re;_DESCRIPTION|CPACK_DEBIAN_&id_re;_DEBUGINFO_PACKAGE|CPACK_COMPONENT_&id_re;_REQUIRED|CPACK_COMPONENT_&id_re;_HIDDEN|CPACK_COMPONENT_&id_re;_GROUP|CPACK_COMPONENT_&id_re;_DISPLAY_NAME|CPACK_COMPONENT_&id_re;_DISABLED|CPACK_COMPONENT_&id_re;_DESCRIPTION|CPACK_COMPONENT_&id_re;_DEPENDS|CPACK_BINARY_&id_re;|CPACK_ARCHIVE_&id_re;_FILE_NAME|CPACK_&id_re;_COMPONENT_INSTALL|CMAKE_XCODE_ATTRIBUTE_&id_re;|CMAKE_USER_MAKE_RULES_OVERRIDE_&id_re;|CMAKE_STATIC_LINKER_FLAGS_&id_re;_INIT|CMAKE_STATIC_LINKER_FLAGS_&id_re;|CMAKE_SHARED_LINKER_FLAGS_&id_re;_INIT|CMAKE_SHARED_LINKER_FLAGS_&id_re;|CMAKE_RUNTIME_OUTPUT_DIRECTORY_&id_re;|CMAKE_PROJECT_&id_re;_INCLUDE|CMAKE_POLICY_WARNING_CMP[0-9]{4}|CMAKE_POLICY_DEFAULT_CMP[0-9]{4}|CMAKE_PDB_OUTPUT_DIRECTORY_&id_re;|CMAKE_MODULE_LINKER_FLAGS_&id_re;_INIT|CMAKE_MODULE_LINKER_FLAGS_&id_re;|CMAKE_MATCH_[0-9]+|CMAKE_MAP_IMPORTED_CONFIG_&id_re;|CMAKE_LIBRARY_OUTPUT_DIRECTORY_&id_re;|CMAKE_INTERPROCEDURAL_OPTIMIZATION_&id_re;|CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;|CMAKE_EXE_LINKER_FLAGS_&id_re;_INIT|CMAKE_EXE_LINKER_FLAGS_&id_re;|CMAKE_DISABLE_FIND_PACKAGE_&id_re;|CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_&id_re;|CMAKE_ARGV[0-9]+|CMAKE_ARCHIVE_OUTPUT_DIRECTORY_&id_re;|CMAKE_&id_re;_VISIBILITY_PRESET|CMAKE_&id_re;_STANDARD_LIBRARIES|CMAKE_&id_re;_STANDARD_INCLUDE_DIRECTORIES|CMAKE_&id_re;_SOURCE_FILE_EXTENSIONS|CMAKE_&id_re;_SIZEOF_DATA_PTR|CMAKE_&id_re;_SIMULATE_VERSION|CMAKE_&id_re;_SIMULATE_ID|CMAKE_&id_re;_POSTFIX|CMAKE_&id_re;_OUTPUT_EXTENSION|CMAKE_&id_re;_LINK_LIBRARY_FLAG|CMAKE_&id_re;_LINK_LIBRARY_FILE_FLAG|CMAKE_&id_re;_LINK_EXECUTABLE|CMAKE_&id_re;_LINKER_WRAPPER_FLAG_SEP|CMAKE_&id_re;_LINKER_WRAPPER_FLAG|CMAKE_&id_re;_LINKER_PREFERENCE_PROPAGATES|CMAKE_&id_re;_LINKER_PREFERENCE|CMAKE_&id_re;_LINKER_LAUNCHER|CMAKE_&id_re;_LIBRARY_ARCHITECTURE|CMAKE_&id_re;_INCLUDE_WHAT_YOU_USE|CMAKE_&id_re;_IMPLICIT_LINK_LIBRARIES|CMAKE_&id_re;_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES|CMAKE_&id_re;_IMPLICIT_LINK_DIRECTORIES|CMAKE_&id_re;_IMPLICIT_INCLUDE_DIRECTORIES|CMAKE_&id_re;_IGNORE_EXTENSIONS|CMAKE_&id_re;_GHS_KERNEL_FLAGS_RELWITHDEBINFO|CMAKE_&id_re;_GHS_KERNEL_FLAGS_RELEASE|CMAKE_&id_re;_GHS_KERNEL_FLAGS_MINSIZEREL|CMAKE_&id_re;_GHS_KERNEL_FLAGS_DEBUG|CMAKE_&id_re;_FLAGS_RELWITHDEBINFO_INIT|CMAKE_&id_re;_FLAGS_RELWITHDEBINFO|CMAKE_&id_re;_FLAGS_RELEASE_INIT|CMAKE_&id_re;_FLAGS_RELEASE|CMAKE_&id_re;_FLAGS_MINSIZEREL_INIT|CMAKE_&id_re;_FLAGS_MINSIZEREL|CMAKE_&id_re;_FLAGS_INIT|CMAKE_&id_re;_FLAGS_DEBUG_INIT|CMAKE_&id_re;_FLAGS_DEBUG|CMAKE_&id_re;_FLAGS|CMAKE_&id_re;_CREATE_STATIC_LIBRARY|CMAKE_&id_re;_CREATE_SHARED_MODULE|CMAKE_&id_re;_CREATE_SHARED_LIBRARY|CMAKE_&id_re;_CPPLINT|CMAKE_&id_re;_CPPCHECK|CMAKE_&id_re;_COMPILE_OBJECT|CMAKE_&id_re;_COMPILER_VERSION|CMAKE_&id_re;_COMPILER_TARGET|CMAKE_&id_re;_COMPILER_RANLIB|CMAKE_&id_re;_COMPILER_LOADED|CMAKE_&id_re;_COMPILER_LAUNCHER|CMAKE_&id_re;_COMPILER_ID|CMAKE_&id_re;_COMPILER_EXTERNAL_TOOLCHAIN|CMAKE_&id_re;_COMPILER_AR|CMAKE_&id_re;_COMPILER|CMAKE_&id_re;_CLANG_TIDY|CMAKE_&id_re;_BYTE_ORDER|CMAKE_&id_re;_ARCHIVE_FINISH|CMAKE_&id_re;_ARCHIVE_CREATE|CMAKE_&id_re;_ARCHIVE_APPEND|CMAKE_&id_re;_ANDROID_TOOLCHAIN_SUFFIX|CMAKE_&id_re;_ANDROID_TOOLCHAIN_PREFIX|CMAKE_&id_re;_ANDROID_TOOLCHAIN_MACHINE|ARGV[0-9]+|&id_re;__TRYRUN_OUTPUT|&id_re;_VERSION_TWEAK|&id_re;_VERSION_STRING|&id_re;_VERSION_PATCH|&id_re;_VERSION_MINOR|&id_re;_VERSION_MAJOR|&id_re;_VERSION_COUNT|&id_re;_VERSION|&id_re;_UNPARSED_ARGUMENTS|&id_re;_SOURCE_DIR|&id_re;_ROOT|&id_re;_MODULE_NAME|&id_re;_LIBRARY_DIRS|&id_re;_LIBRARIES|&id_re;_KEYWORDS_MISSING_VALUES|&id_re;_IS_TOP_LEVEL|&id_re;_INCLUDE_DIRS|&id_re;_HOMEPAGE_URL|&id_re;_FOUND|&id_re;_FIND_VERSION_RANGE_MIN|&id_re;_FIND_VERSION_RANGE_MAX|&id_re;_FIND_VERSION_RANGE|&id_re;_FIND_VERSION_MIN_TWEAK|&id_re;_FIND_VERSION_MIN_PATCH|&id_re;_FIND_VERSION_MIN_MINOR|&id_re;_FIND_VERSION_MIN_MAJOR|&id_re;_FIND_VERSION_MIN_COUNT|&id_re;_FIND_VERSION_MIN|&id_re;_FIND_VERSION_MAX_TWEAK|&id_re;_FIND_VERSION_MAX_PATCH|&id_re;_FIND_VERSION_MAX_MINOR|&id_re;_FIND_VERSION_MAX_MAJOR|&id_re;_FIND_VERSION_MAX_COUNT|&id_re;_FIND_VERSION_MAX|&id_re;_FIND_VERSION_EXACT|&id_re;_FIND_VERSION_COUNT|&id_re;_FIND_VERSION_COMPLETE|&id_re;_FIND_REQUIRED_&id_re;|&id_re;_FIND_REQUIRED|&id_re;_FIND_QUIETLY|&id_re;_FIND_COMPONENTS|&id_re;_DESCRIPTION|&id_re;_CONSIDERED_VERSIONS|&id_re;_CONSIDERED_CONFIGS|&id_re;_CONFIG|&id_re;_BINARY_DIR)\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions"> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml index d7a53a167c..5516c1454b 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd" [ - <!ENTITY wordsep "(?:[][,?;()]|\.$|\.?\s)"> <!-- things that end a TagWord --> + <!ENTITY wordsep "(?:[][,?;()]|\.$|\.?\s|$)"> <!-- things that end a TagWord --> <!ENTITY sl_word ".*?(?=&wordsep;)"> <!ENTITY ml_word ".*?(?=&wordsep;|\*/)"> ]> <language name="Doxygen" - version="13" + version="14" kateversion="5.0" section="Markup" extensions="*.dox;*.doxygen" diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml index 8b36a56290..476522961b 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd"> -<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="8" kateversion="5.0" author="Jan Janssen (medhefgo@web.de)" license="LGPL"> +<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="10" kateversion="5.0" author="Jan Janssen (medhefgo@web.de)" license="LGPL"> <highlighting> <list name="keywords"> @@ -34,15 +34,26 @@ <contexts> <context name="ini" attribute="Normal Text" lineEndContext="#stay"> - <RangeDetect attribute="Section" context="#stay" char="[" char1="]" beginRegion="Section" endRegion="Section" /> + <RangeDetect attribute="Section" context="#stay" char="[" char1="]" beginRegion="Section" endRegion="Section" /> <DetectChar attribute="Assignment" context="Value" char="=" /> <AnyChar String=";#" attribute="Comment" context="Comment" firstNonSpace="true" /> + <DetectIdentifier /> + <DetectSpaces /> + </context> + + <context name="Value" attribute="Value" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop!NormalValue"> + <RegExpr context="#pop!SpecialValue" String="\s*((-?(\d+(\.\d*)?|\.d+)(e\d+)?|On|Off|Defaults?|Localhost|Null|True|False|Yes|No|Normal)\s*$|~?(E_ALL|E_ERROR|E_WARNING|E_PARSE|E_NOTICE|E_STRICT|E_CORE_ERROR|E_CORE_WARNING|E_COMPILE_ERROR|E_COMPILE_WARNING|E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE)\b)" lookAhead="1" insensitive="1"/> </context> - <context name="Value" attribute="Value" lineEndContext="#pop" > + <context name="SpecialValue" attribute="Value" lineEndContext="#pop"> <Float attribute="Float" /> <Int attribute="Int" /> - <keyword attribute="Keyword" String="keywords" /> + <keyword attribute="Keyword" String="keywords"/> + <DetectChar attribute="Int" char="-" /> + <DetectSpaces /> + </context> + + <context name="NormalValue" attribute="Value" lineEndContext="#pop"> </context> <context name="Comment" attribute="Comment" lineEndContext="#pop"> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml index 6091cd4ee2..e71b1618a0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml @@ -7,7 +7,7 @@ <!ENTITY float "(\b∫(\.((∫&exp;?+|&exp;)[fFdD]?\b|[fFdD]\b)?|&exp;[fFdD]?\b|[fFdD]\b)|\.∫&exp;?[fFdD]?\b)"> <!ENTITY hexfloat "\b0[xX](&hex;\.?+&hex;?+|\.&hex;?)[pP][-+]?∫[fFdD]?\b"> ]> -<language name="Java" version="9" kateversion="5.62" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)"> +<language name="Java" version="10" kateversion="5.62" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)"> <highlighting> <list name="java15"> <item>ACTIVE</item> @@ -3732,6 +3732,7 @@ <item>volatile</item> </list> <list name="control flow"> + <item>assert</item> <item>break</item> <item>case</item> <item>catch</item> @@ -3760,6 +3761,7 @@ <item>long</item> <item>short</item> <item>static</item> + <item>var</item> <item>void</item> </list> <contexts> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml index b35397af9c..f03587977a 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml @@ -90,7 +90,7 @@ <!ENTITY checkbox "\[[ x]\](?=\s)"> ]> -<language name="Markdown" version="17" kateversion="5.79" section="Markup" extensions="*.md;*.mmd;*.markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD"> +<language name="Markdown" version="19" kateversion="5.79" section="Markup" extensions="*.md;*.mmd;*.markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD"> <highlighting> <contexts> <!-- Start of the Markdown document: find metadata or code block --> @@ -149,14 +149,33 @@ </context> <context name="find-header" attribute="Normal Text" lineEndContext="#pop"> - <RegExpr attribute="Header H1" context="#pop" String="^#\s.*[#]?$" column="0"/> - <RegExpr attribute="Header H2" context="#pop" String="^##\s.*[#]?$" column="0"/> - <RegExpr attribute="Header H3" context="#pop" String="^###\s.*[#]?$" column="0"/> - <RegExpr attribute="Header H4" context="#pop" String="^####\s.*[#]?$" column="0"/> - <RegExpr attribute="Header H5" context="#pop" String="^#####\s.*[#]?$" column="0"/> - <RegExpr attribute="Header H6" context="#pop" String="^######\s.*[#]?$" column="0"/> + <!-- TODO: Replace "(?=.$)" in the regexes with just "$" when close-H#-region are removed --> + <RegExpr attribute="Header H1" context="#pop!close-H2-region" String="^#\s.*[#]?(?=.$)" column="0" endRegion="H1" beginRegion="H1"/> + <RegExpr attribute="Header H2" context="#pop!close-H3-region" String="^##\s.*[#]?(?=.$)" column="0" endRegion="H2" beginRegion="H2"/> + <RegExpr attribute="Header H3" context="#pop!close-H4-region" String="^###\s.*[#]?(?=.$)" column="0" endRegion="H3" beginRegion="H3"/> + <RegExpr attribute="Header H4" context="#pop!close-H5-region" String="^####\s.*[#]?(?=.$)" column="0" endRegion="H4" beginRegion="H4"/> + <RegExpr attribute="Header H5" context="#pop!close-H6-region" String="^#####\s.*[#]?(?=.$)" column="0" endRegion="H5" beginRegion="H5"/> + <RegExpr attribute="Header H6" context="#pop" String="^######\s.*[#]?$" column="0" endRegion="H6" beginRegion="H6"/> <DetectChar attribute="Normal Text" context="#pop" char="#"/> </context> + <!-- BUG: 441278 sub-headers should be closed when their parent header is closed (e.g. in h1 h2 h3 h1, h1-h3 should all be closed at the 2nd h1) --> + <!-- TODO: Port to a less hacky version (maybe a new attribute for declaring multiple endRegions) --> + <context name="close-H2-region" attribute="Header H2" lineEndContext="#pop!close-H3-region" fallthroughContext="#pop!close-H3-region"> + <RegExpr attribute="Header H2" context="#pop!close-H3-region" String="." lookAhead="true" endRegion="H2"/> + </context> + <context name="close-H3-region" attribute="Header H3" lineEndContext="#pop!close-H4-region" fallthroughContext="#pop!close-H4-region"> + <RegExpr attribute="Header H3" context="#pop!close-H4-region" String="." lookAhead="true" endRegion="H3"/> + </context> + <context name="close-H4-region" attribute="Header H4" lineEndContext="#pop!close-H5-region" fallthroughContext="#pop!close-H5-region"> + <RegExpr attribute="Header H4" context="#pop!close-H5-region" String="." lookAhead="true" endRegion="H4"/> + </context> + <context name="close-H5-region" attribute="Header H5" lineEndContext="#pop!close-H6-region" fallthroughContext="#pop!close-H6-region"> + <RegExpr attribute="Header H5" context="#pop!close-H6-region" String="." lookAhead="true" endRegion="H5"/> + </context> + <context name="close-H6-region" attribute="Header H6" lineEndContext="#pop" fallthroughContext="#pop"> + <RegExpr attribute="Header H6" context="#pop" String="." endRegion="H6"/> + </context> + <context name="find-strong-normal" attribute="Normal Text" lineEndContext="#pop"> <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;|&strongemphasisregex_ast_und2;"/> <RegExpr attribute="Strong Text" context="#pop" minimal="true" String="&strongregex_ast;"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml index fdf2266558..c9a60d64db 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml @@ -39,7 +39,7 @@ Enhance tr/// and y/// support. --> -<language name="Perl" version="17" kateversion="5.0" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2"> +<language name="Perl" version="18" kateversion="5.0" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2"> <highlighting> <list name="keywords"> <item>if</item> @@ -92,7 +92,7 @@ <item>+</item> <item>-</item> <item>*</item> - <!-- <item>/</item>//--> + <!-- <item>/</item>//--> <item>%</item> <item>||</item> <item>//</item> @@ -420,7 +420,8 @@ <DetectChar attribute="Operator" context="quote_word_paren" char="(" beginRegion="Wordlist" /> <DetectChar attribute="Operator" context="quote_word_brace" char="{" beginRegion="Wordlist" /> <DetectChar attribute="Operator" context="quote_word_bracket" char="[" beginRegion="Wordlist" /> - <RegExpr attribute="Operator" context="quote_word" String="([^a-zA-Z0-9_\s[\]{}()])" beginRegion="Wordlist" /> + <DetectChar attribute="Operator" context="quote_word_angular" char="<" beginRegion="Wordlist" /> + <RegExpr attribute="Operator" context="quote_word" String="([^a-zA-Z0-9_\s[\]{}()\<>])" beginRegion="Wordlist" /> <RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- q[qwx] # == comment, look for the delim on the next line --> </context> @@ -756,6 +757,12 @@ <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="]" /> <DetectChar attribute="Operator" context="#pop#pop#pop" char="]" endRegion="Wordlist" /> </context> + <context name="quote_word_angular" attribute="Normal Text" lineEndContext="#stay"> + <DetectSpaces /> + <DetectIdentifier /> + <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=">" /> + <DetectChar attribute="Operator" context="#pop#pop#pop" char=">" endRegion="Wordlist" /> + </context> <!-- ====== Here Documents ====== --> <context name="find_here_document" attribute="Normal Text" lineEndContext="#pop" > diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml index f1c89a54e4..676872f03f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml @@ -33,6 +33,10 @@ type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%" --> <!ENTITY strsubstitution_py3 "\{(?:(?:[a-zA-Z0-9_]+|[0-9]+)(?:\.[a-zA-Z0-9_]+|\[[^ \]]+\])*)?(?:![rs])?(?::(?:[^}]?[<>=^])?[ +-]?#?0?[0-9]*(?:\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}"> + + <!ENTITY rawString "(?:ru|u?r|)(?:'(?:[^']++|\\')*+'|"(?:[^"]++|\\")*+")"> + <!ENTITY formatString "(?:r?f|fr?)(?:'(?:[^'{]++|\\'|\{\{|\{[^}]++\})*+'|"(?:[^"]++|\\"|\{\{|\{[^}]*+\})*+")"> + <!ENTITY string "&rawString;|&formatString;"> ]> <!-- Python syntax highlightning v0.9 by Per Wigren --> <!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) --> @@ -48,7 +52,7 @@ <!-- v2.07 add support for %prog and co, see bug 142832 --> <!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords --> <!-- v2.29 recognize escape sequenzes correctly --> -<language name="Python" version="14" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> +<language name="Python" version="22" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> <highlighting> <list name="import"> <item>import</item> @@ -86,10 +90,21 @@ <item>try</item> <item>while</item> <item>with</item> - <item>yield</item> <item>async</item> <item>await</item> </list> + <list name="flow_yield"> + <item>yield</item> + <!-- + "yield from" added here as a keyword for autocompletion. The actual handling + is in context="yield" so that we won't need to add space as a weakDeliminator. + --> + <item>yield from</item> + </list> + <list name="patternmatching"> + <item>match</item> + <item>case</item> + </list> <list name="builtinfuncs"> <item>__import__</item> <item>abs</item> @@ -366,89 +381,137 @@ </list> <contexts> <context name="Normal" attribute="Normal Text" lineEndContext="#stay"> + <DetectSpaces attribute="Normal Text"/> + <keyword attribute="Import" String="import" context="#stay"/> <keyword attribute="Definition Keyword" String="defs" context="#stay"/> <keyword attribute="Operator Keyword" String="operators" context="#stay"/> <keyword attribute="Flow Control Keyword" String="flow" context="#stay"/> + <keyword attribute="Flow Control Keyword" String="flow_yield" context="yield"/> + <keyword attribute="Flow Control Keyword" String="patternmatching" context="Pattern Matching" lookAhead="1" firstNonSpace="1"/> <keyword attribute="Builtin Function" String="builtinfuncs" context="#stay"/> <keyword attribute="Special Variable" String="specialvars" context="#stay"/> <keyword attribute="Extensions" String="bindings" context="#stay"/> <keyword attribute="Exceptions" String="exceptions" context="#stay"/> <keyword attribute="Overloaders" String="overloaders" context="#stay"/> - <RegExpr attribute="Normal Text" String="[a-zA-Z_][a-zA-Z_0-9]{2,}" context="#stay"/> - - <!-- Complex: 1j ; 1.1j ; 1.j ; .1j ; 1e3j ; 1.1e3j ; 1.e3j ; .1e3j --> - <RegExpr attribute="Complex" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)(?:[eE][\+\-]?&digitPart;)?[jJ]\b" context="#stay"/> - <!-- Hexadecimal: 0xA1, Binary: 0b01, Octal: 0o71 --> - <RegExpr attribute="Hex" String="&beforeDigit;0[xX](?:_?[\da-fA-F])+\b" context="#stay"/> - <RegExpr attribute="Binary" String="&beforeDigit;0[bB](?:_?[01])+\b" context="#stay"/> - <RegExpr attribute="Octal" String="&beforeDigit;0[oO](?:_?[0-7])+\b" context="#stay"/> - <!-- Float: 1.1 ; 1. ; .1 ; 1e3 ; 1.1e3 ; 1.e3 ; .1e3 --> - <RegExpr attribute="Float" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)[eE][\+\-]?&digitPart;\b|(?:&beforeDigit;&digitPart;\.(?:&digitPart;\b)?|&beforePointFloat;\.&digitPart;\b)" context="#stay"/> - <!-- Decimal: 123 ; 000 --> - <RegExpr attribute="Int" String="&beforeDigit;(?:[1-9](?:_?\d)*|0(?:_?0)*)[lL]?\b" context="#stay"/> <DetectChar attribute="Normal Text" char="{" context="Dictionary" beginRegion="Dictionary"/> <DetectChar attribute="Normal Text" char="[" context="List" beginRegion="List"/> <DetectChar attribute="Normal Text" char="(" context="Tuple" beginRegion="Tuple"/> - <IncludeRules context="CommentVariants" /> - <DetectChar attribute="Comment" char="#" context="Hash comment"/> + <IncludeRules context="Number" /> + <IncludeRules context="CommentVariants" /> <IncludeRules context="StringVariants" /> + <DetectIdentifier attribute="Normal Text"/> + <RegExpr attribute="Decorator" String="@[_a-zA-Z[:^ascii:]][\._a-zA-Z0-9[:^ascii:]]*" firstNonSpace="true"/> - <AnyChar attribute="Operator" String="+*/%\|=;\!<>!^&~-@" context="#stay"/> + <AnyChar attribute="Operator" String="+*/%\|=;<>!^&~-@" context="#stay"/> + + <Int attribute="Error"/> + </context> + + <!-- https://docs.python.org/2/reference/lexical_analysis.html#integer-and-long-integer-literals --> + <!-- https://docs.python.org/3/reference/lexical_analysis.html#integer-literals --> + <context name="Number" attribute="Normal Text" lineEndContext="#pop"> + <!-- fast path --> + <RegExpr String="&beforeDigit;[0-9]|&beforePointFloat;\.[0-9]" context="AssumeNumber" lookAhead="1"/> + </context> + <context name="AssumeNumber" attribute="Normal Text" lineEndContext="#pop"> + <!-- Complex: 1j ; 1.1j ; 1.j ; .1j ; 1e3j ; 1.1e3j ; 1.e3j ; .1e3j --> + <RegExpr attribute="Complex" String="(?:&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)(?:[eE][\+\-]?&digitPart;)?[jJ]" context="CheckSuffixError"/> + <!-- Hexadecimal: 0xA1, Binary: 0b01, Octal: 0o71 --> + <RegExpr attribute="Hex" String="0[xX](?:_?[0-9a-fA-F])+" context="CheckSuffixError"/> + <RegExpr attribute="Binary" String="0[bB](?:_?[01])+" context="CheckSuffixError"/> + <RegExpr attribute="Octal" String="0[oO](?:_?[0-7])+" context="CheckSuffixError"/> + <!-- Float: 1.1 ; 1. ; .1 ; 1e3 ; 1.1e3 ; 1.e3 ; .1e3 --> + <RegExpr attribute="Float" String="(?:&digitPart;(?:\.(?:&digitPart;)?)?|\.&digitPart;)[eE][\+\-]?&digitPart;|&digitPart;\.(?:&digitPart;)?|\.&digitPart;" context="CheckSuffixError"/> + <!-- Decimal: 123 ; 000 --> + <!-- l and L are python2 suffixes --> + <RegExpr attribute="Int" String="(?:[1-9](?:_?\d)*|0(?:_?0)*)[lL]?" context="CheckSuffixError"/> + </context> + <context name="CheckSuffixError" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> + <RegExpr attribute="Error" String="[\w\d]+" context="#pop#pop"/> + </context> + + <context name="yield" attribute="Flow Control Keyword" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> + <DetectSpaces attribute="Normal Text" context="#stay"/> + <WordDetect attribute="Flow Control Keyword" context="#pop" String="from"/> + </context> + + <context name="Pattern Matching" attribute="Flow Control Keyword" lineEndContext="#pop"> + <!-- + Python 3.10: https://docs.python.org/3.10/reference/compound_stmts.html#the-match-statement + ( 'match' | 'case' ) expression ':' + exclude: + ( 'match' | 'case' ) ( 'if' | 'for' | '.' | ':' | '=' | ',' | ']' | ')' ) ... + --> + <RegExpr attribute="Flow Control Keyword" String="\w++(?=\s+(?!(?:if|for)\b)[\w'"~]|\s*+(?![.:=\]),]|(?:if|for)\b)((?:&string;|[^#;(){}]|\(\)|\((?1)\)|\{\}|\{(\s*+(?:(?:&string;|[a-zA-Z0-9.]++)\s*+:\s*+(?:&string;|[^#;(){},]|\(\)|\((?1)\)|\{\}|\{(?2)\})++,?)*+)\})+?):)|" context="#pop"/> + <DetectIdentifier attribute="Normal Text" context="#pop"/> </context> <context name="#CheckForString" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces/> - <LineContinue attribute="Normal Text" context="CheckForStringNext"/> + <LineContinue attribute="Normal Text" context="#pop!CheckForStringNext"/> </context> - <context name="CheckForStringNext" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <context name="CheckForStringNext" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop"> <DetectSpaces/> - <LineContinue attribute="Normal Text" context="CheckForStringNext"/> + <LineContinue attribute="Normal Text" context="#stay"/> <IncludeRules context="StringVariants"/> </context> + <!-- https://docs.python.org/2/reference/lexical_analysis.html#string-literals --> + <!-- https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals --> <context name="StringVariants" attribute="Normal Text" lineEndContext="#stay"> - <DetectSpaces/> - - <RegExpr attribute="String" String="u?'''" insensitive="true" context="Triple A-string" beginRegion="Triple A-region"/> - <RegExpr attribute="String" String="u?"""" insensitive="true" context="Triple Q-string" beginRegion="Triple Q-region"/> - <RegExpr attribute="String" String="u?'" insensitive="true" context="Single A-string"/> - <RegExpr attribute="String" String="u?"" insensitive="true" context="Single Q-string"/> - - <RegExpr attribute="Raw String" String="(?:u?r|ru)'''" insensitive="true" context="Raw Triple A-string" beginRegion="Triple A-region"/> - <RegExpr attribute="Raw String" String="(?:u?r|ru)"""" insensitive="true" context="Raw Triple Q-string" beginRegion="Triple Q-region"/> - <RegExpr attribute="Raw String" String="(?:u?r|ru)'" insensitive="true" context="Raw A-string"/> - <RegExpr attribute="Raw String" String="(?:u?r|ru)"" insensitive="true" context="Raw Q-string"/> - - <StringDetect attribute="F-String" String="f'''" insensitive="true" context="Triple A-F-String" beginRegion="Triple A-region"/> - <StringDetect attribute="F-String" String="f"""" insensitive="true" context="Triple Q-F-String" beginRegion="Triple Q-region"/> - <StringDetect attribute="F-String" String="f'" insensitive="true" context="Single A-F-String"/> - <StringDetect attribute="F-String" String="f"" insensitive="true" context="Single Q-F-String"/> - - <RegExpr attribute="Raw F-String" String="(?:fr|rf)'''" insensitive="true" context="Raw Triple A-F-String" beginRegion="Triple A-region"/> - <RegExpr attribute="Raw F-String" String="(?:fr|rf)"""" insensitive="true" context="Raw Triple Q-F-String" beginRegion="Triple Q-region"/> - <RegExpr attribute="Raw F-String" String="(?:fr|rf)'" insensitive="true" context="Raw A-F-String"/> - <RegExpr attribute="Raw F-String" String="(?:fr|rf)"" insensitive="true" context="Raw Q-F-String"/> - </context> - + <!-- fast path --> + <RegExpr String="(?:u|r|b|f|ur|fr|rf|br|rb)?['"]" insensitive="true" context="AssumeStringVariants" lookAhead="1"/> + </context> + <context name="AssumeStringVariants" attribute="Normal Text" lineEndContext="#stay"> + <RegExpr attribute="String" String="u?'''" insensitive="true" context="#pop!Triple A-string" beginRegion="Triple A-region"/> + <RegExpr attribute="String" String="u?"""" insensitive="true" context="#pop!Triple Q-string" beginRegion="Triple Q-region"/> + <RegExpr attribute="String" String="u?'" insensitive="true" context="#pop!Single A-string"/> + <RegExpr attribute="String" String="u?"" insensitive="true" context="#pop!Single Q-string"/> + + <RegExpr attribute="Raw String" String="u?r'''" insensitive="true" context="#pop!Raw Triple A-string" beginRegion="Triple A-region"/> + <RegExpr attribute="Raw String" String="u?r"""" insensitive="true" context="#pop!Raw Triple Q-string" beginRegion="Triple Q-region"/> + <RegExpr attribute="Raw String" String="u?r'" insensitive="true" context="#pop!Raw A-string"/> + <RegExpr attribute="Raw String" String="u?r"" insensitive="true" context="#pop!Raw Q-string"/> + + <StringDetect attribute="F-String" String="f'''" insensitive="true" context="#pop!Triple A-F-String" beginRegion="Triple A-region"/> + <StringDetect attribute="F-String" String="f"""" insensitive="true" context="#pop!Triple Q-F-String" beginRegion="Triple Q-region"/> + <StringDetect attribute="F-String" String="f'" insensitive="true" context="#pop!Single A-F-String"/> + <StringDetect attribute="F-String" String="f"" insensitive="true" context="#pop!Single Q-F-String"/> + + <RegExpr attribute="Raw F-String" String="(?:fr|rf)'''" insensitive="true" context="#pop!Raw Triple A-F-String" beginRegion="Triple A-region"/> + <RegExpr attribute="Raw F-String" String="(?:fr|rf)"""" insensitive="true" context="#pop!Raw Triple Q-F-String" beginRegion="Triple Q-region"/> + <RegExpr attribute="Raw F-String" String="(?:fr|rf)'" insensitive="true" context="#pop!Raw A-F-String"/> + <RegExpr attribute="Raw F-String" String="(?:fr|rf)"" insensitive="true" context="#pop!Raw Q-F-String"/> + + <StringDetect attribute="B-String" String="b'''" insensitive="true" context="#pop!Triple A-B-String" beginRegion="Triple A-region"/> + <StringDetect attribute="B-String" String="b"""" insensitive="true" context="#pop!Triple Q-B-String" beginRegion="Triple Q-region"/> + <StringDetect attribute="B-String" String="b'" insensitive="true" context="#pop!Single A-B-String"/> + <StringDetect attribute="B-String" String="b"" insensitive="true" context="#pop!Single Q-B-String"/> + + <RegExpr attribute="Raw B-String" String="(?:br|rb)'''" insensitive="true" context="#pop!Raw Triple A-B-String" beginRegion="Triple A-region"/> + <RegExpr attribute="Raw B-String" String="(?:br|rb)"""" insensitive="true" context="#pop!Raw Triple Q-B-String" beginRegion="Triple Q-region"/> + <RegExpr attribute="Raw B-String" String="(?:br|rb)'" insensitive="true" context="#pop!Raw A-B-String"/> + <RegExpr attribute="Raw B-String" String="(?:br|rb)"" insensitive="true" context="#pop!Raw Q-B-String"/> + </context> + + <!-- https://docs.python.org/2/reference/lexical_analysis.html#string-literals --> + <!-- https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals --> <context name="CommentVariants" attribute="Normal Text" lineEndContext="#stay"> - <DetectSpaces/> - - <RegExpr attribute="Comment" String="u?'''" insensitive="true" firstNonSpace="true" context="Triple A-comment" beginRegion="Triple A-region"/> - <RegExpr attribute="Comment" String="u?"""" insensitive="true" firstNonSpace="true" context="Triple Q-comment" beginRegion="Triple Q-region"/> - <RegExpr attribute="Comment" String="u?'" insensitive="true" firstNonSpace="true" context="Single A-comment"/> - <RegExpr attribute="Comment" String="u?"" insensitive="true" firstNonSpace="true" context="Single Q-comment"/> - - <RegExpr attribute="Comment" String="(?:u?r|ru)'''" insensitive="true" firstNonSpace="true" context="Triple A-comment" beginRegion="Triple A-region"/> - <RegExpr attribute="Comment" String="(?:u?r|ru)"""" insensitive="true" firstNonSpace="true" context="Triple Q-comment" beginRegion="Triple Q-region"/> - <RegExpr attribute="Comment" String="(?:u?r|ru)'" insensitive="true" firstNonSpace="true" context="Single A-comment"/> - <RegExpr attribute="Comment" String="(?:u?r|ru)"" insensitive="true" firstNonSpace="true" context="Single Q-comment"/> + <!-- fast path --> + <RegExpr String="(?:u|r|ur)?['"]" insensitive="true" firstNonSpace="true" context="AssumeCommentVariants" lookAhead="1"/> + </context> + <context name="AssumeCommentVariants" attribute="Normal Text" lineEndContext="#stay"> + <RegExpr attribute="Comment" String="(?:u?r?)'''" insensitive="true" context="#pop!Triple A-comment" beginRegion="Triple A-region"/> + <RegExpr attribute="Comment" String="(?:u?r?)"""" insensitive="true" context="#pop!Triple Q-comment" beginRegion="Triple Q-region"/> + <RegExpr attribute="Comment" String="(?:u?r?)'" insensitive="true" context="#pop!Single A-comment"/> + <RegExpr attribute="Comment" String="(?:u?r?)"" insensitive="true" context="#pop!Single Q-comment"/> </context> <context name="Dictionary" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true"> @@ -472,35 +535,53 @@ <IncludeRules context="Normal" /> </context> + <context name="UnfinishedStringError" attribute="Error" lineEndContext="#stay" noIndentationBasedFolding="true"> + <!-- A single string/comment reached the end of the line without a \ line escape --> + <!-- We set ALL succeeding lines to the "Error" attribute so that this error is easier to spot --> + </context> + <!-- Comments --> <context name="Hash comment" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <IncludeRules context="##Comments" /> + <DetectIdentifier/> </context> <context name="Triple A-comment" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> - <IncludeRules context="stringescape"/> + <DetectSpaces/> <StringDetect attribute="Comment" String="'''" context="#pop" endRegion="Triple A-region"/> <IncludeRules context="##Comments" /> + <DetectIdentifier/> + <IncludeRules context="stringescape"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <context name="Triple Q-comment" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> - <IncludeRules context="stringescape"/> + <DetectSpaces/> <StringDetect attribute="Comment" String=""""" context="#pop" endRegion="Triple Q-region"/> <IncludeRules context="##Comments" /> + <DetectIdentifier/> + <IncludeRules context="stringescape"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Single A-comment" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="stringescape"/> + <context name="Single A-comment" attribute="Comment" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces/> <DetectChar attribute="Comment" char="'" context="#pop"/> <IncludeRules context="##Comments" /> + <DetectIdentifier/> + <IncludeRules context="stringescape"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Single Q-comment" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="stringescape"/> + <context name="Single Q-comment" attribute="Comment" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces/> <DetectChar attribute="Comment" char=""" context="#pop"/> <IncludeRules context="##Comments" /> + <DetectIdentifier/> + <IncludeRules context="stringescape"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <!-- Strings --> @@ -520,14 +601,25 @@ <RegExpr attribute="String Char" String="\\[\\'"abfnrtv]|\\[0-7]{1,3}|\\x[0-9A-Fa-f]{2}|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8}|\\N\{[a-zA-Z0-9\- ]+\}" context="#stay"/> </context> + <!-- escape characters --> + <context name="bytesescape" attribute="String Char" lineEndContext="#stay"> + <!-- As this highlighting style is for both, Python 2 and 3, + we do not know if a normal string is “unicode” or not. So we + --> + <RegExpr attribute="String Char" String="\\[\\'"abfnrtv]|\\[0-7]{1,3}|\\x[0-9A-Fa-f]{2}" context="#stay"/> + </context> + <!-- f-literals --> <context name="stringinterpolation" attribute="F-String" lineEndContext="#stay"> <Detect2Chars attribute="String Char" char="{" char1="{" context="#stay"/> <DetectChar attribute="String Substitution" char="{" context="String Interpolation"/> + <Detect2Chars attribute="String Char" char="}" char1="}" context="#stay"/> + <DetectChar attribute="Error" char="}" context="#stay"/> </context> <context name="String Interpolation" attribute="String Substitution" lineEndContext="#stay"> <DetectChar attribute="Error" char="\" context="#pop"/> - <RegExpr attribute="String Substitution" String="(?:![rs])?(?::(?:[^}]?[<>=^])?[ +-]?#?0?[0-9]*(?:\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}" context="#pop"/> + <!-- format specifiers: [[fill]align][sign][#][0][minimumwidth][.precision][type] --> + <RegExpr attribute="String Substitution" String="(?:![rsa])?(?::(?:[^}]?[<>=^])?[ +-]?#?0?[0-9]*(?:\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}" context="#pop"/> <IncludeRules context="Normal"/> <!-- TODO: create expression context instead --> </context> @@ -542,107 +634,218 @@ Adding byte literals wouldn’t make the current 2⁴ into 2⁵ contexts, as there are no byte f-literals --> - <!-- Triple-quoted A-strings --> <context name="Triple A-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <DetectSpaces attribute="String"/> + <DetectIdentifier attribute="String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringformat"/> <StringDetect attribute="String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <context name="Raw Triple A-string" attribute="Raw String" lineEndContext="#stay" noIndentationBasedFolding="true"> - <HlCStringChar attribute="Raw String" context="#stay"/> + <DetectSpaces attribute="Raw String"/> + <DetectIdentifier attribute="Raw String"/> + <Detect2Chars attribute="Raw String" char="\" char1="'"/> + <Detect2Chars attribute="Raw String" char="\" char1="\"/> <IncludeRules context="stringformat"/> <StringDetect attribute="Raw String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> </context> <context name="Triple A-F-String" attribute="F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <DetectSpaces attribute="F-String"/> + <DetectIdentifier attribute="F-String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringinterpolation"/> <StringDetect attribute="F-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <context name="Raw Triple A-F-String" attribute="Raw F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> - <HlCStringChar attribute="Raw F-String" context="#stay"/> + <DetectSpaces attribute="Raw F-String"/> + <DetectIdentifier attribute="Raw F-String"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="'"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="\"/> <IncludeRules context="stringinterpolation"/> <StringDetect attribute="Raw F-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> </context> + <context name="Triple A-B-String" attribute="B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <RegExpr attribute="B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2})|'(?!''))++"/> + <IncludeRules context="bytesescape"/> + <StringDetect attribute="B-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> + <LineContinue attribute="String Char" context="#stay"/> + <RegExpr attribute="Error" String="."/> + </context> + + <context name="Raw Triple A-B-String" attribute="Raw B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <RegExpr attribute="Raw B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\.?|'(?!''))++"/> + <StringDetect attribute="Raw B-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> + <RegExpr attribute="Error" String="."/> + </context> + <!-- Triple-quoted Q-strings --> <context name="Triple Q-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <DetectSpaces attribute="String"/> + <DetectIdentifier attribute="String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringformat"/> <StringDetect attribute="String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <context name="Raw Triple Q-string" attribute="Raw String" lineEndContext="#stay" noIndentationBasedFolding="true"> - <HlCStringChar attribute="Raw String" context="#stay"/> + <DetectSpaces attribute="Raw String"/> + <DetectIdentifier attribute="Raw String"/> + <Detect2Chars attribute="Raw String" char="\" char1="""/> + <Detect2Chars attribute="Raw String" char="\" char1="\"/> <IncludeRules context="stringformat"/> <StringDetect attribute="Raw String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> </context> <context name="Triple Q-F-String" attribute="F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <DetectSpaces attribute="F-String"/> + <DetectIdentifier attribute="F-String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringinterpolation"/> <StringDetect attribute="F-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> + <LineContinue attribute="String Char" context="#stay"/> </context> <context name="Raw Triple Q-F-String" attribute="Raw F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> - <HlCStringChar attribute="Raw F-String" context="#stay"/> + <DetectSpaces attribute="Raw F-String"/> + <DetectIdentifier attribute="Raw F-String"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="""/> + <Detect2Chars attribute="Raw F-String" char="\" char1="\"/> <IncludeRules context="stringinterpolation"/> <StringDetect attribute="Raw F-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> </context> + <context name="Triple Q-B-String" attribute="B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <RegExpr attribute="B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2})|"(?!""))++"/> + <IncludeRules context="bytesescape"/> + <StringDetect attribute="B-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> + <LineContinue attribute="String Char" context="#stay"/> + <RegExpr attribute="Error" String="."/> + </context> + + <context name="Raw Triple Q-B-String" attribute="Raw B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> + <RegExpr attribute="Raw B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\.?|"(?!""))++"/> + <StringDetect attribute="Raw B-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> + <RegExpr attribute="Error" String="."/> + </context> + <!-- Single-quoted A-strings --> - <context name="Single A-string" attribute="String" lineEndContext="#stay"> + <context name="Single A-string" attribute="String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="String"/> + <DetectIdentifier attribute="String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringformat"/> <DetectChar attribute="String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Raw A-string" attribute="Raw String" lineEndContext="#stay"> - <HlCStringChar attribute="Raw String" context="#stay"/> + <context name="Raw A-string" attribute="Raw String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="Raw String"/> + <DetectIdentifier attribute="Raw String"/> + <Detect2Chars attribute="Raw String" char="\" char1="'"/> + <Detect2Chars attribute="Raw String" char="\" char1="\"/> <IncludeRules context="stringformat"/> <DetectChar attribute="Raw String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="Raw String" context="#stay"/> </context> - <context name="Single A-F-String" attribute="F-String" lineEndContext="#stay"> + <context name="Single A-F-String" attribute="F-String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="F-String"/> + <DetectIdentifier attribute="F-String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringinterpolation"/> <DetectChar attribute="F-String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Raw A-F-String" attribute="Raw F-String" lineEndContext="#stay"> - <HlCStringChar attribute="Raw F-String" context="#stay"/> + <context name="Raw A-F-String" attribute="Raw F-String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="Raw F-String"/> + <DetectIdentifier attribute="Raw F-String"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="'"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="\"/> <IncludeRules context="stringinterpolation"/> <DetectChar attribute="Raw F-String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="Raw F-String" context="#stay"/> + </context> + + <context name="Single A-B-String" attribute="B-String" lineEndContext="#pop!UnfinishedStringError"> + <RegExpr attribute="B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2}))++"/> + <IncludeRules context="bytesescape"/> + <DetectChar attribute="B-String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> + <RegExpr attribute="Error" String="."/> + </context> + + <context name="Raw A-B-String" attribute="Raw B-String" lineEndContext="#pop!UnfinishedStringError"> + <RegExpr attribute="Raw B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\.)++"/> + <DetectChar attribute="Raw B-String" char="'" context="#pop!#CheckForString"/> + <LineContinue attribute="Raw B-String" context="#stay"/> + <RegExpr attribute="Error" String="."/> </context> <!-- Single-quoted Q-strings --> - <context name="Single Q-string" attribute="String" lineEndContext="#stay"> + <context name="Single Q-string" attribute="String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="String"/> + <DetectIdentifier attribute="String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringformat"/> <DetectChar attribute="String" char=""" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Raw Q-string" attribute="Raw String" lineEndContext="#stay"> - <HlCStringChar attribute="Raw String" context="#stay"/> + <context name="Raw Q-string" attribute="Raw String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="Raw String"/> + <DetectIdentifier attribute="Raw String"/> + <Detect2Chars attribute="Raw String" char="\" char1="""/> + <Detect2Chars attribute="Raw String" char="\" char1="\"/> <IncludeRules context="stringformat"/> <DetectChar attribute="Raw String" char=""" context="#pop!#CheckForString"/> + <LineContinue attribute="Raw String" context="#stay"/> </context> - <context name="Single Q-F-String" attribute="F-String" lineEndContext="#stay"> + <context name="Single Q-F-String" attribute="F-String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="F-String"/> + <DetectIdentifier attribute="F-String"/> <IncludeRules context="stringescape"/> <IncludeRules context="stringinterpolation"/> <DetectChar attribute="F-String" char=""" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> </context> - <context name="Raw Q-F-String" attribute="Raw F-String" lineEndContext="#stay"> - <HlCStringChar attribute="Raw F-String" context="#stay"/> + <context name="Raw Q-F-String" attribute="Raw F-String" lineEndContext="#pop!UnfinishedStringError"> + <DetectSpaces attribute="Raw F-String"/> + <DetectIdentifier attribute="Raw F-String"/> + <Detect2Chars attribute="Raw F-String" char="\" char1="""/> + <Detect2Chars attribute="Raw F-String" char="\" char1="\"/> <IncludeRules context="stringinterpolation"/> <DetectChar attribute="Raw F-String" char=""" context="#pop!#CheckForString"/> + <LineContinue attribute="Raw F-String" context="#stay"/> </context> + + <context name="Single Q-B-String" attribute="B-String" lineEndContext="#pop!UnfinishedStringError"> + <RegExpr attribute="B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2}))++"/> + <IncludeRules context="bytesescape"/> + <DetectChar attribute="B-String" char=""" context="#pop!#CheckForString"/> + <LineContinue attribute="String Char" context="#stay"/> + <RegExpr attribute="Error" String="."/> + </context> + + <context name="Raw Q-B-String" attribute="Raw B-String" lineEndContext="#pop!UnfinishedStringError"> + <RegExpr attribute="Raw B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\.)++"/> + <DetectChar attribute="Raw B-String" char=""" context="#pop!#CheckForString"/> + <Detect2Chars attribute="Raw B-String" char="\" char1="\"/> + <LineContinue attribute="Raw B-String" context="#stay"/> + <RegExpr attribute="Error" String="."/> + </context> + </contexts> <itemDatas> @@ -668,6 +871,8 @@ <itemData name="Raw String" defStyleNum="dsVerbatimString"/> <itemData name="F-String" defStyleNum="dsSpecialString"/> <itemData name="Raw F-String" defStyleNum="dsVerbatimString"/> + <itemData name="B-String" defStyleNum="dsString" spellChecking="false"/> + <itemData name="Raw B-String" defStyleNum="dsVerbatimString" spellChecking="false"/> <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> <itemData name="String Substitution" defStyleNum="dsSpecialChar" spellChecking="false"/> <itemData name="Decorator" defStyleNum="dsAttribute" spellChecking="false"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml index fbefcb6dad..839e8f9162 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml @@ -6,7 +6,7 @@ <!ENTITY name "(?![0-9])[\w_:][\w.:_-]*"> <!ENTITY entref "&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> ]> -<language name="XML" version="12" kateversion="5.0" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml;*.xbel;*.dae;*.sch;*.brd" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/x-xbel;application/xml;application/scxml+xml" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> +<language name="XML" version="14" kateversion="5.0" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml;*.xbel;*.dae;*.sch;*.brd" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/x-xbel;application/xml;application/scxml+xml" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> <highlighting> <contexts> @@ -16,13 +16,13 @@ <context name="FindXML" attribute="Normal Text" lineEndContext="#stay"> <DetectSpaces /> + <DetectIdentifier /> + <RegExpr attribute="Element Symbols" context="ElementTagName" String="<(?=(&name;))" beginRegion="element" /> <StringDetect attribute="Comment" context="Comment" String="<!--" beginRegion="comment" /> <StringDetect attribute="CDATA" context="CDATAStart" String="<![CDATA[" lookAhead="true" /> - <RegExpr attribute="Doctype Symbols" context="DoctypeTagName" String="<!(?=DOCTYPE\s+)" beginRegion="doctype" /> + <RegExpr attribute="Doctype Symbols" context="DoctypeTagName" String="<!(?=DOCTYPE(\s|$))" beginRegion="doctype" /> <IncludeRules context="FindProcessingInstruction" /> - <RegExpr attribute="Element Symbols" context="ElementTagName" String="<(?=(&name;))" beginRegion="element" /> <IncludeRules context="FindEntityRefs" /> - <DetectIdentifier /> </context> <context name="FindEntityRefs" attribute="Other Text" lineEndContext="#stay"> @@ -70,13 +70,13 @@ <context name="PI-XML" attribute="Other Text" lineEndContext="#stay"> <IncludeRules context="PI" /> <RegExpr attribute="Attribute" context="#stay" String="(?:^|\s+)&name;" /> - <DetectChar attribute="Attribute" context="Value" char="=" /> + <DetectChar attribute="Attribute Separator" context="Value" char="=" /> </context> <context name="DoctypeTagName" attribute="Other Text" lineEndContext="#pop"> <StringDetect attribute="Doctype" context="#pop!DoctypeVariableName" String="DOCTYPE" /> </context> - <context name="DoctypeVariableName" attribute="Other Text" lineEndContext="#pop!Doctype" fallthrough="true" fallthroughContext="#pop!Doctype"> + <context name="DoctypeVariableName" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Doctype"> <DetectSpaces /> <RegExpr attribute="Doctype Name" context="#pop!Doctype" String="&name;" /> </context> @@ -116,7 +116,7 @@ <IncludeRules context="FindPEntityRefs" /> </context> - <context name="ElementTagName" attribute="Other Text" lineEndContext="#pop!Element" fallthrough="true" fallthroughContext="#pop!Element"> + <context name="ElementTagName" attribute="Other Text" lineEndContext="#pop!Element"> <StringDetect attribute="Element" context="#pop!Element" String="%1" dynamic="true" /> </context> <context name="Element" attribute="Other Text" lineEndContext="#stay"> @@ -131,7 +131,7 @@ <IncludeRules context="FindXML" /> </context> - <context name="El End TagName" attribute="Other Text" lineEndContext="#pop!El End" fallthrough="true" fallthroughContext="#pop!El End"> + <context name="El End TagName" attribute="Other Text" lineEndContext="#pop!El End"> <StringDetect attribute="Element" context="#pop!El End" String="%1" dynamic="true" /> </context> <context name="El End" attribute="Other Text" lineEndContext="#stay"> @@ -140,7 +140,7 @@ </context> <context name="Attribute" attribute="Other Text" lineEndContext="#stay"> - <DetectChar attribute="Attribute" context="#pop!Value" char="=" /> + <DetectChar attribute="Attribute Separator" context="#pop!Value" char="=" /> <RegExpr attribute="Error" context="#stay" String="\S" /> </context> @@ -175,6 +175,7 @@ <itemData name="Element" defStyleNum="dsKeyword" spellChecking="false" /> <itemData name="Element Symbols" defStyleNum="dsNormal" spellChecking="false" /> <itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false" /> + <itemData name="Attribute Separator" defStyleNum="dsOthers" spellChecking="false" /> <itemData name="Value" defStyleNum="dsString" spellChecking="false" /> <itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false" /> <itemData name="PEntityRef" defStyleNum="dsDecVal" spellChecking="false" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme index ebfde02797..fea8def01f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Feb 22, 2021 (revision 3)", + "Last update: Jul 28, 2021 (revision 4)", "This file has been converted from: https://github.com/dempfi/ayu", "Also see: https://github.com/ayu-theme" ], @@ -11,7 +11,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "ayu Dark", - "revision": 3 + "revision": 4 }, "editor-colors": { "BackgroundColor": "#0a0e14", @@ -169,8 +169,8 @@ "text-color": "#39bae6" }, "VerbatimString": { - "selected-text-color": "#c2d94c", - "text-color": "#c2d94c" + "selected-text-color": "#99ca44", + "text-color": "#99ca44" }, "Warning": { "selected-text-color": "#f07178", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme index c93e414457..30e119ed1b 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Sep 21, 2020 (revision 2)", + "Last update: Jul 28, 2021 (revision 3)", "This file has been converted from: https://github.com/dempfi/ayu", "Also see: https://github.com/ayu-theme" ], @@ -11,7 +11,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "ayu Light", - "revision": 2 + "revision": 3 }, "editor-colors": { "BackgroundColor": "#fafafa", @@ -169,8 +169,8 @@ "text-color": "#55b4d4" }, "VerbatimString": { - "selected-text-color": "#86b300", - "text-color": "#86b300" + "selected-text-color": "#729800", + "text-color": "#729800" }, "Warning": { "selected-text-color": "#f07171", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme index e389ecf298..005d6a0ad2 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Feb 22, 2021 (revision 3)", + "Last update: Jul 28, 2021 (revision 4)", "This file has been converted from: https://github.com/dempfi/ayu", "Also see: https://github.com/ayu-theme" ], @@ -11,7 +11,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "ayu Mirage", - "revision": 3 + "revision": 4 }, "editor-colors": { "BackgroundColor": "#1f2430", @@ -169,8 +169,8 @@ "text-color": "#5ccfe6" }, "VerbatimString": { - "selected-text-color": "#bae67e", - "text-color": "#bae67e" + "selected-text-color": "#82e26a", + "text-color": "#82e26a" }, "Warning": { "selected-text-color": "#f28779", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme index 712da4acc4..1ad7fffee3 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme @@ -5,7 +5,7 @@ "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 6, + "revision" : 7, "name" : "Breeze Dark" }, "text-styles": { @@ -149,7 +149,7 @@ "editor-colors": { "BackgroundColor" : "#232629", "CodeFolding" : "#224e65", - "BracketMatching" : "#323030", + "BracketMatching" : "#8e44ad", "CurrentLine" : "#2A2E32", "IconBorder" : "#31363b", "IndentationLine" : "#3a3f44", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme index 7d0116bea9..6dee8dd777 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme @@ -5,7 +5,7 @@ "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 8, + "revision" : 9, "name" : "Breeze Light" }, "text-styles": { @@ -70,7 +70,7 @@ "selected-text-color" : "#9c0e0e" }, "VerbatimString" : { - "text-color" : "#bf0303", + "text-color" : "#e31616", "selected-text-color" : "#9c0e0e" }, "SpecialString" : { diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme index 93b1833334..b388396050 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme @@ -570,7 +570,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "Dracula", - "revision": 7 + "revision": 8 }, "text-styles": { "Alert": { @@ -694,8 +694,8 @@ "text-color": "#8be9fd" }, "VerbatimString": { - "selected-text-color": "#f1fa8c", - "text-color": "#f1fa8c" + "selected-text-color": "#d7e60a", + "text-color": "#d7e60a" }, "Warning": { "selected-text-color": "#ff5555", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/falcon.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/falcon.theme new file mode 100644 index 0000000000..1ebf8c6946 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/falcon.theme @@ -0,0 +1,184 @@ +{ + "_comments": [ + "A theme focused on ergonomics, using the 3 digit Tango color palette" + ], + "metadata": { + "name": "Falcon", + "revision": 4, + "license": "SPDX-License-Identifier: MIT", + "copyright": [ "SPDX-FileCopyrightText: 2021 Alberto Salvia Novella <https://es20490446e.wordpress.com>" ] + }, + "custom-styles": { + "Bash": { + "Normal Text": { + "text-color": "#bbbbbb" + } + } + }, + "editor-colors": { + "BackgroundColor": "#223333", + "BracketMatching": "#555555", + "CodeFolding": "#224488", + "CurrentLine": "#555555", + "CurrentLineNumber": "#bbbbbb", + "IconBorder": "#223333", + "IndentationLine": "#888888", + "LineNumbers": "#888888", + "MarkBookmark": "#7799cc", + "MarkBreakpointActive": "#ffaa33", + "MarkBreakpointDisabled": "#aa77aa", + "MarkBreakpointReached": "#449900", + "MarkError": "#ef2929", + "MarkExecution": "#888888", + "MarkWarning": "#aa77aa", + "ModifiedLines": "#aa0000", + "ReplaceHighlight": "#224488", + "SavedLines": "#449900", + "SearchHighlight": "#224488", + "Separator": "#555753", + "SpellChecking": "#ef2929", + "TabMarker": "#555555", + "TemplateBackground": "#223333", + "TemplateFocusedPlaceholder": "#23321a", + "TemplatePlaceholder": "#23321a", + "TemplateReadOnlyPlaceholder": "#451e1a", + "TextSelection": "#3366aa", + "WordWrapMarker": "#555753" + }, + "text-styles": { + "Alert": { + "background-color": "#320000", + "bold": true, + "selected-text-color": "#ffaa33", + "text-color": "#ee2222" + }, + "Annotation": { + "selected-text-color": "#ddddcc", + "text-color": "#aa77aa" + }, + "Attribute": { + "selected-text-color": "#ddddcc", + "text-color": "#aa77aa" + }, + "BaseN": { + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "BuiltIn": { + "selected-text-color": "#ddddcc", + "text-color": "#7799cc" + }, + "Char": { + "selected-text-color": "#ffaa33", + "text-color": "#ffaa33" + }, + "Comment": { + "selected-text-color": "#eeeeec", + "text-color": "#888888" + }, + "CommentVar": { + "selected-text-color": "#ddddcc", + "text-color": "#aa77aa" + }, + "Constant": { + "bold": true, + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "DataType": { + "selected-text-color": "#ddddcc", + "text-color": "#7799cc" + }, + "DecVal": { + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "Documentation": { + "selected-text-color": "#eeeeee", + "text-color": "#d3d7cf" + }, + "Error": { + "selected-text-color": "#ffaa33", + "text-color": "#ee2222", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#ddddcc", + "text-color": "#7799cc" + }, + "Float": { + "selected-text-color": "#ffaa33", + "text-color": "#ffaa33" + }, + "Function": { + "bold": true, + "selected-text-color": "#ddddcc", + "text-color": "#7799cc" + }, + "Import": { + "selected-text-color": "#88ee33", + "text-color": "#88ee33" + }, + "Information": { + "selected-text-color": "#eeeeee", + "text-color": "#ddddcc" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#ddddcc", + "text-color": "#aa77aa" + }, + "Normal": { + "selected-text-color": "#eeeeee", + "text-color": "#ddddcc" + }, + "Operator": { + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "Others": { + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + }, + "Preprocessor": { + "selected-text-color": "#ddddcc", + "text-color": "#aa77aa" + }, + "RegionMarker": { + "background-color": "#0d1932", + "selected-text-color": "#ddddcc", + "text-color": "#7799cc" + }, + "SpecialChar": { + "selected-text-color": "#ffaa33", + "text-color": "#ffaa33" + }, + "SpecialString": { + "selected-text-color": "#eeeeee", + "text-color": "#ddddcc" + }, + "String": { + "selected-text-color": "#eeeeee", + "text-color": "#ddddcc" + }, + "Variable": { + "bold": true, + "selected-text-color": "#ffaa33", + "text-color": "#ffaa33" + }, + "VerbatimString": { + "selected-text-color": "#ffaa33", + "text-color": "#ffaa33" + }, + "Warning": { + "selected-text-color": "#ffee44", + "text-color": "#eedd00" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/github-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/github-dark.theme index 313e99f052..a699638532 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/github-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/github-dark.theme @@ -82,7 +82,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "GitHub Dark", - "revision": 2 + "revision": 3 }, "text-styles": { "Alert": { @@ -205,8 +205,8 @@ "text-color": "#ffab70" }, "VerbatimString": { - "selected-text-color": "#9ecbff", - "text-color": "#9ecbff" + "selected-text-color": "#41a0ff", + "text-color": "#41a0ff" }, "Warning": { "selected-text-color": "#ff5555", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/github-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/github-light.theme index 5f465c653c..ed56418fde 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/github-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/github-light.theme @@ -82,7 +82,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "GitHub Light", - "revision": 2 + "revision": 3 }, "text-styles": { "Alert": { @@ -205,8 +205,8 @@ "text-color": "#e36209" }, "VerbatimString": { - "selected-text-color": "#032f62", - "text-color": "#032f62" + "selected-text-color": "#034c95", + "text-color": "#034c95" }, "Warning": { "selected-text-color": "#ff5555", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme index 66c6c9afb7..0e006ab46e 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Sep 17, 2020 (revision 2)", + "Last update: Jul 28, 2021 (revision 3)", "This file has been converted from: https://github.com/morhetz/gruvbox" ], "metadata" : { @@ -10,7 +10,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name" : "gruvbox Dark", - "revision" : 2 + "revision" : 3 }, "text-styles": { "Normal" : { @@ -73,7 +73,7 @@ "selected-text-color" : "#b8bb26" }, "VerbatimString" : { - "text-color" : "#98971a", + "text-color" : "#848216", "selected-text-color" : "#b8bb26" }, "SpecialString" : { diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme index 6038c70e94..937a43d084 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Sep 17, 2020 (revision 2)", + "Last update: Jul 28, 2021 (revision 3)", "This file has been converted from: https://github.com/morhetz/gruvbox" ], "metadata" : { @@ -10,7 +10,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name" : "gruvbox Light", - "revision" : 2 + "revision" : 3 }, "text-styles": { "Normal" : { @@ -73,7 +73,7 @@ "selected-text-color" : "#79740e" }, "VerbatimString" : { - "text-color" : "#98971a", + "text-color" : "#848216", "selected-text-color" : "#79740e" }, "SpecialString" : { diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/monokai.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/monokai.theme index 3df8e66c00..e0026ca3b3 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/monokai.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/monokai.theme @@ -259,7 +259,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "Monokai", - "revision": 5 + "revision": 6 }, "text-styles": { "Alert": { @@ -383,8 +383,8 @@ "text-color": "#f8f8f2" }, "VerbatimString": { - "selected-text-color": "#e6db74", - "text-color": "#e6db74" + "selected-text-color": "#d8c72c", + "text-color": "#d8c72c" }, "Warning": { "selected-text-color": "#ff5555", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme index 6ad4d82e43..dbe44d9b09 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme @@ -1,6 +1,6 @@ { "_comments": [ - "Last update: Sep 21, 2020 (revision 2)", + "Last update: Jul 28, 2020 (revision 3)", "This theme has been adapted from: https://www.nordtheme.com" ], "metadata": { @@ -11,7 +11,7 @@ ], "license": "SPDX-License-Identifier: MIT", "name": "Nord", - "revision": 2 + "revision": 3 }, "editor-colors": { "BackgroundColor": "#2e3440", @@ -170,8 +170,8 @@ "text-color": "#5e81ac" }, "VerbatimString": { - "selected-text-color": "#a3be8c", - "text-color": "#a3be8c" + "selected-text-color": "#8dae70", + "text-color": "#8dae70" }, "Warning": { "selected-text-color": "#bf616a", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme index 26d779582d..49bbe6419f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme @@ -5,7 +5,7 @@ "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 4, + "revision" : 5, "name" : "Printing" }, "text-styles": { @@ -69,7 +69,7 @@ "selected-text-color" : "#9c0e0e" }, "VerbatimString" : { - "text-color" : "#bf0303", + "text-color" : "#ea0404", "selected-text-color" : "#9c0e0e" }, "SpecialString" : { diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme index b8d13b31d3..1fe48bacd0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme @@ -9,7 +9,7 @@ "SPDX-FileCopyrightText: 2018 Andrew Crouthamel <andrew.crouthamel@kdemail.net>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 5, + "revision" : 6, "name" : "Solarized Dark" }, "text-styles": { @@ -70,8 +70,8 @@ "selected-text-color" : "#2aa198" }, "VerbatimString" : { - "text-color" : "#2aa198", - "selected-text-color" : "#2aa198" + "text-color" : "#23877e", + "selected-text-color" : "#23877e" }, "SpecialString" : { "text-color" : "#dc322f", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme index a532b128f8..51c76faaec 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme @@ -9,7 +9,7 @@ "SPDX-FileCopyrightText: 2018 Andrew Crouthamel <andrew.crouthamel@kdemail.net>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 4, + "revision" : 5, "name" : "Solarized Light" }, "text-styles": { @@ -73,8 +73,8 @@ "selected-text-color" : "#2aa198" }, "VerbatimString" : { - "text-color" : "#2aa198", - "selected-text-color" : "#2aa198" + "text-color" : "#23837a", + "selected-text-color" : "#23837a" }, "SpecialString" : { "text-color" : "#dc322f", diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc b/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc index fe0a1627be..cf9d658c82 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc @@ -9,6 +9,7 @@ <file>ayu-light.theme</file> <file>ayu-mirage.theme</file> <file>dracula.theme</file> + <file>falcon.theme</file> <file>github-dark.theme</file> <file>github-light.theme</file> <file>gruvbox-dark.theme</file> diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme index 1a2c7785ac..d039822cae 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme @@ -5,7 +5,7 @@ "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" ], "license": "SPDX-License-Identifier: MIT", - "revision" : 3, + "revision" : 4, "name" : "Vim Dark" }, "text-styles": { @@ -70,8 +70,8 @@ "selected-text-color" : "#ff54ff" }, "VerbatimString" : { - "text-color" : "#ff54ff", - "selected-text-color" : "#ff54ff" + "text-color" : "#f000f0", + "selected-text-color" : "#f000f0" }, "SpecialString" : { "text-color" : "#ff5500", diff --git a/src/libs/3rdparty/syntax-highlighting/metainfo.yaml b/src/libs/3rdparty/syntax-highlighting/metainfo.yaml index 7a3220a31e..a82f7a986d 100644 --- a/src/libs/3rdparty/syntax-highlighting/metainfo.yaml +++ b/src/libs/3rdparty/syntax-highlighting/metainfo.yaml @@ -6,7 +6,7 @@ platforms: - name: Linux - name: FreeBSD - name: Windows - - name: MacOSX + - name: macOS - name: Android portingAid: false deprecated: false diff --git a/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp index a009c4f259..749123aa54 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp @@ -30,10 +30,11 @@ static void applyHighlighter(Highlighter &highlighter, const QCommandLineOption &outputName, const Ts &...highlightParams) { - if (parser.isSet(outputName)) + if (parser.isSet(outputName)) { highlighter.setOutputFile(parser.value(outputName)); - else + } else { highlighter.setOutputFile(stdout); + } if (fromFileName) { highlighter.highlightFile(inFileName, highlightParams...); @@ -126,8 +127,9 @@ int main(int argc, char **argv) } if (parser.isSet(listThemes)) { - for (const auto &theme : repo.themes()) + for (const auto &theme : repo.themes()) { std::cout << qPrintable(theme.name()) << std::endl; + } return 0; } @@ -158,9 +160,10 @@ int main(int argc, char **argv) if (!def.isValid()) { /* see if it's a extension instead */ def = repo.definitionForFileName(QLatin1String("f.") + syntax); - if (!def.isValid()) + if (!def.isValid()) { /* see if it's a filename instead */ def = repo.definitionForFileName(syntax); + } } } } else if (fromFileName) { @@ -177,8 +180,9 @@ int main(int argc, char **argv) QString outputFormat = parser.value(outputFormatOption); if (0 == outputFormat.compare(QLatin1String("html"), Qt::CaseInsensitive)) { QString title; - if (parser.isSet(titleOption)) + if (parser.isSet(titleOption)) { title = parser.value(titleOption); + } HtmlHighlighter highlighter; highlighter.setDefinition(def); diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt index 508cd276cc..4a84696ad9 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt @@ -28,7 +28,8 @@ elseif(CMAKE_CROSSCOMPILING) else() # host build add_executable(katehighlightingindexer katehighlightingindexer.cpp ../lib/worddelimiters.cpp) - if(Qt5XmlPatterns_FOUND) + ecm_mark_nongui_executable(katehighlightingindexer) + if(Qt5XmlPatterns_FOUND AND NOT ECM_ENABLE_SANITIZERS) target_link_libraries(katehighlightingindexer Qt5::XmlPatterns) else() target_link_libraries(katehighlightingindexer Qt5::Core) diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp index 86b3a38b12..4de51ba7c8 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp @@ -31,7 +31,8 @@ using KSyntaxHighlighting::Xml::attrToBool; class HlFilesChecker { public: - void setDefinition(const QStringRef &verStr, const QString &filename, const QString &name) + template<typename T> + void setDefinition(const T &verStr, const QString &filename, const QString &name) { m_currentDefinition = &*m_definitions.insert(name, Definition{}); m_currentDefinition->languageName = name; @@ -93,6 +94,12 @@ public: continue; } + auto markAsUsedContext = [](ContextName &ContextName) { + if (!ContextName.stay && ContextName.context) { + ContextName.context->isOnlyIncluded = false; + } + }; + QMutableMapIterator<QString, Context> contextIt(contexts); while (contextIt.hasNext()) { contextIt.next(); @@ -100,12 +107,21 @@ public: resolveContextName(definition, context, context.lineEndContext, context.line); resolveContextName(definition, context, context.lineEmptyContext, context.line); resolveContextName(definition, context, context.fallthroughContext, context.line); + markAsUsedContext(context.lineEndContext); + markAsUsedContext(context.lineEmptyContext); + markAsUsedContext(context.fallthroughContext); for (auto &rule : context.rules) { + rule.parentContext = &context; resolveContextName(definition, context, rule.context, rule.line); + if (rule.type != Context::Rule::Type::IncludeRules) { + markAsUsedContext(rule.context); + } } } - definition.firstContext = &*definition.contexts.find(definition.firstContextName); + auto *firstContext = &*definition.contexts.find(definition.firstContextName); + firstContext->isOnlyIncluded = false; + definition.firstContext = firstContext; } resolveIncludeRules(); @@ -118,6 +134,7 @@ public: const auto usedContexts = extractUsedContexts(); QMap<const Definition *, const Definition *> maxVersionByDefinitions; + QMap<const Context::Rule *, IncludedRuleUnreachableBy> unreachableIncludedRules; QMapIterator<QString, Definition> def(m_definitions); while (def.hasNext()) { @@ -135,14 +152,7 @@ public: QSet<const Keywords *> referencedKeywords; QSet<ItemDatas::Style> usedAttributeNames; success = checkKeywordsList(definition, referencedKeywords) && success; - success = checkContexts(definition, referencedKeywords, usedAttributeNames, usedContexts) && success; - - // search for non-existing or unreferenced keyword lists. - for (const auto &keywords : definition.keywordsList) { - if (!referencedKeywords.contains(&keywords)) { - qWarning() << filename << "line" << keywords.line << "unused keyword:" << keywords.name; - } - } + success = checkContexts(definition, referencedKeywords, usedAttributeNames, usedContexts, unreachableIncludedRules) && success; // search for non-existing itemDatas. const auto invalidNames = usedAttributeNames - definition.itemDatas.styleNames; @@ -159,6 +169,56 @@ public: } } + QMutableMapIterator<const Context::Rule *, IncludedRuleUnreachableBy> unreachableIncludedRuleIt(unreachableIncludedRules); + while (unreachableIncludedRuleIt.hasNext()) { + unreachableIncludedRuleIt.next(); + IncludedRuleUnreachableBy &unreachableRulesBy = unreachableIncludedRuleIt.value(); + if (unreachableRulesBy.alwaysUnreachable) { + auto *rule = unreachableIncludedRuleIt.key(); + + if (!rule->parentContext->isOnlyIncluded) { + continue; + } + + // remove duplicates rules + QSet<const Context::Rule *> rules; + auto &unreachableBy = unreachableRulesBy.unreachableBy; + unreachableBy.erase(std::remove_if(unreachableBy.begin(), + unreachableBy.end(), + [&](const RuleAndInclude &ruleAndInclude) { + if (rules.contains(ruleAndInclude.rule)) { + return true; + } + rules.insert(ruleAndInclude.rule); + return false; + }), + unreachableBy.end()); + + QString message; + message.reserve(128); + for (auto &ruleAndInclude : std::as_const(unreachableBy)) { + message += QStringLiteral("line "); + message += QString::number(ruleAndInclude.rule->line); + message += QStringLiteral(" ["); + message += ruleAndInclude.rule->parentContext->name; + if (rule->filename != ruleAndInclude.rule->filename) { + message += QStringLiteral(" ("); + message += ruleAndInclude.rule->filename; + message += QLatin1Char(')'); + } + if (ruleAndInclude.includeRules) { + message += QStringLiteral(" via line "); + message += QString::number(ruleAndInclude.includeRules->line); + } + message += QStringLiteral("], "); + } + message.chop(2); + + qWarning() << rule->filename << "line" << rule->line << "no IncludeRule can reach this rule, hidden by" << message; + success = false; + } + } + return success; } @@ -176,7 +236,7 @@ private: int popCount = 0; bool stay = false; - const Context *context = nullptr; + Context *context = nullptr; }; struct Parser { @@ -185,12 +245,13 @@ private: QXmlStreamAttribute &attr; bool success; - //! Read a string type attribute, \c sucess = \c false when \p str is not empty + //! Read a string type attribute, \c success = \c false when \p str is not empty //! \return \c true when attr.name() == attrName, otherwise false bool extractString(QString &str, const QString &attrName) { - if (attr.name() != attrName) + if (attr.name() != attrName) { return false; + } str = attr.value().toString(); if (str.isEmpty()) { @@ -201,24 +262,26 @@ private: return true; } - //! Read a bool type attribute, \c sucess = \c false when \p xmlBool is not \c XmlBool::Unspecified. + //! Read a bool type attribute, \c success = \c false when \p xmlBool is not \c XmlBool::Unspecified. //! \return \c true when attr.name() == attrName, otherwise false bool extractXmlBool(XmlBool &xmlBool, const QString &attrName) { - if (attr.name() != attrName) + if (attr.name() != attrName) { return false; + } xmlBool = attr.value().isNull() ? XmlBool::Unspecified : attrToBool(attr.value()) ? XmlBool::True : XmlBool::False; return true; } - //! Read a positive integer type attribute, \c sucess = \c false when \p positive is already greater than or equal to 0 + //! Read a positive integer type attribute, \c success = \c false when \p positive is already greater than or equal to 0 //! \return \c true when attr.name() == attrName, otherwise false bool extractPositive(int &positive, const QString &attrName) { - if (attr.name() != attrName) + if (attr.name() != attrName) { return false; + } bool ok = true; positive = attr.value().toInt(&ok); @@ -231,12 +294,13 @@ private: return true; } - //! Read a color, \c sucess = \c false when \p color is already greater than or equal to 0 + //! Read a color, \c success = \c false when \p color is already greater than or equal to 0 //! \return \c true when attr.name() == attrName, otherwise false bool checkColor(const QString &attrName) { - if (attr.name() != attrName) + if (attr.name() != attrName) { return false; + } const auto value = attr.value().toString(); if (value.isEmpty() /*|| QColor(value).isValid()*/) { @@ -247,16 +311,17 @@ private: return true; } - //! Read a QChar, \c sucess = \c false when \p c is not \c '\0' or does not have one char + //! Read a QChar, \c success = \c false when \p c is not \c '\0' or does not have one char //! \return \c true when attr.name() == attrName, otherwise false bool extractChar(QChar &c, const QString &attrName) { - if (attr.name() != attrName) + if (attr.name() != attrName) { return false; + } - if (attr.value().size() == 1) + if (attr.value().size() == 1) { c = attr.value()[0]; - else { + } else { c = QLatin1Char('_'); qWarning() << filename << "line" << xml.lineNumber() << attrName << "must contain exactly one char:" << attr.value(); success = false; @@ -268,8 +333,9 @@ private: //! \return parsing status when \p isExtracted is \c true, otherwise \c false bool checkIfExtracted(bool isExtracted) { - if (isExtracted) + if (isExtracted) { return success; + } qWarning() << filename << "line" << xml.lineNumber() << "unknown attribute:" << attr.name(); return false; @@ -284,7 +350,7 @@ private: friend uint qHash(const Item &item, uint seed = 0) { - return qHash(item.content, seed); + return uint(qHash(item.content, seed)); } friend bool operator==(const Item &item0, const Item &item1) @@ -400,18 +466,19 @@ private: QString additionalDeliminator; QString weakDeliminator; - // rules included by IncludeRules + // rules included by IncludeRules (without IncludeRule) QVector<const Rule *> includedRules; // IncludeRules included by IncludeRules QSet<const Rule *> includedIncludeRules; + Context const *parentContext = nullptr; + QString filename; bool parseElement(const QString &filename, QXmlStreamReader &xml) { this->filename = filename; - line = xml.lineNumber(); using Pair = QPair<QString, Type>; @@ -579,6 +646,8 @@ private: }; int line; + // becomes false when a context refers to it + bool isOnlyIncluded = true; QString name; QString attribute; ContextName lineEndContext; @@ -650,7 +719,7 @@ private: friend uint qHash(const Style &style, uint seed = 0) { - return qHash(style.name, seed); + return uint(qHash(style.name, seed)); } friend bool operator==(const Style &style0, const Style &style1) @@ -723,8 +792,9 @@ private: { Context context; m_success = context.parseElement(m_currentDefinition->filename, xml) && m_success; - if (m_currentDefinition->firstContextName.isEmpty()) + if (m_currentDefinition->firstContextName.isEmpty()) { m_currentDefinition->firstContextName = context.name; + } if (m_currentDefinition->contexts.contains(context.name)) { qWarning() << m_currentDefinition->filename << "line" << xml.lineNumber() << "duplicate context:" << context.name; m_success = false; @@ -784,6 +854,7 @@ private: m_success = false; continue; } + if (rule.context.popCount) { qWarning() << definition.filename << "line" << rule.line << "IncludeRules with #pop prefix"; m_success = false; @@ -794,6 +865,8 @@ private: continue; } + // resolve includedRules and includedIncludeRules + usedContexts.clear(); usedContexts.insert(rule.context.context); contexts.clear(); @@ -866,11 +939,27 @@ private: return usedContexts; } + struct RuleAndInclude { + const Context::Rule *rule; + const Context::Rule *includeRules; + + explicit operator bool() const + { + return rule; + } + }; + + struct IncludedRuleUnreachableBy { + QVector<RuleAndInclude> unreachableBy; + bool alwaysUnreachable = true; + }; + //! Check contexts and rules bool checkContexts(const Definition &definition, QSet<const Keywords *> &referencedKeywords, QSet<ItemDatas::Style> &usedAttributeNames, - const QSet<const Context *> &usedContexts) const + const QSet<const Context *> &usedContexts, + QMap<const Context::Rule *, IncludedRuleUnreachableBy> &unreachableIncludedRules) const { bool success = true; @@ -892,16 +981,18 @@ private: success = false; } - if (!context.attribute.isEmpty()) + if (!context.attribute.isEmpty()) { usedAttributeNames.insert({context.attribute, context.line}); + } success = checkfallthrough(definition, context) && success; - success = checkUreachableRules(definition.filename, context) && success; + success = checkUreachableRules(definition.filename, context, unreachableIncludedRules) && success; success = suggestRuleMerger(definition.filename, context) && success; for (const auto &rule : context.rules) { - if (!rule.attribute.isEmpty()) + if (!rule.attribute.isEmpty()) { usedAttributeNames.insert({rule.attribute, rule.line}); + } success = checkLookAhead(rule) && success; success = checkStringDetect(rule) && success; success = checkAnyChar(rule) && success; @@ -954,9 +1045,14 @@ private: return false; } +#define REG_ESCAPE_CHAR R"(\\(?:[^0BDPSWbdpswoux]|x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\}|0\d\d|o\{[0-7]+\}|u[0-9a-fA-F]{4}))" +#define REG_CHAR "(?:" REG_ESCAPE_CHAR "|\\[(?:" REG_ESCAPE_CHAR "|.)\\]|[^[.^])" + // is RangeDetect - static const QRegularExpression isRange(QStringLiteral( - R"(^(\\(?:[^0BDPSWbdpswoux]|x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\}|0\d\d|o\{[0-7]+\}|u[0-9a-fA-F]{4})|[^[.]|\[[^].\\]\])(?:\.|\[^\1\])\*[?*]?\1$)")); + static const QRegularExpression isRange(QStringLiteral("^\\^?" REG_CHAR "(?:" + "\\.\\*[?*]?" REG_CHAR "|" + "\\[\\^(" REG_ESCAPE_CHAR "|.)\\]\\*[?*]?\\1" + ")$")); if (( rule.lookAhead == XmlBool::True || rule.minimal == XmlBool::True || rule.string.contains(QStringLiteral(".*?")) @@ -967,11 +1063,21 @@ private: return false; } + // is LineContinue + static const QRegularExpression isLineContinue(QStringLiteral("^\\^?" REG_CHAR "\\$$")); + if (reg.contains(isLineContinue)) { + auto extra = (reg[0] == QLatin1Char('^')) ? "with column=\"0\"" : ""; + qWarning() << filename << "line" << rule.line << "RegExpr should be replaced by LineContinue:" << rule.string << extra; + return false; + } + // replace \c, \xhhh, \x{hhh...}, \0dd, \o{ddd}, \uhhhh, with _ - static const QRegularExpression sanitize1( - QStringLiteral(R"(\\(?:[^0BDPSWbdpswoux]|x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\}|0\d\d|o\{[0-7]+\}|u[0-9a-fA-F]{4}))")); + static const QRegularExpression sanitize1(QStringLiteral(REG_ESCAPE_CHAR)); reg.replace(sanitize1, QStringLiteral("_")); +#undef REG_CHAR +#undef REG_ESCAPE_CHAR + // use minimal or lazy operator static const QRegularExpression isMinimal(QStringLiteral( R"([.][*+][^][?+*()|$]*$)")); @@ -1008,8 +1114,9 @@ private: char const *extraMsg = rule.string.contains(QLatin1Char('^')) ? "+ column=\"0\" or firstNonSpace=\"1\"" : ""; qWarning() << rule.filename << "line" << rule.line << "RegExpr should be replaced by StringDetect / Detect2Chars / DetectChar" << extraMsg << ":" << rule.string; - if (len != reg.size()) + if (len != reg.size()) { qWarning() << rule.filename << "line" << rule.line << "insensitive=\"1\" missing:" << rule.string; + } return false; } @@ -1019,8 +1126,8 @@ private: // (^sas*) -> ok // (^sa|s*) -> ko // (^(sa|s*)) -> ok - auto first = qAsConst(reg).begin(); - auto last = qAsConst(reg).end(); + auto first = std::as_const(reg).begin(); + auto last = std::as_const(reg).end(); int depth = 0; while (QLatin1Char('(') == *first) { @@ -1066,8 +1173,8 @@ private: // add ^ with column=0 if (rule.column == 0 && !rule.isDotRegex) { bool hasStartOfLine = false; - auto first = qAsConst(reg).begin(); - auto last = qAsConst(reg).end(); + auto first = std::as_const(reg).begin(); + auto last = std::as_const(reg).end(); for (; first != last; ++first) { if (*first == QLatin1Char('^')) { hasStartOfLine = true; @@ -1306,8 +1413,9 @@ private: //! Search for additionalDeliminator/weakDeliminator which has no effect. bool checkDelimiters(const Definition &definition, const Context::Rule &rule) const { - if (rule.additionalDeliminator.isEmpty() && rule.weakDeliminator.isEmpty()) + if (rule.additionalDeliminator.isEmpty() && rule.weakDeliminator.isEmpty()) { return true; + } bool success = true; @@ -1472,16 +1580,39 @@ private: //! - StringDetect, WordDetect, RegExpr with as prefix Detect2Chars or other strings //! - duplicate rule (Int, Float, keyword with same String, etc) //! - Rule hidden by a dot regex - bool checkUreachableRules(const QString &filename, const Context &context) const + bool checkUreachableRules(const QString &filename, + const Context &context, + QMap<const Context::Rule *, IncludedRuleUnreachableBy> &unreachableIncludedRules) const { - struct RuleAndInclude { - const Context::Rule *rule; - const Context::Rule *includeRules; + if (context.isOnlyIncluded) { + return true; + } - explicit operator bool() const + struct Rule4 { + RuleAndInclude setRule(const Context::Rule &rule, const Context::Rule *includeRules = nullptr) { - return rule; + auto set = [&](RuleAndInclude &ruleAndInclude) { + auto old = ruleAndInclude; + ruleAndInclude = {&rule, includeRules}; + return old; + }; + + if (rule.firstNonSpace == XmlBool::True) { + return set(firstNonSpace); + } else if (rule.column == 0) { + return set(column0); + } else if (rule.column > 0) { + return set(columnGreaterThan0[rule.column]); + } else { + return set(normal); + } } + + private: + RuleAndInclude normal; + RuleAndInclude column0; + QMap<int, RuleAndInclude> columnGreaterThan0; + RuleAndInclude firstNonSpace; }; // Associate QChar with RuleAndInclude @@ -1489,8 +1620,9 @@ private: /// Search RuleAndInclude associated with @p c. RuleAndInclude find(QChar c) const { - if (c.unicode() < 128) + if (c.unicode() < 128) { return m_asciiMap[c.unicode()]; + } auto it = m_utf8Map.find(c); return it == m_utf8Map.end() ? RuleAndInclude{nullptr, nullptr} : it.value(); } @@ -1517,10 +1649,11 @@ private: /// Associates @p c with a rule. void append(QChar c, const Context::Rule &rule, const Context::Rule *includeRule = nullptr) { - if (c.unicode() < 128) + if (c.unicode() < 128) { m_asciiMap[c.unicode()] = {&rule, includeRule}; - else + } else { m_utf8Map[c] = {&rule, includeRule}; + } } /// Associates each character of @p s with a rule. @@ -1549,13 +1682,15 @@ private: // Char4Tables::char is always added. CharTableArray(Char4Tables &tables, const Context::Rule &rule) { - if (rule.firstNonSpace == XmlBool::True) + if (rule.firstNonSpace == XmlBool::True) { appendTable(tables.charsFirstNonSpace); + } - if (rule.column == 0) + if (rule.column == 0) { appendTable(tables.charsColumn0); - else if (rule.column > 0) + } else if (rule.column > 0) { appendTable(tables.charsColumnGreaterThan0[rule.column]); + } appendTable(tables.chars); } @@ -1572,8 +1707,9 @@ private: RuleAndInclude find(QChar c) const { for (int i = 0; i < m_size; ++i) { - if (auto ruleAndInclude = m_charTables[i]->find(c)) + if (auto ruleAndInclude = m_charTables[i]->find(c)) { return ruleAndInclude; + } } return RuleAndInclude{nullptr, nullptr}; } @@ -1621,9 +1757,19 @@ private: int m_size = 0; }; + struct ObservableRule { + const Context::Rule *rule; + const Context::Rule *includeRules; + + bool hasResolvedIncludeRules() const + { + return rule == includeRules; + } + }; + // Iterates over all the rules, including those in includedRules struct RuleIterator { - RuleIterator(const QVector<Context::Rule> &rules, const Context::Rule &endRule) + RuleIterator(const QVector<ObservableRule> &rules, const ObservableRule &endRule) : m_end(&endRule - rules.data()) , m_rules(rules) { @@ -1635,7 +1781,7 @@ private: // if in includedRules if (m_includedRules) { ++m_i2; - if (m_i2 != m_rules[m_i].includedRules.size()) { + if (m_i2 != m_includedRules->size()) { return (*m_includedRules)[m_i2]; } ++m_i; @@ -1643,10 +1789,10 @@ private: } // if is a includedRules - while (m_i < m_end && m_rules[m_i].type == Context::Rule::Type::IncludeRules) { - if (m_rules[m_i].includedRules.size()) { + while (m_i < m_end && m_rules[m_i].rule->type == Context::Rule::Type::IncludeRules) { + if (!m_rules[m_i].includeRules && m_rules[m_i].rule->includedRules.size()) { m_i2 = 0; - m_includedRules = &m_rules[m_i].includedRules; + m_includedRules = &m_rules[m_i].rule->includedRules; return (*m_includedRules)[m_i2]; } ++m_i; @@ -1654,7 +1800,7 @@ private: if (m_i < m_end) { ++m_i; - return &m_rules[m_i - 1]; + return m_rules[m_i - 1].rule; } return nullptr; @@ -1663,14 +1809,14 @@ private: /// \return current IncludeRules or nullptr const Context::Rule *currentIncludeRules() const { - return m_includedRules ? &m_rules[m_i] : nullptr; + return m_includedRules ? m_rules[m_i].rule : m_rules[m_i].includeRules; } private: int m_i = 0; int m_i2; int m_end; - const QVector<Context::Rule> &m_rules; + const QVector<ObservableRule> &m_rules; const QVector<const Context::Rule *> *m_includedRules = nullptr; }; @@ -1680,20 +1826,24 @@ private: void append(const Context::Rule &rule, const Context::Rule *includedRule) { auto array = extractDotRegexes(rule); - if (array[0]) + if (array[0]) { *array[0] = {&rule, includedRule}; - if (array[1]) + } + if (array[1]) { *array[1] = {&rule, includedRule}; + } } /// Search dot regex which hides @p rule RuleAndInclude find(const Context::Rule &rule) { auto array = extractDotRegexes(rule); - if (array[0]) + if (array[0]) { return *array[0]; - if (array[1]) + } + if (array[1]) { return *array[1]; + } return RuleAndInclude{}; } @@ -1707,13 +1857,15 @@ private: if (rule.firstNonSpace != XmlBool::True && rule.column == -1) { ret[0] = &dotRegex; } else { - if (rule.firstNonSpace == XmlBool::True) + if (rule.firstNonSpace == XmlBool::True) { ret[0] = &dotRegexFirstNonSpace; + } - if (rule.column == 0) + if (rule.column == 0) { ret[1] = &dotRegexColumn0; - else if (rule.column > 0) + } else if (rule.column > 0) { ret[1] = &dotRegexColumnGreaterThan0[rule.column]; + } } return ret; @@ -1734,23 +1886,44 @@ private: // characters of LineContinue Char4Tables lineContinueChars; - RuleAndInclude intRule{}; - RuleAndInclude floatRule{}; - RuleAndInclude hlCCharRule{}; - RuleAndInclude hlCOctRule{}; - RuleAndInclude hlCHexRule{}; - RuleAndInclude hlCStringCharRule{}; + Rule4 intRule{}; + Rule4 floatRule{}; + Rule4 hlCCharRule{}; + Rule4 hlCOctRule{}; + Rule4 hlCHexRule{}; + Rule4 hlCStringCharRule{}; + Rule4 detectIdentifierRule{}; // Contains includedRules and included includedRules QMap<Context const*, RuleAndInclude> includeContexts; DotRegex dotRegex; + QVector<ObservableRule> observedRules; + observedRules.reserve(context.rules.size()); for (const Context::Rule &rule : context.rules) { + const Context::Rule *includeRule = nullptr; + if (rule.type == Context::Rule::Type::IncludeRules) { + auto *context = rule.context.context; + if (context && context->isOnlyIncluded) { + includeRule = &rule; + } + } + + observedRules.push_back({&rule, includeRule}); + if (includeRule) { + for (const Context::Rule *rule2 : rule.includedRules) { + observedRules.push_back({rule2, includeRule}); + } + } + } + + for (auto &observedRule : observedRules) { + const Context::Rule &rule = *observedRule.rule; bool isUnreachable = false; QVector<RuleAndInclude> unreachableBy; - // declare rule as unreacheable if ruleAndInclude is not empty + // declare rule as unreachable if ruleAndInclude is not empty auto updateUnreachable1 = [&](RuleAndInclude ruleAndInclude) { if (ruleAndInclude) { isUnreachable = true; @@ -1758,7 +1931,7 @@ private: } }; - // declare rule as unreacheable if ruleAndIncludes is not empty + // declare rule as unreachable if ruleAndIncludes is not empty auto updateUnreachable2 = [&](const QVector<RuleAndInclude> &ruleAndIncludes) { if (!ruleAndIncludes.isEmpty()) { isUnreachable = true; @@ -1810,43 +1983,42 @@ private: // check if hidden by DetectChar/AnyChar case Context::Rule::Type::HlCChar: updateUnreachable1(CharTableArray(detectChars, rule).find(QLatin1Char('\''))); - updateUnreachable1(hlCCharRule); - hlCCharRule = {&rule, nullptr}; + updateUnreachable1(hlCCharRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar case Context::Rule::Type::HlCHex: updateUnreachable1(CharTableArray(detectChars, rule).find(QLatin1Char('0'))); - updateUnreachable1(hlCHexRule); - hlCHexRule = {&rule, nullptr}; + updateUnreachable1(hlCHexRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar case Context::Rule::Type::HlCOct: updateUnreachable1(CharTableArray(detectChars, rule).find(QLatin1Char('0'))); - updateUnreachable1(hlCOctRule); - hlCOctRule = {&rule, nullptr}; + updateUnreachable1(hlCOctRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar case Context::Rule::Type::HlCStringChar: updateUnreachable1(CharTableArray(detectChars, rule).find(QLatin1Char('\\'))); - updateUnreachable1(hlCStringCharRule); - hlCStringCharRule = {&rule, nullptr}; + updateUnreachable1(hlCStringCharRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar case Context::Rule::Type::Int: updateUnreachable2(CharTableArray(detectChars, rule).find(QStringLiteral("0123456789"))); - updateUnreachable1(intRule); - intRule = {&rule, nullptr}; + updateUnreachable1(intRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar case Context::Rule::Type::Float: updateUnreachable2(CharTableArray(detectChars, rule).find(QStringLiteral("0123456789."))); - updateUnreachable1(floatRule); - floatRule = {&rule, nullptr}; + updateUnreachable1(floatRule.setRule(rule)); + break; + + // check if hidden by another DetectIdentifier rule + case Context::Rule::Type::DetectIdentifier: + updateUnreachable1(detectIdentifierRule.setRule(rule)); break; // check if hidden by DetectChar/AnyChar or another LineContinue @@ -1865,10 +2037,11 @@ private: case Context::Rule::Type::RangeDetect: updateUnreachable1(CharTableArray(detectChars, rule).find(rule.char0)); if (!isUnreachable) { - RuleIterator ruleIterator(context.rules, rule); + RuleIterator ruleIterator(observedRules, observedRule); while (const auto *rulePtr = ruleIterator.next()) { - if (isUnreachable) + if (isUnreachable) { break; + } const auto &rule2 = *rulePtr; if (rule2.type == rule.type && isCompatible(rule2) && rule.char0 == rule2.char0 && rule.char1 == rule2.char1) { updateUnreachable1({&rule2, ruleIterator.currentIncludeRules()}); @@ -1884,10 +2057,11 @@ private: } // check that `rule` does not have another RegExpr as a prefix - RuleIterator ruleIterator(context.rules, rule); + RuleIterator ruleIterator(observedRules, observedRule); while (const auto *rulePtr = ruleIterator.next()) { - if (isUnreachable) + if (isUnreachable) { break; + } const auto &rule2 = *rulePtr; if (rule2.type == Context::Rule::Type::RegExpr && isCompatible(rule2) && rule.insensitive == rule2.insensitive && rule.dynamic == rule2.dynamic && rule.string.startsWith(rule2.string)) { @@ -1902,10 +2076,11 @@ private: case Context::Rule::Type::StringDetect: { // check that dynamic `rule` does not have another dynamic StringDetect as a prefix if (rule.type == Context::Rule::Type::StringDetect && rule.dynamic == XmlBool::True) { - RuleIterator ruleIterator(context.rules, rule); + RuleIterator ruleIterator(observedRules, observedRule); while (const auto *rulePtr = ruleIterator.next()) { - if (isUnreachable) + if (isUnreachable) { break; + } const auto &rule2 = *rulePtr; if (rule2.type != Context::Rule::Type::StringDetect || rule2.dynamic != XmlBool::True || !isCompatible(rule2)) { @@ -1963,10 +2138,11 @@ private: // combination of uppercase and lowercase RuleAndInclude detect2CharsInsensitives[]{{}, {}, {}, {}}; - RuleIterator ruleIterator(context.rules, rule); + RuleIterator ruleIterator(observedRules, observedRule); while (const auto *rulePtr = ruleIterator.next()) { - if (isUnreachable) + if (isUnreachable) { break; + } const auto &rule2 = *rulePtr; const bool isSensitive = (rule2.insensitive == XmlBool::True); const auto caseSensitivity = isSensitive ? Qt::CaseInsensitive : Qt::CaseSensitive; @@ -2030,10 +2206,11 @@ private: // check if hidden by another keyword rule case Context::Rule::Type::keyword: { - RuleIterator ruleIterator(context.rules, rule); + RuleIterator ruleIterator(observedRules, observedRule); while (const auto *rulePtr = ruleIterator.next()) { - if (isUnreachable) + if (isUnreachable) { break; + } const auto &rule2 = *rulePtr; if (rule2.type == Context::Rule::Type::keyword && isCompatible(rule2) && rule.string == rule2.string) { updateUnreachable1({&rule2, ruleIterator.currentIncludeRules()}); @@ -2049,6 +2226,10 @@ private: // <includedRules .../> <- reference a <DetectChar char="{" /> who will be added // <DetectChar char="{" /> <- hidden by previous rule case Context::Rule::Type::IncludeRules: + if (observedRule.includeRules && !observedRule.hasResolvedIncludeRules()) { + break; + } + if (auto &ruleAndInclude = includeContexts[rule.context.context]) { updateUnreachable1(ruleAndInclude); } @@ -2060,6 +2241,10 @@ private: includeContexts.insert(rulePtr->context.context, RuleAndInclude{rulePtr, &rule}); } + if (observedRule.includeRules) { + break; + } + for (const auto *rulePtr : rule.includedRules) { const auto &rule2 = *rulePtr; switch (rule2.type) { @@ -2087,27 +2272,27 @@ private: } case Context::Rule::Type::HlCChar: - hlCCharRule = {&rule2, &rule}; + hlCCharRule.setRule(rule2, &rule); break; case Context::Rule::Type::HlCHex: - hlCHexRule = {&rule2, &rule}; + hlCHexRule.setRule(rule2, &rule); break; case Context::Rule::Type::HlCOct: - hlCOctRule = {&rule2, &rule}; + hlCOctRule.setRule(rule2, &rule); break; case Context::Rule::Type::HlCStringChar: - hlCStringCharRule = {&rule2, &rule}; + hlCStringCharRule.setRule(rule2, &rule); break; case Context::Rule::Type::Int: - intRule = {&rule2, &rule}; + intRule.setRule(rule2, &rule); break; case Context::Rule::Type::Float: - floatRule = {&rule2, &rule}; + floatRule.setRule(rule2, &rule); break; case Context::Rule::Type::LineContinue: { @@ -2136,12 +2321,18 @@ private: } break; - case Context::Rule::Type::DetectIdentifier: case Context::Rule::Type::Unknown: break; } - if (isUnreachable) { + if (observedRule.includeRules && !observedRule.hasResolvedIncludeRules()) { + auto &unreachableIncludedRule = unreachableIncludedRules[&rule]; + if (isUnreachable && unreachableIncludedRule.alwaysUnreachable) { + unreachableIncludedRule.unreachableBy.append(unreachableBy); + } else { + unreachableIncludedRule.alwaysUnreachable = false; + } + } else if (isUnreachable) { success = false; QString message; message.reserve(128); @@ -2165,7 +2356,7 @@ private: message += QStringLiteral(", "); } message.chop(2); - qWarning() << filename << "line" << rule.line << "unreachable element by" << message; + qWarning() << filename << "line" << rule.line << "unreachable rule by" << message; } } @@ -2179,8 +2370,9 @@ private: { bool success = true; - if (context.rules.isEmpty()) + if (context.rules.isEmpty()) { return success; + } auto it = context.rules.begin(); const auto end = context.rules.end() - 1; @@ -2249,7 +2441,7 @@ private: //! - "#pop!Comment" -> "Comment" //! - "##ISO C++" -> "" //! - "Comment##ISO C++"-> "Comment" in ISO C++ - void resolveContextName(Definition &definition, const Context &context, ContextName &contextName, int line) + void resolveContextName(Definition &definition, Context &context, ContextName &contextName, int line) { QString name = contextName.name; if (name.isEmpty()) { @@ -2281,8 +2473,9 @@ private: const int idx = name.indexOf(QStringLiteral("##")); if (idx == -1) { auto it = definition.contexts.find(name); - if (it != definition.contexts.end()) + if (it != definition.contexts.end()) { contextName.context = &*it; + } } else { auto defName = name.mid(idx + 2); auto listName = name.left(idx); @@ -2392,14 +2585,16 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); // ensure enough arguments are passed - if (app.arguments().size() < 3) + if (app.arguments().size() < 3) { return 1; + } #ifdef QT_XMLPATTERNS_LIB // open schema QXmlSchema schema; - if (!schema.load(QUrl::fromLocalFile(app.arguments().at(2)))) + if (!schema.load(QUrl::fromLocalFile(app.arguments().at(2)))) { return 2; + } #endif const QString hlFilenamesListing = app.arguments().value(3); @@ -2422,7 +2617,7 @@ int main(int argc, char *argv[]) HlFilesChecker filesChecker; QVariantMap hls; int anyError = 0; - for (const QString &hlFilename : qAsConst(hlFilenames)) { + for (const QString &hlFilename : std::as_const(hlFilenames)) { QFile hlFile(hlFilename); if (!hlFile.open(QIODevice::ReadOnly)) { qWarning("Failed to open %s", qPrintable(hlFilename)); @@ -2456,7 +2651,7 @@ int main(int argc, char *argv[]) QVariantMap hl; // transfer text attributes - for (const QString &attribute : qAsConst(textAttributes)) { + for (const QString &attribute : std::as_const(textAttributes)) { hl[attribute] = xml.attributes().value(attribute).toString(); } @@ -2489,17 +2684,20 @@ int main(int argc, char *argv[]) filesChecker.resolveContexts(); - if (!filesChecker.check()) + if (!filesChecker.check()) { anyError = 7; + } // bail out if any problem was seen - if (anyError) + if (anyError) { return anyError; + } // create outfile, after all has worked! QFile outFile(app.arguments().at(1)); - if (!outFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) + if (!outFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { return 9; + } // write out json outFile.write(QCborValue::fromVariant(QVariant(hls)).toCbor()); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt index 722f92742b..43a60cc19b 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt @@ -1,6 +1,8 @@ +add_library(KF5SyntaxHighlighting) + ecm_create_qm_loader(syntax_highlighting_QM_LOADER syntaxhighlighting5_qt) -set(syntax_highlighting_srcs +target_sources(KF5SyntaxHighlighting PRIVATE abstracthighlighter.cpp context.cpp contextswitch.cpp @@ -20,8 +22,9 @@ set(syntax_highlighting_srcs themedata.cpp worddelimiters.cpp ${syntax_highlighting_QM_LOADER} + $<TARGET_OBJECTS:SyntaxHighlightingData> ) -ecm_qt_declare_logging_category(syntax_highlighting_srcs +ecm_qt_declare_logging_category(KF5SyntaxHighlighting HEADER ksyntaxhighlighting_logging.h IDENTIFIER KSyntaxHighlighting::Log CATEGORY_NAME kf.syntaxhighlighting @@ -30,16 +33,27 @@ ecm_qt_declare_logging_category(syntax_highlighting_srcs EXPORT KSYNTAXHIGHLIGHTING ) -add_library(KF5SyntaxHighlighting ${syntax_highlighting_srcs} $<TARGET_OBJECTS:SyntaxHighlightingData>) -generate_export_header(KF5SyntaxHighlighting BASE_NAME KSyntaxHighlighting) +ecm_generate_export_header(KF5SyntaxHighlighting + BASE_NAME KSyntaxHighlighting + GROUP_BASE_NAME KF + VERSION ${KF_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.87 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) set_target_properties(KF5SyntaxHighlighting PROPERTIES - VERSION ${SyntaxHighlighting_VERSION_STRING} + VERSION ${SyntaxHighlighting_VERSION} SOVERSION ${SyntaxHighlighting_SOVERSION} EXPORT_NAME SyntaxHighlighting ) target_include_directories(KF5SyntaxHighlighting INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KSyntaxHighlighting;${KDE_INSTALL_INCLUDEDIR_KF5}>") target_include_directories(KF5SyntaxHighlighting PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR};>") -target_link_libraries(KF5SyntaxHighlighting LINK_PUBLIC Qt5::Gui LINK_PRIVATE Qt5::Network) +target_link_libraries(KF5SyntaxHighlighting + PUBLIC + Qt5::Gui + PRIVATE + Qt5::Network +) ecm_generate_headers(SyntaxHighlighting_HEADERS HEADER_NAMES @@ -52,6 +66,7 @@ ecm_generate_headers(SyntaxHighlighting_HEADERS State SyntaxHighlighter Theme + WildcardMatcher REQUIRED_HEADERS SyntaxHighlighting_HEADERS ) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp index 2ad9d371f9..d6f8cad0c7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp @@ -36,11 +36,13 @@ void AbstractHighlighterPrivate::ensureDefinitionLoaded() defData = DefinitionData::get(m_definition); } - if (Q_UNLIKELY(!defData->repo && !defData->fileName.isEmpty())) + if (Q_UNLIKELY(!defData->repo && !defData->fileName.isEmpty())) { qCCritical(Log) << "Repository got deleted while a highlighter is still active!"; + } - if (m_definition.isValid()) + if (m_definition.isValid()) { defData->load(); + } } AbstractHighlighter::AbstractHighlighter() @@ -85,7 +87,7 @@ void AbstractHighlighter::setTheme(const Theme &theme) * Returns the index of the first non-space character. If the line is empty, * or only contains white spaces, text.size() is returned. */ -static inline int firstNonSpaceChar(const QString &text) +static inline int firstNonSpaceChar(QStringView text) { for (int i = 0; i < text.length(); ++i) { if (!text[i].isSpace()) { @@ -95,8 +97,15 @@ static inline int firstNonSpaceChar(const QString &text) return text.size(); } +#if KSYNTAXHIGHLIGHTING_BUILD_DEPRECATED_SINCE(5, 87) State AbstractHighlighter::highlightLine(const QString &text, const State &state) { + return highlightLine(QStringView(text), state); +} +#endif + +State AbstractHighlighter::highlightLine(QStringView text, const State &state) +{ Q_D(AbstractHighlighter); // verify definition, deal with no highlighting being enabled @@ -145,8 +154,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state * skipping empty lines after a line continuation character (see bug 405903) */ } else if (!stateData->topContext()->lineEndContext().isStay() - && !d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) + && !d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) { break; + } // guard against endless loops ++endlessLoopingCounter; @@ -160,7 +170,8 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state return newState; } - int offset = 0, beginOffset = 0; + int offset = 0; + int beginOffset = 0; bool lineContinuation = false; /** @@ -247,8 +258,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state skipOffsets.clear(); } const auto currentSkipOffset = skipOffsets.value(rule.get()); - if (currentSkipOffset < 0 || currentSkipOffset > offset) + if (currentSkipOffset < 0 || currentSkipOffset > offset) { continue; + } const auto newResult = rule->doMatch(text, offset, stateData->topCaptures()); newOffset = newResult.offset(); @@ -265,8 +277,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state } } - if (newOffset <= offset) + if (newOffset <= offset) { continue; + } /** * apply folding. @@ -274,12 +287,14 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state * - rule with endRegion + beginRegion: in endRegion, the length is 0 * - rule with lookAhead: length is 0 */ - if (rule->endRegion().isValid() && rule->beginRegion().isValid()) + if (rule->endRegion().isValid() && rule->beginRegion().isValid()) { applyFolding(offset, 0, rule->endRegion()); - else if (rule->endRegion().isValid()) + } else if (rule->endRegion().isValid()) { applyFolding(offset, rule->isLookAhead() ? 0 : newOffset - offset, rule->endRegion()); - if (rule->beginRegion().isValid()) + } + if (rule->beginRegion().isValid()) { applyFolding(offset, rule->isLookAhead() ? 0 : newOffset - offset, rule->beginRegion()); + } if (rule->isLookAhead()) { Q_ASSERT(!rule->context().isStay()); @@ -290,12 +305,14 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state d->switchContext(stateData, rule->context(), newResult.captures()); newFormat = rule->attributeFormat().isValid() ? &rule->attributeFormat() : &stateData->topContext()->attributeFormat(); - if (newOffset == text.size() && std::dynamic_pointer_cast<LineContinue>(rule)) + if (newOffset == text.size() && std::dynamic_pointer_cast<LineContinue>(rule)) { lineContinuation = true; + } break; } - if (isLookAhead) + if (isLookAhead) { continue; + } if (newOffset <= offset) { // no matching rule if (stateData->topContext()->fallthrough()) { @@ -316,8 +333,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state * on format change, apply the last one and switch to new one */ if (newFormat != currentFormat && newFormat->id() != currentFormat->id()) { - if (offset > 0) + if (offset > 0) { applyFormat(beginOffset, offset - beginOffset, *currentFormat); + } beginOffset = offset; currentFormat = newFormat; } @@ -333,8 +351,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state /** * apply format for remaining text, if any */ - if (beginOffset < offset) + if (beginOffset < offset) { applyFormat(beginOffset, text.size() - beginOffset, *currentFormat); + } /** * handle line end context switches @@ -344,8 +363,9 @@ State AbstractHighlighter::highlightLine(const QString &text, const State &state { int endlessLoopingCounter = 0; while (!stateData->topContext()->lineEndContext().isStay() && !lineContinuation) { - if (!d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) + if (!d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) { break; + } // guard against endless loops ++endlessLoopingCounter; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h index 5e85873ce0..49cfbf2530 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h @@ -108,6 +108,15 @@ protected: AbstractHighlighter(); AbstractHighlighter(AbstractHighlighterPrivate *dd); +#if KSYNTAXHIGHLIGHTING_ENABLE_DEPRECATED_SINCE(5, 87) + /** + * @copydoc highlightLine(QStringView,const State&) + * @deprecated since 5.87, use highlightLine(QStringView, const State&) instead. + */ + // no deprecation warning, as removal of this will automatically "port" the using code + State highlightLine(const QString &text, const State &state); +#endif + // TODO KF6: add an optional void* context argument that is passed through // to the applyX() calls, so highlighters dealing with some form of line object // (such as QSyntaxHighlighter or KTextEditor) can avoid some ugly hacks to have @@ -120,14 +129,14 @@ protected: * @param state The highlighting state handle returned by the call * to highlightLine() for the previous line. For the very first line, * just pass a default constructed State(). - * @returns The state of the highlighing engine after processing the + * @returns The state of the highlighting engine after processing the * given line. This needs to passed into highlightLine() for the * next line. You can store the state for efficient partial * re-highlighting for example during editing. * * @see applyFormat(), applyFolding() */ - State highlightLine(const QString &text, const State &state); + State highlightLine(QStringView text, const State &state); /** * Reimplement this to apply formats to your output. The provided @p format diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp index 9ff012e1d7..8ae47d80eb 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp @@ -33,10 +33,6 @@ struct CieLab { double b; }; -#ifndef M_PI -constexpr double M_PI = 3.14159265358979323846; -#endif - // clang-format off // xterm color reference // constexpr Rgb888 xterm256Colors[] { @@ -388,10 +384,11 @@ CieLab rgbToLab(QRgb rgb) // Perform the inverse gamma companding for a sRGB color // http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html auto inverseGammaCompanding = [](int c) { - if (c <= 10) + if (c <= 10) { return c / (255.0 * 12.92); - else + } else { return std::pow((c / 255.0 + 0.055) / 1.055, 2.4); + } }; const double r = inverseGammaCompanding(qRed(rgb)); @@ -404,10 +401,11 @@ CieLab rgbToLab(QRgb rgb) // http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html auto f = [](double t) { - if (t > 216.0 / 24389.0) + if (t > 216.0 / 24389.0) { return std::cbrt(t); - else + } else { return t * (24389.0 / (27.0 * 116.0)) + 4.0 / 29.0; + } }; const double f_x = f(x / illuminant_D65[0]); @@ -440,8 +438,9 @@ inline double pow2(double x) inline double computeHPrime(double a_prime, double b) { - if (std::abs(a_prime) < epsilon && std::abs(b) < epsilon) + if (std::abs(a_prime) < epsilon && std::abs(b) < epsilon) { return 0.0; + } const double value = std::atan2(b, a_prime) * 180.0 / M_PI; return (value < 0.0) ? value + 360.0 : value; @@ -449,34 +448,38 @@ inline double computeHPrime(double a_prime, double b) inline double computeDeltaHPrime(double C1_prime, double C2_prime, double h1_prime, double h2_prime) { - if (C1_prime * C2_prime < epsilon) + if (C1_prime * C2_prime < epsilon) { return 0.0; + } const double diff = h2_prime - h1_prime; - if (std::abs(diff) <= 180.0) + if (std::abs(diff) <= 180.0) { return diff; - else if (diff > 180.0) + } else if (diff > 180.0) { return diff - 360.0; - else + } else { return diff + 360.0; + } } inline double computeHPrimeBar(double C1_prime, double C2_prime, double h1_prime, double h2_prime) { const double sum = h1_prime + h2_prime; - if (C1_prime * C2_prime < epsilon) + if (C1_prime * C2_prime < epsilon) { return sum; + } const double dist = std::abs(h1_prime - h2_prime); - if (dist <= 180.0) + if (dist <= 180.0) { return 0.5 * sum; - else if (sum < 360.0) + } else if (sum < 360.0) { return 0.5 * (sum + 360.0); - else + } else { return 0.5 * (sum - 360.0); + } } /// Calculate the perceptual color difference based on CIEDE2000. @@ -702,7 +705,7 @@ struct GraphLine { const int n2 = offset - labelLineLength; labelLineLength += n2 + 1; fillLine(labelLine, n2); - labelLine += graphLine.rightRef(graphLine.size() - ps1); + labelLine += QStringView(graphLine).right(graphLine.size() - ps1); } } @@ -781,8 +784,9 @@ public: state = highlightLine(currentLine, state); if (hasSeparator) { - if (!firstLine) + if (!firstLine) { out << QStringLiteral("\x1b[0m────────────────────────────────────────────────────\x1b[K\n"); + } firstLine = false; } @@ -793,14 +797,15 @@ public: for (const auto &fragment : m_highlightedFragments) { auto const &ansiStyle = ansiStyles[fragment.formatId]; - out << ansiStyle.first << currentLine.midRef(fragment.offset, fragment.length) << ansiStyle.second; + out << ansiStyle.first << QStringView(currentLine).mid(fragment.offset, fragment.length) << ansiStyle.second; } out << QStringLiteral("\x1b[K\n"); if (hasFormatOrContextTrace && !m_highlightedFragments.empty()) { - if (m_hasContextTrace || m_hasStackSizeTrace) + if (m_hasContextTrace || m_hasStackSizeTrace) { appendContextNames(oldState, currentLine); + } printFormats(out, infoStyle, ansiStyles); out << resetBgColor; @@ -817,8 +822,9 @@ public: void applyFolding(int offset, int /*length*/, FoldingRegion region) override { - if (!m_hasRegionTrace) + if (!m_hasRegionTrace) { return; + } const auto id = region.id(); @@ -829,8 +835,9 @@ public: auto &previousRegion = m_regions[m_regions.size() - 2]; if (previousRegion.state == Region::State::Close && previousRegion.offset == offset) { std::swap(previousRegion, m_regions.back()); - if (previousRegion.bindIndex != -1) + if (previousRegion.bindIndex != -1) { m_regions[previousRegion.bindIndex].bindIndex = m_regions.size() - 1; + } } } ++m_regionDepth; @@ -840,10 +847,11 @@ public: auto eit = m_regions.rend(); for (int depth = 0; it != eit; ++it) { if (it->regionId == id && it->bindIndex < 0) { - if (it->state == Region::State::Close) + if (it->state == Region::State::Close) { ++depth; - else if (--depth < 0) + } else if (--depth < 0) { break; + } } } @@ -868,8 +876,9 @@ private: void initRegionStyles(const std::vector<QPair<QString, QString>> &ansiStyles) { m_regionStyles.resize(ansiStyles.size()); - for (std::size_t i = 0; i < m_regionStyles.size(); ++i) + for (std::size_t i = 0; i < m_regionStyles.size(); ++i) { m_regionStyles[i] = ansiStyles[i].first; + } std::sort(m_regionStyles.begin(), m_regionStyles.end()); m_regionStyles.erase(std::unique(m_regionStyles.begin(), m_regionStyles.end()), m_regionStyles.end()); @@ -1216,7 +1225,7 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE } // initialize ansiStyles - for (auto &&definition : qAsConst(definitions)) { + for (auto &&definition : std::as_const(definitions)) { const auto formats = definition.formats(); for (auto &&format : formats) { const auto id = format.id(); @@ -1236,20 +1245,26 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE const bool hasUnderline = format.isUnderline(theme); const bool hasStrikeThrough = format.isStrikeThrough(theme); - if (hasFg) + if (hasFg) { buffer.appendForeground(format.textColor(theme).rgb(), is256Colors, colorCache); - else + } else { buffer.append(foregroundDefaultColor); - if (hasBg) + } + if (hasBg) { buffer.appendBackground(format.backgroundColor(theme).rgb(), is256Colors, colorCache); - if (hasBold) + } + if (hasBold) { buffer.append(QLatin1String("1;")); - if (hasItalic) + } + if (hasItalic) { buffer.append(QLatin1String("3;")); - if (hasUnderline) + } + if (hasUnderline) { buffer.append(QLatin1String("4;")); - if (hasStrikeThrough) + } + if (hasStrikeThrough) { buffer.append(QLatin1String("9;")); + } // if there is ANSI style if (buffer.latin1().size() > 2) { @@ -1266,14 +1281,18 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE d->ansiStyles[id].second = buffer.latin1(); } else if (hasEffect) { buffer.append(QLatin1String("\x1b[")); - if (hasBold) + if (hasBold) { buffer.append(QLatin1String("21;")); - if (hasItalic) + } + if (hasItalic) { buffer.append(QLatin1String("23;")); - if (hasUnderline) + } + if (hasUnderline) { buffer.append(QLatin1String("24;")); - if (hasStrikeThrough) + } + if (hasStrikeThrough) { buffer.append(QLatin1String("29;")); + } buffer.setFinalStyle(); d->ansiStyles[id].second = buffer.latin1(); } @@ -1301,10 +1320,11 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE d->currentLine = in.readLine(); state = highlightLine(d->currentLine, state); - if (useEditorBackground) + if (useEditorBackground) { d->out << QStringLiteral("\x1b[K\n"); - else + } else { d->out << QLatin1Char('\n'); + } } } else { AnsiBuffer buffer; @@ -1328,5 +1348,5 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE void AnsiHighlighter::applyFormat(int offset, int length, const Format &format) { auto const &ansiStyle = d->ansiStyles[format.id()]; - d->out << ansiStyle.first << d->currentLine.midRef(offset, length) << ansiStyle.second; + d->out << ansiStyle.first << QStringView(d->currentLine).mid(offset, length) << ansiStyle.second; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp index f980ea5be8..724f37a03f 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp @@ -30,8 +30,9 @@ void Context::setDefinition(const DefinitionRef &def) bool Context::indentationBasedFoldingEnabled() const { - if (m_noIndentationBasedFolding) + if (m_noIndentationBasedFolding) { return false; + } return m_def.definition().indentationBasedFoldingEnabled(); } @@ -56,8 +57,9 @@ void Context::load(QXmlStreamReader &reader) auto rule = Rule::create(reader.name()); if (rule) { rule->setDefinition(m_def.definition()); - if (rule->load(reader)) + if (rule->load(reader)) { m_rules.push_back(std::move(rule)); + } } else { reader.skipCurrentElement(); } @@ -79,8 +81,9 @@ void Context::resolveContexts() m_lineEndContext.resolve(def); m_lineEmptyContext.resolve(def); m_fallthroughContext.resolve(def); - for (const auto &rule : m_rules) + for (const auto &rule : m_rules) { rule->resolveContext(); + } } Context::ResolveState Context::resolveState() @@ -100,8 +103,9 @@ Context::ResolveState Context::resolveState() void Context::resolveIncludes() { - if (resolveState() == Resolved) + if (resolveState() == Resolved) { return; + } if (resolveState() == Resolving) { qCWarning(Log) << "Cyclic dependency!"; return; @@ -129,10 +133,11 @@ void Context::resolveIncludes() } auto defData = DefinitionData::get(def); defData->load(); - if (inc->contextName().isEmpty()) + if (inc->contextName().isEmpty()) { context = defData->initialContext(); - else + } else { context = defData->contextByName(inc->contextName()); + } } if (!context) { qCWarning(Log) << "Unable to resolve include rule for definition" << inc->contextName() << "##" << inc->definitionName() << "in" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp index 7ccd73ee9b..e829af463a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp @@ -29,8 +29,9 @@ Context *ContextSwitch::context() const void ContextSwitch::parse(QStringView contextInstr) { - if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) + if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) { return; + } if (contextInstr.startsWith(QLatin1String("#pop!"))) { ++m_popCount; @@ -60,13 +61,15 @@ void ContextSwitch::resolve(const Definition &def) d = DefinitionData::get(def)->repo->definitionForName(m_defName); auto data = DefinitionData::get(d); data->load(); - if (m_contextName.isEmpty()) + if (m_contextName.isEmpty()) { m_context = data->initialContext(); + } } if (!m_contextName.isEmpty()) { m_context = DefinitionData::get(d)->contextByName(m_contextName); - if (!m_context) + if (!m_context) { qCWarning(Log) << "cannot find context" << m_contextName << "in" << def.name(); + } } } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp index 7434e745b2..068907a4e2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp @@ -52,29 +52,20 @@ DefinitionData *DefinitionData::get(const Definition &def) Definition::Definition() : d(new DefinitionData) { -} - -Definition::Definition(const Definition &other) - : d(other.d) -{ d->q = *this; } +Definition::Definition(Definition &&other) noexcept = default; +Definition::Definition(const Definition &) = default; +Definition::~Definition() = default; +Definition &Definition::operator=(Definition &&other) noexcept = default; +Definition &Definition::operator=(const Definition &) = default; + Definition::Definition(std::shared_ptr<DefinitionData> &&dd) : d(std::move(dd)) { } -Definition::~Definition() -{ -} - -Definition &Definition::operator=(const Definition &rhs) -{ - d = rhs.d; - return *this; -} - bool Definition::operator==(const Definition &other) const { return d->fileName == other.d->fileName; @@ -223,8 +214,9 @@ bool Definition::setKeywordList(const QString &name, const QStringList &content) if (list) { list->setKeywordList(content); return true; - } else + } else { return false; + } } QVector<Format> Definition::formats() const @@ -251,7 +243,7 @@ QVector<Definition> Definition::includedDefinitions() const // Iterate all context rules to find associated Definitions. This will // automatically catch other Definitions referenced with IncludeRuldes or ContextSwitch. const auto definition = queue.takeLast(); - for (const auto &context : qAsConst(definition.d->contexts)) { + for (const auto &context : std::as_const(definition.d->contexts)) { // handle context switch attributes of this context itself for (const auto switchContext : {context->lineEndContext().context(), context->lineEmptyContext().context(), context->fallthroughContext().context()}) { @@ -321,8 +313,9 @@ Context *DefinitionData::initialContext() const Context *DefinitionData::contextByName(const QString &wantedName) const { for (const auto context : contexts) { - if (context->name() == wantedName) + if (context->name() == wantedName) { return context; + } } return nullptr; } @@ -336,8 +329,9 @@ KeywordList *DefinitionData::keywordList(const QString &wantedName) Format DefinitionData::formatByName(const QString &wantedName) const { const auto it = formats.constFind(wantedName); - if (it != formats.constEnd()) + if (it != formats.constEnd()) { return it.value(); + } return Format(); } @@ -349,24 +343,29 @@ bool DefinitionData::isLoaded() const bool DefinitionData::load(OnlyKeywords onlyKeywords) { - if (fileName.isEmpty()) + if (fileName.isEmpty()) { return false; + } - if (isLoaded()) + if (isLoaded()) { return true; + } - if (bool(onlyKeywords) && keywordIsLoaded) + if (bool(onlyKeywords) && keywordIsLoaded) { return true; + } QFile file(fileName); - if (!file.open(QFile::ReadOnly)) + if (!file.open(QFile::ReadOnly)) { return false; + } QXmlStreamReader reader(&file); while (!reader.atEnd()) { const auto token = reader.readNext(); - if (token != QXmlStreamReader::StartElement) + if (token != QXmlStreamReader::StartElement) { continue; + } if (reader.name() == QLatin1String("highlighting")) { loadHighlighting(reader, onlyKeywords); @@ -375,21 +374,22 @@ bool DefinitionData::load(OnlyKeywords onlyKeywords) } } - else if (reader.name() == QLatin1String("general")) + else if (reader.name() == QLatin1String("general")) { loadGeneral(reader); + } } for (auto it = keywordLists.begin(); it != keywordLists.end(); ++it) { it->setCaseSensitivity(caseSensitive); } - for (const auto context : qAsConst(contexts)) { + for (const auto context : std::as_const(contexts)) { context->resolveContexts(); context->resolveIncludes(); context->resolveAttributeFormat(); } - for (const auto context : qAsConst(contexts)) { + for (const auto context : std::as_const(contexts)) { for (const auto &rule : context->rules()) { rule->resolvePostProcessing(); } @@ -427,14 +427,16 @@ bool DefinitionData::loadMetaData(const QString &definitionFileName) fileName = definitionFileName; QFile file(definitionFileName); - if (!file.open(QFile::ReadOnly)) + if (!file.open(QFile::ReadOnly)) { return false; + } QXmlStreamReader reader(&file); while (!reader.atEnd()) { const auto token = reader.readNext(); - if (token != QXmlStreamReader::StartElement) + if (token != QXmlStreamReader::StartElement) { continue; + } if (reader.name() == QLatin1String("language")) { return loadLanguage(reader); } @@ -457,11 +459,13 @@ bool DefinitionData::loadMetaData(const QString &file, const QCborMap &obj) fileName = file; const auto exts = obj.value(QLatin1String("extensions")).toString(); - for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) + for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) { extensions.push_back(ext); + } const auto mts = obj.value(QLatin1String("mimetype")).toString(); - for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) + for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) { mimetypes.push_back(mt); + } return true; } @@ -471,8 +475,9 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader) Q_ASSERT(reader.name() == QLatin1String("language")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - if (!checkKateVersion(reader.attributes().value(QLatin1String("kateversion")))) + if (!checkKateVersion(reader.attributes().value(QLatin1String("kateversion")))) { return false; + } name = reader.attributes().value(QLatin1String("name")).toString(); section = reader.attributes().value(QLatin1String("section")).toString(); @@ -485,13 +490,16 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader) author = reader.attributes().value(QLatin1String("author")).toString(); license = reader.attributes().value(QLatin1String("license")).toString(); const auto exts = reader.attributes().value(QLatin1String("extensions")).toString(); - for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) + for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) { extensions.push_back(ext); + } const auto mts = reader.attributes().value(QLatin1String("mimetype")).toString(); - for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) + for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) { mimetypes.push_back(mt); - if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) + } + if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) { caseSensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; + } return true; } @@ -618,8 +626,9 @@ void DefinitionData::loadGeneral(QXmlStreamReader &reader) ++elementRefCounter; if (reader.name() == QLatin1String("keywords")) { - if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) + if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) { caseSensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; + } // adapt wordDelimiters wordDelimiters.append(reader.attributes().value(QLatin1String("additionalDeliminator"))); @@ -628,14 +637,15 @@ void DefinitionData::loadGeneral(QXmlStreamReader &reader) // adapt WordWrapDelimiters auto wordWrapDeliminatorAttr = reader.attributes().value( QLatin1String("wordWrapDeliminator")); - if (wordWrapDeliminatorAttr.isEmpty()) + if (wordWrapDeliminatorAttr.isEmpty()) { wordWrapDelimiters = wordDelimiters; - else { + } else { wordWrapDelimiters.append(wordWrapDeliminatorAttr); } } else if (reader.name() == QLatin1String("folding")) { - if (reader.attributes().hasAttribute(QLatin1String("indentationsensitive"))) + if (reader.attributes().hasAttribute(QLatin1String("indentationsensitive"))) { indentationBasedFolding = Xml::attrToBool(reader.attributes().value(QLatin1String("indentationsensitive"))); + } } else if (reader.name() == QLatin1String("emptyLines")) { loadFoldingIgnoreList(reader); } else if (reader.name() == QLatin1String("comments")) { @@ -649,8 +659,9 @@ void DefinitionData::loadGeneral(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement: --elementRefCounter; - if (elementRefCounter == 0) + if (elementRefCounter == 0) { return; + } reader.readNext(); break; default: @@ -688,8 +699,9 @@ void DefinitionData::loadComments(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement: --elementRefCounter; - if (elementRefCounter == 0) + if (elementRefCounter == 0) { return; + } reader.readNext(); break; default: @@ -719,8 +731,9 @@ void DefinitionData::loadFoldingIgnoreList(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement: --elementRefCounter; - if (elementRefCounter == 0) + if (elementRefCounter == 0) { return; + } reader.readNext(); break; default: @@ -754,8 +767,9 @@ void DefinitionData::loadSpellchecking(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement: --elementRefCounter; - if (elementRefCounter == 0) + if (elementRefCounter == 0) { return; + } reader.readNext(); break; default: @@ -798,10 +812,6 @@ DefinitionRef::DefinitionRef(const Definition &def) { } -DefinitionRef::~DefinitionRef() -{ -} - DefinitionRef &DefinitionRef::operator=(const Definition &def) { d = def.d; @@ -810,8 +820,9 @@ DefinitionRef &DefinitionRef::operator=(const Definition &def) Definition DefinitionRef::definition() const { - if (!d.expired()) + if (!d.expired()) { return Definition(d.lock()); + } return Definition(); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h index 8226fbdd24..05757ea52a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h @@ -13,6 +13,7 @@ #include <QPair> #include <QVector> #include <memory> +#include <qobjectdefs.h> QT_BEGIN_NAMESPACE class QChar; @@ -74,7 +75,7 @@ enum class CommentPosition { * singleLineCommentMarker() and multiLineCommentMarker() provide comment * markers that can be used for commenting/uncommenting code. Similarly, * formats() returns a list of Format items defined by this Definition (which - * equal the itemDatas of a highlighing definition file). includedDefinitions() + * equal the itemDatas of a highlighting definition file). includedDefinitions() * returns a list of all included Definition%s referenced by this Definition via * the rule IncludeRules, which is useful for displaying all Format items for * color configuration in the user interface. @@ -84,6 +85,13 @@ enum class CommentPosition { */ class KSYNTAXHIGHLIGHTING_EXPORT Definition { + Q_GADGET + Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString translatedName READ translatedName) + Q_PROPERTY(QString section READ section) + Q_PROPERTY(QString translatedSection READ translatedSection) + Q_PROPERTY(QString author READ author) + Q_PROPERTY(QString license READ license) public: /** * Default constructor, creating an empty (invalid) Definition instance. @@ -94,6 +102,14 @@ public: Definition(); /** + * Move constructor. + * This definition takes the Definition data from @p other. + * @note @p other may only be assigned to or destroyed afterwards. + * @since 5.86 + */ + Definition(Definition &&other) noexcept; + + /** * Copy constructor. * Both this definition as well as @p other share the Definition data. */ @@ -105,7 +121,15 @@ public: ~Definition(); /** - * Assignment operator. + * Move assignment operator. + * This definition takes the Definition data from @p other. + * @note @p other may only be assigned to or destroyed afterwards. + * @since 5.86 + */ + Definition &operator=(Definition &&other) noexcept; + + /** + * Copy assignment operator. * Both this definition as well as @p rhs share the Definition data. */ Definition &operator=(const Definition &rhs); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp index 3dff1dd436..b16139b731 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp @@ -51,24 +51,27 @@ void DefinitionDownloaderPrivate::definitionListDownloadFinished(QNetworkReply * while (!parser.atEnd()) { switch (parser.readNext()) { case QXmlStreamReader::StartElement: - if (parser.name() == QLatin1String("Definition")) + if (parser.name() == QLatin1String("Definition")) { updateDefinition(parser); + } break; default: break; } } - if (pendingDownloads == 0) + if (pendingDownloads == 0) { Q_EMIT q->informationMessage(QObject::tr("All syntax definitions are up-to-date.")); + } checkDone(); } void DefinitionDownloaderPrivate::updateDefinition(QXmlStreamReader &parser) { const auto name = parser.attributes().value(QLatin1String("name")); - if (name.isEmpty()) + if (name.isEmpty()) { return; + } auto localDef = repo->definitionForName(name.toString()); if (!localDef.isValid()) { @@ -86,11 +89,13 @@ void DefinitionDownloaderPrivate::updateDefinition(QXmlStreamReader &parser) void DefinitionDownloaderPrivate::downloadDefinition(const QUrl &downloadUrl) { - if (!downloadUrl.isValid()) + if (!downloadUrl.isValid()) { return; + } auto url = downloadUrl; - if (url.scheme() == QLatin1String("http")) + if (url.scheme() == QLatin1String("http")) { url.setScheme(QStringLiteral("https")); + } QNetworkRequest req(url); auto reply = nam->get(req); @@ -133,8 +138,9 @@ void DefinitionDownloaderPrivate::downloadDefinitionFinished(QNetworkReply *repl void DefinitionDownloaderPrivate::checkDone() { if (pendingDownloads == 0) { - if (needsReload) + if (needsReload) { repo->reload(); + } Q_EMIT QTimer::singleShot(0, q, &DefinitionDownloader::done); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h index 25a1a749e4..285fec3e20 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h @@ -13,7 +13,6 @@ namespace KSyntaxHighlighting { class Definition; class DefinitionData; -class DefinitionPrivate; /** Weak reference for Definition instances. * @@ -21,6 +20,8 @@ class DefinitionPrivate; * in objects hold directly or indirectly by Definition * to avoid reference count loops and thus memory leaks. * + * This class follows the rule of zero. It is implicitly movable and copyable. + * * @internal */ class DefinitionRef @@ -28,7 +29,6 @@ class DefinitionRef public: DefinitionRef(); explicit DefinitionRef(const Definition &def); - ~DefinitionRef(); DefinitionRef &operator=(const Definition &def); Definition definition() const; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp index d459ee36d8..bcc64c3c2b 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp @@ -21,8 +21,9 @@ using namespace KSyntaxHighlighting; static Theme::TextStyle stringToDefaultFormat(QStringView str) { - if (!str.startsWith(QLatin1String("ds"))) + if (!str.startsWith(QLatin1String("ds"))) { return Theme::Normal; + } static const auto idx = Theme::staticMetaObject.indexOfEnumerator("TextStyle"); Q_ASSERT(idx >= 0); @@ -30,8 +31,9 @@ static Theme::TextStyle stringToDefaultFormat(QStringView str) bool ok = false; const auto value = metaEnum.keyToValue(str.mid(2).toLatin1().constData(), &ok); - if (!ok || value < 0) + if (!ok || value < 0) { return Theme::Normal; + } return static_cast<Theme::TextStyle>(value); } @@ -44,8 +46,9 @@ FormatPrivate *FormatPrivate::detachAndGet(Format &format) TextStyleData FormatPrivate::styleOverride(const Theme &theme) const { const auto themeData = ThemeData::get(theme); - if (themeData) + if (themeData) { return themeData->textStyleOverride(definition.definition().name(), name); + } return TextStyleData(); } @@ -113,16 +116,18 @@ bool Format::hasTextColor(const Theme &theme) const QColor Format::textColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.textColor) + if (overrideStyle.textColor) { return overrideStyle.textColor; + } return d->style.textColor ? QColor::fromRgba(d->style.textColor) : QColor::fromRgba(theme.textColor(d->defaultStyle)); } QColor Format::selectedTextColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.selectedTextColor) + if (overrideStyle.selectedTextColor) { return overrideStyle.selectedTextColor; + } return d->style.selectedTextColor ? QColor::fromRgba(d->style.selectedTextColor) : QColor::fromRgba(theme.selectedTextColor(d->defaultStyle)); } @@ -136,8 +141,9 @@ bool Format::hasBackgroundColor(const Theme &theme) const QColor Format::backgroundColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.backgroundColor) + if (overrideStyle.backgroundColor) { return overrideStyle.backgroundColor; + } // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! return d->style.backgroundColor ? QColor::fromRgba(d->style.backgroundColor) : QColor::fromRgba(theme.backgroundColor(d->defaultStyle)); @@ -146,8 +152,9 @@ QColor Format::backgroundColor(const Theme &theme) const QColor Format::selectedBackgroundColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.selectedBackgroundColor) + if (overrideStyle.selectedBackgroundColor) { return overrideStyle.selectedBackgroundColor; + } // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! return d->style.selectedBackgroundColor ? QColor::fromRgba(d->style.selectedBackgroundColor) @@ -157,32 +164,36 @@ QColor Format::selectedBackgroundColor(const Theme &theme) const bool Format::isBold(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.hasBold) + if (overrideStyle.hasBold) { return overrideStyle.bold; + } return d->style.hasBold ? d->style.bold : theme.isBold(d->defaultStyle); } bool Format::isItalic(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.hasItalic) + if (overrideStyle.hasItalic) { return overrideStyle.italic; + } return d->style.hasItalic ? d->style.italic : theme.isItalic(d->defaultStyle); } bool Format::isUnderline(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.hasUnderline) + if (overrideStyle.hasUnderline) { return overrideStyle.underline; + } return d->style.hasUnderline ? d->style.underline : theme.isUnderline(d->defaultStyle); } bool Format::isStrikeThrough(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - if (overrideStyle.hasStrikeThrough) + if (overrideStyle.hasStrikeThrough) { return overrideStyle.strikeThrough; + } return d->style.hasStrikeThrough ? d->style.strikeThrough : theme.isStrikeThrough(d->defaultStyle); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp index 5ba421d0e1..688a42d45c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp @@ -70,10 +70,11 @@ void HtmlHighlighter::highlightFile(const QString &fileName, const QString &titl return; } - if (title.isEmpty()) + if (title.isEmpty()) { highlightData(&f, fi.fileName()); - else + } else { highlightData(&f, title); + } } /** @@ -87,8 +88,9 @@ void HtmlHighlighter::highlightFile(const QString &fileName, const QString &titl */ static QString toHtmlRgbaString(const QColor &color) { - if (color.alpha() == 0xFF) + if (color.alpha() == 0xFF) { return color.name(); + } QString rgba = QStringLiteral("rgba("); rgba.append(QString::number(color.red())); @@ -111,10 +113,11 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title) } QString htmlTitle; - if (title.isEmpty()) + if (title.isEmpty()) { htmlTitle = QStringLiteral("Kate Syntax Highlighter"); - else + } else { htmlTitle = title.toHtmlEscaped(); + } State state; *d->out << "<!DOCTYPE html>\n"; @@ -125,8 +128,9 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title) << ")\"/>\n"; *d->out << "</head><body"; *d->out << " style=\"background-color:" << toHtmlRgbaString(QColor::fromRgba(theme().editorColor(Theme::BackgroundColor))); - if (theme().textColor(Theme::Normal)) + if (theme().textColor(Theme::Normal)) { *d->out << ";color:" << toHtmlRgbaString(QColor::fromRgba(theme().textColor(Theme::Normal))); + } *d->out << "\"><pre>\n"; QTextStream in(dev); @@ -148,27 +152,34 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title) void HtmlHighlighter::applyFormat(int offset, int length, const Format &format) { - if (length == 0) + if (length == 0) { return; + } // collect potential output, cheaper than thinking about "is there any?" QVarLengthArray<QString, 16> formatOutput; - if (format.hasTextColor(theme())) + if (format.hasTextColor(theme())) { formatOutput << QStringLiteral("color:") << toHtmlRgbaString(format.textColor(theme())) << QStringLiteral(";"); - if (format.hasBackgroundColor(theme())) + } + if (format.hasBackgroundColor(theme())) { formatOutput << QStringLiteral("background-color:") << toHtmlRgbaString(format.backgroundColor(theme())) << QStringLiteral(";"); - if (format.isBold(theme())) + } + if (format.isBold(theme())) { formatOutput << QStringLiteral("font-weight:bold;"); - if (format.isItalic(theme())) + } + if (format.isItalic(theme())) { formatOutput << QStringLiteral("font-style:italic;"); - if (format.isUnderline(theme())) + } + if (format.isUnderline(theme())) { formatOutput << QStringLiteral("text-decoration:underline;"); - if (format.isStrikeThrough(theme())) + } + if (format.isStrikeThrough(theme())) { formatOutput << QStringLiteral("text-decoration:line-through;"); + } if (!formatOutput.isEmpty()) { *d->out << "<span style=\""; - for (const auto &out : qAsConst(formatOutput)) { + for (const auto &out : std::as_const(formatOutput)) { *d->out << out; } *d->out << "\">"; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp index b13e30607b..3a7514897a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp @@ -16,6 +16,27 @@ using namespace KSyntaxHighlighting; +namespace +{ +struct KeywordComparator { + Qt::CaseSensitivity caseSensitive; + + bool operator()(QStringView a, QStringView b) const + { + if (a.size() < b.size()) { + return true; + } + + if (a.size() > b.size()) { + return false; + } + + return a.compare(b, caseSensitive) < 0; + } +}; + +} + bool KeywordList::contains(QStringView str, Qt::CaseSensitivity caseSensitive) const { /** @@ -26,9 +47,7 @@ bool KeywordList::contains(QStringView str, Qt::CaseSensitivity caseSensitive) c /** * search with right predicate */ - return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), QStringView(str), [caseSensitive](QStringView a, QStringView b) { - return a.compare(b, caseSensitive) < 0; - }); + return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), QStringView(str), KeywordComparator{caseSensitive}); } void KeywordList::load(QXmlStreamReader &reader) @@ -85,16 +104,14 @@ void KeywordList::initLookupForCaseSensitivity(Qt::CaseSensitivity caseSensitive * fill vector with refs to keywords */ vectorToSort.reserve(m_keywords.size()); - for (const auto &keyword : qAsConst(m_keywords)) { + for (const auto &keyword : std::as_const(m_keywords)) { vectorToSort.push_back(keyword); } /** * sort with right predicate */ - std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive](QStringView a, QStringView b) { - return a.compare(b, caseSensitive) < 0; - }); + std::sort(vectorToSort.begin(), vectorToSort.end(), KeywordComparator{caseSensitive}); } void KeywordList::resolveIncludeKeywords(DefinitionData &def) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp index 1e3191a7bc..f3b36df459 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp @@ -11,7 +11,7 @@ #include "repository_p.h" #include "theme.h" #include "themedata_p.h" -#include "wildcardmatcher_p.h" +#include "wildcardmatcher.h" #include <QCborMap> #include <QCborValue> @@ -19,15 +19,75 @@ #include <QFile> #include <QFileInfo> #include <QPalette> +#include <QString> +#include <QStringView> #ifndef NO_STANDARD_PATHS #include <QStandardPaths> #endif +#include <algorithm> +#include <iterator> #include <limits> using namespace KSyntaxHighlighting; +namespace +{ +QString fileNameFromFilePath(const QString &filePath) +{ + return QFileInfo{filePath}.fileName(); +} + +auto anyWildcardMatches(QStringView str) +{ + return [str](const Definition &def) { + const auto strings = def.extensions(); + return std::any_of(strings.cbegin(), strings.cend(), [str](QStringView wildcard) { + return WildcardMatcher::exactMatch(str, wildcard); + }); + }; +} + +auto anyMimeTypeEquals(QStringView mimeTypeName) +{ + return [mimeTypeName](const Definition &def) { + const auto strings = def.mimeTypes(); + return std::any_of(strings.cbegin(), strings.cend(), [mimeTypeName](QStringView name) { + return mimeTypeName == name; + }); + }; +} + +// The two function templates below take defs - a map sorted by highlighting name - to be deterministic and independent of translations. + +template<typename UnaryPredicate> +Definition findHighestPriorityDefinitionIf(const QMap<QString, Definition> &defs, UnaryPredicate predicate) +{ + const Definition *match = nullptr; + auto matchPriority = std::numeric_limits<int>::lowest(); + for (const Definition &def : defs) { + const auto defPriority = def.priority(); + if (defPriority > matchPriority && predicate(def)) { + match = &def; + matchPriority = defPriority; + } + } + return match == nullptr ? Definition{} : *match; +} + +template<typename UnaryPredicate> +QVector<Definition> findDefinitionsIf(const QMap<QString, Definition> &defs, UnaryPredicate predicate) +{ + QVector<Definition> matches; + std::copy_if(defs.cbegin(), defs.cend(), std::back_inserter(matches), predicate); + std::stable_sort(matches.begin(), matches.end(), [](const Definition &lhs, const Definition &rhs) { + return lhs.priority() > rhs.priority(); + }); + return matches; +} +} // unnamed namespace + static void initResource() { #ifdef HAS_SYNTAX_RESOURCE @@ -52,8 +112,9 @@ Repository::~Repository() { // reset repo so we can detect in still alive definition instances // that the repo was deleted - for (const auto &def : qAsConst(d->m_sortedDefs)) + for (const auto &def : std::as_const(d->m_sortedDefs)) { DefinitionData::get(def)->repo = nullptr; + } } Definition Repository::definitionForName(const QString &defName) const @@ -61,58 +122,24 @@ Definition Repository::definitionForName(const QString &defName) const return d->m_defs.value(defName); } -static void sortDefinitions(QVector<Definition> &definitions) -{ - std::stable_sort(definitions.begin(), definitions.end(), [](const Definition &lhs, const Definition &rhs) { - return lhs.priority() > rhs.priority(); - }); -} - Definition Repository::definitionForFileName(const QString &fileName) const { - return definitionsForFileName(fileName).value(0); + return findHighestPriorityDefinitionIf(d->m_defs, anyWildcardMatches(fileNameFromFilePath(fileName))); } QVector<Definition> Repository::definitionsForFileName(const QString &fileName) const { - QFileInfo fi(fileName); - const auto name = fi.fileName(); - - // use d->m_defs, sorted map by highlighting name, to be deterministic and independent of translations - QVector<Definition> candidates; - for (const Definition &def : qAsConst(d->m_defs)) { - for (const auto &pattern : def.extensions()) { - if (WildcardMatcher::exactMatch(name, pattern)) { - candidates.push_back(def); - break; - } - } - } - - sortDefinitions(candidates); - return candidates; + return findDefinitionsIf(d->m_defs, anyWildcardMatches(fileNameFromFilePath(fileName))); } Definition Repository::definitionForMimeType(const QString &mimeType) const { - return definitionsForMimeType(mimeType).value(0); + return findHighestPriorityDefinitionIf(d->m_defs, anyMimeTypeEquals(mimeType)); } QVector<Definition> Repository::definitionsForMimeType(const QString &mimeType) const { - // use d->m_defs, sorted map by highlighting name, to be deterministic and independent of translations - QVector<Definition> candidates; - for (const Definition &def : qAsConst(d->m_defs)) { - for (const auto &matchType : def.mimeTypes()) { - if (mimeType == matchType) { - candidates.push_back(def); - break; - } - } - } - - sortDefinitions(candidates); - return candidates; + return findDefinitionsIf(d->m_defs, anyMimeTypeEquals(mimeType)); } QVector<Definition> Repository::definitions() const @@ -127,7 +154,7 @@ QVector<Theme> Repository::themes() const Theme Repository::theme(const QString &themeName) const { - for (const auto &theme : qAsConst(d->m_themes)) { + for (const auto &theme : std::as_const(d->m_themes)) { if (theme.name() == themeName) { return theme; } @@ -138,14 +165,15 @@ Theme Repository::theme(const QString &themeName) const Theme Repository::defaultTheme(Repository::DefaultTheme t) const { - if (t == DarkTheme) + if (t == DarkTheme) { return theme(QLatin1String("Breeze Dark")); + } return theme(QLatin1String("Breeze Light")); } Theme Repository::defaultTheme(Repository::DefaultTheme t) { - return qAsConst(*this).defaultTheme(t); + return std::as_const(*this).defaultTheme(t); } Theme Repository::themeForPalette(const QPalette &palette) const @@ -164,7 +192,7 @@ Theme Repository::themeForPalette(const QPalette &palette) const if (!matchingThemes.empty()) { // if there's multiple, search for one with a matching highlight color const auto highlight = palette.color(QPalette::Highlight); - for (const auto &theme : qAsConst(matchingThemes)) { + for (const auto &theme : std::as_const(matchingThemes)) { auto selection = theme.editorColor(KSyntaxHighlighting::Theme::EditorColorRole::TextSelection); if (selection == highlight.rgb()) { return theme; @@ -179,7 +207,7 @@ Theme Repository::themeForPalette(const QPalette &palette) const Theme Repository::themeForPalette(const QPalette &palette) { - return qAsConst(*this).themeForPalette(palette); + return std::as_const(*this).themeForPalette(palette); } void RepositoryPrivate::load(Repository *repo) @@ -189,29 +217,39 @@ void RepositoryPrivate::load(Repository *repo) // do lookup in standard paths, if not disabled #ifndef NO_STANDARD_PATHS - for (const auto &dir : - QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/syntax"), QStandardPaths::LocateDirectory)) + for (const auto &dir : QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QStringLiteral("org.kde.syntax-highlighting/syntax"), + QStandardPaths::LocateDirectory)) { loadSyntaxFolder(repo, dir); + } // backward compatibility with Kate - for (const auto &dir : QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("katepart5/syntax"), QStandardPaths::LocateDirectory)) + for (const auto &dir : + QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("katepart5/syntax"), QStandardPaths::LocateDirectory)) { loadSyntaxFolder(repo, dir); + } #endif - // default resources are always used - loadSyntaxFolder(repo, QStringLiteral(":/org.kde.syntax-highlighting/syntax")); + // default resources are always used, this is the one location that has a index cbor file + loadSyntaxFolderFromIndex(repo, QStringLiteral(":/org.kde.syntax-highlighting/syntax")); + + // extra resources provided by 3rdparty libraries/applications + loadSyntaxFolder(repo, QStringLiteral(":/org.kde.syntax-highlighting/syntax-addons")); // user given extra paths - for (const auto &path : qAsConst(m_customSearchPaths)) + for (const auto &path : std::as_const(m_customSearchPaths)) { loadSyntaxFolder(repo, path + QStringLiteral("/syntax")); + } m_sortedDefs.reserve(m_defs.size()); - for (auto it = m_defs.constBegin(); it != m_defs.constEnd(); ++it) + for (auto it = m_defs.constBegin(); it != m_defs.constEnd(); ++it) { m_sortedDefs.push_back(it.value()); + } std::sort(m_sortedDefs.begin(), m_sortedDefs.end(), [](const Definition &left, const Definition &right) { auto comparison = left.translatedSection().compare(right.translatedSection(), Qt::CaseInsensitive); - if (comparison == 0) + if (comparison == 0) { comparison = left.translatedName().compare(right.translatedName(), Qt::CaseInsensitive); + } return comparison < 0; }); @@ -219,54 +257,60 @@ void RepositoryPrivate::load(Repository *repo) // do lookup in standard paths, if not disabled #ifndef NO_STANDARD_PATHS - for (const auto &dir : - QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/themes"), QStandardPaths::LocateDirectory)) + for (const auto &dir : QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QStringLiteral("org.kde.syntax-highlighting/themes"), + QStandardPaths::LocateDirectory)) { loadThemeFolder(dir); + } #endif // default resources are always used loadThemeFolder(QStringLiteral(":/org.kde.syntax-highlighting/themes")); + // extra resources provided by 3rdparty libraries/applications + loadThemeFolder(QStringLiteral(":/org.kde.syntax-highlighting/themes-addons")); + // user given extra paths - for (const auto &path : qAsConst(m_customSearchPaths)) + for (const auto &path : std::as_const(m_customSearchPaths)) { loadThemeFolder(path + QStringLiteral("/themes")); + } } void RepositoryPrivate::loadSyntaxFolder(Repository *repo, const QString &path) { - if (loadSyntaxFolderFromIndex(repo, path)) - return; - QDirIterator it(path, QStringList() << QLatin1String("*.xml"), QDir::Files); while (it.hasNext()) { Definition def; auto defData = DefinitionData::get(def); defData->repo = repo; - if (defData->loadMetaData(it.next())) + if (defData->loadMetaData(it.next())) { addDefinition(def); + } } } -bool RepositoryPrivate::loadSyntaxFolderFromIndex(Repository *repo, const QString &path) +void RepositoryPrivate::loadSyntaxFolderFromIndex(Repository *repo, const QString &path) { QFile indexFile(path + QLatin1String("/index.katesyntax")); - if (!indexFile.open(QFile::ReadOnly)) - return false; + if (!indexFile.open(QFile::ReadOnly)) { + return; + } const auto indexDoc(QCborValue::fromCbor(indexFile.readAll())); const auto index = indexDoc.toMap(); for (auto it = index.begin(); it != index.end(); ++it) { - if (!it.value().isMap()) + if (!it.value().isMap()) { continue; + } const auto fileName = QString(path + QLatin1Char('/') + it.key().toString()); const auto defMap = it.value().toMap(); Definition def; auto defData = DefinitionData::get(def); defData->repo = repo; - if (defData->loadMetaData(fileName, defMap)) + if (defData->loadMetaData(fileName, defMap)) { addDefinition(def); + } } - return true; } void RepositoryPrivate::addDefinition(const Definition &def) @@ -277,8 +321,9 @@ void RepositoryPrivate::addDefinition(const Definition &def) return; } - if (it.value().version() >= def.version()) + if (it.value().version() >= def.version()) { return; + } m_defs.insert(def.name(), def); } @@ -287,8 +332,9 @@ void RepositoryPrivate::loadThemeFolder(const QString &path) QDirIterator it(path, QStringList() << QLatin1String("*.theme"), QDir::Files); while (it.hasNext()) { auto themeData = std::unique_ptr<ThemeData>(new ThemeData); - if (themeData->load(it.next())) + if (themeData->load(it.next())) { addTheme(Theme(themeData.release())); + } } } @@ -307,15 +353,17 @@ void RepositoryPrivate::addTheme(const Theme &theme) m_themes.insert(it, theme); return; } - if (themeRevision(*it) < themeRevision(theme)) + if (themeRevision(*it) < themeRevision(theme)) { *it = theme; + } } quint16 RepositoryPrivate::foldingRegionId(const QString &defName, const QString &foldName) { const auto it = m_foldingRegionIds.constFind(qMakePair(defName, foldName)); - if (it != m_foldingRegionIds.constEnd()) + if (it != m_foldingRegionIds.constEnd()) { return it.value(); + } m_foldingRegionIds.insert(qMakePair(defName, foldName), ++m_foldingRegionId); return m_foldingRegionId; } @@ -329,8 +377,9 @@ quint16 RepositoryPrivate::nextFormatId() void Repository::reload() { qCDebug(Log) << "Reloading syntax definitions!"; - for (const auto &def : qAsConst(d->m_sortedDefs)) + for (const auto &def : std::as_const(d->m_sortedDefs)) { DefinitionData::get(def)->clear(); + } d->m_defs.clear(); d->m_sortedDefs.clear(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h index 323407f008..9e19ecda56 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h @@ -86,6 +86,11 @@ class Theme; * The internal resource path is ":/org.kde.syntax-highlighting/syntax". * This path should never be touched by other applications. * + * -# Then, all custom files compiled into resources are loaded. + * The resource path is ":/org.kde.syntax-highlighting/syntax-addons". + * This path can be used by other libraries/applications to bundle specialized definitions. + * Per default this path isn't used by the framework itself. + * * -# Finally, the search path can be extended by calling addCustomSearchPath(). * A custom search path can either be a path on disk or again a path to * a Qt resource. @@ -102,6 +107,11 @@ class Theme; * The internal resource path is ":/org.kde.syntax-highlighting/themes". * This path should never be touched by other applications. * + * -# Then, all custom files compiled into resources are loaded. + * The resource path is ":/org.kde.syntax-highlighting/themes-addons". + * This path can be used by other libraries/applications to bundle specialized themes. + * Per default this path isn't used by the framework itself. + * * -# Finally, all Theme%s located in the paths added addCustomSearchPath() * are loaded. * diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h index 447cfae699..abc992358d 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h @@ -29,7 +29,7 @@ public: void load(Repository *repo); void loadSyntaxFolder(Repository *repo, const QString &path); - bool loadSyntaxFolderFromIndex(Repository *repo, const QString &path); + void loadSyntaxFolderFromIndex(Repository *repo, const QString &path); void addDefinition(const Definition &def); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp index c8d3fa0e63..f4e88b719a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp @@ -34,10 +34,11 @@ static bool isHexChar(QChar c) return isDigit(c) || (c <= QLatin1Char('f') && QLatin1Char('a') <= c) || (c <= QLatin1Char('F') && QLatin1Char('A') <= c); } -static int matchEscapedChar(const QString &text, int offset) +static int matchEscapedChar(QStringView text, int offset) { - if (text.at(offset) != QLatin1Char('\\') || text.size() < offset + 2) + if (text.at(offset) != QLatin1Char('\\') || text.size() < offset + 2) { return offset; + } const auto c = text.at(offset + 1); switch (c.unicode()) { @@ -59,8 +60,9 @@ static int matchEscapedChar(const QString &text, int offset) // hex encoded character case 'x': if (offset + 2 < text.size() && isHexChar(text.at(offset + 2))) { - if (offset + 3 < text.size() && isHexChar(text.at(offset + 3))) + if (offset + 3 < text.size() && isHexChar(text.at(offset + 3))) { return offset + 4; + } return offset + 3; } return offset; @@ -75,8 +77,9 @@ static int matchEscapedChar(const QString &text, int offset) case '6': case '7': if (offset + 2 < text.size() && isOctalChar(text.at(offset + 2))) { - if (offset + 3 < text.size() && isOctalChar(text.at(offset + 3))) + if (offset + 3 < text.size() && isOctalChar(text.at(offset + 3))) { return offset + 4; + } return offset + 3; } return offset + 2; @@ -116,26 +119,31 @@ bool Rule::load(QXmlStreamReader &reader) Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); m_attribute = reader.attributes().value(QLatin1String("attribute")).toString(); - if (reader.name() != QLatin1String("IncludeRules")) // IncludeRules uses this with a different semantic + if (reader.name() != QLatin1String("IncludeRules")) { // IncludeRules uses this with a different semantic m_context.parse(reader.attributes().value(QLatin1String("context"))); + } m_firstNonSpace = Xml::attrToBool(reader.attributes().value(QLatin1String("firstNonSpace"))); m_lookAhead = Xml::attrToBool(reader.attributes().value(QLatin1String("lookAhead"))); bool colOk = false; m_column = reader.attributes().value(QLatin1String("column")).toInt(&colOk); - if (!colOk) + if (!colOk) { m_column = -1; + } auto regionName = reader.attributes().value(QLatin1String("beginRegion")); - if (!regionName.isEmpty()) + if (!regionName.isEmpty()) { m_beginRegion = FoldingRegion(FoldingRegion::Begin, DefinitionData::get(m_def.definition())->foldingRegionId(regionName.toString())); + } regionName = reader.attributes().value(QLatin1String("endRegion")); - if (!regionName.isEmpty()) + if (!regionName.isEmpty()) { m_endRegion = FoldingRegion(FoldingRegion::End, DefinitionData::get(m_def.definition())->foldingRegionId(regionName.toString())); + } auto result = doLoad(reader); - if (m_lookAhead && m_context.isStay()) + if (m_lookAhead && m_context.isStay()) { result = false; + } // be done with this rule, skip all subelements, e.g. no longer supported sub-rules reader.skipCurrentElement(); @@ -184,42 +192,60 @@ void Rule::loadAdditionalWordDelimiters(QXmlStreamReader &reader) Rule::Ptr Rule::create(QStringView name) { - if (name == QLatin1String("AnyChar")) + if (name == QLatin1String("AnyChar")) { return std::make_shared<AnyChar>(); - if (name == QLatin1String("DetectChar")) + } + if (name == QLatin1String("DetectChar")) { return std::make_shared<DetectChar>(); - if (name == QLatin1String("Detect2Chars")) + } + if (name == QLatin1String("Detect2Chars")) { return std::make_shared<Detect2Char>(); - if (name == QLatin1String("DetectIdentifier")) + } + if (name == QLatin1String("DetectIdentifier")) { return std::make_shared<DetectIdentifier>(); - if (name == QLatin1String("DetectSpaces")) + } + if (name == QLatin1String("DetectSpaces")) { return std::make_shared<DetectSpaces>(); - if (name == QLatin1String("Float")) + } + if (name == QLatin1String("Float")) { return std::make_shared<Float>(); - if (name == QLatin1String("Int")) + } + if (name == QLatin1String("Int")) { return std::make_shared<Int>(); - if (name == QLatin1String("HlCChar")) + } + if (name == QLatin1String("HlCChar")) { return std::make_shared<HlCChar>(); - if (name == QLatin1String("HlCHex")) + } + if (name == QLatin1String("HlCHex")) { return std::make_shared<HlCHex>(); - if (name == QLatin1String("HlCOct")) + } + if (name == QLatin1String("HlCOct")) { return std::make_shared<HlCOct>(); - if (name == QLatin1String("HlCStringChar")) + } + if (name == QLatin1String("HlCStringChar")) { return std::make_shared<HlCStringChar>(); - if (name == QLatin1String("IncludeRules")) + } + if (name == QLatin1String("IncludeRules")) { return std::make_shared<IncludeRules>(); - if (name == QLatin1String("keyword")) + } + if (name == QLatin1String("keyword")) { return std::make_shared<KeywordListRule>(); - if (name == QLatin1String("LineContinue")) + } + if (name == QLatin1String("LineContinue")) { return std::make_shared<LineContinue>(); - if (name == QLatin1String("RangeDetect")) + } + if (name == QLatin1String("RangeDetect")) { return std::make_shared<RangeDetect>(); - if (name == QLatin1String("RegExpr")) + } + if (name == QLatin1String("RegExpr")) { return std::make_shared<RegExpr>(); - if (name == QLatin1String("StringDetect")) + } + if (name == QLatin1String("StringDetect")) { return std::make_shared<StringDetect>(); - if (name == QLatin1String("WordDetect")) + } + if (name == QLatin1String("WordDetect")) { return std::make_shared<WordDetect>(); + } qCWarning(Log) << "Unknown rule type:" << name; return Ptr(nullptr); @@ -233,23 +259,26 @@ bool Rule::isWordDelimiter(QChar c) const bool AnyChar::doLoad(QXmlStreamReader &reader) { m_chars = reader.attributes().value(QLatin1String("String")).toString(); - if (m_chars.size() == 1) + if (m_chars.size() == 1) { qCDebug(Log) << "AnyChar rule with just one char: use DetectChar instead."; + } return !m_chars.isEmpty(); } -MatchResult AnyChar::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult AnyChar::doMatch(QStringView text, int offset, const QStringList &) const { - if (m_chars.contains(text.at(offset))) + if (m_chars.contains(text.at(offset))) { return offset + 1; + } return offset; } bool DetectChar::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QLatin1String("char")); - if (s.isEmpty()) + if (s.isEmpty()) { return false; + } m_char = s.at(0); m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); if (m_dynamic) { @@ -258,18 +287,21 @@ bool DetectChar::doLoad(QXmlStreamReader &reader) return true; } -MatchResult DetectChar::doMatch(const QString &text, int offset, const QStringList &captures) const +MatchResult DetectChar::doMatch(QStringView text, int offset, const QStringList &captures) const { if (m_dynamic) { - if (m_captureIndex == 0 || captures.size() <= m_captureIndex || captures.at(m_captureIndex).isEmpty()) + if (m_captureIndex == 0 || captures.size() <= m_captureIndex || captures.at(m_captureIndex).isEmpty()) { return offset; - if (text.at(offset) == captures.at(m_captureIndex).at(0)) + } + if (text.at(offset) == captures.at(m_captureIndex).at(0)) { return offset + 1; + } return offset; } - if (text.at(offset) == m_char) + if (text.at(offset) == m_char) { return offset + 1; + } return offset; } @@ -277,40 +309,46 @@ bool Detect2Char::doLoad(QXmlStreamReader &reader) { const auto s1 = reader.attributes().value(QLatin1String("char")); const auto s2 = reader.attributes().value(QLatin1String("char1")); - if (s1.isEmpty() || s2.isEmpty()) + if (s1.isEmpty() || s2.isEmpty()) { return false; + } m_char1 = s1.at(0); m_char2 = s2.at(0); return true; } -MatchResult Detect2Char::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult Detect2Char::doMatch(QStringView text, int offset, const QStringList &) const { - if (text.size() - offset < 2) + if (text.size() - offset < 2) { return offset; - if (text.at(offset) == m_char1 && text.at(offset + 1) == m_char2) + } + if (text.at(offset) == m_char1 && text.at(offset + 1) == m_char2) { return offset + 2; + } return offset; } -MatchResult DetectIdentifier::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult DetectIdentifier::doMatch(QStringView text, int offset, const QStringList &) const { - if (!text.at(offset).isLetter() && text.at(offset) != QLatin1Char('_')) + if (!text.at(offset).isLetter() && text.at(offset) != QLatin1Char('_')) { return offset; + } for (int i = offset + 1; i < text.size(); ++i) { const auto c = text.at(i); - if (!c.isLetterOrNumber() && c != QLatin1Char('_')) + if (!c.isLetterOrNumber() && c != QLatin1Char('_')) { return i; + } } return text.size(); } -MatchResult DetectSpaces::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult DetectSpaces::doMatch(QStringView text, int offset, const QStringList &) const { - while (offset < text.size() && text.at(offset).isSpace()) + while (offset < text.size() && text.at(offset).isSpace()) { ++offset; + } return offset; } @@ -320,63 +358,76 @@ bool Float::doLoad(QXmlStreamReader &reader) return true; } -MatchResult Float::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult Float::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) + if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { return offset; + } auto newOffset = offset; - while (newOffset < text.size() && isDigit(text.at(newOffset))) + while (newOffset < text.size() && isDigit(text.at(newOffset))) { ++newOffset; + } - if (newOffset >= text.size() || text.at(newOffset) != QLatin1Char('.')) + if (newOffset >= text.size() || text.at(newOffset) != QLatin1Char('.')) { return offset; + } ++newOffset; - while (newOffset < text.size() && isDigit(text.at(newOffset))) + while (newOffset < text.size() && isDigit(text.at(newOffset))) { ++newOffset; + } - if (newOffset == offset + 1) // we only found a decimal point + if (newOffset == offset + 1) { // we only found a decimal point return offset; + } auto expOffset = newOffset; - if (expOffset >= text.size() || (text.at(expOffset) != QLatin1Char('e') && text.at(expOffset) != QLatin1Char('E'))) + if (expOffset >= text.size() || (text.at(expOffset) != QLatin1Char('e') && text.at(expOffset) != QLatin1Char('E'))) { return newOffset; + } ++expOffset; - if (expOffset < text.size() && (text.at(expOffset) == QLatin1Char('+') || text.at(expOffset) == QLatin1Char('-'))) + if (expOffset < text.size() && (text.at(expOffset) == QLatin1Char('+') || text.at(expOffset) == QLatin1Char('-'))) { ++expOffset; + } bool foundExpDigit = false; while (expOffset < text.size() && isDigit(text.at(expOffset))) { ++expOffset; foundExpDigit = true; } - if (!foundExpDigit) + if (!foundExpDigit) { return newOffset; + } return expOffset; } -MatchResult HlCChar::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult HlCChar::doMatch(QStringView text, int offset, const QStringList &) const { - if (text.size() < offset + 3) + if (text.size() < offset + 3) { return offset; + } - if (text.at(offset) != QLatin1Char('\'') || text.at(offset + 1) == QLatin1Char('\'')) + if (text.at(offset) != QLatin1Char('\'') || text.at(offset + 1) == QLatin1Char('\'')) { return offset; + } auto newOffset = matchEscapedChar(text, offset + 1); if (newOffset == offset + 1) { - if (text.at(newOffset) == QLatin1Char('\\')) + if (text.at(newOffset) == QLatin1Char('\\')) { return offset; - else + } else { ++newOffset; + } } - if (newOffset >= text.size()) + if (newOffset >= text.size()) { return offset; + } - if (text.at(newOffset) == QLatin1Char('\'')) + if (text.at(newOffset) == QLatin1Char('\'')) { return newOffset + 1; + } return offset; } @@ -387,23 +438,28 @@ bool HlCHex::doLoad(QXmlStreamReader &reader) return true; } -MatchResult HlCHex::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult HlCHex::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) + if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { return offset; + } - if (text.size() < offset + 3) + if (text.size() < offset + 3) { return offset; + } - if (text.at(offset) != QLatin1Char('0') || (text.at(offset + 1) != QLatin1Char('x') && text.at(offset + 1) != QLatin1Char('X'))) + if (text.at(offset) != QLatin1Char('0') || (text.at(offset + 1) != QLatin1Char('x') && text.at(offset + 1) != QLatin1Char('X'))) { return offset; + } - if (!isHexChar(text.at(offset + 2))) + if (!isHexChar(text.at(offset + 2))) { return offset; + } offset += 3; - while (offset < text.size() && isHexChar(text.at(offset))) + while (offset < text.size() && isHexChar(text.at(offset))) { ++offset; + } // TODO Kate matches U/L suffix, QtC does not? @@ -416,28 +472,33 @@ bool HlCOct::doLoad(QXmlStreamReader &reader) return true; } -MatchResult HlCOct::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult HlCOct::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) + if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { return offset; + } - if (text.size() < offset + 2) + if (text.size() < offset + 2) { return offset; + } - if (text.at(offset) != QLatin1Char('0')) + if (text.at(offset) != QLatin1Char('0')) { return offset; + } - if (!isOctalChar(text.at(offset + 1))) + if (!isOctalChar(text.at(offset + 1))) { return offset; + } offset += 2; - while (offset < text.size() && isOctalChar(text.at(offset))) + while (offset < text.size() && isOctalChar(text.at(offset))) { ++offset; + } return offset; } -MatchResult HlCStringChar::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult HlCStringChar::doMatch(QStringView text, int offset, const QStringList &) const { return matchEscapedChar(text, offset); } @@ -461,17 +522,19 @@ bool IncludeRules::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QLatin1String("context")); const auto split = s.split(QString::fromLatin1("##"), Qt::KeepEmptyParts); - if (split.isEmpty()) + if (split.isEmpty()) { return false; + } m_contextName = split.at(0).toString(); - if (split.size() > 1) + if (split.size() > 1) { m_defName = split.at(1).toString(); + } m_includeAttribute = Xml::attrToBool(reader.attributes().value(QLatin1String("includeAttrib"))); return !m_contextName.isEmpty() || !m_defName.isEmpty(); } -MatchResult IncludeRules::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult IncludeRules::doMatch(QStringView text, int offset, const QStringList &) const { Q_UNUSED(text); qCWarning(Log) << "Unresolved include rule for" << m_contextName << "##" << m_defName; @@ -484,13 +547,15 @@ bool Int::doLoad(QXmlStreamReader &reader) return true; } -MatchResult Int::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult Int::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) + if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { return offset; + } - while (offset < text.size() && isDigit(text.at(offset))) + while (offset < text.size() && isDigit(text.at(offset))) { ++offset; + } return offset; } @@ -522,21 +587,24 @@ bool KeywordListRule::doLoad(QXmlStreamReader &reader) return !m_keywordList->isEmpty(); } -MatchResult KeywordListRule::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult KeywordListRule::doMatch(QStringView text, int offset, const QStringList &) const { auto newOffset = offset; - while (text.size() > newOffset && !isWordDelimiter(text.at(newOffset))) + while (text.size() > newOffset && !isWordDelimiter(text.at(newOffset))) { ++newOffset; - if (newOffset == offset) + } + if (newOffset == offset) { return offset; + } if (m_hasCaseSensitivityOverride) { - if (m_keywordList->contains(QStringView(text).mid(offset, newOffset - offset), - m_caseSensitivityOverride)) + if (m_keywordList->contains(text.mid(offset, newOffset - offset), m_caseSensitivityOverride)) { return newOffset; + } } else { - if (m_keywordList->contains(QStringView(text).mid(offset, newOffset - offset))) + if (m_keywordList->contains(text.mid(offset, newOffset - offset))) { return newOffset; + } } // we don't match, but we can skip until newOffset as we can't start a keyword in-between @@ -546,17 +614,19 @@ MatchResult KeywordListRule::doMatch(const QString &text, int offset, const QStr bool LineContinue::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QLatin1String("char")); - if (s.isEmpty()) + if (s.isEmpty()) { m_char = QLatin1Char('\\'); - else + } else { m_char = s.at(0); + } return true; } -MatchResult LineContinue::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult LineContinue::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset == text.size() - 1 && text.at(offset) == m_char) + if (offset == text.size() - 1 && text.at(offset) == m_char) { return offset + 1; + } return offset; } @@ -564,24 +634,28 @@ bool RangeDetect::doLoad(QXmlStreamReader &reader) { const auto s1 = reader.attributes().value(QLatin1String("char")); const auto s2 = reader.attributes().value(QLatin1String("char1")); - if (s1.isEmpty() || s2.isEmpty()) + if (s1.isEmpty() || s2.isEmpty()) { return false; + } m_begin = s1.at(0); m_end = s2.at(0); return true; } -MatchResult RangeDetect::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult RangeDetect::doMatch(QStringView text, int offset, const QStringList &) const { - if (text.size() - offset < 2) + if (text.size() - offset < 2) { return offset; - if (text.at(offset) != m_begin) + } + if (text.at(offset) != m_begin) { return offset; + } auto newOffset = offset + 1; while (newOffset < text.size()) { - if (text.at(newOffset) == m_end) + if (text.at(newOffset) == m_end) { return newOffset + 1; + } ++newOffset; } return offset; @@ -596,7 +670,9 @@ bool RegExpr::doLoad(QXmlStreamReader &reader) m_regexp.setPatternOptions((isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) | (isCaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption) // DontCaptureOption is removed by resolvePostProcessing() when necessary - | QRegularExpression::DontCaptureOption); + | QRegularExpression::DontCaptureOption + // ensure Unicode support is enabled + | QRegularExpression::UseUnicodePropertiesOption); m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); @@ -605,8 +681,9 @@ bool RegExpr::doLoad(QXmlStreamReader &reader) void KSyntaxHighlighting::RegExpr::resolvePostProcessing() { - if (m_isResolved) + if (m_isResolved) { return; + } m_isResolved = true; bool hasCapture = false; @@ -641,7 +718,7 @@ void KSyntaxHighlighting::RegExpr::resolvePostProcessing() } } -MatchResult RegExpr::doMatch(const QString &text, int offset, const QStringList &captures) const +MatchResult RegExpr::doMatch(QStringView text, int offset, const QStringList &captures) const { /** * for dynamic case: create new pattern with right instantiation @@ -651,7 +728,11 @@ MatchResult RegExpr::doMatch(const QString &text, int offset, const QStringList /** * match the pattern */ +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2) + const auto result = regexp.match(text.toString(), offset, QRegularExpression::NormalMatch, QRegularExpression::DontCheckSubjectStringMatchOption); +#else const auto result = regexp.match(text, offset, QRegularExpression::NormalMatch, QRegularExpression::DontCheckSubjectStringMatchOption); +#endif if (result.capturedStart() == offset) { /** * we only need to compute the captured texts if we have real capture groups @@ -683,16 +764,16 @@ bool StringDetect::doLoad(QXmlStreamReader &reader) return !m_string.isEmpty(); } -MatchResult StringDetect::doMatch(const QString &text, int offset, const QStringList &captures) const +MatchResult StringDetect::doMatch(QStringView text, int offset, const QStringList &captures) const { /** * for dynamic case: create new pattern with right instantiation */ const auto &pattern = m_dynamic ? replaceCaptures(m_string, captures, false) : m_string; - if (offset + pattern.size() <= text.size() - && QStringView(text).mid(offset, pattern.size()).compare(pattern, m_caseSensitivity) == 0) + if (offset + pattern.size() <= text.size() && text.mid(offset, pattern.size()).compare(pattern, m_caseSensitivity) == 0) { return offset + pattern.size(); + } return offset; } @@ -704,23 +785,27 @@ bool WordDetect::doLoad(QXmlStreamReader &reader) return !m_word.isEmpty(); } -MatchResult WordDetect::doMatch(const QString &text, int offset, const QStringList &) const +MatchResult WordDetect::doMatch(QStringView text, int offset, const QStringList &) const { - if (text.size() - offset < m_word.size()) + if (text.size() - offset < m_word.size()) { return offset; + } /** * detect delimiter characters on the inner and outer boundaries of the string * NOTE: m_word isn't empty */ - if (offset > 0 && !isWordDelimiter(text.at(offset - 1)) && !isWordDelimiter(text.at(offset))) + if (offset > 0 && !isWordDelimiter(text.at(offset - 1)) && !isWordDelimiter(text.at(offset))) { return offset; + } - if (QStringView(text).mid(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) + if (text.mid(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) { return offset; + } - if (text.size() == offset + m_word.size() || isWordDelimiter(text.at(offset + m_word.size())) || isWordDelimiter(text.at(offset + m_word.size() - 1))) + if (text.size() == offset + m_word.size() || isWordDelimiter(text.at(offset + m_word.size())) || isWordDelimiter(text.at(offset + m_word.size() - 1))) { return offset + m_word.size(); + } return offset; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h index 22c786eaa2..374eb87dfa 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h @@ -87,7 +87,7 @@ public: { } - virtual MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const = 0; + virtual MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const = 0; static Rule::Ptr create(QStringView name); @@ -121,58 +121,58 @@ protected: bool m_dynamic = false; }; -class AnyChar : public Rule +class AnyChar final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QString m_chars; }; -class DetectChar : public Rule +class DetectChar final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QChar m_char; int m_captureIndex = 0; }; -class Detect2Char : public Rule +class Detect2Char final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QChar m_char1; QChar m_char2; }; -class DetectIdentifier : public Rule +class DetectIdentifier final : public Rule { protected: - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class DetectSpaces : public Rule +class DetectSpaces final : public Rule { protected: - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class Float : public Rule +class Float final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class IncludeRules : public Rule +class IncludeRules final : public Rule { public: QString contextName() const; @@ -181,7 +181,7 @@ public: protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QString m_contextName; @@ -189,44 +189,44 @@ private: bool m_includeAttribute; }; -class Int : public Rule +class Int final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; }; -class HlCChar : public Rule +class HlCChar final : public Rule { protected: - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class HlCHex : public Rule +class HlCHex final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class HlCOct : public Rule +class HlCOct final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class HlCStringChar : public Rule +class HlCStringChar final : public Rule { protected: - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; }; -class KeywordListRule : public Rule +class KeywordListRule final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: KeywordList *m_keywordList; @@ -234,55 +234,55 @@ private: Qt::CaseSensitivity m_caseSensitivityOverride; }; -class LineContinue : public Rule +class LineContinue final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QChar m_char; }; -class RangeDetect : public Rule +class RangeDetect final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QChar m_begin; QChar m_end; }; -class RegExpr : public Rule +class RegExpr final : public Rule { protected: void resolvePostProcessing() override; bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QRegularExpression m_regexp; bool m_isResolved = false; }; -class StringDetect : public Rule +class StringDetect final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QString m_string; Qt::CaseSensitivity m_caseSensitivity; }; -class WordDetect : public Rule +class WordDetect final : public Rule { protected: bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QString m_word; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp index f9b4f4b4ab..ea21fef215 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp @@ -104,7 +104,8 @@ bool State::operator!=(const State &other) const bool State::indentationBasedFoldingEnabled() const { - if (!d || d->m_contextStack.isEmpty()) + if (!d || d->m_contextStack.isEmpty()) { return false; + } return d->m_contextStack.last().first->indentationBasedFoldingEnabled(); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp index d0c4ee98ae..41551e96da 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp @@ -37,11 +37,13 @@ public: FoldingRegion SyntaxHighlighterPrivate::foldingRegion(const QTextBlock &startBlock) { const auto data = dynamic_cast<TextBlockUserData *>(startBlock.userData()); - if (!data) + if (!data) { return FoldingRegion(); + } for (int i = data->foldingRegions.size() - 1; i >= 0; --i) { - if (data->foldingRegions.at(i).type() == FoldingRegion::Begin) + if (data->foldingRegions.at(i).type() == FoldingRegion::Begin) { return data->foldingRegions.at(i); + } } return FoldingRegion(); } @@ -68,8 +70,9 @@ void SyntaxHighlighter::setDefinition(const Definition &def) { const auto needsRehighlight = definition() != def; AbstractHighlighter::setDefinition(def); - if (needsRehighlight) + if (needsRehighlight) { rehighlight(); + } } bool SyntaxHighlighter::startsFoldingRegion(const QTextBlock &startBlock) const @@ -86,17 +89,21 @@ QTextBlock SyntaxHighlighter::findFoldingRegionEnd(const QTextBlock &startBlock) while (block.isValid()) { block = block.next(); const auto data = dynamic_cast<TextBlockUserData *>(block.userData()); - if (!data) + if (!data) { continue; + } for (auto it = data->foldingRegions.constBegin(); it != data->foldingRegions.constEnd(); ++it) { - if ((*it).id() != region.id()) + if ((*it).id() != region.id()) { continue; - if ((*it).type() == FoldingRegion::End) + } + if ((*it).type() == FoldingRegion::End) { --depth; - else if ((*it).type() == FoldingRegion::Begin) + } else if ((*it).type() == FoldingRegion::Begin) { ++depth; - if (depth == 0) + } + if (depth == 0) { return block; + } } } @@ -111,8 +118,9 @@ void SyntaxHighlighter::highlightBlock(const QString &text) if (currentBlock().position() > 0) { const auto prevBlock = currentBlock().previous(); const auto prevData = dynamic_cast<TextBlockUserData *>(prevBlock.userData()); - if (prevData) + if (prevData) { state = prevData->state; + } } d->foldingRegions.clear(); state = highlightLine(text, state); @@ -126,35 +134,43 @@ void SyntaxHighlighter::highlightBlock(const QString &text) return; } - if (data->state == state && data->foldingRegions == d->foldingRegions) // we ended up in the same state, so we are done here + if (data->state == state && data->foldingRegions == d->foldingRegions) { // we ended up in the same state, so we are done here return; + } data->state = state; data->foldingRegions = d->foldingRegions; const auto nextBlock = currentBlock().next(); - if (nextBlock.isValid()) + if (nextBlock.isValid()) { QMetaObject::invokeMethod(this, "rehighlightBlock", Qt::QueuedConnection, Q_ARG(QTextBlock, nextBlock)); + } } void SyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) { - if (length == 0) + if (length == 0) { return; + } QTextCharFormat tf; // always set the foreground color to avoid palette issues tf.setForeground(format.textColor(theme())); - if (format.hasBackgroundColor(theme())) + if (format.hasBackgroundColor(theme())) { tf.setBackground(format.backgroundColor(theme())); - if (format.isBold(theme())) + } + if (format.isBold(theme())) { tf.setFontWeight(QFont::Bold); - if (format.isItalic(theme())) + } + if (format.isItalic(theme())) { tf.setFontItalic(true); - if (format.isUnderline(theme())) + } + if (format.isUnderline(theme())) { tf.setFontUnderline(true); - if (format.isStrikeThrough(theme())) + } + if (format.isStrikeThrough(theme())) { tf.setFontStrikeOut(true); + } QSyntaxHighlighter::setFormat(offset, length, tf); } @@ -165,13 +181,15 @@ void SyntaxHighlighter::applyFolding(int offset, int length, FoldingRegion regio Q_UNUSED(length); Q_D(SyntaxHighlighter); - if (region.type() == FoldingRegion::Begin) + if (region.type() == FoldingRegion::Begin) { d->foldingRegions.push_back(region); + } if (region.type() == FoldingRegion::End) { for (int i = d->foldingRegions.size() - 1; i >= 0; --i) { - if (d->foldingRegions.at(i).id() != region.id() || d->foldingRegions.at(i).type() != FoldingRegion::Begin) + if (d->foldingRegions.at(i).id() != region.id() || d->foldingRegions.at(i).type() != FoldingRegion::Begin) { continue; + } d->foldingRegions.remove(i); return; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h index 076e8d0318..37f9de1694 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h @@ -64,6 +64,8 @@ class RepositoryPrivate; class KSYNTAXHIGHLIGHTING_EXPORT Theme { Q_GADGET + Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString translatedName READ translatedName) public: // TODO KF6: // - make TextStyle an enum class diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp index 2919a31a6e..f9c386bc2a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp @@ -160,8 +160,9 @@ bool ThemeData::load(const QString &filePath) for (auto it = customStyles.begin(); it != customStyles.end(); ++it) { const auto obj = it.value().toObject(); auto &overrideStyle = m_textStyleOverrides[it.key()]; - for (auto it2 = obj.begin(); it2 != obj.end(); ++it2) + for (auto it2 = obj.begin(); it2 != obj.end(); ++it2) { overrideStyle.insert(it2.key(), readThemeData(it2.value().toObject())); + } } return true; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp index 82d3e4ea80..98daff19d6 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp @@ -4,14 +4,16 @@ SPDX-License-Identifier: MIT */ -#include "wildcardmatcher_p.h" +#include "wildcardmatcher.h" using namespace KSyntaxHighlighting; #include <QChar> -#include <QString> +#include <QStringView> -static bool exactMatch(const QString &candidate, const QString &wildcard, int candidatePosFromRight, int wildcardPosFromRight, bool caseSensitive = true) +namespace +{ +bool wildcardMatch(QStringView candidate, QStringView wildcard, int candidatePosFromRight, int wildcardPosFromRight) { for (; wildcardPosFromRight >= 0; wildcardPosFromRight--) { const auto ch = wildcard.at(wildcardPosFromRight).unicode(); @@ -27,7 +29,7 @@ static bool exactMatch(const QString &candidate, const QString &wildcard, int ca // Eat all we can and go back as far as we have to for (int j = -1; j <= candidatePosFromRight; j++) { - if (exactMatch(candidate, wildcard, j, wildcardPosFromRight - 1)) { + if (wildcardMatch(candidate, wildcard, j, wildcardPosFromRight - 1)) { return true; } } @@ -47,18 +49,19 @@ static bool exactMatch(const QString &candidate, const QString &wildcard, int ca } const auto candidateCh = candidate.at(candidatePosFromRight).unicode(); - const auto match = caseSensitive ? (candidateCh == ch) : (QChar::toLower(candidateCh) == QChar::toLower(ch)); - if (match) { + if (candidateCh == ch) { candidatePosFromRight--; } else { return false; } } } - return true; + return candidatePosFromRight == -1; } -bool WildcardMatcher::exactMatch(const QString &candidate, const QString &wildcard, bool caseSensitive) +} // unnamed namespace + +bool WildcardMatcher::exactMatch(QStringView candidate, QStringView wildcard) { - return ::exactMatch(candidate, wildcard, candidate.length() - 1, wildcard.length() - 1, caseSensitive); + return ::wildcardMatch(candidate, wildcard, candidate.length() - 1, wildcard.length() - 1); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.h b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.h new file mode 100644 index 0000000000..4042de3788 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.h @@ -0,0 +1,33 @@ +/* + SPDX-FileCopyrightText: 2007 Sebastian Pipping <webmaster@hartwork.org> + + SPDX-License-Identifier: MIT +*/ + +#ifndef KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_H +#define KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_H + +#include "ksyntaxhighlighting_export.h" + +#include <QStringView> + +namespace KSyntaxHighlighting +{ +namespace WildcardMatcher +{ +/** + * Matches a string against a given wildcard case-sensitively. + * The wildcard supports '*' (".*" in regex) and '?' ("." in regex), not more. + * + * @param candidate Text to match + * @param wildcard Wildcard to use + * @return True for an exact match, false otherwise + * + * @since 5.86 + */ +KSYNTAXHIGHLIGHTING_EXPORT bool exactMatch(QStringView candidate, QStringView wildcard); +} + +} + +#endif // KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp index 634eeb70bb..f9079ea1f3 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp @@ -11,15 +11,17 @@ using namespace KSyntaxHighlighting; WordDelimiters::WordDelimiters() : asciiDelimiters{} { - for (const char *p = "\t !%&()*+,-./:;<=>?[\\]^{|}~"; *p; ++p) + for (const char *p = "\t !%&()*+,-./:;<=>?[\\]^{|}~"; *p; ++p) { // int(*p) fix -Wchar-subscripts asciiDelimiters[int(*p)] = true; + } } bool WordDelimiters::contains(QChar c) const { - if (c.unicode() < 128) + if (c.unicode() < 128) { return asciiDelimiters[c.unicode()]; + } // perf tells contains is MUCH faster than binary search here, very short array return notAsciiDelimiters.contains(c); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h index 3fa5db10a4..c1afaaa6bb 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h @@ -12,7 +12,7 @@ namespace KSyntaxHighlighting { /** - * Repesents a list of character that separates 2 words. + * Represents a list of character that separates 2 words. * * Default delimiters are .():!+*,-<=>%&/;?[]^{|}~\, space (' ') and tabulator ('\t'). * diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h index 5aae9eebb5..2e1dd25cc8 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h @@ -17,7 +17,7 @@ namespace Xml /** Parse a xs:boolean attribute. */ inline bool attrToBool(QStringView str) { - return str == QLatin1String("1") || str.compare(QString("true"), Qt::CaseInsensitive) == 0; + return str == QStringLiteral("1") || str.compare(QStringLiteral("true"), Qt::CaseInsensitive) == 0; } } diff --git a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro index 333af297a8..e9354a2f69 100644 --- a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro +++ b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro @@ -3,7 +3,7 @@ include(autogenerated/autogenerated.pri) QT += network -DEFINES += KSYNTAXHIGHLIGHTING_LIBRARY +DEFINES += KF5SyntaxHighlighting_EXPORTS RESOURCES += \ data/themes/theme-data.qrc diff --git a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs index 27b5987e1a..985264440f 100644 --- a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs +++ b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs @@ -25,7 +25,7 @@ Project { name: "KSyntaxHighlighting_bundled" condition: !qtc.preferSystemSyntaxHighlighting || !Qt.KSyntaxHighlighting.present - cpp.defines: base.concat("KSYNTAXHIGHLIGHTING_LIBRARY") + cpp.defines: base.concat("KF5SyntaxHighlighting_EXPORTS") cpp.includePaths: [ product.sourceDirectory + "/src/lib/", product.sourceDirectory + "/autogenerated/src/lib/", @@ -66,7 +66,6 @@ Project { "htmlhighlighter.h", "keywordlist.cpp", "keywordlist_p.h", - "ksyntaxhighlighting_export.h", "matchresult_p.h", "repository.cpp", "repository.h", diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 5eaa04baf4..3f7e791115 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -38,6 +38,7 @@ #include <cplusplus/Control.h> #include <utils/algorithm.h> +#include <utils/porting.h> #include <QStack> #include <QHash> @@ -150,9 +151,9 @@ bool operator==(const FullyQualifiedName &left, const FullyQualifiedName &right) return compareFullyQualifiedName(left.fqn, right.fqn); } -uint qHash(const FullyQualifiedName &fullyQualifiedName) +Utils::QHashValueType qHash(const FullyQualifiedName &fullyQualifiedName) { - uint h = 0; + Utils::QHashValueType h = 0; for (int i = 0; i < fullyQualifiedName.fqn.size(); ++i) { if (const Name *n = fullyQualifiedName.fqn.at(i)) { if (const Identifier *id = n->identifier()) { diff --git a/src/libs/cplusplus/LookupItem.cpp b/src/libs/cplusplus/LookupItem.cpp index 7fc73ba240..f4fce6e4ed 100644 --- a/src/libs/cplusplus/LookupItem.cpp +++ b/src/libs/cplusplus/LookupItem.cpp @@ -33,10 +33,10 @@ using namespace CPlusPlus; -uint CPlusPlus::qHash(const LookupItem &key) +Utils::QHashValueType CPlusPlus::qHash(const LookupItem &key) { - const uint h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type()); - const uint h2 = QT_PREPEND_NAMESPACE(qHash)(key.scope()); + const Utils::QHashValueType h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type()); + const Utils::QHashValueType h2 = QT_PREPEND_NAMESPACE(qHash)(key.scope()); return ((h1 << 16) | (h1 >> 16)) ^ h2; } diff --git a/src/libs/cplusplus/LookupItem.h b/src/libs/cplusplus/LookupItem.h index e2683c2877..bc760f8d8b 100644 --- a/src/libs/cplusplus/LookupItem.h +++ b/src/libs/cplusplus/LookupItem.h @@ -26,6 +26,7 @@ #pragma once #include <cplusplus/FullySpecifiedType.h> +#include <utils/porting.h> #include <QHash> @@ -70,6 +71,6 @@ private: ClassOrNamespace *_binding; }; -uint qHash(const CPlusPlus::LookupItem &result); +Utils::QHashValueType qHash(const CPlusPlus::LookupItem &result); } // namespace CPlusPlus diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index ea83933b7e..e3b2b07080 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -155,7 +155,7 @@ using namespace ExtensionSystem::Internal; \fn uint ExtensionSystem::qHash(const ExtensionSystem::PluginDependency &value) \internal */ -uint ExtensionSystem::qHash(const PluginDependency &value) +Utils::QHashValueType ExtensionSystem::qHash(const PluginDependency &value) { return qHash(value.name); } diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index d8d85ba520..4b2bcc1306 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -27,6 +27,8 @@ #include "extensionsystem_global.h" +#include <utils/porting.h> + #include <QString> #include <QHash> #include <QVector> @@ -65,7 +67,7 @@ struct EXTENSIONSYSTEM_EXPORT PluginDependency QString toString() const; }; -uint qHash(const ExtensionSystem::PluginDependency &value); +Utils::QHashValueType qHash(const ExtensionSystem::PluginDependency &value); struct EXTENSIONSYSTEM_EXPORT PluginArgumentDescription { diff --git a/src/libs/languageserverprotocol/jsonrpcmessages.cpp b/src/libs/languageserverprotocol/jsonrpcmessages.cpp index 64045f1e3a..2b71d34a75 100644 --- a/src/libs/languageserverprotocol/jsonrpcmessages.cpp +++ b/src/libs/languageserverprotocol/jsonrpcmessages.cpp @@ -37,6 +37,7 @@ #include <QTextCodec> namespace LanguageServerProtocol { +Q_LOGGING_CATEGORY(timingLog, "qtc.languageserverprotocol.timing", QtWarningMsg) constexpr const char CancelRequest::methodName[]; @@ -148,4 +149,10 @@ CancelRequest::CancelRequest(const CancelParameter ¶ms) : Notification(methodName, params) { } +void logElapsedTime(const QString &method, const QElapsedTimer &t) +{ + qCDebug(timingLog) << "received server reply to" << method + << "after" << t.elapsed() << "ms"; +} + } // namespace LanguageServerProtocol diff --git a/src/libs/languageserverprotocol/jsonrpcmessages.h b/src/libs/languageserverprotocol/jsonrpcmessages.h index bb20ca8a3c..010bc770f8 100644 --- a/src/libs/languageserverprotocol/jsonrpcmessages.h +++ b/src/libs/languageserverprotocol/jsonrpcmessages.h @@ -34,6 +34,7 @@ #include <utils/variant.h> #include <QDebug> +#include <QElapsedTimer> #include <QHash> #include <QJsonObject> #include <QJsonValue> @@ -294,6 +295,8 @@ public: { return JsonRpcMessage::isValid(errorMessage) && id().isValid(); } }; +void LANGUAGESERVERPROTOCOL_EXPORT logElapsedTime(const QString &method, const QElapsedTimer &t); + template <typename Result, typename ErrorDataType, typename Params> class Request : public Notification<Params> { @@ -316,9 +319,13 @@ public: Utils::optional<ResponseHandler> responseHandler() const final { - auto callback = [callback = m_callBack](const QByteArray &content, QTextCodec *codec) { + QElapsedTimer timer; + timer.start(); + auto callback = [callback = m_callBack, method = this->method(), t = std::move(timer)] + (const QByteArray &content, QTextCodec *codec) { if (!callback) return; + logElapsedTime(method, t); QString parseError; const QJsonObject &object = JsonRpcMessageHandler::toJsonObject(content, codec, diff --git a/src/libs/languageserverprotocol/lsptypes.cpp b/src/libs/languageserverprotocol/lsptypes.cpp index 820f4b6c4b..65651366a3 100644 --- a/src/libs/languageserverprotocol/lsptypes.cpp +++ b/src/libs/languageserverprotocol/lsptypes.cpp @@ -293,6 +293,14 @@ QTextCursor Position::toTextCursor(QTextDocument *doc) const return cursor; } +Position Position::withOffset(int offset, const QTextDocument *doc) const +{ + int line; + int character; + Utils::Text::convertPosition(doc, toPositionInDocument(doc) + offset, &line, &character); + return Position(line - 1, character - 1); +} + Range::Range(const Position &start, const Position &end) { setStart(start); @@ -323,7 +331,7 @@ bool Range::contains(const Range &other) const bool Range::overlaps(const Range &range) const { - return end() > range.start() && start() < range.end(); + return !isLeftOf(range) && !range.isLeftOf(*this); } QString expressionForGlob(QString globPattern) diff --git a/src/libs/languageserverprotocol/lsptypes.h b/src/libs/languageserverprotocol/lsptypes.h index 7cbe045563..7bd004ca6c 100644 --- a/src/libs/languageserverprotocol/lsptypes.h +++ b/src/libs/languageserverprotocol/lsptypes.h @@ -90,6 +90,7 @@ public: int toPositionInDocument(const QTextDocument *doc) const; QTextCursor toTextCursor(QTextDocument *doc) const; + Position withOffset(int offset, const QTextDocument *doc) const; }; inline bool operator<(const Position &first, const Position &second) @@ -103,6 +104,11 @@ inline bool operator>(const Position &first, const Position &second) return second < first; } +inline bool operator>=(const Position &first, const Position &second) +{ + return !(first < second); +} + inline bool operator<=(const Position &first, const Position &second) { return !(first > second); @@ -124,9 +130,12 @@ public: Position end() const { return typedValue<Position>(endKey); } void setEnd(const Position &end) { insert(endKey, end); } + bool isEmpty() const { return start() == end(); } bool contains(const Position &pos) const { return start() <= pos && pos <= end(); } bool contains(const Range &other) const; bool overlaps(const Range &range) const; + bool isLeftOf(const Range &other) const + { return isEmpty() || other.isEmpty() ? end() < other.start() : end() <= other.start(); } bool isValid() const override { return JsonObject::contains(startKey) && JsonObject::contains(endKey); } diff --git a/src/libs/modelinglib/qmt/infrastructure/handle.h b/src/libs/modelinglib/qmt/infrastructure/handle.h index b7333a1146..7558ec9699 100644 --- a/src/libs/modelinglib/qmt/infrastructure/handle.h +++ b/src/libs/modelinglib/qmt/infrastructure/handle.h @@ -74,7 +74,7 @@ private: }; template<class T> -inline int qHash(const Handle<T> &handle) +inline auto qHash(const Handle<T> &handle) { return qHash(handle.uid()); } diff --git a/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp b/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp index f2da9a9292..47706f91fc 100644 --- a/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp +++ b/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp @@ -38,6 +38,7 @@ #include "qmt/infrastructure/qmtassert.h" #include <utils/algorithm.h> +#include <utils/porting.h> #include <QSet> @@ -82,7 +83,7 @@ public: ObjectVisuals m_objectVisuals; }; -uint qHash(const ObjectStyleKey &styleKey) +Utils::QHashValueType qHash(const ObjectStyleKey &styleKey) { return ::qHash(styleKey.m_elementType) ^ qHash(styleKey.m_objectVisuals); } @@ -106,7 +107,7 @@ public: DObject::VisualPrimaryRole m_visualPrimaryRole = DObject::PrimaryRoleNormal; }; -uint qHash(const RelationStyleKey &styleKey) +Utils::QHashValueType qHash(const RelationStyleKey &styleKey) { return ::qHash(styleKey.m_elementType) ^ ::qHash(styleKey.m_visualPrimaryRole); } @@ -127,7 +128,7 @@ public: DAnnotation::VisualRole m_visualRole = DAnnotation::RoleNormal; }; -uint qHash(const AnnotationStyleKey &styleKey) +Utils::QHashValueType qHash(const AnnotationStyleKey &styleKey) { return ::qHash(styleKey.m_visualRole); } @@ -142,11 +143,11 @@ class BoundaryStyleKey { }; -uint qHash(const BoundaryStyleKey &styleKey) +Utils::QHashValueType qHash(const BoundaryStyleKey &styleKey) { Q_UNUSED(styleKey) - return 1; + return ::qHash(1); } bool operator==(const BoundaryStyleKey &lhs, const BoundaryStyleKey &rhs) @@ -162,11 +163,11 @@ class SwimlaneStyleKey { }; -uint qHash(const SwimlaneStyleKey &styleKey) +Utils::QHashValueType qHash(const SwimlaneStyleKey &styleKey) { Q_UNUSED(styleKey) - return 1; + return ::qHash(1); } bool operator==(const SwimlaneStyleKey &lhs, const SwimlaneStyleKey &rhs) diff --git a/src/libs/modelinglib/qmt/style/objectvisuals.cpp b/src/libs/modelinglib/qmt/style/objectvisuals.cpp index a4bdadc26e..7db69f6965 100644 --- a/src/libs/modelinglib/qmt/style/objectvisuals.cpp +++ b/src/libs/modelinglib/qmt/style/objectvisuals.cpp @@ -82,7 +82,7 @@ bool operator==(const ObjectVisuals &lhs, const ObjectVisuals &rhs) && lhs.depth() == rhs.depth(); } -uint qHash(const ObjectVisuals &objectVisuals) +Utils::QHashValueType qHash(const ObjectVisuals &objectVisuals) { return ::qHash(static_cast<int>(objectVisuals.visualPrimaryRole())) ^ ::qHash(static_cast<int>(objectVisuals.visualSecondaryRole())) diff --git a/src/libs/modelinglib/qmt/style/objectvisuals.h b/src/libs/modelinglib/qmt/style/objectvisuals.h index 0d708fe0a5..dcc4bee623 100644 --- a/src/libs/modelinglib/qmt/style/objectvisuals.h +++ b/src/libs/modelinglib/qmt/style/objectvisuals.h @@ -27,6 +27,8 @@ #include "qmt/diagram/dobject.h" +#include <utils/porting.h> + #include <QColor> namespace qmt { @@ -60,6 +62,6 @@ private: }; bool operator==(const ObjectVisuals &lhs, const ObjectVisuals &rhs); -uint qHash(const ObjectVisuals &objectVisuals); +Utils::QHashValueType qHash(const ObjectVisuals &objectVisuals); } // namespace qmt diff --git a/src/libs/qlitehtml b/src/libs/qlitehtml -Subproject 2fbaad08a01d611858bef5e747addea7f42318b +Subproject e6fcc8ddb4e435160cca6a94bd7b011fd169865 diff --git a/src/libs/qmldebug/qpacketprotocol.cpp b/src/libs/qmldebug/qpacketprotocol.cpp index 76822d34d4..24d4d29c54 100644 --- a/src/libs/qmldebug/qpacketprotocol.cpp +++ b/src/libs/qmldebug/qpacketprotocol.cpp @@ -225,7 +225,7 @@ void QPacketProtocol::send(const QByteArray &p) return; } - const qint32 sendSize = p.size() + sizeof(qint32); + const qint32 sendSize = qint32(p.size() + sizeof(qint32)); d->sendingPackets.append(sendSize); const qint32 sendSizeLE = qToLittleEndian(sendSize); diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 3ce402589c..38595a8b36 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -1263,13 +1263,28 @@ static bool equalIsAlwaysFalse(const Value *lhs, const Value *rhs) return false; } +static bool isIntegerValue(const Value *value) +{ + if (value->asNumberValue() || value->asIntValue()) + return true; + if (auto obj = value->asObjectValue()) + return obj->className() == "Number"; + + return false; +} + static bool strictCompareConstant(const Value *lhs, const Value *rhs) { if (lhs->asUnknownValue() || rhs->asUnknownValue()) return false; + if (lhs->asFunctionValue() || rhs->asFunctionValue()) // function evaluation not implemented + return false; + if (isIntegerValue(lhs) && isIntegerValue(rhs)) + return false; if (lhs->asBooleanValue() && !rhs->asBooleanValue()) return true; - if (lhs->asNumberValue() && !rhs->asNumberValue()) + // attached properties and working at runtime cases may be undefined at evaluation time + if (lhs->asNumberValue() && (!rhs->asNumberValue() && !rhs->asUndefinedValue())) return true; if (lhs->asStringValue() && !rhs->asStringValue()) return true; diff --git a/src/libs/qmljs/qmljsdialect.cpp b/src/libs/qmljs/qmljsdialect.cpp index cfe71b2265..d0b922a720 100644 --- a/src/libs/qmljs/qmljsdialect.cpp +++ b/src/libs/qmljs/qmljsdialect.cpp @@ -221,9 +221,9 @@ QList<Dialect> Dialect::companionLanguages() const return langs; } -uint qHash(const Dialect &o) +Utils::QHashValueType qHash(const Dialect &o) { - return uint(o.dialect()); + return Utils::QHashValueType(o.dialect()); } QDebug operator << (QDebug &dbg, const Dialect &dialect) diff --git a/src/libs/qmljs/qmljsdialect.h b/src/libs/qmljs/qmljsdialect.h index a2f2822599..e594164278 100644 --- a/src/libs/qmljs/qmljsdialect.h +++ b/src/libs/qmljs/qmljsdialect.h @@ -28,6 +28,7 @@ #include "qmljs_global.h" #include <utils/fileutils.h> +#include <utils/porting.h> #include <QDebug> #include <QString> @@ -73,7 +74,7 @@ private: Enum m_dialect; }; -QMLJS_EXPORT uint qHash(const Dialect &o); +QMLJS_EXPORT Utils::QHashValueType qHash(const Dialect &o); QMLJS_EXPORT QDebug operator << (QDebug &dbg, const Dialect &dialect); diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp index 3cf94cb342..757ff2c388 100644 --- a/src/libs/qmljs/qmljsimportdependencies.cpp +++ b/src/libs/qmljs/qmljsimportdependencies.cpp @@ -502,9 +502,9 @@ QString ImportKey::toString() const return res; } -uint qHash(const ImportKey &info) +Utils::QHashValueType qHash(const ImportKey &info) { - uint res = ::qHash(info.type) ^ + Utils::QHashValueType res = ::qHash(info.type) ^ ::qHash(info.majorVersion) ^ ::qHash(info.minorVersion); foreach (const QString &s, info.splitPath) res = res ^ ::qHash(s); diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h index 41f8491551..a05bf1b408 100644 --- a/src/libs/qmljs/qmljsimportdependencies.h +++ b/src/libs/qmljs/qmljsimportdependencies.h @@ -29,6 +29,7 @@ #include "qmljsdialect.h" #include <languageutils/componentversion.h> +#include <utils/porting.h> #include <QObject> #include <QString> @@ -117,7 +118,7 @@ public: QString toString() const; }; -uint qHash(const ImportKey &info); +Utils::QHashValueType qHash(const ImportKey &info); bool operator ==(const ImportKey &i1, const ImportKey &i2); bool operator !=(const ImportKey &i1, const ImportKey &i2); bool operator <(const ImportKey &i1, const ImportKey &i2); diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 9ae98e3530..47951eeb28 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -175,7 +175,7 @@ bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) co return fakeMetaObject == o.fakeMetaObject; } -uint qHash(const FakeMetaObjectWithOrigin &fmoo) +Utils::QHashValueType qHash(const FakeMetaObjectWithOrigin &fmoo) { return qHash(fmoo.fakeMetaObject); } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 6929386785..7322541e1a 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -31,6 +31,7 @@ #include <qmljs/parser/qmljsastfwd_p.h> #include <languageutils/fakemetaobject.h> +#include <utils/porting.h> #include <QFileInfoList> #include <QHash> @@ -734,7 +735,7 @@ public: bool operator ==(const FakeMetaObjectWithOrigin &o) const; }; -QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo); +QMLJS_EXPORT Utils::QHashValueType qHash(const FakeMetaObjectWithOrigin &fmoo); class QMLJS_EXPORT CppQmlTypes { diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 4fcdb0a748..58ead76afc 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -32,6 +32,7 @@ #include "qmljsmodelmanagerinterface.h" #include "qmljsconstants.h" +#include <utils/porting.h> #include <utils/qrcparser.h> #include <QDir> @@ -54,7 +55,7 @@ public: {} private: - friend uint qHash(const ImportCacheKey &); + friend Utils::QHashValueType qHash(const ImportCacheKey &); friend bool operator==(const ImportCacheKey &, const ImportCacheKey &); int m_type; @@ -63,7 +64,7 @@ private: int m_minorVersion; }; -uint qHash(const ImportCacheKey &info) +Utils::QHashValueType qHash(const ImportCacheKey &info) { return ::qHash(info.m_type) ^ ::qHash(info.m_path) ^ ::qHash(info.m_majorVersion) ^ ::qHash(info.m_minorVersion); diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 34048e8185..db08418ca7 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -1329,7 +1329,7 @@ bool rescanExports(const QString &fileName, FindExportedCppTypes &finder, QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes(); QHash<QString, QString> contextProperties = finder.contextProperties(); if (exported.isEmpty() && contextProperties.isEmpty()) { - hasNewInfo = hasNewInfo || newData.remove(fileName) > 0; + hasNewInfo = hasNewInfo || newData.remove(fileName); } else { ModelManagerInterface::CppData &data = newData[fileName]; if (!hasNewInfo && (data.exportedTypes.size() != exported.size() @@ -1382,7 +1382,7 @@ void ModelManagerInterface::updateCppQmlTypes( const bool scan = pair.second; const QString fileName = doc->fileName(); if (!scan) { - hasNewInfo = newData.remove(fileName) > 0 || hasNewInfo; + hasNewInfo = newData.remove(fileName) || hasNewInfo; const auto savedDocs = newDeclarations.value(fileName); for (const CPlusPlus::Document::Ptr &savedDoc : savedDocs) { finder(savedDoc); diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt index 9378c0e4e0..c34f583810 100644 --- a/src/libs/tracing/CMakeLists.txt +++ b/src/libs/tracing/CMakeLists.txt @@ -46,7 +46,7 @@ else() # < Qt 6.2 find_package(Qt6 COMPONENTS ShaderTools QUIET) add_qtc_library(Tracing - CONDITION TARGET Qt6::ShaderTools + CONDITION TARGET Qt6::ShaderTools AND TARGET Qt5::Quick FEATURE_INFO DEPENDS Utils Qt5::Qml Qt5::Quick PUBLIC_DEPENDS Qt5::Widgets diff --git a/src/libs/utils/CMakeLists.txt b/src/libs/utils/CMakeLists.txt index 9db6ea5f1e..b94b2b4222 100644 --- a/src/libs/utils/CMakeLists.txt +++ b/src/libs/utils/CMakeLists.txt @@ -168,6 +168,7 @@ add_qtc_library(Utils textfileformat.cpp textfileformat.h textutils.cpp textutils.h theme/theme.cpp theme/theme.h theme/theme_p.h + threadutils.cpp threadutils.h tooltip/effects.h tooltip/tips.cpp tooltip/tips.h tooltip/tooltip.cpp tooltip/tooltip.h diff --git a/src/libs/utils/elfreader.cpp b/src/libs/utils/elfreader.cpp index 3ff3388041..1883585bc8 100644 --- a/src/libs/utils/elfreader.cpp +++ b/src/libs/utils/elfreader.cpp @@ -113,7 +113,7 @@ bool ElfMapper::map() return fdlen > 0; } - file.setFileName(binary.fileName()); + file.setFileName(binary.path()); if (!file.open(QIODevice::ReadOnly)) return false; diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index fd68683ace..065f96809e 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -819,6 +819,24 @@ FilePath FilePath::symLinkTarget() const return FilePath::fromString(info.symLinkTarget()); } +FilePath FilePath::mapToGlobalPath() const +{ + if (needsDevice()) { + QTC_ASSERT(s_deviceHooks.mapToGlobalPath, return {}); + return s_deviceHooks.mapToGlobalPath(*this); + } + return *this; +} + +QString FilePath::mapToDevicePath() const +{ + if (needsDevice()) { + QTC_ASSERT(s_deviceHooks.mapToDevicePath, return {}); + return s_deviceHooks.mapToDevicePath(*this); + } + return m_data; +} + FilePath FilePath::withExecutableSuffix() const { FilePath res = *this; @@ -1280,7 +1298,7 @@ FilePath FilePath::stringAppended(const QString &str) const return fn; } -uint FilePath::hash(uint seed) const +QHashValueType FilePath::hash(uint seed) const { if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive) return qHash(m_data.toUpper(), seed); diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index 409421eaf5..a83c0aa517 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -26,6 +26,7 @@ #pragma once #include "utils_global.h" +#include "porting.h" #include "hostosinfo.h" @@ -140,7 +141,7 @@ public: void clear(); bool isEmpty() const; - uint hash(uint seed) const; + QHashValueType hash(uint seed) const; [[nodiscard]] FilePath resolvePath(const FilePath &tail) const; [[nodiscard]] FilePath resolvePath(const QString &tail) const; @@ -161,6 +162,9 @@ public: QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags) const; + [[nodiscard]] FilePath mapToGlobalPath() const; + [[nodiscard]] QString mapToDevicePath() const; + // makes sure that capitalization of directories is canonical // on Windows and macOS. This is rarely needed. [[nodiscard]] FilePath normalizedPathName() const; @@ -198,6 +202,11 @@ private: using FilePaths = QList<FilePath>; +inline QHashValueType qHash(const Utils::FilePath &a, uint seed = 0) +{ + return a.hash(seed); +} + } // namespace Utils QT_BEGIN_NAMESPACE @@ -205,3 +214,13 @@ QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug dbg, const Utils::FilePath &c); QT_END_NAMESPACE Q_DECLARE_METATYPE(Utils::FilePath) + +namespace std { +template<> +struct QTCREATOR_UTILS_EXPORT hash<Utils::FilePath> +{ + using argument_type = Utils::FilePath; + using result_type = size_t; + result_type operator()(const argument_type &fn) const; +}; +} // namespace std diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index a92017f770..c87ca5d5dd 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -78,6 +78,8 @@ public: std::function<bool(const FilePath &, const FilePath &)> renameFile; std::function<FilePath(const FilePath &, const QList<FilePath> &)> searchInPath; std::function<FilePath(const FilePath &)> symLinkTarget; + std::function<FilePath(const FilePath &)> mapToGlobalPath; + std::function<QString(const FilePath &)> mapToDevicePath; std::function<QList<FilePath>(const FilePath &, const QStringList &, QDir::Filters, QDir::SortFlags)> dirEntries; std::function<QByteArray(const FilePath &, qint64, qint64)> fileContents; @@ -314,16 +316,5 @@ private: QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FilePath &fn); -inline uint qHash(const Utils::FilePath &a, uint seed = 0) { return a.hash(seed); } - } // namespace Utils -namespace std { -template<> struct QTCREATOR_UTILS_EXPORT hash<Utils::FilePath> -{ - using argument_type = Utils::FilePath; - using result_type = size_t; - result_type operator()(const argument_type &fn) const; -}; -} // namespace std - diff --git a/src/libs/utils/id.cpp b/src/libs/utils/id.cpp index 26430a2938..1349dd8488 100644 --- a/src/libs/utils/id.cpp +++ b/src/libs/utils/id.cpp @@ -84,7 +84,7 @@ static bool operator==(const StringHolder &sh1, const StringHolder &sh2) } -static uint qHash(const StringHolder &sh) +static auto qHash(const StringHolder &sh) { return QT_PREPEND_NAMESPACE(qHash)(sh.h, 0); } diff --git a/src/libs/utils/id.h b/src/libs/utils/id.h index e0af61099c..5c6440bd56 100644 --- a/src/libs/utils/id.h +++ b/src/libs/utils/id.h @@ -26,6 +26,7 @@ #pragma once #include "utils_global.h" +#include "porting.h" #include <QList> #include <QMetaType> @@ -79,7 +80,7 @@ private: quintptr m_id = 0; }; -inline uint qHash(Id id) { return static_cast<uint>(id.uniqueIdentifier()); } +inline QHashValueType qHash(Id id) { return static_cast<QHashValueType>(id.uniqueIdentifier()); } } // namespace Utils diff --git a/src/libs/utils/link.cpp b/src/libs/utils/link.cpp index 884936a7bb..1df67837b1 100644 --- a/src/libs/utils/link.cpp +++ b/src/libs/utils/link.cpp @@ -63,7 +63,7 @@ Link Link::fromFilePath(const FilePath &filePath, bool canContainLineNumber, QSt return Link{filePath.withNewPath(fileName.left(postfixPos)), lineColumn.line, lineColumn.column}; } -uint qHash(const Link &l) +QHashValueType qHash(const Link &l) { QString s = l.targetFilePath.toString(); return qHash(s.append(':').append(QString::number(l.targetLine)).append(':') diff --git a/src/libs/utils/link.h b/src/libs/utils/link.h index 34c2c5a5cf..6d9fbb8ac1 100644 --- a/src/libs/utils/link.h +++ b/src/libs/utils/link.h @@ -25,7 +25,8 @@ #pragma once -#include <utils/fileutils.h> +#include "fileutils.h" +#include "porting.h" #include <QString> #include <qmetatype.h> @@ -75,7 +76,7 @@ public: int targetColumn; }; -uint QTCREATOR_UTILS_EXPORT qHash(const Link &l); +QTCREATOR_UTILS_EXPORT QHashValueType qHash(const Link &l); using ProcessLinkCallback = std::function<void(const Link &)>; diff --git a/src/libs/utils/mimetypes/mimeglobpattern.cpp b/src/libs/utils/mimetypes/mimeglobpattern.cpp index 9ab335b862..ae0899dd0e 100644 --- a/src/libs/utils/mimetypes/mimeglobpattern.cpp +++ b/src/libs/utils/mimetypes/mimeglobpattern.cpp @@ -83,6 +83,39 @@ void MimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const QS } } +MimeGlobPattern::PatternType MimeGlobPattern::detectPatternType(const QString &pattern) const +{ + const int patternLength = pattern.length(); + if (!patternLength) + return OtherPattern; + + const bool starCount = pattern.count(QLatin1Char('*')) == 1; + const bool hasSquareBracket = pattern.indexOf(QLatin1Char('[')) != -1; + const bool hasQuestionMark = pattern.indexOf(QLatin1Char('?')) != -1; + + if (!hasSquareBracket && !hasQuestionMark) { + if (starCount == 1) { + // Patterns like "*~", "*.extension" + if (pattern.at(0) == QLatin1Char('*')) + return SuffixPattern; + // Patterns like "README*" (well this is currently the only one like that...) + if (pattern.at(patternLength - 1) == QLatin1Char('*')) + return PrefixPattern; + } + // Names without any wildcards like "README" + if (starCount == 0) + return LiteralPattern; + } + + if (pattern == QLatin1String("[0-9][0-9][0-9].vdr")) + return VdrPattern; + + if (pattern == QLatin1String("*.anim[1-9j]")) + return AnimPattern; + + return OtherPattern; +} + /*! \internal \class MimeGlobPattern @@ -92,55 +125,63 @@ void MimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const QS \sa MimeType, MimeDatabase, MimeMagicRuleMatcher, MimeMagicRule */ -bool MimeGlobPattern::matchFileName(const QString &inputFilename) const +bool MimeGlobPattern::matchFileName(const QString &inputFileName) const { // "Applications MUST match globs case-insensitively, except when the case-sensitive // attribute is set to true." // The constructor takes care of putting case-insensitive patterns in lowercase. - const QString filename = m_caseSensitivity == Qt::CaseInsensitive ? inputFilename.toLower() : inputFilename; + const QString fileName = m_caseSensitivity == Qt::CaseInsensitive + ? inputFileName.toLower() : inputFileName; - const int pattern_len = m_pattern.length(); - if (!pattern_len) + const int patternLength = m_pattern.length(); + if (!patternLength) return false; - const int len = filename.length(); + const int fileNameLength = fileName.length(); - const int starCount = m_pattern.count(QLatin1Char('*')); + switch (m_patternType) { + case SuffixPattern: { + if (fileNameLength + 1 < patternLength) + return false; - // Patterns like "*~", "*.extension" - if (m_pattern[0] == QLatin1Char('*') && m_pattern.indexOf(QLatin1Char('[')) == -1 && starCount == 1) - { - if (len + 1 < pattern_len) return false; - - const QChar *c1 = m_pattern.unicode() + pattern_len - 1; - const QChar *c2 = filename.unicode() + len - 1; + const QChar *c1 = m_pattern.unicode() + patternLength - 1; + const QChar *c2 = fileName.unicode() + fileNameLength - 1; int cnt = 1; - while (cnt < pattern_len && *c1-- == *c2--) + while (cnt < patternLength && *c1-- == *c2--) ++cnt; - return cnt == pattern_len; + return cnt == patternLength; } - - // Patterns like "README*" (well this is currently the only one like that...) - if (starCount == 1 && m_pattern.at(pattern_len - 1) == QLatin1Char('*')) { - if (len + 1 < pattern_len) return false; - if (m_pattern.at(0) == QLatin1Char('*')) - return filename.indexOf(QStringView(m_pattern).mid(1, pattern_len - 2)) != -1; + case PrefixPattern: { + if (fileNameLength + 1 < patternLength) + return false; const QChar *c1 = m_pattern.unicode(); - const QChar *c2 = filename.unicode(); + const QChar *c2 = fileName.unicode(); int cnt = 1; - while (cnt < pattern_len && *c1++ == *c2++) + while (cnt < patternLength && *c1++ == *c2++) ++cnt; - return cnt == pattern_len; + return cnt == patternLength; } - - // Names without any wildcards like "README" - if (m_pattern.indexOf(QLatin1Char('[')) == -1 && starCount == 0 && m_pattern.indexOf(QLatin1Char('?'))) - return (m_pattern == filename); - - // Other (quite rare) patterns, like "*.anim[1-9j]": use slow but correct method - const QRegularExpression rx(QRegularExpression::anchoredPattern( + case LiteralPattern: + return (m_pattern == fileName); + case VdrPattern: // "[0-9][0-9][0-9].vdr" case + return fileNameLength == 7 + && fileName.at(0).isDigit() && fileName.at(1).isDigit() && fileName.at(2).isDigit() + && QStringView{fileName}.mid(3, 4) == QLatin1String(".vdr"); + case AnimPattern: { // "*.anim[1-9j]" case + if (fileNameLength < 6) + return false; + const QChar lastChar = fileName.at(fileNameLength - 1); + const bool lastCharOK = (lastChar.isDigit() && lastChar != QLatin1Char('0')) + || lastChar == QLatin1Char('j'); + return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == QLatin1String(".anim"); + } + case OtherPattern: + // Other fallback patterns: slow but correct method + const QRegularExpression rx(QRegularExpression::anchoredPattern( QRegularExpression::wildcardToRegularExpression(m_pattern))); - return rx.match(filename).hasMatch(); + return rx.match(fileName).hasMatch(); + } + return false; } static bool isFastPattern(const QString &pattern) diff --git a/src/libs/utils/mimetypes/mimeglobpattern_p.h b/src/libs/utils/mimetypes/mimeglobpattern_p.h index ecbfb02ce9..990a5b07d2 100644 --- a/src/libs/utils/mimetypes/mimeglobpattern_p.h +++ b/src/libs/utils/mimetypes/mimeglobpattern_p.h @@ -73,16 +73,27 @@ public: static const unsigned DefaultWeight = 50; static const unsigned MinWeight = 1; - explicit MimeGlobPattern(const QString &thePattern, const QString &theMimeType, unsigned theWeight = DefaultWeight, Qt::CaseSensitivity s = Qt::CaseInsensitive) : - m_pattern(thePattern), m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s) + explicit MimeGlobPattern(const QString &thePattern, const QString &theMimeType, + unsigned theWeight = DefaultWeight, + Qt::CaseSensitivity s = Qt::CaseInsensitive) : + m_pattern(s == Qt::CaseInsensitive ? thePattern.toLower() : thePattern), + m_mimeType(theMimeType), + m_weight(theWeight), + m_caseSensitivity(s), + m_patternType(detectPatternType(m_pattern)) { - if (s == Qt::CaseInsensitive) { - m_pattern = m_pattern.toLower(); - } } - ~MimeGlobPattern() {} - bool matchFileName(const QString &filename) const; + void swap(MimeGlobPattern &other) noexcept + { + qSwap(m_pattern, other.m_pattern); + qSwap(m_mimeType, other.m_mimeType); + qSwap(m_weight, other.m_weight); + qSwap(m_caseSensitivity, other.m_caseSensitivity); + qSwap(m_patternType, other.m_patternType); + } + + bool matchFileName(const QString &inputFileName) const; inline const QString &pattern() const { return m_pattern; } inline unsigned weight() const { return m_weight; } @@ -90,10 +101,21 @@ public: inline bool isCaseSensitive() const { return m_caseSensitivity == Qt::CaseSensitive; } private: + enum PatternType { + SuffixPattern, + PrefixPattern, + LiteralPattern, + VdrPattern, // special handling for "[0-9][0-9][0-9].vdr" pattern + AnimPattern, // special handling for "*.anim[1-9j]" pattern + OtherPattern + }; + PatternType detectPatternType(const QString &pattern) const; + QString m_pattern; QString m_mimeType; int m_weight; Qt::CaseSensitivity m_caseSensitivity; + PatternType m_patternType; }; class MimeGlobPatternList : public QList<MimeGlobPattern> diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index 4efcae7646..cf6930cbe5 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -136,8 +136,10 @@ bool OutputLineParser::demoteErrorsToWarnings() const FilePath OutputLineParser::absoluteFilePath(const FilePath &filePath) const { - if (filePath.isEmpty() || filePath.toFileInfo().isAbsolute()) + if (filePath.isEmpty()) return filePath; + if (filePath.toFileInfo().isAbsolute()) + return filePath.cleanPath(); FilePaths candidates; for (const FilePath &dir : searchDirectories()) { FilePath candidate = dir.pathAppended(filePath.toString()); diff --git a/src/libs/utils/set_algorithm.h b/src/libs/utils/set_algorithm.h index 42a21f3f2d..97e33a047f 100644 --- a/src/libs/utils/set_algorithm.h +++ b/src/libs/utils/set_algorithm.h @@ -99,6 +99,24 @@ bool set_intersection_compare( return false; } +template<class InputIt1, class InputIt2, class Callable, class Compare> +void set_greedy_difference( + InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Callable call, Compare comp) +{ + while (first1 != last1 && first2 != last2) { + if (comp(*first1, *first2)) { + call(*first1++); + } else if (comp(*first2, *first1)) { + ++first2; + } else { + ++first1; + } + } + + while (first1 != last1) + call(*first1++); +} + template<typename InputIt1, typename InputIt2, typename BinaryPredicate, typename Callable, typename Value> Value mismatch_collect(InputIt1 first1, InputIt1 last1, diff --git a/src/libs/utils/threadutils.cpp b/src/libs/utils/threadutils.cpp new file mode 100644 index 0000000000..7d10199c4a --- /dev/null +++ b/src/libs/utils/threadutils.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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. +** +****************************************************************************/ + +#include "threadutils.h" + +#include <QCoreApplication> +#include <QThread> + +namespace Utils { + +bool isMainThread() +{ + return QThread::currentThread() == qApp->thread(); +} + +} // namespace Utils diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/ksyntaxhighlighting_export.h b/src/libs/utils/threadutils.h index a39adb5ed6..cc59658c27 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/ksyntaxhighlighting_export.h +++ b/src/libs/utils/threadutils.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -25,10 +25,11 @@ #pragma once -#include <QtGlobal> +#include "utils_global.h" + +namespace Utils { + +QTCREATOR_UTILS_EXPORT bool isMainThread(); + +} // namespace Utils -#if defined(KSYNTAXHIGHLIGHTING_LIBRARY) -# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_EXPORT -#else -# define KSYNTAXHIGHLIGHTING_EXPORT Q_DECL_IMPORT -#endif diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri index ddaae4bb69..a8280ba326 100644 --- a/src/libs/utils/utils-lib.pri +++ b/src/libs/utils/utils-lib.pri @@ -143,6 +143,7 @@ SOURCES += \ $$PWD/link.cpp \ $$PWD/linecolumn.cpp \ $$PWD/multitextcursor.cpp \ + $$PWD/threadutils.cpp \ $$PWD/singleton.cpp HEADERS += \ @@ -310,6 +311,7 @@ HEADERS += \ $$PWD/launchersocket.h \ $$PWD/qtcsettings.h \ $$PWD/multitextcursor.h \ + $$PWD/threadutils.h \ $$PWD/singleton.h FORMS += $$PWD/filewizardpage.ui \ diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs index 77f80dd81b..6d888f87ac 100644 --- a/src/libs/utils/utils.qbs +++ b/src/libs/utils/utils.qbs @@ -298,6 +298,8 @@ Project { "textfileformat.h", "textutils.cpp", "textutils.h", + "threadutils.cpp", + "threadutils.h", "treemodel.cpp", "treemodel.h", "treeviewcombobox.cpp", |