diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2020-04-28 14:20:36 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2020-04-30 04:25:35 +0000 |
commit | 8542699b899c4ba0b89ccb9436dc09a047baceaf (patch) | |
tree | 101d11059838357e4ddb2766452479bb963012c1 /src/libs/3rdparty/syntax-highlighting | |
parent | 5d9d0b876a6791b112c55499af0e867b1553d4c3 (diff) |
KSyntaxHighlighter: Sync with original repository
from commit ff67bbbeff62d8b91b83d74c0c27dfee00f39a00.
CMakeLists.txt excluded.
Task-number: QTCREATORBUG-22558
Change-Id: I405e23e63483aa9a7e2daf899a335bd71e1b036e
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting')
64 files changed, 1114 insertions, 1264 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/.gitignore b/src/libs/3rdparty/syntax-highlighting/.gitignore index 52f10e28a56..7df2675d19f 100644 --- a/src/libs/3rdparty/syntax-highlighting/.gitignore +++ b/src/libs/3rdparty/syntax-highlighting/.gitignore @@ -9,4 +9,5 @@ callgrind.* heaptrack.* /build*/ *.unc-backup* - +.clang-format +.cmake/ diff --git a/src/libs/3rdparty/syntax-highlighting/KF5SyntaxHighlightingConfig.cmake.in b/src/libs/3rdparty/syntax-highlighting/KF5SyntaxHighlightingConfig.cmake.in index 0fd1778fb86..aa822b88dc9 100644 --- a/src/libs/3rdparty/syntax-highlighting/KF5SyntaxHighlightingConfig.cmake.in +++ b/src/libs/3rdparty/syntax-highlighting/KF5SyntaxHighlightingConfig.cmake.in @@ -1,6 +1,8 @@ @PACKAGE_INIT@ -find_package(Qt5 @Qt5Core_VERSION_MAJOR@.@Qt5Core_VERSION_MINOR@ NO_MODULE REQUIRED COMPONENTS Core Gui) +include(CMakeFindDependencyMacro) +find_dependency(Qt5Core @REQUIRED_QT_VERSION@) +find_dependency(Qt5Gui @REQUIRED_QT_VERSION@) include("${CMAKE_CURRENT_LIST_DIR}/KF5SyntaxHighlightingTargets.cmake") @PACKAGE_INCLUDE_QCHTARGETS@ diff --git a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt index 73adbe6d20b..cab8c885dcd 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt @@ -1,22 +1,28 @@ # generate PHP definitions macro(generate_php_syntax_definition targetFile srcFile) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/syntax) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax) execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generators/generate-php.pl INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/syntax/${srcFile} - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/syntax/${targetFile}) + OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/${targetFile}) endmacro() generate_php_syntax_definition(javascript-php.xml javascript.xml) generate_php_syntax_definition(css-php.xml css.xml) generate_php_syntax_definition(html-php.xml html.xml) +generate_php_syntax_definition(javascript-react-php.xml javascript-react.xml) +generate_php_syntax_definition(typescript-php.xml typescript.xml) +generate_php_syntax_definition(mustache-php.xml mustache.xml) # find all definitions file(GLOB src_defs "${CMAKE_CURRENT_SOURCE_DIR}/syntax/*.xml") set(defs ${src_defs} - ${CMAKE_CURRENT_BINARY_DIR}/syntax/html-php.xml - ${CMAKE_CURRENT_BINARY_DIR}/syntax/css-php.xml - ${CMAKE_CURRENT_BINARY_DIR}/syntax/javascript-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/html-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/css-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/javascript-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/javascript-react-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/typescript-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/mustache-php.xml ) # theme data resource @@ -58,4 +64,8 @@ else() endif() # set PIC to allow use in static and shared libs +# this needs some more recent CMake than generally required set_property(TARGET SyntaxHighlightingData PROPERTY POSITION_INDEPENDENT_CODE 1) +if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") + target_link_libraries(SyntaxHighlightingData PRIVATE Qt5::Core) +endif() 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 f7b7570cf43..f52084c569e 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl @@ -9,7 +9,7 @@ Copyright 2004 Alexander Neundorf (neundorf@kde.org) Copyright 2005 Dominik Haumann (dhdev@gmx.de) Copyright 2007,2008,2013,2014 Matthew Woehlke (mw_triad@users.sourceforge.net) - Copyright 2013-2015,2017-2019 Alex Turbov (i.zaufi@gmail.com) + Copyright 2013-2015,2017-2020 Alex Turbov (i.zaufi@gmail.com) ********************************************************************** * This library is free software; you can redistribute it and/or * @@ -31,7 +31,7 @@ <language name="CMake" - version="16" + version="22" kateversion="2.4" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" @@ -191,9 +191,9 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Builtin Variables"> + <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" /> <keyword attribute="Builtin Variable" context="#stay" String="variables" insensitive="false" /> <IncludeRules context="Detect More Builtin Variables" /> - <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables"> @@ -278,6 +278,7 @@ </context> <context attribute="Comment" lineEndContext="#stay" name="Bracketed Comment" dynamic="true"> + <LineContinue attribute="Comment" context="#stay" /> <RegExpr attribute="Comment" context="#pop" String=".*\]%1\]" dynamic="true" /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml index f3fa77756f0..3b1e8327ca1 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml @@ -6,6 +6,7 @@ global-properties: - AUTOMOC_TARGETS_FOLDER - AUTORCC_SOURCE_GROUP - CMAKE_C_KNOWN_FEATURES + - CMAKE_CUDA_KNOWN_FEATURES # Since 3.17 - CMAKE_CXX_KNOWN_FEATURES - CMAKE_ROLE # Since 3.14 - DEBUG_CONFIGURATIONS @@ -81,6 +82,7 @@ directory-properties: # NOTE Copy-n-pasting this list from official docs may contain a redudant item `Example`! Check it! target-properties: - ADDITIONAL_CLEAN_FILES # Since 3.15 + - AIX_EXPORT_ALL_SYMBOLS # Since 3.17 - ALIASED_TARGET - ANDROID_ANT_ADDITIONAL_OPTIONS - ANDROID_API @@ -111,6 +113,7 @@ target-properties: - AUTOMOC_EXECUTABLE # Since 3.14 - AUTOMOC_MACRO_NAMES - AUTOMOC_MOC_OPTIONS # Since ??? + - AUTOMOC_PATH_PREFIX # Since 3.16 - AUTOMOC - AUTOUIC - AUTOUIC_EXECUTABLE # Since 3.14 @@ -148,6 +151,7 @@ target-properties: - CUDA_PTX_COMPILATION - CUDA_SEPARABLE_COMPILATION - CUDA_RESOLVE_DEVICE_SYMBOLS + - CUDA_RUNTIME_LIBRARY # Since 3.17 - CUDA_EXTENSIONS - CUDA_STANDARD - CUDA_STANDARD_REQUIRED @@ -158,6 +162,9 @@ target-properties: - DEFINE_SYMBOL - DEPLOYMENT_ADDITIONAL_FILES # Since 3.13 - DEPLOYMENT_REMOTE_DIRECTORY + - DEPRECATION # Since 3.17 + - DISABLE_PRECOMPILE_HEADERS # Since 3.16 + - DOTNET_TARGET_FRAMEWORK # Since 3.17 - DOTNET_TARGET_FRAMEWORK_VERSION # Since 3.12 - EchoString - ENABLE_EXPORTS @@ -203,6 +210,7 @@ target-properties: - IMPORT_SUFFIX - INCLUDE_DIRECTORIES - INSTALL_NAME_DIR + - INSTALL_REMOVE_ENVIRONMENT_RPATH # Since 3.16 - INSTALL_RPATH - INSTALL_RPATH_USE_LINK_PATH - INTERFACE_AUTOUIC_OPTIONS @@ -214,6 +222,7 @@ target-properties: - INTERFACE_LINK_DIRECTORIES # Since 3.13 - INTERFACE_LINK_LIBRARIES - INTERFACE_LINK_OPTIONS # Since 3.13 + - INTERFACE_PRECOMPILE_HEADERS # Since 3.16 - INTERFACE_POSITION_INDEPENDENT_CODE - INTERFACE_SOURCES - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES @@ -262,6 +271,8 @@ target-properties: - NO_SYSTEM_FROM_IMPORTED - OSX_ARCHITECTURES_<CONFIG> - OSX_ARCHITECTURES + - OSX_CURRENT_VERSION # Since 3.17 + - OSX_COMPATIBILITY_VERSION # Since 3.17 - OUTPUT_NAME_<CONFIG> - OUTPUT_NAME - PDB_NAME_<CONFIG> @@ -269,6 +280,8 @@ target-properties: - PDB_OUTPUT_DIRECTORY_<CONFIG> - PDB_OUTPUT_DIRECTORY - POSITION_INDEPENDENT_CODE + - PRECOMPILE_HEADERS # Since 3.16 + - PRECOMPILE_HEADERS_REUSE_FROM # Since 3.16 - PREFIX - PRIVATE_HEADER - PROJECT_LABEL @@ -293,6 +306,10 @@ target-properties: - Swift_MODULE_DIRECTORY # Since 3.15 - Swift_MODULE_NAME # Since 3.15 - TYPE + - UNITY_BUILD # Since 3.16 + - UNITY_BUILD_BATCH_SIZE # Since 3.16 + - UNITY_BUILD_CODE_AFTER_INCLUDE # Since 3.16 + - UNITY_BUILD_CODE_BEFORE_INCLUDE # Since 3.16 - VERSION - VISIBILITY_INLINES_HIDDEN - VS_CONFIGURATION_TYPE @@ -306,6 +323,8 @@ target-properties: - VS_DOTNET_REFERENCES - VS_DOTNET_REFERENCES_COPY_LOCAL - VS_DOTNET_TARGET_FRAMEWORK_VERSION + - VS_DOTNET_DOCUMENTATION_FILE # Since 3.17 + - VS_DPI_AWARE # Since 3.16 - VS_GLOBAL_KEYWORD - VS_GLOBAL_PROJECT_TYPES - VS_GLOBAL_ROOTNAMESPACE @@ -339,21 +358,23 @@ target-properties: - XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN # Since 3.13 - XCODE_SCHEME_ARGUMENTS # Since 3.13 - XCODE_SCHEME_DEBUG_AS_ROOT # Since 3.15 - - XCODE_SCHEME_THREAD_SANITIZER # Since 3.13 - - XCODE_SCHEME_THREAD_SANITIZER_STOP # Since 3.13 - - XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER # Since 3.13 - - XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP # Since 3.13 + - XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING # Since 3.16 - XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER # Since 3.13 - - XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP # Since 3.13 - - XCODE_SCHEME_MALLOC_SCRIBBLE # Since 3.13 - - XCODE_SCHEME_MALLOC_GUARD_EDGES # Since 3.13 - - XCODE_SCHEME_GUARD_MALLOC # Since 3.13 - - XCODE_SCHEME_ZOMBIE_OBJECTS # Since 3.13 - - XCODE_SCHEME_MALLOC_STACK # Since 3.13 - XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE # Since 3.13 - XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS # Since 3.13 - XCODE_SCHEME_EXECUTABLE # Since 3.13 - XCODE_SCHEME_ENVIRONMENT # Since 3.13 + - XCODE_SCHEME_GUARD_MALLOC # Since 3.13 + - XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP # Since 3.13 + - XCODE_SCHEME_MALLOC_GUARD_EDGES # Since 3.13 + - XCODE_SCHEME_MALLOC_SCRIBBLE # Since 3.13 + - XCODE_SCHEME_MALLOC_STACK # Since 3.13 + - XCODE_SCHEME_THREAD_SANITIZER # Since 3.13 + - XCODE_SCHEME_THREAD_SANITIZER_STOP # Since 3.13 + - XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER # Since 3.13 + - XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP # Since 3.13 + - XCODE_SCHEME_WORKING_DIRECTORY # Since 3.1? + - XCODE_SCHEME_ZOMBIE_OBJECTS # Since 3.13 - XCTEST test-properties: @@ -375,6 +396,7 @@ test-properties: - REQUIRED_FILES - RESOURCE_LOCK - RUN_SERIAL + - SKIP_REGULAR_EXPRESSION # Since 3.16 - SKIP_RETURN_CODE - TIMEOUT - TIMEOUT_AFTER_MATCH @@ -404,6 +426,8 @@ source-properties: - SKIP_AUTOMOC - SKIP_AUTORCC - SKIP_AUTOUIC + - SKIP_PRECOMPILE_HEADERS # Since 3.16 + - SKIP_UNITY_BUILD_INCLUSION # Since 3.16 - Swift_DEPENDENCIES_FILE # Since 3.15 - Swift_DIAGNOSTICS_FILE # Since 3.15 - SYMBOLIC @@ -547,22 +571,29 @@ variables: - CMAKE_CROSSCOMPILING_EMULATOR - CMAKE_CTEST_COMMAND - CMAKE_CURRENT_BINARY_DIR + - CMAKE_CURRENT_FUNCTION # Since 3.17 + - CMAKE_CURRENT_FUNCTION_LIST_DIR # Since 3.17 + - CMAKE_CURRENT_FUNCTION_LIST_FILE # Since 3.17 + - CMAKE_CURRENT_FUNCTION_LIST_LINE # Since 3.17 - CMAKE_CURRENT_LIST_DIR - CMAKE_CURRENT_LIST_FILE - CMAKE_CURRENT_LIST_LINE - CMAKE_CURRENT_SOURCE_DIR - CMAKE_DIRECTORY_LABELS # Since 3.10 - CMAKE_DL_LIBS + - CMAKE_DOTNET_TARGET_FRAMEWORK # Since 3.17 - CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION # Since 3.12 - CMAKE_EDIT_COMMAND - CMAKE_EXECUTABLE_SUFFIX - CMAKE_EXTRA_GENERATOR - CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES + - CMAKE_FIND_DEBUG_MODE # Since 3.17 - CMAKE_FIND_PACKAGE_NAME - CMAKE_FIND_PACKAGE_SORT_DIRECTION - CMAKE_FIND_PACKAGE_SORT_ORDER - CMAKE_GENERATOR - CMAKE_GENERATOR_INSTANCE # Since 3.11 + - CMAKE_GENERATOR_NO_COMPILER_ENV # "Professional CMake" §17.4 - CMAKE_GENERATOR_PLATFORM - CMAKE_GENERATOR_TOOLSET - CMAKE_HOME_DIRECTORY @@ -580,6 +611,10 @@ variables: - CMAKE_MAKE_PROGRAM - CMAKE_MATCH_COUNT - CMAKE_MATCH_<n> + - CMAKE_MESSAGE_CONTEXT # Since 3.17 + - CMAKE_MESSAGE_CONTEXT_SHOW # Since 3.17 + - CMAKE_MESSAGE_INDENT # Since 3.16 + - CMAKE_MESSAGE_LOG_LEVEL # Since 3.17 - CMAKE_MINIMUM_REQUIRED_VERSION - CMAKE_MINOR_VERSION - CMAKE_NETRC # Since 3.11 @@ -658,6 +693,7 @@ variables: - CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES - CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT - CMAKE_ECLIPSE_MAKE_ARGUMENTS + - CMAKE_ECLIPSE_RESOURCE_ENCODING # Since 3.16 - CMAKE_ECLIPSE_VERSION - CMAKE_ERROR_DEPRECATED - CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION @@ -671,7 +707,7 @@ variables: - CMAKE_FIND_LIBRARY_PREFIXES - CMAKE_FIND_LIBRARY_SUFFIXES - CMAKE_FIND_NO_INSTALL_PREFIX - - CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY + - CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY # Deprecated since 3.16 - CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY - CMAKE_FIND_PACKAGE_PREFER_CONFIG # Since 3.15 - CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS # Since 3.14 @@ -681,6 +717,13 @@ variables: - CMAKE_FIND_ROOT_PATH_MODE_LIBRARY - CMAKE_FIND_ROOT_PATH_MODE_PACKAGE - CMAKE_FIND_ROOT_PATH_MODE_PROGRAM + - CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH # Since 3.16 + - CMAKE_FIND_USE_CMAKE_PATH # Since 3.16 + - CMAKE_FIND_USE_CMAKE_SYSTEM_PATH # Since 3.16 + - CMAKE_FIND_USE_PACKAGE_ROOT_PATH # Since 3.16 + - CMAKE_FIND_USE_PACKAGE_REGISTRY # Since 3.16 + - CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH # Since 3.16 + - CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY # Since 3.16 - CMAKE_FRAMEWORK_PATH - CMAKE_IGNORE_PATH - CMAKE_INCLUDE_DIRECTORIES_BEFORE @@ -725,19 +768,22 @@ variables: - CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY # Since 3.13 - CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER # Since 3.13 - CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN # Since 3.13 + - CMAKE_XCODE_SCHEME_WORKING_DIRECTORY # Since 3.1? + - CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING # Since 3.16 + - CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER # Since 3.13 + - CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE # Since 3.13 + - CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS # Since 3.13 + - CMAKE_XCODE_SCHEME_ENVIRONMENT # Since 3.17 + - CMAKE_XCODE_SCHEME_GUARD_MALLOC # Since 3.13 + - CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP # Since 3.13 + - CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES # Since 3.13 + - CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE # Since 3.13 + - CMAKE_XCODE_SCHEME_MALLOC_STACK # Since 3.13 - CMAKE_XCODE_SCHEME_THREAD_SANITIZER # Since 3.13 - CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP # Since 3.13 - CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER # Since 3.13 - CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP # Since 3.13 - - CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER # Since 3.13 - - CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP # Since 3.13 - - CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE # Since 3.13 - - CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES # Since 3.13 - - CMAKE_XCODE_SCHEME_GUARD_MALLOC # Since 3.13 - CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS # Since 3.13 - - CMAKE_XCODE_SCHEME_MALLOC_STACK # Since 3.13 - - CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE # Since 3.13 - - CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS # Since 3.13 - CMAKE_SUPPRESS_DEVELOPER_WARNINGS # Undocumented yet (CMake <= 3.10) - CMAKE_SUPPRESS_DEVELOPER_ERRORS # Undocumented yet (CMake <= 3.10) # Variables that Describe the System @@ -787,6 +833,7 @@ variables: - XCODE - XCODE_VERSION # Variables that Control the Build + - CMAKE_AIX_EXPORT_ALL_SYMBOLS # Since 3.17 - CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS - CMAKE_ANDROID_API - CMAKE_ANDROID_API_MIN @@ -820,6 +867,7 @@ variables: - CMAKE_AUTOMOC - CMAKE_AUTOMOC_DEPEND_FILTERS - CMAKE_AUTOMOC_MOC_OPTIONS + - CMAKE_AUTOMOC_PATH_PREFIX # Since 3.16 - CMAKE_AUTORCC - CMAKE_AUTORCC_OPTIONS - CMAKE_AUTOUIC @@ -832,8 +880,15 @@ variables: - CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY - CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> - CMAKE_<CONFIG>_POSTFIX + - CMAKE_CROSS_CONFIGS # Since 3.17 + - CMAKE_CTEST_ARGUMENTS # Since 3.17 - CMAKE_CUDA_SEPARABLE_COMPILATION # Since 3.11 + - CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS # Since 3.16 + - CMAKE_CUDA_RUNTIME_LIBRARY # Since 3.17 - CMAKE_DEBUG_POSTFIX + - CMAKE_DEFAULT_BUILD_TYPE # Since 3.17 + - CMAKE_DEFAULT_CONFIGS # Since 3.17 + - CMAKE_DISABLE_PRECOMPILE_HEADERS # Since 3.17 - CMAKE_ENABLE_EXPORTS - CMAKE_EXE_LINKER_FLAGS - CMAKE_EXE_LINKER_FLAGS_<CONFIG> @@ -851,6 +906,7 @@ variables: - CMAKE_INCLUDE_CURRENT_DIR - CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE - CMAKE_INSTALL_NAME_DIR + - CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH # Since 3.16 - CMAKE_INSTALL_RPATH - CMAKE_INSTALL_RPATH_USE_LINK_PATH - CMAKE_INTERPROCEDURAL_OPTIMIZATION @@ -904,6 +960,8 @@ variables: - CMAKE_TRY_COMPILE_CONFIGURATION - CMAKE_TRY_COMPILE_PLATFORM_VARIABLES - CMAKE_TRY_COMPILE_TARGET_TYPE + - CMAKE_UNITY_BUILD # Since 3.16 + - CMAKE_UNITY_BUILD_BATCH_SIZE # Since 3.16 - CMAKE_USE_RELATIVE_PATHS - CMAKE_VISIBILITY_INLINES_HIDDEN - CMAKE_VS_GLOBALS # Since 3.13 @@ -926,6 +984,8 @@ variables: - CMAKE_COMPILER_IS_GNUCC - CMAKE_COMPILER_IS_GNUCXX - CMAKE_COMPILER_IS_GNUG77 + - CMAKE_CUDA_COMPILE_FEATURES # Since 3.17 + - CMAKE_CUDA_HOST_COMPILER # Since 3.17 - CMAKE_CUDA_EXTENSIONS - CMAKE_CUDA_STANDARD - CMAKE_CUDA_STANDARD_REQUIRED @@ -1072,7 +1132,8 @@ variables: - CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION - CPACK_INCLUDE_TOPLEVEL_DIRECTORY - CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS # Since 3.11 - - CPACK_INSTALL_SCRIPT + - CPACK_INSTALL_SCRIPT # Deprecated since 3.16 + - CPACK_INSTALL_SCRIPTS # Since 3.16 - CPACK_PACKAGING_INSTALL_PREFIX - CPACK_SET_DESTDIR - CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION @@ -1201,7 +1262,7 @@ variables: - CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS - CPACK_DEBIAN_PACKAGE_MAINTAINER - CPACK_DEBIAN_PACKAGE_DESCRIPTION - - CPACK_COMPONENT_<COMPONENT>_DESCRIPTION + - CPACK_DEBIAN_<COMPONENT>_DESCRIPTION # Since 3.16 - CPACK_DEBIAN_PACKAGE_SECTION - CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION - CPACK_DEBIAN_ARCHIVE_TYPE @@ -1247,6 +1308,7 @@ variables: - CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK - CPACK_DMG_SLA_DIR - CPACK_DMG_SLA_LANGUAGES + - CPACK_DMG_<component>_FILE_NAME # Since 3.17 - CPACK_COMMAND_HDIUTIL - CPACK_COMMAND_SETFILE - CPACK_COMMAND_REZ @@ -1318,6 +1380,12 @@ variables: - CPACK_NSIS_EXECUTABLES_DIRECTORY - CPACK_NSIS_MUI_FINISHPAGE_RUN - CPACK_NSIS_MENU_LINKS + - CPACK_NSIS_UNINSTALL_NAME # Since 3.17 + - CPACK_NSIS_WELCOME_TITLE # Since 3.17 + - CPACK_NSIS_WELCOME_TITLE_3LINES # Since 3.17 + - CPACK_NSIS_FINISH_TITLE # Since 3.17 + - CPACK_NSIS_FINISH_TITLE_3LINES # Since 3.17 + - CPACK_NSIS_MUI_HEADERIMAGE # Since 3.17 # - CPackNuGet (since 3.12) - CPACK_NUGET_COMPONENT_INSTALL - CPACK_NUGET_PACKAGE_NAME @@ -1351,8 +1419,7 @@ variables: - CPACK_NUGET_PACKAGE_DEPENDENCIES_<dependency>_VERSION - CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES_<dependency>_VERSION - CPACK_NUGET_PACKAGE_DEBUG - # - CPackPackageMaker - - CPACK_OSX_PACKAGE_VERSION + # - CPackPackageMaker is deprecated and gonna be removed in next versions of CPack # - CPackProductBuild - CPACK_COMMAND_PRODUCTBUILD - CPACK_PRODUCTBUILD_IDENTITY_NAME @@ -1360,7 +1427,19 @@ variables: - CPACK_COMMAND_PKGBUILD - CPACK_PKGBUILD_IDENTITY_NAME - CPACK_PKGBUILD_KEYCHAIN_PATH + - CPACK_PREFLIGHT_<COMP>_SCRIPT # Since 3.1? + - CPACK_POSTFLIGHT_<COMP>_SCRIPT # Since 3.1? - CPACK_PRODUCTBUILD_RESOURCES_DIR + - CPACK_PRODUCTBUILD_BACKGROUND # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_SCALING # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_UTI # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE # Since 3.17 + - CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI # Since 3.17 # - CPackRPM - CPACK_RPM_COMPONENT_INSTALL - CPACK_RPM_PACKAGE_SUMMARY @@ -1457,8 +1536,6 @@ variables: # - CPack - CPACK_PACKAGE_NAME - CPACK_PACKAGE_VENDOR - # `CPACK_PACKAGE_CONTACT` used by some modules (like Deb and NSIS), - # but not documented yet... - CPACK_PACKAGE_CONTACT - CPACK_PACKAGE_DIRECTORY - CPACK_PACKAGE_VERSION_MAJOR @@ -1497,6 +1574,12 @@ variables: - CPACK_PACKAGE_INSTALL_REGISTRY_KEY - CPACK_CREATE_DESKTOP_LINKS - CPACK_BINARY_<GENNAME> + # The following variables used by CPack and some CMake modules, + # but not documented (yet): + # used by some modules like Deb and NSIS + - CPACK_PACKAGE_CONTACT + # - used in CPack.cmake as default value for `CPACK_RPM_PACKAGE_RELOCATABLE` + - CPACK_PACKAGE_RELOCATABLE # - CPackWIX - CPACK_WIX_UPGRADE_GUID - CPACK_WIX_PRODUCT_GUID @@ -1554,6 +1637,7 @@ variables: - PKG_CONFIG_EXECUTABLE - PKG_CONFIG_VERSION_STRING - PKG_CONFIG_USE_CMAKE_PREFIX_PATH + - <prefix>_MODULE_NAME # Since 3.16 # - FindThreads - CMAKE_THREAD_LIBS_INIT - CMAKE_USE_SPROC_INIT @@ -1627,10 +1711,12 @@ environment-variables: # Environment Variables that Control the Build - CMAKE_BUILD_PARALLEL_LEVEL - CMAKE_CONFIG_TYPE + - CMAKE_EXPORT_COMPILE_COMMANDS # Since 3.17 - CMAKE_GENERATOR - CMAKE_GENERATOR_INSTANCE - CMAKE_GENERATOR_PLATFORM - CMAKE_GENERATOR_TOOLSET + - CMAKE_<LANG>_COMPILER_LAUNCHER # Since 3.17 - CMAKE_MSVCIDE_RUN_PATH - CMAKE_NO_VERBOSE - CMAKE_OSX_ARCHITECTURES @@ -1897,6 +1983,8 @@ scripting-commands: # New sub-options since 3.14 , READ_SYMLINK , SIZE + # New sub-options since 3.16 + , GET_RUNTIME_DEPENDENCIES ] special-args: [ UTF-8 @@ -1996,12 +2084,25 @@ scripting-commands: named-args: *find_library - name: foreach - named-args: [RANGE, IN, LISTS, ITEMS] + named-args: [ + RANGE + , IN + , LISTS + , ITEMS + , ZIP_LISTS # Since 3.17 + ] - name: function - name: get_cmake_property property-args: [global-properties] + special-args: [ + COMMANDS + , COMPONENTS + , MACROS + , VARIABLES + , CACHE_VARIABLES + ] - name: get_directory_property named-args: [DIRECTORY, DEFINITION] @@ -2118,6 +2219,10 @@ scripting-commands: , VERBOSE , DEBUG , TRACE + # Since 3.17 + , CHECK_START + , CHECK_PASS + , CHECK_FAIL ] - name: option @@ -2270,7 +2375,7 @@ project-commands: named-args: [EXCLUDE_FROM_ALL] - name: add_test - named-args: [NAME, COMMAND, CONFIGURATIONS, WORKING_DIRECTORY] + named-args: [NAME, COMMAND, COMMAND_EXPAND_LISTS, CONFIGURATIONS, WORKING_DIRECTORY] nested-parentheses?: true - name: aux_source_directory @@ -2287,7 +2392,22 @@ project-commands: - name: enable_language named-args: [OPTIONAL] - special-args: [C, CXX, RC, Fortran] + special-args: [ + ASM + , ASM-ATT + , ASM_NASM + , ASM_MASM + , C + , CSharp + , CXX + , CUDA + , Java + , OBJC # Since 3.16 + , OBJCXX # Since 3.16 + , RC + , Fortran + , Swift + ] - name: enable_testing - @@ -2391,7 +2511,23 @@ project-commands: , HOMEPAGE_URL # Since 3.12 , LANGUAGES ] - special-args: [NONE, C, CXX, RC, CUDA, Fortran, ASM] + special-args: [ + ASM + , ASM-ATT + , ASM_NASM + , ASM_MASM + , C + , CSharp + , CXX + , CUDA + , Java + , OBJC # Since 3.16 + , OBJCXX # Since 3.16 + , RC + , Fortran + , Swift + , NONE # This one is different from `enable_language` + ] - name: qt_wrap_cpp - @@ -2491,6 +2627,12 @@ project-commands: , c_restrict , c_static_assert , c_variadic_macros + # CMAKE_CUDA_KNOWN_FEATURES (since 3.17) + , cuda_std_03 + , cuda_std_11 + , cuda_std_14 + , cuda_std_17 + , cuda_std_20 ] - name: target_compile_options @@ -2509,6 +2651,10 @@ project-commands: name: target_link_options named-args: *target_compile_definitions - + # Since 3.16 + name: target_precompile_headers + named-args: [INTERFACE, PUBLIC, PRIVATE, REUSE_FROM] + - name: target_sources named-args: *target_compile_definitions - @@ -2623,8 +2769,15 @@ ctest-commands: , STOP_TIME , RETURN_VALUE , CAPTURE_CMAKE_ERROR + , REPEAT # Since 3.17 , QUIET ] + special-args: [ + # Since 3.17 + UNTIL_FAIL + , UNTIL_PASS + , AFTER_TIMEOUT + ] - name: ctest_update named-args: [SOURCE, RETURN_VALUE, QUIET] diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py index ff94189b811..c092d27f8f5 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py @@ -48,6 +48,12 @@ def try_transform_placeholder_string_to_regex(name): if 'CMAKE_ARGV' in m: return '\\bCMAKE_ARGV[0-9]+\\b' + if 'CMAKE_POLICY_DEFAULT_CMP' in m: + return '\\bCMAKE_POLICY_DEFAULT_CMP[0-9]{4}\\b' + + if 'CMAKE_POLICY_WARNING_CMP' in m: + return '\\bCMAKE_POLICY_WARNING_CMP[0-9]{4}\\b' + return '\\b{}\\b'.format('&id_re;'.join(list(m))) if 1 < len(m) else name diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml index def91cc4ddd..1f476858fda 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml @@ -9,7 +9,7 @@ Copyright 2004 Alexander Neundorf (neundorf@kde.org) Copyright 2005 Dominik Haumann (dhdev@gmx.de) Copyright 2007,2008,2013,2014 Matthew Woehlke (mw_triad@users.sourceforge.net) - Copyright 2013-2015,2017-2019 Alex Turbov (i.zaufi@gmail.com) + Copyright 2013-2015,2017-2020 Alex Turbov (i.zaufi@gmail.com) ********************************************************************** * This library is free software; you can redistribute it and/or * @@ -31,7 +31,7 @@ <language name="CMake" - version="16" + version="22" kateversion="2.4" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" @@ -133,6 +133,7 @@ <item>target_link_directories</item> <item>target_link_libraries</item> <item>target_link_options</item> + <item>target_precompile_headers</item> <item>target_sources</item> <item>try_compile</item> <item>try_run</item> @@ -292,6 +293,7 @@ <item>FOLLOW_SYMLINKS</item> <item>FOLLOW_SYMLINK_CHAIN</item> <item>GENERATE</item> + <item>GET_RUNTIME_DEPENDENCIES</item> <item>GLOB</item> <item>GLOB_RECURSE</item> <item>GUARD</item> @@ -479,6 +481,14 @@ <item>ITEMS</item> <item>LISTS</item> <item>RANGE</item> + <item>ZIP_LISTS</item> + </list> + <list name="get_cmake_property_sargs"> + <item>CACHE_VARIABLES</item> + <item>COMMANDS</item> + <item>COMPONENTS</item> + <item>MACROS</item> + <item>VARIABLES</item> </list> <list name="get_directory_property_nargs"> <item>DEFINITION</item> @@ -608,6 +618,9 @@ </list> <list name="message_nargs"> <item>AUTHOR_WARNING</item> + <item>CHECK_FAIL</item> + <item>CHECK_PASS</item> + <item>CHECK_START</item> <item>DEBUG</item> <item>DEPRECATION</item> <item>FATAL_ERROR</item> @@ -800,6 +813,7 @@ </list> <list name="add_test_nargs"> <item>COMMAND</item> + <item>COMMAND_EXPAND_LISTS</item> <item>CONFIGURATIONS</item> <item>NAME</item> <item>WORKING_DIRECTORY</item> @@ -828,10 +842,20 @@ <item>OPTIONAL</item> </list> <list name="enable_language_sargs"> + <item>ASM</item> + <item>ASM-ATT</item> + <item>ASM_MASM</item> + <item>ASM_NASM</item> <item>C</item> + <item>CSharp</item> + <item>CUDA</item> <item>CXX</item> <item>Fortran</item> + <item>Java</item> + <item>OBJC</item> + <item>OBJCXX</item> <item>RC</item> + <item>Swift</item> </list> <list name="export_nargs"> <item>ANDROID_MK</item> @@ -928,12 +952,20 @@ </list> <list name="project_sargs"> <item>ASM</item> + <item>ASM-ATT</item> + <item>ASM_MASM</item> + <item>ASM_NASM</item> <item>C</item> + <item>CSharp</item> <item>CUDA</item> <item>CXX</item> <item>Fortran</item> + <item>Java</item> <item>NONE</item> + <item>OBJC</item> + <item>OBJCXX</item> <item>RC</item> + <item>Swift</item> </list> <list name="set_source_files_properties_nargs"> <item>PROPERTIES</item> @@ -968,6 +1000,11 @@ <item>c_std_90</item> <item>c_std_99</item> <item>c_variadic_macros</item> + <item>cuda_std_03</item> + <item>cuda_std_11</item> + <item>cuda_std_14</item> + <item>cuda_std_17</item> + <item>cuda_std_20</item> <item>cxx_aggregate_default_initializers</item> <item>cxx_alias_templates</item> <item>cxx_alignas</item> @@ -1060,6 +1097,12 @@ <item>PRIVATE</item> <item>PUBLIC</item> </list> + <list name="target_precompile_headers_nargs"> + <item>INTERFACE</item> + <item>PRIVATE</item> + <item>PUBLIC</item> + <item>REUSE_FROM</item> + </list> <list name="target_sources_nargs"> <item>INTERFACE</item> <item>PRIVATE</item> @@ -1174,6 +1217,7 @@ <item>INCLUDE_LABEL</item> <item>PARALLEL_LEVEL</item> <item>QUIET</item> + <item>REPEAT</item> <item>RETURN_VALUE</item> <item>SCHEDULE_RANDOM</item> <item>START</item> @@ -1181,6 +1225,11 @@ <item>STRIDE</item> <item>TEST_LOAD</item> </list> + <list name="ctest_test_sargs"> + <item>AFTER_TIMEOUT</item> + <item>UNTIL_FAIL</item> + <item>UNTIL_PASS</item> + </list> <list name="ctest_update_nargs"> <item>QUIET</item> <item>RETURN_VALUE</item> @@ -1199,6 +1248,7 @@ <item>BUILD_SHARED_LIBS</item> <item>BUILD_TESTING</item> <item>CMAKE_ABSOLUTE_DESTINATION_FILES</item> + <item>CMAKE_AIX_EXPORT_ALL_SYMBOLS</item> <item>CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS</item> <item>CMAKE_ANDROID_API</item> <item>CMAKE_ANDROID_API_MIN</item> @@ -1235,6 +1285,7 @@ <item>CMAKE_AUTOMOC</item> <item>CMAKE_AUTOMOC_DEPEND_FILTERS</item> <item>CMAKE_AUTOMOC_MOC_OPTIONS</item> + <item>CMAKE_AUTOMOC_PATH_PREFIX</item> <item>CMAKE_AUTOMOC_RELAXED_MODE</item> <item>CMAKE_AUTORCC</item> <item>CMAKE_AUTORCC_OPTIONS</item> @@ -1268,13 +1319,23 @@ <item>CMAKE_CONFIGURATION_TYPES</item> <item>CMAKE_CROSSCOMPILING</item> <item>CMAKE_CROSSCOMPILING_EMULATOR</item> + <item>CMAKE_CROSS_CONFIGS</item> + <item>CMAKE_CTEST_ARGUMENTS</item> <item>CMAKE_CTEST_COMMAND</item> + <item>CMAKE_CUDA_COMPILE_FEATURES</item> <item>CMAKE_CUDA_EXTENSIONS</item> + <item>CMAKE_CUDA_HOST_COMPILER</item> + <item>CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS</item> + <item>CMAKE_CUDA_RUNTIME_LIBRARY</item> <item>CMAKE_CUDA_SEPARABLE_COMPILATION</item> <item>CMAKE_CUDA_STANDARD</item> <item>CMAKE_CUDA_STANDARD_REQUIRED</item> <item>CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES</item> <item>CMAKE_CURRENT_BINARY_DIR</item> + <item>CMAKE_CURRENT_FUNCTION</item> + <item>CMAKE_CURRENT_FUNCTION_LIST_DIR</item> + <item>CMAKE_CURRENT_FUNCTION_LIST_FILE</item> + <item>CMAKE_CURRENT_FUNCTION_LIST_LINE</item> <item>CMAKE_CURRENT_LIST_DIR</item> <item>CMAKE_CURRENT_LIST_FILE</item> <item>CMAKE_CURRENT_LIST_LINE</item> @@ -1289,13 +1350,18 @@ <item>CMAKE_C_STANDARD_REQUIRED</item> <item>CMAKE_DEBUG_POSTFIX</item> <item>CMAKE_DEBUG_TARGET_PROPERTIES</item> + <item>CMAKE_DEFAULT_BUILD_TYPE</item> + <item>CMAKE_DEFAULT_CONFIGS</item> <item>CMAKE_DEPENDS_IN_PROJECT_ONLY</item> <item>CMAKE_DIRECTORY_LABELS</item> + <item>CMAKE_DISABLE_PRECOMPILE_HEADERS</item> <item>CMAKE_DL_LIBS</item> + <item>CMAKE_DOTNET_TARGET_FRAMEWORK</item> <item>CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION</item> <item>CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES</item> <item>CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT</item> <item>CMAKE_ECLIPSE_MAKE_ARGUMENTS</item> + <item>CMAKE_ECLIPSE_RESOURCE_ENCODING</item> <item>CMAKE_ECLIPSE_VERSION</item> <item>CMAKE_EDIT_COMMAND</item> <item>CMAKE_ENABLE_EXPORTS</item> @@ -1312,6 +1378,7 @@ <item>CMAKE_EXTRA_INCLUDE_FILES</item> <item>CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES</item> <item>CMAKE_FIND_APPBUNDLE</item> + <item>CMAKE_FIND_DEBUG_MODE</item> <item>CMAKE_FIND_FRAMEWORK</item> <item>CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS</item> <item>CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX</item> @@ -1331,6 +1398,13 @@ <item>CMAKE_FIND_ROOT_PATH_MODE_LIBRARY</item> <item>CMAKE_FIND_ROOT_PATH_MODE_PACKAGE</item> <item>CMAKE_FIND_ROOT_PATH_MODE_PROGRAM</item> + <item>CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH</item> + <item>CMAKE_FIND_USE_CMAKE_PATH</item> + <item>CMAKE_FIND_USE_CMAKE_SYSTEM_PATH</item> + <item>CMAKE_FIND_USE_PACKAGE_REGISTRY</item> + <item>CMAKE_FIND_USE_PACKAGE_ROOT_PATH</item> + <item>CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH</item> + <item>CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY</item> <item>CMAKE_FOLDER</item> <item>CMAKE_FRAMEWORK</item> <item>CMAKE_FRAMEWORK_PATH</item> @@ -1341,6 +1415,7 @@ <item>CMAKE_Fortran_MODULE_DIRECTORY</item> <item>CMAKE_GENERATOR</item> <item>CMAKE_GENERATOR_INSTANCE</item> + <item>CMAKE_GENERATOR_NO_COMPILER_ENV</item> <item>CMAKE_GENERATOR_PLATFORM</item> <item>CMAKE_GENERATOR_TOOLSET</item> <item>CMAKE_GLOBAL_AUTOGEN_TARGET</item> @@ -1405,6 +1480,7 @@ <item>CMAKE_INSTALL_OPENMP_LIBRARIES</item> <item>CMAKE_INSTALL_PREFIX</item> <item>CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT</item> + <item>CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH</item> <item>CMAKE_INSTALL_RPATH</item> <item>CMAKE_INSTALL_RPATH_USE_LINK_PATH</item> <item>CMAKE_INSTALL_RUNSTATEDIR</item> @@ -1444,6 +1520,10 @@ <item>CMAKE_MAKE_PROGRAM</item> <item>CMAKE_MATCH_COUNT</item> <item>CMAKE_MAXIMUM_RECURSION_DEPTH</item> + <item>CMAKE_MESSAGE_CONTEXT</item> + <item>CMAKE_MESSAGE_CONTEXT_SHOW</item> + <item>CMAKE_MESSAGE_INDENT</item> + <item>CMAKE_MESSAGE_LOG_LEVEL</item> <item>CMAKE_MFC_FLAG</item> <item>CMAKE_MINIMUM_REQUIRED_VERSION</item> <item>CMAKE_MINOR_VERSION</item> @@ -1540,6 +1620,8 @@ <item>CMAKE_TRY_COMPILE_PLATFORM_VARIABLES</item> <item>CMAKE_TRY_COMPILE_TARGET_TYPE</item> <item>CMAKE_TWEAK_VERSION</item> + <item>CMAKE_UNITY_BUILD</item> + <item>CMAKE_UNITY_BUILD_BATCH_SIZE</item> <item>CMAKE_USER_MAKE_RULES_OVERRIDE</item> <item>CMAKE_USE_PTHREADS_INIT</item> <item>CMAKE_USE_RELATIVE_PATHS</item> @@ -1577,9 +1659,11 @@ <item>CMAKE_XCODE_PLATFORM_TOOLSET</item> <item>CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER</item> <item>CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN</item> + <item>CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING</item> <item>CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER</item> <item>CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS</item> <item>CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE</item> + <item>CMAKE_XCODE_SCHEME_ENVIRONMENT</item> <item>CMAKE_XCODE_SCHEME_GUARD_MALLOC</item> <item>CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP</item> <item>CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES</item> @@ -1589,6 +1673,7 @@ <item>CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP</item> <item>CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER</item> <item>CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP</item> + <item>CMAKE_XCODE_SCHEME_WORKING_DIRECTORY</item> <item>CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS</item> <item>CPACK_ABSOLUTE_DESTINATION_FILES</item> <item>CPACK_ARCHIVE_COMPONENT_INSTALL</item> @@ -1704,6 +1789,7 @@ <item>CPACK_INSTALL_COMMANDS</item> <item>CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS</item> <item>CPACK_INSTALL_SCRIPT</item> + <item>CPACK_INSTALL_SCRIPTS</item> <item>CPACK_MONOLITHIC_INSTALL</item> <item>CPACK_NSIS_COMPRESSOR</item> <item>CPACK_NSIS_CONTACT</item> @@ -1715,6 +1801,8 @@ <item>CPACK_NSIS_EXTRA_INSTALL_COMMANDS</item> <item>CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS</item> <item>CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS</item> + <item>CPACK_NSIS_FINISH_TITLE</item> + <item>CPACK_NSIS_FINISH_TITLE_3LINES</item> <item>CPACK_NSIS_HELP_LINK</item> <item>CPACK_NSIS_INSTALLED_ICON_NAME</item> <item>CPACK_NSIS_INSTALLER_MUI_ICON_CODE</item> @@ -1722,12 +1810,16 @@ <item>CPACK_NSIS_MENU_LINKS</item> <item>CPACK_NSIS_MODIFY_PATH</item> <item>CPACK_NSIS_MUI_FINISHPAGE_RUN</item> + <item>CPACK_NSIS_MUI_HEADERIMAGE</item> <item>CPACK_NSIS_MUI_ICON</item> <item>CPACK_NSIS_MUI_UNIICON</item> <item>CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP</item> <item>CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP</item> <item>CPACK_NSIS_PACKAGE_NAME</item> + <item>CPACK_NSIS_UNINSTALL_NAME</item> <item>CPACK_NSIS_URL_INFO_ABOUT</item> + <item>CPACK_NSIS_WELCOME_TITLE</item> + <item>CPACK_NSIS_WELCOME_TITLE_3LINES</item> <item>CPACK_NUGET_COMPONENT_INSTALL</item> <item>CPACK_NUGET_PACKAGE_AUTHORS</item> <item>CPACK_NUGET_PACKAGE_COPYRIGHT</item> @@ -1744,7 +1836,6 @@ <item>CPACK_NUGET_PACKAGE_TAGS</item> <item>CPACK_NUGET_PACKAGE_TITLE</item> <item>CPACK_NUGET_PACKAGE_VERSION</item> - <item>CPACK_OSX_PACKAGE_VERSION</item> <item>CPACK_OUTPUT_CONFIG_FILE</item> <item>CPACK_PACKAGE_CHECKSUM</item> <item>CPACK_PACKAGE_CONTACT</item> @@ -1759,6 +1850,7 @@ <item>CPACK_PACKAGE_INSTALL_DIRECTORY</item> <item>CPACK_PACKAGE_INSTALL_REGISTRY_KEY</item> <item>CPACK_PACKAGE_NAME</item> + <item>CPACK_PACKAGE_RELOCATABLE</item> <item>CPACK_PACKAGE_VENDOR</item> <item>CPACK_PACKAGE_VERSION</item> <item>CPACK_PACKAGE_VERSION_MAJOR</item> @@ -1767,6 +1859,16 @@ <item>CPACK_PACKAGING_INSTALL_PREFIX</item> <item>CPACK_PKGBUILD_IDENTITY_NAME</item> <item>CPACK_PKGBUILD_KEYCHAIN_PATH</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_SCALING</item> + <item>CPACK_PRODUCTBUILD_BACKGROUND_UTI</item> <item>CPACK_PRODUCTBUILD_IDENTITY_NAME</item> <item>CPACK_PRODUCTBUILD_KEYCHAIN_PATH</item> <item>CPACK_PRODUCTBUILD_RESOURCES_DIR</item> @@ -2024,6 +2126,7 @@ <item>CMAKE_APPBUNDLE_PATH</item> <item>CMAKE_BUILD_PARALLEL_LEVEL</item> <item>CMAKE_CONFIG_TYPE</item> + <item>CMAKE_EXPORT_COMPILE_COMMANDS</item> <item>CMAKE_FRAMEWORK_PATH</item> <item>CMAKE_GENERATOR</item> <item>CMAKE_GENERATOR_INSTANCE</item> @@ -2063,6 +2166,7 @@ <item>AUTOMOC_SOURCE_GROUP</item> <item>AUTOMOC_TARGETS_FOLDER</item> <item>AUTORCC_SOURCE_GROUP</item> + <item>CMAKE_CUDA_KNOWN_FEATURES</item> <item>CMAKE_CXX_KNOWN_FEATURES</item> <item>CMAKE_C_KNOWN_FEATURES</item> <item>CMAKE_ROLE</item> @@ -2132,6 +2236,7 @@ </list> <list name="target-properties"> <item>ADDITIONAL_CLEAN_FILES</item> + <item>AIX_EXPORT_ALL_SYMBOLS</item> <item>ALIASED_TARGET</item> <item>ANDROID_ANT_ADDITIONAL_OPTIONS</item> <item>ANDROID_API</item> @@ -2161,6 +2266,7 @@ <item>AUTOMOC_EXECUTABLE</item> <item>AUTOMOC_MACRO_NAMES</item> <item>AUTOMOC_MOC_OPTIONS</item> + <item>AUTOMOC_PATH_PREFIX</item> <item>AUTORCC</item> <item>AUTORCC_EXECUTABLE</item> <item>AUTORCC_OPTIONS</item> @@ -2190,6 +2296,7 @@ <item>CUDA_EXTENSIONS</item> <item>CUDA_PTX_COMPILATION</item> <item>CUDA_RESOLVE_DEVICE_SYMBOLS</item> + <item>CUDA_RUNTIME_LIBRARY</item> <item>CUDA_SEPARABLE_COMPILATION</item> <item>CUDA_STANDARD</item> <item>CUDA_STANDARD_REQUIRED</item> @@ -2202,6 +2309,9 @@ <item>DEFINE_SYMBOL</item> <item>DEPLOYMENT_ADDITIONAL_FILES</item> <item>DEPLOYMENT_REMOTE_DIRECTORY</item> + <item>DEPRECATION</item> + <item>DISABLE_PRECOMPILE_HEADERS</item> + <item>DOTNET_TARGET_FRAMEWORK</item> <item>DOTNET_TARGET_FRAMEWORK_VERSION</item> <item>ENABLE_EXPORTS</item> <item>EXCLUDE_FROM_ALL</item> @@ -2236,6 +2346,7 @@ <item>IMPORT_SUFFIX</item> <item>INCLUDE_DIRECTORIES</item> <item>INSTALL_NAME_DIR</item> + <item>INSTALL_REMOVE_ENVIRONMENT_RPATH</item> <item>INSTALL_RPATH</item> <item>INSTALL_RPATH_USE_LINK_PATH</item> <item>INTERFACE_AUTOUIC_OPTIONS</item> @@ -2248,6 +2359,7 @@ <item>INTERFACE_LINK_LIBRARIES</item> <item>INTERFACE_LINK_OPTIONS</item> <item>INTERFACE_POSITION_INDEPENDENT_CODE</item> + <item>INTERFACE_PRECOMPILE_HEADERS</item> <item>INTERFACE_SOURCES</item> <item>INTERFACE_SYSTEM_INCLUDE_DIRECTORIES</item> <item>INTERPROCEDURAL_OPTIMIZATION</item> @@ -2280,10 +2392,14 @@ <item>NO_SONAME</item> <item>NO_SYSTEM_FROM_IMPORTED</item> <item>OSX_ARCHITECTURES</item> + <item>OSX_COMPATIBILITY_VERSION</item> + <item>OSX_CURRENT_VERSION</item> <item>OUTPUT_NAME</item> <item>PDB_NAME</item> <item>PDB_OUTPUT_DIRECTORY</item> <item>POSITION_INDEPENDENT_CODE</item> + <item>PRECOMPILE_HEADERS</item> + <item>PRECOMPILE_HEADERS_REUSE_FROM</item> <item>PREFIX</item> <item>PRIVATE_HEADER</item> <item>PROJECT_LABEL</item> @@ -2305,6 +2421,10 @@ <item>Swift_MODULE_DIRECTORY</item> <item>Swift_MODULE_NAME</item> <item>TYPE</item> + <item>UNITY_BUILD</item> + <item>UNITY_BUILD_BATCH_SIZE</item> + <item>UNITY_BUILD_CODE_AFTER_INCLUDE</item> + <item>UNITY_BUILD_CODE_BEFORE_INCLUDE</item> <item>VERSION</item> <item>VISIBILITY_INLINES_HIDDEN</item> <item>VS_CONFIGURATION_TYPE</item> @@ -2313,9 +2433,11 @@ <item>VS_DEBUGGER_ENVIRONMENT</item> <item>VS_DEBUGGER_WORKING_DIRECTORY</item> <item>VS_DESKTOP_EXTENSIONS_VERSION</item> + <item>VS_DOTNET_DOCUMENTATION_FILE</item> <item>VS_DOTNET_REFERENCES</item> <item>VS_DOTNET_REFERENCES_COPY_LOCAL</item> <item>VS_DOTNET_TARGET_FRAMEWORK_VERSION</item> + <item>VS_DPI_AWARE</item> <item>VS_GLOBAL_KEYWORD</item> <item>VS_GLOBAL_PROJECT_TYPES</item> <item>VS_GLOBAL_ROOTNAMESPACE</item> @@ -2346,6 +2468,7 @@ <item>XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN</item> <item>XCODE_SCHEME_ARGUMENTS</item> <item>XCODE_SCHEME_DEBUG_AS_ROOT</item> + <item>XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING</item> <item>XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER</item> <item>XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS</item> <item>XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE</item> @@ -2360,6 +2483,7 @@ <item>XCODE_SCHEME_THREAD_SANITIZER_STOP</item> <item>XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER</item> <item>XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP</item> + <item>XCODE_SCHEME_WORKING_DIRECTORY</item> <item>XCODE_SCHEME_ZOMBIE_OBJECTS</item> <item>XCTEST</item> </list> @@ -2386,6 +2510,8 @@ <item>SKIP_AUTOMOC</item> <item>SKIP_AUTORCC</item> <item>SKIP_AUTOUIC</item> + <item>SKIP_PRECOMPILE_HEADERS</item> + <item>SKIP_UNITY_BUILD_INCLUSION</item> <item>SYMBOLIC</item> <item>Swift_DEPENDENCIES_FILE</item> <item>Swift_DIAGNOSTICS_FILE</item> @@ -2429,6 +2555,7 @@ <item>REQUIRED_FILES</item> <item>RESOURCE_LOCK</item> <item>RUN_SERIAL</item> + <item>SKIP_REGULAR_EXPRESSION</item> <item>SKIP_RETURN_CODE</item> <item>TIMEOUT</item> <item>TIMEOUT_AFTER_MATCH</item> @@ -2621,6 +2748,7 @@ <WordDetect String="target_link_directories" insensitive="true" attribute="Command" context="target_link_directories_ctx" /> <WordDetect String="target_link_libraries" insensitive="true" attribute="Command" context="target_link_libraries_ctx" /> <WordDetect String="target_link_options" insensitive="true" attribute="Command" context="target_link_options_ctx" /> + <WordDetect String="target_precompile_headers" insensitive="true" attribute="Command" context="target_precompile_headers_ctx" /> <WordDetect String="target_sources" insensitive="true" attribute="Command" context="target_sources_ctx" /> <WordDetect String="try_compile" insensitive="true" attribute="Command" context="try_compile_ctx" /> <WordDetect String="try_run" insensitive="true" attribute="Command" context="try_run_ctx" /> @@ -2838,6 +2966,7 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="get_cmake_property_ctx_op"> <IncludeRules context="EndCmdPop2" /> + <keyword attribute="Special Args" context="#stay" String="get_cmake_property_sargs" /> <keyword attribute="Property" context="#stay" String="global-properties" /> <IncludeRules context="Detect More global-properties" /> <IncludeRules context="User Function Args" /> @@ -3442,6 +3571,14 @@ <keyword attribute="Named Args" context="#stay" String="target_link_options_nargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="target_precompile_headers_ctx"> + <DetectChar attribute="Normal Text" context="target_precompile_headers_ctx_op" char="(" /> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="target_precompile_headers_ctx_op"> + <IncludeRules context="EndCmdPop2" /> + <keyword attribute="Named Args" context="#stay" String="target_precompile_headers_nargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="target_sources_ctx"> <DetectChar attribute="Normal Text" context="target_sources_ctx_op" char="(" /> </context> @@ -3549,6 +3686,7 @@ <context attribute="Normal Text" lineEndContext="#stay" name="ctest_test_ctx_op"> <IncludeRules context="EndCmdPop2" /> <keyword attribute="Named Args" context="#stay" String="ctest_test_nargs" /> + <keyword attribute="Special Args" context="#stay" String="ctest_test_sargs" /> <IncludeRules context="User Function Args" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="ctest_update_ctx"> @@ -3645,9 +3783,9 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Builtin Variables"> + <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" /> <keyword attribute="Builtin Variable" context="#stay" String="variables" insensitive="false" /> <IncludeRules context="Detect More Builtin Variables" /> - <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables"> @@ -3679,6 +3817,7 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_LIBRARY_DIRS\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_VERSION_COUNT\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_VERSION_STRING\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_MODULE_NAME\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_POSTFIX\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_ANDROID_TOOLCHAIN_MACHINE\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_ANDROID_TOOLCHAIN_PREFIX\b" /> @@ -3751,8 +3890,8 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_MODULE_LINKER_FLAGS_&id_re;\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_MODULE_LINKER_FLAGS_&id_re;_INIT\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_PDB_OUTPUT_DIRECTORY_&id_re;\b" /> - <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_POLICY_DEFAULT_CMP&id_re;\b" /> - <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_POLICY_WARNING_CMP&id_re;\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_POLICY_DEFAULT_CMP[0-9]{4}\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_POLICY_WARNING_CMP[0-9]{4}\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_PROJECT_&id_re;_INCLUDE\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_RUNTIME_OUTPUT_DIRECTORY_&id_re;\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_SHARED_LINKER_FLAGS_&id_re;\b" /> @@ -3771,7 +3910,7 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_COMPONENT_&id_re;_GROUP\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_COMPONENT_&id_re;_HIDDEN\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_COMPONENT_&id_re;_REQUIRED\b" /> - <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_COMPONENT_&id_re;_DESCRIPTION\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_DESCRIPTION\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_FILE_NAME\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_PACKAGE_ARCHITECTURE\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_PACKAGE_BREAKS\b" /> @@ -3791,6 +3930,7 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_PACKAGE_SOURCE\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_PACKAGE_SUGGESTS\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DEBIAN_&id_re;_DEBUGINFO_PACKAGE\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_DMG_&id_re;_FILE_NAME\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NSIS_&id_re;_INSTALL_DIRECTORY\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NUGET_&id_re;_PACKAGE_AUTHORS\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NUGET_&id_re;_PACKAGE_COPYRIGHT\b" /> @@ -3808,6 +3948,8 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NUGET_&id_re;_PACKAGE_TITLE\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NUGET_&id_re;_PACKAGE_VERSION\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_NUGET_PACKAGE_DEPENDENCIES_&id_re;_VERSION\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_POSTFLIGHT_&id_re;_SCRIPT\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_PREFLIGHT_&id_re;_SCRIPT\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_RPM_&id_re;_DEFAULT_DIR_PERMISSIONS\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_RPM_&id_re;_DEFAULT_FILE_PERMISSIONS\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCPACK_RPM_&id_re;_DEFAULT_GROUP\b" /> @@ -3866,6 +4008,7 @@ <RegExpr attribute="Standard Environment Variable" context="#stay" String="\b&id_re;_ROOT\b" /> <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bASM&id_re;\b" /> <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bASM&id_re;FLAGS\b" /> + <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_LAUNCHER\b" /> <DetectIdentifier /> <DetectChar attribute="Environment Variable Substitution" context="#pop#pop" char="}" /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml index 7f0d52b353c..ecbd46624c3 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml @@ -3,9 +3,9 @@ [ <!ENTITY name "[A-Za-z_:][\w.:_-]*"> <!ENTITY attributeName "[A-Za-z_:*#\(\[][\)\]\w.:_-]*"> - <!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> + <!ENTITY entref "&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> ]> -<language name="HTML" version="9" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> +<language name="HTML" version="11" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> <highlighting> <contexts> @@ -33,37 +33,37 @@ </context> <context name="FindHTMLTags" attribute="Normal Text" lineEndContext="#stay"> - <RegExpr attribute="Element" context="El Open" String="<pre\b" insensitive="true" beginRegion="pre" /> - <RegExpr attribute="Element" context="El Open" String="<div\b" insensitive="true" beginRegion="div" /> - <RegExpr attribute="Element" context="El Open" String="<table\b" insensitive="true" beginRegion="table" /> - <RegExpr attribute="Element" context="El Open" String="<ul\b" insensitive="true" beginRegion="ul" /> - <RegExpr attribute="Element" context="El Open" String="<ol\b" insensitive="true" beginRegion="ol" /> - <RegExpr attribute="Element" context="El Open" String="<dl\b" insensitive="true" beginRegion="dl" /> - <RegExpr attribute="Element" context="El Open" String="<article\b" insensitive="true" beginRegion="article" /> - <RegExpr attribute="Element" context="El Open" String="<aside\b" insensitive="true" beginRegion="aside" /> - <RegExpr attribute="Element" context="El Open" String="<details\b" insensitive="true" beginRegion="details" /> - <RegExpr attribute="Element" context="El Open" String="<figure\b" insensitive="true" beginRegion="figure" /> - <RegExpr attribute="Element" context="El Open" String="<footer\b" insensitive="true" beginRegion="footer" /> - <RegExpr attribute="Element" context="El Open" String="<header\b" insensitive="true" beginRegion="header" /> - <RegExpr attribute="Element" context="El Open" String="<main\b" insensitive="true" beginRegion="main" /> - <RegExpr attribute="Element" context="El Open" String="<nav\b" insensitive="true" beginRegion="nav" /> - <RegExpr attribute="Element" context="El Open" String="<section\b" insensitive="true" beginRegion="section" /> + <WordDetect attribute="Element" context="El Open" String="<pre" insensitive="true" beginRegion="pre" /> + <WordDetect attribute="Element" context="El Open" String="<div" insensitive="true" beginRegion="div" /> + <WordDetect attribute="Element" context="El Open" String="<table" insensitive="true" beginRegion="table" /> + <WordDetect attribute="Element" context="El Open" String="<ul" insensitive="true" beginRegion="ul" /> + <WordDetect attribute="Element" context="El Open" String="<ol" insensitive="true" beginRegion="ol" /> + <WordDetect attribute="Element" context="El Open" String="<dl" insensitive="true" beginRegion="dl" /> + <WordDetect attribute="Element" context="El Open" String="<article" insensitive="true" beginRegion="article" /> + <WordDetect attribute="Element" context="El Open" String="<aside" insensitive="true" beginRegion="aside" /> + <WordDetect attribute="Element" context="El Open" String="<details" insensitive="true" beginRegion="details" /> + <WordDetect attribute="Element" context="El Open" String="<figure" insensitive="true" beginRegion="figure" /> + <WordDetect attribute="Element" context="El Open" String="<footer" insensitive="true" beginRegion="footer" /> + <WordDetect attribute="Element" context="El Open" String="<header" insensitive="true" beginRegion="header" /> + <WordDetect attribute="Element" context="El Open" String="<main" insensitive="true" beginRegion="main" /> + <WordDetect attribute="Element" context="El Open" String="<nav" insensitive="true" beginRegion="nav" /> + <WordDetect attribute="Element" context="El Open" String="<section" insensitive="true" beginRegion="section" /> <RegExpr attribute="Element" context="El Open" String="<&name;" /> - <RegExpr attribute="Element" context="El Close" String="</pre\b" insensitive="true" endRegion="pre" /> - <RegExpr attribute="Element" context="El Close" String="</div\b" insensitive="true" endRegion="div" /> - <RegExpr attribute="Element" context="El Close" String="</table\b" insensitive="true" endRegion="table" /> - <RegExpr attribute="Element" context="El Close" String="</ul\b" insensitive="true" endRegion="ul" /> - <RegExpr attribute="Element" context="El Close" String="</ol\b" insensitive="true" endRegion="ol" /> - <RegExpr attribute="Element" context="El Close" String="</dl\b" insensitive="true" endRegion="dl" /> - <RegExpr attribute="Element" context="El Close" String="</article\b" insensitive="true" endRegion="article" /> - <RegExpr attribute="Element" context="El Close" String="</aside\b" insensitive="true" endRegion="aside" /> - <RegExpr attribute="Element" context="El Close" String="</details\b" insensitive="true" endRegion="details" /> - <RegExpr attribute="Element" context="El Close" String="</figure\b" insensitive="true" endRegion="figure" /> - <RegExpr attribute="Element" context="El Close" String="</footer\b" insensitive="true" endRegion="footer" /> - <RegExpr attribute="Element" context="El Close" String="</header\b" insensitive="true" endRegion="header" /> - <RegExpr attribute="Element" context="El Close" String="</main\b" insensitive="true" endRegion="main" /> - <RegExpr attribute="Element" context="El Close" String="</nav\b" insensitive="true" endRegion="nav" /> - <RegExpr attribute="Element" context="El Close" String="</section\b" insensitive="true" endRegion="section" /> + <WordDetect attribute="Element" context="El Close" String="</pre" insensitive="true" endRegion="pre" /> + <WordDetect attribute="Element" context="El Close" String="</div" insensitive="true" endRegion="div" /> + <WordDetect attribute="Element" context="El Close" String="</table" insensitive="true" endRegion="table" /> + <WordDetect attribute="Element" context="El Close" String="</ul" insensitive="true" endRegion="ul" /> + <WordDetect attribute="Element" context="El Close" String="</ol" insensitive="true" endRegion="ol" /> + <WordDetect attribute="Element" context="El Close" String="</dl" insensitive="true" endRegion="dl" /> + <WordDetect attribute="Element" context="El Close" String="</article" insensitive="true" endRegion="article" /> + <WordDetect attribute="Element" context="El Close" String="</aside" insensitive="true" endRegion="aside" /> + <WordDetect attribute="Element" context="El Close" String="</details" insensitive="true" endRegion="details" /> + <WordDetect attribute="Element" context="El Close" String="</figure" insensitive="true" endRegion="figure" /> + <WordDetect attribute="Element" context="El Close" String="</footer" insensitive="true" endRegion="footer" /> + <WordDetect attribute="Element" context="El Close" String="</header" insensitive="true" endRegion="header" /> + <WordDetect attribute="Element" context="El Close" String="</main" insensitive="true" endRegion="main" /> + <WordDetect attribute="Element" context="El Close" String="</nav" insensitive="true" endRegion="nav" /> + <WordDetect attribute="Element" context="El Close" String="</section" insensitive="true" endRegion="section" /> <RegExpr attribute="Element" context="El Close" String="</&name;" /> </context> @@ -85,7 +85,7 @@ </context> <context name="FindDTDRules" attribute="Other Text" lineEndContext="#stay"> - <RegExpr attribute="Doctype" context="Doctype Markupdecl" String="<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> + <RegExpr attribute="Doctype" context="Doctype Markupdecl" String="<!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> </context> @@ -94,7 +94,7 @@ <IncludeRules context="##Alerts" /> <DetectIdentifier/> <StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> - <RegExpr attribute="Error" context="#stay" String="-(-(?!->))+" /> + <RegExpr attribute="Error" context="#stay" String="-(?:-(?!->))+" /> </context> <context name="CDATA" attribute="Other Text" lineEndContext="#stay"> @@ -172,7 +172,7 @@ </context> <context name="JS" attribute="Other Text" lineEndContext="#stay"> - <RegExpr attribute="Attribute" context="Script-Type" String="(\s+|^)type(?=\=|\s|$)" insensitive="true"/> + <RegExpr attribute="Attribute" context="Script-Type" String="(?:\s+|^)type(?=\=|\s|$)" insensitive="true"/> <DetectChar attribute="Element" context="JS content" char=">" /> <IncludeRules context="DefaultJS" /> </context> @@ -257,7 +257,7 @@ </context> <context name="JSX content" attribute="Other Text" lineEndContext="#stay"> <IncludeRules context="Default JS content"/> - <IncludeRules context="Normal##JavaScript React" includeAttrib="true"/> + <IncludeRules context="Normal##JavaScript React (JSX)" includeAttrib="true"/> </context> <context name="TypeScript" attribute="Other Text" lineEndContext="#stay"> @@ -310,7 +310,7 @@ </highlighting> <general> <comments> - <comment name="multiLine" start="<!--" end="-->" /> + <comment name="multiLine" start="<!--" end="-->" region="comment" /> </comments> </general> </language> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml index 6067a2470f5..db158d532f7 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml @@ -10,7 +10,7 @@ <!-- v4 by Alex Richardson <arichardson.kde@gmail.com> added bmake support --> <language name="Makefile" section="Other" - version="7" kateversion="3.4" + version="9" kateversion="3.4" extensions="GNUmakefile;Makefile;makefile;GNUmakefile.*;Makefile.*;makefile.*;*.mk" mimetype="text/x-makefile" priority="11" author="Per Wigren (wigren@home.se)" license=""> @@ -185,8 +185,8 @@ <keyword attribute="Keyword" context="bmake_for_loop" String="bmake_for_stmt" firstNonSpace="true" beginRegion="for"/> <keyword attribute="Keyword" context="#stay" String="bmake_endfor_stmt" firstNonSpace="true" endRegion="for"/> - <RegExpr attribute="Section" context="prereq" String="^\.[^.][^:]*:"/> - <RegExpr attribute="Target" context="prereq" String="^[^:]*:"/> + <RegExpr attribute="Section" context="prereq" String="^\.[^.][^:]*:" column="0"/> + <RegExpr attribute="Target" context="prereq" String="^[^:]*:" column="0"/> <DetectIdentifier/> <DetectChar attribute="String" context="string"" char="""/> <DetectChar attribute="String" context="string'" char="'"/> @@ -203,10 +203,16 @@ <DetectChar attribute="Comment" context="Comment" char="#"/> </context> - <context name="gmake_else" attribute="Error" lineEndContext="#pop"> + <context name="gmake_else" attribute="Normal" lineEndContext="#pop"> <DetectSpaces attribute="Normal"/> <keyword attribute="ControlFlow" String="gmake_if_keywords" context="#stay"/> <IncludeRules context="strings_and_vars"/> + <Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/> + <Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/> + <!-- NOTE: Allow highlighting any variable name (see bug #417379), for example: + else ifdef foo + else ifeq (bar, foo) + --> </context> <context name="bmake_include" attribute="Normal" lineEndContext="#pop"> @@ -341,7 +347,8 @@ <DetectChar attribute="Operator" char=")" context="#pop#pop#pop"/> <DetectChar attribute="Operator" context="dollar" char="$"/> <DetectSpaces attribute="Error" context="#stay"/> - <AnyChar attribute="Error" context="#stay" String="=#:"/> + <DetectChar attribute="RealOperator" context="SubstitutionRefs" char=":"/> + <AnyChar attribute="Error" context="#stay" String="=#"/> </context> <context name="callVar{" attribute="Variable" lineEndContext="#stay"> @@ -456,6 +463,16 @@ <DetectChar attribute="String" context="string'" char="'"/> </context> + <!-- $(var:pattern=replacement) --> + <context name="SubstitutionRefs" attribute="VarModifier" lineEndContext="#stay"> + <DetectChar attribute="RealOperator" context="#pop!SubstitutionRefsReplacement" char="="/> + <IncludeRules context="SubstitutionRefsReplacement"/> + </context> + <context name="SubstitutionRefsReplacement" attribute="VarModifier" lineEndContext="#stay"> + <DetectChar attribute="Operator" char=")" context="#pop#pop#pop#pop"/> + <DetectChar attribute="Operator" context="dollar" char="$"/> + </context> + <context attribute="Comment" lineEndContext="#pop" name="Comment"> <LineContinue attribute="Comment" context="#stay" /> <IncludeRules context="##Alerts" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml index 7d11b34e6b6..b47b1afceed 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml @@ -40,10 +40,12 @@ <!-- emphasis text --> <!ENTITY emphasisregex_ast "\*(?:&contentregex_ast;\*|\*{1,4}&contentregex_ast;\*(?!\*))"> <!ENTITY emphasisregex_und "\b_(?:&contentregex_und;_+|_{1,4}&contentregex_und;_)\b"> -<!-- links --> +<!-- links. + Keep in sync with reStructuredText (rest) --> <!ENTITY startlink "(?:https?|ftp)\://"> <!ENTITY link "&startlink;[^">\s]+"> -<!-- link in normal text --> +<!-- link in normal text. + Keep in sync with reStructuredText’s (rest) StandaloneHyperlink attribute --> <!ENTITY implicitlink "\b&startlink;[^">\s`\)]*[^\s!"'`\(\)\*,\.:;<>\?~\]\}\\](?=[[:punct:]]*(?:[\s\)]|$))"> <!-- references: [name], [name][id], [name][id] "title", [name](https://example.com) --> <!ENTITY refchar "(?:\\.|[^\]\\])"> @@ -88,7 +90,7 @@ <!ENTITY checkbox "\[[ x]\](?=\s)"> ]> -<language name="Markdown" version="10" kateversion="5.53" section="Markup" extensions="*.md;*.mmd;*.markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD"> +<language name="Markdown" version="11" kateversion="5.53" 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 --> @@ -392,7 +394,7 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="jsx-code"> <IncludeRules context="code"/> - <IncludeRules context="Normal##JavaScript React" includeAttrib="true"/> + <IncludeRules context="Normal##JavaScript React (JSX)" includeAttrib="true"/> </context> <context attribute="Normal Text" lineEndContext="#stay" name="json-code"> <IncludeRules context="code"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml index 0f3c882b6c9..b39c136acc3 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml @@ -8,7 +8,7 @@ Copyright (c) 2012-2014 by Alex Turbov (i.zaufi@gmail.com) --> <language name="Modelines" - version="4" + version="5" kateversion="5.0" section="Other" extensions="" @@ -130,10 +130,10 @@ <context name="Normal" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <keyword String="ModelineStartKeyword" context="Modeline" attribute="Keyword" /> - <RegExpr String="kate-(mimetype|wildcard)\(.*\):" context="Modeline" attribute="Keyword" /> + <RegExpr String="kate-(?:mimetype|wildcard)\(.*\):" context="Modeline" attribute="Keyword" /> </context> - <context name="Modeline" attribute="Comment" lineEndContext="#pop"> + <context name="Modeline" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces /> <keyword String="Booleans" context="Booleans" attribute="Variable" /> <keyword String="Integrals" context="Integrals" attribute="Variable" /> @@ -142,7 +142,7 @@ <LineContinue context="#pop" /> </context> - <context name="Booleans" attribute="Comment" lineEndContext="#pop"> + <context name="Booleans" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces /> <keyword String="True" attribute="Option ON" context="#stay" /> <keyword String="False" attribute="Option OFF" context="#stay" /> @@ -150,7 +150,7 @@ <LineContinue context="#pop" /> </context> - <context name="Integrals" attribute="Comment" lineEndContext="#pop"> + <context name="Integrals" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces /> <Int attribute="Number" context="#stay" /> <DetectChar char="&end;" context="#pop" attribute="Variable" /> @@ -164,13 +164,13 @@ <LineContinue context="#pop" /> </context> - <context name="RemoveSpaces" attribute="Comment" lineEndContext="#pop"> + <context name="RemoveSpaces" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces /> <keyword String="RemoveSpacesOptions" attribute="Value" context="#pop!RemoveSpacesEnd" /> <DetectChar char="&end;" context="#pop" attribute="Variable" /> <LineContinue context="#pop" /> </context> - <context name="RemoveSpacesEnd" attribute="Comment" lineEndContext="#pop"> + <context name="RemoveSpacesEnd" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectChar char="&end;" context="#pop" attribute="Variable" /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml index c2d366d1f30..26c82cd66ef 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="9" kateversion="2.4" 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="10" kateversion="2.4" 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> @@ -252,6 +252,7 @@ <item>rewinddir</item> <item>rindex</item> <item>rmdir</item> + <item>say</item> <item>scalar</item> <item>seek</item> <item>seekdir</item> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml index 8208fd7aaed..e5c1e44c45a 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml @@ -1,7 +1,7 @@ <!DOCTYPE language SYSTEM "language.dtd"> <language name="PowerShell" - version="4" + version="5" kateversion="5.0" extensions="*.ps1;*.ps1m;*.ps1d" section="Scripts" @@ -892,7 +892,12 @@ <RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" /> <AnyChar attribute="Symbol" context="#stay" String=":!%&()+,-/.*<=>?[]|~^;"/> </context> + <context attribute="String Char" lineEndContext="#stay" name="StringEscape"> + <RegExpr attribute="String Char" String="`[`"0abefnrtv]" context="#stay"/> + <RegExpr attribute="String Char" String="`u\{[0-9A-Fa-f]+\}" context="#stay"/> + </context> <context attribute="String" lineEndContext="#pop" name="String"> + <IncludeRules context="StringEscape"/> <LineContinue attribute="String" context="#pop"/> <DetectChar attribute="String" context="#pop" char="""/> </context> @@ -916,6 +921,7 @@ <itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/> <itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/> <itemData name="String" defStyleNum="dsString"/> + <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> <itemData name="HereString" defStyleNum="dsVerbatimString"/> <itemData name="Comment" defStyleNum="dsComment"/> <itemData name="Cmdlets" defStyleNum="dsBuiltIn" spellChecking="false"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml index 33a313a6942..2c0c24bf00d 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE language> +<!DOCTYPE language SYSTEM "language.dtd" +[ + <!ENTITY digitPart "[0-9](?:_?[0-9])*"> + <!ENTITY beforeDigit "(?<![\.\w[:^ascii:]])"> + <!ENTITY beforePointFloat "(?<![\w[:^ascii:]])"> +]> <!-- Python syntax highlightning v0.9 by Per Wigren --> <!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) --> <!-- Python syntax highlighting v1.97 by Paul Giannaros --> @@ -14,7 +19,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="9" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> +<language name="Python" version="11" 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> @@ -65,6 +70,7 @@ <item>ascii</item> <item>basestring</item> <item>bin</item> + <item>breakpoint</item> <item>bool</item> <item>buffer</item> <item>bytearray</item> @@ -342,15 +348,17 @@ <keyword attribute="Overloaders" String="overloaders" context="#stay"/> <RegExpr attribute="Normal Text" String="[a-zA-Z_][a-zA-Z_0-9]{2,}" context="#stay"/> - <RegExpr attribute="Complex" String=" ((([0-9]*\.[0-9]+|[0-9]+\.)|([0-9]+|([0-9]*\.[0-9]+|[0-9]+\.))[eE](\+|-)?[0-9]+)|[0-9]+)[jJ]" context="#stay"/> - <Float attribute="Float" context="#stay" /> - <HlCHex attribute="Hex" context="#stay"/> - <HlCOct attribute="Octal" context="#stay"/> - <Int attribute="Int" context="Int Suffixes"/> - - <RegExpr attribute="Int" String=" ([0-9]+_)+[0-9]+" context="#stay"/> - <RegExpr attribute="Float" String=" ([0-9]+_)+[0-9]+\.[0-9]+" context="#stay"/> - <RegExpr attribute="Hex" String=" [0-9]x([A-F0-9]+_)+[A-F0-9]+" 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" context="#stay"/> + <RegExpr attribute="Float" String="(?:&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"/> @@ -362,14 +370,10 @@ <IncludeRules context="StringVariants" /> - <RegExpr attribute="Decorator" String="@[_a-zA-Z][\._a-zA-Z0-9]*" firstNonSpace="true"/> + <RegExpr attribute="Decorator" String="@[_a-zA-Z[:^ascii:]][\._a-zA-Z0-9[:^ascii:]]*" firstNonSpace="true"/> <AnyChar attribute="Operator" String="+*/%\|=;\!<>!^&~-@" context="#stay"/> </context> - <context name="Int Suffixes" attribute="Int" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> - <StringDetect attribute="Int" context="#pop" String="L" insensitive="true"/> - </context> - <context name="#CheckForString" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces/> <LineContinue attribute="Normal Text" context="CheckForStringNext"/> @@ -661,6 +665,7 @@ <itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/> <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> + <itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/> <itemData name="Complex" defStyleNum="dsOthers" spellChecking="false"/> <itemData name="Comment" defStyleNum="dsComment"/> <itemData name="String" defStyleNum="dsString"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml index ad34a450b66..ddfc4e705f0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml @@ -4,9 +4,9 @@ <!-- names must start with a letter, ideogram or underscore. \w matches any word character *or* a number, hence the lookahead --> <!ENTITY name "(?![0-9])[\w_:][\w.:_-]*"> - <!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> + <!ENTITY entref "&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> ]> -<language name="XML" version="9" kateversion="3.4" 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="10" kateversion="3.4" 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> @@ -40,8 +40,9 @@ <context name="Comment" attribute="Comment" lineEndContext="#stay"> <DetectSpaces /> <StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> - <RegExpr attribute="Error" context="#stay" String="-(-(?!->))+" /> + <RegExpr attribute="Error" context="#stay" String="-(?:\-(?!->))+" /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> @@ -63,7 +64,7 @@ <context name="Doctype Internal Subset" attribute="Other Text" lineEndContext="#stay"> <DetectChar attribute="Doctype" context="#pop" char="]" endRegion="int_subset" /> - <RegExpr attribute="Doctype" context="Doctype Markupdecl" String="<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> + <RegExpr attribute="Doctype" context="Doctype Markupdecl" String="<!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> <StringDetect attribute="Comment" context="Comment" String="<!--" beginRegion="comment" /> <RegExpr attribute="Processing Instruction" context="PI" String="<\?[\w:_-]*" beginRegion="pi" /> <IncludeRules context="FindPEntityRefs" /> @@ -88,8 +89,7 @@ <context name="Element" attribute="Other Text" lineEndContext="#stay"> <Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="element" /> <DetectChar attribute="Element" context="El Content" char=">" /> - <RegExpr attribute="Attribute" context="Attribute" String="^&name;" /> - <RegExpr attribute="Attribute" context="Attribute" String="\s+&name;" /> + <RegExpr attribute="Attribute" context="Attribute" String="(?:^|\s+)&name;" /> <RegExpr attribute="Error" context="#stay" String="\S" /> </context> @@ -143,7 +143,7 @@ </highlighting> <general> <comments> - <comment name="multiLine" start="<!--" end="-->" /> + <comment name="multiLine" start="<!--" end="-->" region="comment" /> </comments> </general> </language> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml index 06d6492ff14..ecb1a0d6a22 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml @@ -12,12 +12,12 @@ This code is released under the LGPL as part of kdelibs/kate. == UPDATE HISTORY == 2018-02-20 // Nibaldo González <nibgonz@gmail.com> - Fix '$' symbol, highlighted as 'dsError' by C++ (isocpp.xml). + Fix '$' symbol, highlighted as 'dsError' by C++ (isocpp.xml). Update syntax for Bison (3.0.4): - Add declarations, directives in rules and the '@' variable. - - Allow a tag in '%union', declarations in multiple lines and + - Allow a tag in '%union', declarations in multiple lines and grammar declarations in the grammar rules section. - - The ';' char is not necessary to finish a rule. Allow '; |' + - The ';' char is not necessary to finish a rule. Allow '; |' within rules. Add mimetypes and extensions '*.ypp' & '*.y++'. @@ -32,7 +32,7 @@ This code is released under the LGPL as part of kdelibs/kate. ======================================================================== --> -<language name="Yacc/Bison" version="5" kateversion="5.0" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL"> +<language name="Yacc/Bison" version="6" kateversion="5.0" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL"> <highlighting> <contexts> @@ -62,7 +62,7 @@ This code is released under the LGPL as part of kdelibs/kate. <WordDetect attribute="Directive" context="Percent Command In" String="%<flag>" /> <!-- Any word followed by '%' (End with ';' or '%') --> <DetectChar attribute="Directive" context="Percent Command" char="%" /> - </context> + </context> <context name="Grammar Declarations" attribute="Normal Text" lineEndContext="#stay"> <WordDetect attribute="Directive" context="Union Start" String="%union" /> <WordDetect attribute="Directive" context="Union Start" String="%code" /> @@ -74,7 +74,7 @@ This code is released under the LGPL as part of kdelibs/kate. <IncludeRules context="Comment" /> <DetectSpaces /> <DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" /> - <RegExpr attribute="Normal Text" context="#pop!Union Tag" String="[^\s\{](?=(\s|$|//))" /> + <RegExpr attribute="Normal Text" context="#pop!Union Tag" String="[^\s\{](?=\s|$|//)" /> </context> <context name="Union Tag" attribute="Normal Text" lineEndContext="#stay"> <IncludeRules context="Comment" /> @@ -141,9 +141,9 @@ This code is released under the LGPL as part of kdelibs/kate. <!-- Finish rule without the ';' character (see the 'rhses.1' rule in the 'src/parse-gram.y' file, from the Bison source) --> <RegExpr attribute="Open Rule" context="#pop" String="[\w\-\.](?=[\w\-\.]*:)" column="0" endRegion="rule" /> <Detect2Chars attribute="Content-Type Delimiter" context="#pop" char="%" char1="%" lookAhead="true" firstNonSpace="true" endRegion="rule" /> - <RegExpr attribute="Directive" context="#pop" String="%(union|code|destructor|printer|start|(no\-)?default\-prec|nterm|token|type|left|right|nonassoc|precedence)\b" lookAhead="true" column="0" endRegion="rule" /> + <RegExpr attribute="Directive" context="#pop" String="%(?:union|code|destructor|printer|start|(?:no\-)?default\-prec|nterm|token|type|left|right|nonassoc|precedence)\b" lookAhead="true" column="0" endRegion="rule" /> </context> - <!-- The Bison parser allows to have ';' followed by '|', without the rule ending. + <!-- The Bison parser allows to have ';' followed by '|', without the rule ending. The problem here is that the ';' char has endRegion="rule" (although it is not very relevant). --> <context name="Rule End" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop"> <DetectSpaces /> @@ -164,7 +164,7 @@ This code is released under the LGPL as part of kdelibs/kate. <WordDetect attribute="Directive" context="Percent Command In" String="%left" /> <WordDetect attribute="Directive" context="Percent Command In" String="%right" /> <WordDetect attribute="Directive" context="Percent Command In" String="%nonassoc" /> - <WordDetect attribute="Directive" context="Percent Command In" String="%precedence" /> + <WordDetect attribute="Directive" context="Percent Command In" String="%precedence" /> <DetectChar attribute="Rule" context="#pop" char="%" /> <!-- End when there is an invalid declaration --> <DetectChar attribute="Normal Text" context="#pop" char=";" /> @@ -195,11 +195,11 @@ This code is released under the LGPL as part of kdelibs/kate. </context> <context name="Comment" attribute="Comment" lineEndContext="#stay"> - <Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" /> + <Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" beginRegion="comment" /> <Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" /> </context> <context name="CommentStar" attribute="Comment" lineEndContext="#stay"> - <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" /> + <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="comment" /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> @@ -229,7 +229,7 @@ This code is released under the LGPL as part of kdelibs/kate. </context> <context name="Symbol-Variable" attribute="Normal Text" lineEndContext="#stay"> <DetectChar attribute="Directive" context="Dol" char="$" /> - <RegExpr attribute="Directive" context="#stay" String="@(\$?)(\d+|[A-Za-z_]\w*)?" /> + <RegExpr attribute="Directive" context="#stay" String="@\$?(?:\d+|[A-Za-z_]\w*)?" /> </context> <context name="Dol" attribute="Normal Text" fallthrough="true" fallthroughContext="DolEnd" lineEndContext="#stay"> <RegExpr attribute="Data Type" context="DolEnd" String="<[^>]+>" /> @@ -259,7 +259,7 @@ This code is released under the LGPL as part of kdelibs/kate. </highlighting> <general> <comments> - <comment name="multiLine" start="/*" end="*/" /> + <comment name="multiLine" start="/*" end="*/" region="comment" /> <comment name="singleLine" start="//" /> </comments> </general> diff --git a/src/libs/3rdparty/syntax-highlighting/examples/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/examples/CMakeLists.txt deleted file mode 100644 index 652b72cb0a9..00000000000 --- a/src/libs/3rdparty/syntax-highlighting/examples/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -if(Qt5Widgets_FOUND) - add_executable(codeeditor codeeditor.cpp main.cpp) - target_link_libraries(codeeditor Qt5::Widgets KF5SyntaxHighlighting) -endif() diff --git a/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.cpp b/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.cpp deleted file mode 100644 index 88f315462d8..00000000000 --- a/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "codeeditor.h" - -#include <definition.h> -#include <foldingregion.h> -#include <syntaxhighlighter.h> -#include <theme.h> - -#include <QApplication> -#include <QDebug> -#include <QFile> -#include <QFileDialog> -#include <QFontDatabase> -#include <QMenu> -#include <QPainter> -#include <QPalette> - -class CodeEditorSidebar : public QWidget -{ - Q_OBJECT -public: - explicit CodeEditorSidebar(CodeEditor *editor); - QSize sizeHint() const Q_DECL_OVERRIDE; - -protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - -private: - CodeEditor *m_codeEditor; -}; - -CodeEditorSidebar::CodeEditorSidebar(CodeEditor *editor) : - QWidget(editor), - m_codeEditor(editor) -{ -} - -QSize CodeEditorSidebar::sizeHint() const -{ - return QSize(m_codeEditor->sidebarWidth(), 0); -} - -void CodeEditorSidebar::paintEvent(QPaintEvent *event) -{ - m_codeEditor->sidebarPaintEvent(event); -} - -void CodeEditorSidebar::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->x() >= width() - m_codeEditor->fontMetrics().lineSpacing()) { - auto block = m_codeEditor->blockAtPosition(event->y()); - if (!block.isValid() || !m_codeEditor->isFoldable(block)) - return; - m_codeEditor->toggleFold(block); - } - QWidget::mouseReleaseEvent(event); -} - - -CodeEditor::CodeEditor(QWidget *parent) : - QPlainTextEdit(parent), - m_highlighter(new KSyntaxHighlighting::SyntaxHighlighter(document())), - m_sideBar(new CodeEditorSidebar(this)) -{ - setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - - setTheme((palette().color(QPalette::Base).lightness() < 128) - ? m_repository.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme) - : m_repository.defaultTheme(KSyntaxHighlighting::Repository::LightTheme)); - - connect(this, &QPlainTextEdit::blockCountChanged, this, &CodeEditor::updateSidebarGeometry); - connect(this, &QPlainTextEdit::updateRequest, this, &CodeEditor::updateSidebarArea); - connect(this, &QPlainTextEdit::cursorPositionChanged, this, &CodeEditor::highlightCurrentLine); - - updateSidebarGeometry(); - highlightCurrentLine(); -} - -CodeEditor::~CodeEditor() -{ -} - -void CodeEditor::openFile(const QString& fileName) -{ - QFile f(fileName); - if (!f.open(QFile::ReadOnly)) { - qWarning() << "Failed to open" << fileName << ":" << f.errorString(); - return; - } - - clear(); - - const auto def = m_repository.definitionForFileName(fileName); - m_highlighter->setDefinition(def); - - setWindowTitle(fileName); - setPlainText(QString::fromUtf8(f.readAll())); -} - -void CodeEditor::contextMenuEvent(QContextMenuEvent *event) -{ - auto menu = createStandardContextMenu(event->pos()); - menu->addSeparator(); - auto openAction = menu->addAction(QStringLiteral("Open File...")); - connect(openAction, &QAction::triggered, this, [this]() { - const auto fileName = QFileDialog::getOpenFileName(this, QStringLiteral("Open File")); - if (!fileName.isEmpty()) - openFile(fileName); - }); - - // syntax selection - auto hlActionGroup = new QActionGroup(menu); - hlActionGroup->setExclusive(true); - auto hlGroupMenu = menu->addMenu(QStringLiteral("Syntax")); - QMenu *hlSubMenu = hlGroupMenu; - QString currentGroup; - foreach (const auto &def, m_repository.definitions()) { - if (def.isHidden()) - continue; - if (currentGroup != def.section()) { - currentGroup = def.section(); - hlSubMenu = hlGroupMenu->addMenu(def.translatedSection()); - } - - Q_ASSERT(hlSubMenu); - auto action = hlSubMenu->addAction(def.translatedName()); - action->setCheckable(true); - action->setData(def.name()); - hlActionGroup->addAction(action); - if (def.name() == m_highlighter->definition().name()) - action->setChecked(true); - } - connect(hlActionGroup, &QActionGroup::triggered, this, [this](QAction *action) { - const auto defName = action->data().toString(); - const auto def = m_repository.definitionForName(defName); - m_highlighter->setDefinition(def); - }); - - // theme selection - auto themeGroup = new QActionGroup(menu); - themeGroup->setExclusive(true); - auto themeMenu = menu->addMenu(QStringLiteral("Theme")); - foreach (const auto &theme, m_repository.themes()) { - auto action = themeMenu->addAction(theme.translatedName()); - action->setCheckable(true); - action->setData(theme.name()); - themeGroup->addAction(action); - if (theme.name() == m_highlighter->theme().name()) - action->setChecked(true); - } - connect(themeGroup, &QActionGroup::triggered, this, [this](QAction *action) { - const auto themeName = action->data().toString(); - const auto theme = m_repository.theme(themeName); - setTheme(theme); - }); - - menu->exec(event->globalPos()); - delete menu; -} - -void CodeEditor::resizeEvent(QResizeEvent *event) -{ - QPlainTextEdit::resizeEvent(event); - updateSidebarGeometry(); -} - -void CodeEditor::setTheme(const KSyntaxHighlighting::Theme &theme) -{ - auto pal = qApp->palette(); - if (theme.isValid()) { - pal.setColor(QPalette::Base, theme.editorColor(KSyntaxHighlighting::Theme::BackgroundColor)); - pal.setColor(QPalette::Text, theme.textColor(KSyntaxHighlighting::Theme::Normal)); - pal.setColor(QPalette::Highlight, theme.editorColor(KSyntaxHighlighting::Theme::TextSelection)); - } - setPalette(pal); - - m_highlighter->setTheme(theme); - m_highlighter->rehighlight(); - highlightCurrentLine(); -} - -int CodeEditor::sidebarWidth() const -{ - int digits = 1; - auto count = blockCount(); - while (count >= 10) { - ++digits; - count /= 10; - } - return 4 + fontMetrics().width(QLatin1Char('9')) * digits + fontMetrics().lineSpacing(); -} - -void CodeEditor::sidebarPaintEvent(QPaintEvent *event) -{ - QPainter painter(m_sideBar); - painter.fillRect(event->rect(), m_highlighter->theme().editorColor(KSyntaxHighlighting::Theme::IconBorder)); - - auto block = firstVisibleBlock(); - auto blockNumber = block.blockNumber(); - int top = blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + blockBoundingRect(block).height(); - const int currentBlockNumber = textCursor().blockNumber(); - - const auto foldingMarkerSize = fontMetrics().lineSpacing(); - - while (block.isValid() && top <= event->rect().bottom()) { - if (block.isVisible() && bottom >= event->rect().top()) { - const auto number = QString::number(blockNumber + 1); - painter.setPen(m_highlighter->theme().editorColor( - (blockNumber == currentBlockNumber) ? KSyntaxHighlighting::Theme::CurrentLineNumber - : KSyntaxHighlighting::Theme::LineNumbers)); - painter.drawText(0, top, m_sideBar->width() - 2 - foldingMarkerSize, fontMetrics().height(), Qt::AlignRight, number); - } - - // folding marker - if (block.isVisible() && isFoldable(block)) { - QPolygonF polygon; - if (isFolded(block)) { - polygon << QPointF(foldingMarkerSize * 0.4, foldingMarkerSize * 0.25); - polygon << QPointF(foldingMarkerSize * 0.4, foldingMarkerSize * 0.75); - polygon << QPointF(foldingMarkerSize * 0.8, foldingMarkerSize * 0.5); - } else { - polygon << QPointF(foldingMarkerSize * 0.25, foldingMarkerSize * 0.4); - polygon << QPointF(foldingMarkerSize * 0.75, foldingMarkerSize * 0.4); - polygon << QPointF(foldingMarkerSize * 0.5, foldingMarkerSize * 0.8); - } - painter.save(); - painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(Qt::NoPen); - painter.setBrush(QColor(m_highlighter->theme().editorColor(KSyntaxHighlighting::Theme::CodeFolding))); - painter.translate(m_sideBar->width() - foldingMarkerSize, top); - painter.drawPolygon(polygon); - painter.restore(); - } - - block = block.next(); - top = bottom; - bottom = top + blockBoundingRect(block).height(); - ++blockNumber; - } -} - -void CodeEditor::updateSidebarGeometry() -{ - setViewportMargins(sidebarWidth(), 0, 0, 0); - const auto r = contentsRect(); - m_sideBar->setGeometry(QRect(r.left(), r.top(), sidebarWidth(), r.height())); -} - -void CodeEditor::updateSidebarArea(const QRect& rect, int dy) -{ - if (dy) - m_sideBar->scroll(0, dy); - else - m_sideBar->update(0, rect.y(), m_sideBar->width(), rect.height()); -} - -void CodeEditor::highlightCurrentLine() -{ - QTextEdit::ExtraSelection selection; - selection.format.setBackground(QColor(m_highlighter->theme().editorColor(KSyntaxHighlighting::Theme::CurrentLine))); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = textCursor(); - selection.cursor.clearSelection(); - - QList<QTextEdit::ExtraSelection> extraSelections; - extraSelections.append(selection); - setExtraSelections(extraSelections); -} - -QTextBlock CodeEditor::blockAtPosition(int y) const -{ - auto block = firstVisibleBlock(); - if (!block.isValid()) - return QTextBlock(); - - int top = blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + blockBoundingRect(block).height(); - do { - if (top <= y && y <= bottom) - return block; - block = block.next(); - top = bottom; - bottom = top + blockBoundingRect(block).height(); - } while (block.isValid()); - return QTextBlock(); -} - -bool CodeEditor::isFoldable(const QTextBlock &block) const -{ - return m_highlighter->startsFoldingRegion(block); -} - -bool CodeEditor::isFolded(const QTextBlock &block) const -{ - if (!block.isValid()) - return false; - const auto nextBlock = block.next(); - if (!nextBlock.isValid()) - return false; - return !nextBlock.isVisible(); -} - -void CodeEditor::toggleFold(const QTextBlock &startBlock) -{ - // we also want to fold the last line of the region, therefore the ".next()" - const auto endBlock = m_highlighter->findFoldingRegionEnd(startBlock).next(); - - if (isFolded(startBlock)) { - // unfold - auto block = startBlock.next(); - while (block.isValid() && !block.isVisible()) { - block.setVisible(true); - block.setLineCount(block.layout()->lineCount()); - block = block.next(); - } - - } else { - // fold - auto block = startBlock.next(); - while (block.isValid() && block != endBlock) { - block.setVisible(false); - block.setLineCount(0); - block = block.next(); - } - } - - // redraw document - document()->markContentsDirty(startBlock.position(), endBlock.position() - startBlock.position() + 1); - - // update scrollbars - emit document()->documentLayout()->documentSizeChanged(document()->documentLayout()->documentSize()); -} - -#include "codeeditor.moc" diff --git a/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.h b/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.h deleted file mode 100644 index 1823b43e856..00000000000 --- a/src/libs/3rdparty/syntax-highlighting/examples/codeeditor.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef CODEEDITOR_H -#define CODEEDITOR_H - -#include <repository.h> - -#include <QPlainTextEdit> - -namespace KSyntaxHighlighting { -class SyntaxHighlighter; -} - -class CodeEditorSidebar; - -class CodeEditor : public QPlainTextEdit -{ - Q_OBJECT -public: - explicit CodeEditor(QWidget *parent = nullptr); - ~CodeEditor(); - - void openFile(const QString &fileName); - -protected: - void contextMenuEvent(QContextMenuEvent *event) override; - void resizeEvent(QResizeEvent *event) override; - -private: - friend class CodeEditorSidebar; - void setTheme(const KSyntaxHighlighting::Theme &theme); - int sidebarWidth() const; - void sidebarPaintEvent(QPaintEvent *event); - void updateSidebarGeometry(); - void updateSidebarArea(const QRect &rect, int dy); - void highlightCurrentLine(); - - QTextBlock blockAtPosition(int y) const; - bool isFoldable(const QTextBlock &block) const; - bool isFolded(const QTextBlock &block) const; - void toggleFold(const QTextBlock &block); - - KSyntaxHighlighting::Repository m_repository; - KSyntaxHighlighting::SyntaxHighlighter *m_highlighter; - CodeEditorSidebar *m_sideBar; -}; - -#endif // CODEEDITOR_H diff --git a/src/libs/3rdparty/syntax-highlighting/examples/main.cpp b/src/libs/3rdparty/syntax-highlighting/examples/main.cpp deleted file mode 100644 index 3fb542954d3..00000000000 --- a/src/libs/3rdparty/syntax-highlighting/examples/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "codeeditor.h" - -#include <QApplication> -#include <QCommandLineParser> -#include <QFile> -#include <QTextEdit> - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QCommandLineParser parser; - parser.addHelpOption(); - parser.addPositionalArgument(QStringLiteral("source"), QStringLiteral("The source file to highlight.")); - parser.process(app); - - CodeEditor edit; - edit.resize(1024, 1024); - edit.show(); - if (parser.positionalArguments().size() == 1) - edit.openFile(parser.positionalArguments().at(0)); - return app.exec(); -} 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 92df89dc46e..82207c00999 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 @@ -49,23 +49,18 @@ int main(int argc, char **argv) parser.setApplicationDescription(app.translate("SyntaxHighlightingCLI", "Command line syntax highlighter using Kate syntax definitions.")); parser.addHelpOption(); parser.addVersionOption(); - parser.addPositionalArgument(app.translate("SyntaxHighlightingCLI", "source"), - app.translate("SyntaxHighlightingCLI", "The source file to highlight.")); + parser.addPositionalArgument(app.translate("SyntaxHighlightingCLI", "source"), app.translate("SyntaxHighlightingCLI", "The source file to highlight.")); - QCommandLineOption listDefs(QStringList() << QStringLiteral("l") << QStringLiteral("list"), - app.translate("SyntaxHighlightingCLI", "List all available syntax definitions.")); + QCommandLineOption listDefs(QStringList() << QStringLiteral("l") << QStringLiteral("list"), app.translate("SyntaxHighlightingCLI", "List all available syntax definitions.")); parser.addOption(listDefs); - QCommandLineOption listThemes(QStringList() << QStringLiteral("list-themes"), - app.translate("SyntaxHighlightingCLI", "List all available themes.")); + QCommandLineOption listThemes(QStringList() << QStringLiteral("list-themes"), app.translate("SyntaxHighlightingCLI", "List all available themes.")); parser.addOption(listThemes); - QCommandLineOption updateDefs(QStringList() << QStringLiteral("u") << QStringLiteral("update"), - app.translate("SyntaxHighlightingCLI", "Download new/updated syntax definitions.")); + QCommandLineOption updateDefs(QStringList() << QStringLiteral("u") << QStringLiteral("update"), app.translate("SyntaxHighlightingCLI", "Download new/updated syntax definitions.")); parser.addOption(updateDefs); - QCommandLineOption outputName(QStringList() << QStringLiteral("o") << QStringLiteral("output"), - app.translate("SyntaxHighlightingCLI", "File to write HTML output to (default: stdout)."), - app.translate("SyntaxHighlightingCLI", "output")); + QCommandLineOption outputName( + QStringList() << QStringLiteral("o") << QStringLiteral("output"), app.translate("SyntaxHighlightingCLI", "File to write HTML output to (default: stdout)."), app.translate("SyntaxHighlightingCLI", "output")); parser.addOption(outputName); QCommandLineOption syntaxName(QStringList() << QStringLiteral("s") << QStringLiteral("syntax"), @@ -73,9 +68,8 @@ int main(int argc, char **argv) app.translate("SyntaxHighlightingCLI", "syntax")); parser.addOption(syntaxName); - QCommandLineOption themeName(QStringList() << QStringLiteral("t") << QStringLiteral("theme"), - app.translate("SyntaxHighlightingCLI", "Color theme to use for highlighting."), - app.translate("SyntaxHighlightingCLI", "theme"), QStringLiteral("Default")); + QCommandLineOption themeName( + QStringList() << QStringLiteral("t") << QStringLiteral("theme"), app.translate("SyntaxHighlightingCLI", "Color theme to use for highlighting."), app.translate("SyntaxHighlightingCLI", "theme"), QStringLiteral("Default")); parser.addOption(themeName); QCommandLineOption titleOption(QStringList() << QStringLiteral("T") << QStringLiteral("title"), @@ -83,8 +77,7 @@ int main(int argc, char **argv) app.translate("SyntaxHighlightingCLI", "title")); parser.addOption(titleOption); - QCommandLineOption stdinOption(QStringList() << QStringLiteral("stdin"), - app.translate("SyntaxHighlightingCLI", "Read file from stdin. The -s option must also be used.")); + QCommandLineOption stdinOption(QStringList() << QStringLiteral("stdin"), app.translate("SyntaxHighlightingCLI", "Read file from stdin. The -s option must also be used.")); parser.addOption(stdinOption); parser.process(app); @@ -105,9 +98,7 @@ int main(int argc, char **argv) if (parser.isSet(updateDefs)) { DefinitionDownloader downloader(&repo); - QObject::connect(&downloader, &DefinitionDownloader::informationMessage, [](const QString &msg) { - std::cout << qPrintable(msg) << std::endl; - }); + QObject::connect(&downloader, &DefinitionDownloader::informationMessage, [](const QString &msg) { std::cout << qPrintable(msg) << std::endl; }); QObject::connect(&downloader, &DefinitionDownloader::done, &app, &QCoreApplication::quit); downloader.start(); return app.exec(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp index 2a2ea0081ec..82235819a1c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp @@ -22,21 +22,21 @@ */ #include <QCoreApplication> +#include <QDebug> #include <QFile> #include <QFileInfo> -#include <QVariant> -#include <QXmlStreamReader> #include <QJsonDocument> #include <QRegularExpression> -#include <QDebug> +#include <QVariant> +#include <QXmlStreamReader> #ifdef QT_XMLPATTERNS_LIB #include <QXmlSchema> #include <QXmlSchemaValidator> #endif -namespace { - +namespace +{ QStringList readListing(const QString &fileName) { QFile file(fileName); @@ -56,8 +56,7 @@ QStringList readListing(const QString &fileName) } if (xml.hasError()) { - qWarning() << "XML error while reading" << fileName << " - " - << qPrintable(xml.errorString()) << "@ offset" << xml.characterOffset(); + qWarning() << "XML error while reading" << fileName << " - " << qPrintable(xml.errorString()) << "@ offset" << xml.characterOffset(); listing.clear(); } @@ -72,7 +71,11 @@ QStringList readListing(const QString &fileName) bool checkExtensions(const QString &extensions) { // get list of extensions +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) const QStringList extensionParts = extensions.split(QLatin1Char(';'), QString::SkipEmptyParts); +#else + const QStringList extensionParts = extensions.split(QLatin1Char(';'), Qt::SkipEmptyParts); +#endif // ok if empty if (extensionParts.isEmpty()) { @@ -80,7 +83,7 @@ bool checkExtensions(const QString &extensions) } // check that only valid wildcard things are inside the parts - for (const auto& extension : extensionParts) { + for (const auto &extension : extensionParts) { for (const auto c : extension) { // eat normal things if (c.isDigit() || c.isLetter()) { @@ -110,14 +113,15 @@ bool checkExtensions(const QString &extensions) //! - is not empty //! - isValid() //! - character ranges such as [A-Z] are valid and not accidentally e.g. [A-z]. +//! - dynamic=true but no place holder used? bool checkRegularExpression(const QString &hlFilename, QXmlStreamReader &xml) { if (xml.name() == QLatin1String("RegExpr") || xml.name() == QLatin1String("emptyLine")) { // get right attribute - const QString string (xml.attributes().value((xml.name() == QLatin1String("RegExpr")) ? QLatin1String("String") : QLatin1String("regexpr")).toString()); + const QString string(xml.attributes().value((xml.name() == QLatin1String("RegExpr")) ? QLatin1String("String") : QLatin1String("regexpr")).toString()); // validate regexp - const QRegularExpression regexp (string); + const QRegularExpression regexp(string); if (!regexp.isValid()) { qWarning() << hlFilename << "line" << xml.lineNumber() << "broken regex:" << string << "problem:" << regexp.errorString() << "at offset" << regexp.patternErrorOffset(); return false; @@ -132,6 +136,15 @@ bool checkRegularExpression(const QString &hlFilename, QXmlStreamReader &xml) qWarning() << hlFilename << "line" << xml.lineNumber() << "broken regex:" << string << "problem: [a-Z] or [A-z] at offset" << azOffset; return false; } + + // dynamic == true and no place holder? + if (xml.name() == QLatin1String("RegExpr") && xml.attributes().value(QStringLiteral("dynamic")) == QStringLiteral("true")) { + static const QRegularExpression placeHolder(QStringLiteral("%\\d+")); + if (!string.contains(placeHolder)) { + qWarning() << hlFilename << "line" << xml.lineNumber() << "broken regex:" << string << "problem: dynamic=true but no %\\d+ placeholder"; + return false; + } + } } return true; @@ -203,20 +216,19 @@ class KeywordIncludeChecker public: void processElement(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml) { - if (xml.name() == QLatin1String("list")) { - auto &keywords = m_keywordMap[hlName]; - keywords.filename = hlFilename; - auto name = xml.attributes().value(QLatin1String("name")).toString(); - m_currentIncludes = &keywords.includes[name]; - } - else if (xml.name() == QLatin1String("include")) { - if (!m_currentIncludes) { - qWarning() << hlFilename << "line" << xml.lineNumber() << "<include> tag ouside <list>"; - m_success = false; - } else { - m_currentIncludes->push_back({xml.lineNumber(), xml.readElementText()}); - } - } + if (xml.name() == QLatin1String("list")) { + auto &keywords = m_keywordMap[hlName]; + keywords.filename = hlFilename; + auto name = xml.attributes().value(QLatin1String("name")).toString(); + m_currentIncludes = &keywords.includes[name]; + } else if (xml.name() == QLatin1String("include")) { + if (!m_currentIncludes) { + qWarning() << hlFilename << "line" << xml.lineNumber() << "<include> tag ouside <list>"; + m_success = false; + } else { + m_currentIncludes->push_back({xml.lineNumber(), xml.readElementText()}); + } + } } bool check() const @@ -232,8 +244,7 @@ public: if (idx == -1) { auto &keywordName = includes.key(); containsKeywordName = keywords.includes.contains(keywordName); - } - else { + } else { auto defName = include.name.mid(idx + 2); auto listName = include.name.left(idx); auto it = m_keywordMap.find(defName); @@ -256,11 +267,9 @@ public: } private: - struct Keywords - { + struct Keywords { QString filename; - struct Include - { + struct Include { qint64 line; QString name; }; @@ -279,7 +288,8 @@ class KeywordChecker public: KeywordChecker(const QString &filename) : m_filename(filename) - {} + { + } void processElement(QXmlStreamReader &xml) { @@ -343,7 +353,7 @@ public: void processElement(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml) { if (xml.name() == QLatin1String("context")) { - auto & language = m_contextMap[hlName]; + auto &language = m_contextMap[hlName]; language.hlFilename = hlFilename; const QString name = xml.attributes().value(QLatin1String("name")).toString(); if (language.isFirstContext) { @@ -387,13 +397,12 @@ public: bool success = m_success; // recursive search for the required miximal version - struct GetRequiredVersion - { - QHash<const Language*, Version> versionMap; + struct GetRequiredVersion { + QHash<const Language *, Version> versionMap; Version operator()(const QHash<QString, Language> &contextMap, const Language &language) { - auto& version = versionMap[&language]; + auto &version = versionMap[&language]; if (version < language.version) { version = language.version; for (auto &languageName : language.usedLanguageName) { @@ -451,7 +460,11 @@ private: // handle cross-language context references if (context.contains(QStringLiteral("##"))) { +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) const QStringList list = context.split(QStringLiteral("##"), QString::SkipEmptyParts); +#else + const QStringList list = context.split(QStringLiteral("##"), Qt::SkipEmptyParts); +#endif if (list.size() == 1) { // nothing to do, other language is included: e.g. ##Doxygen } else if (list.size() == 2) { @@ -471,15 +484,15 @@ private: } private: - struct Version - { + struct Version { int majorRevision; int minorRevision; Version(int majorRevision = 0, int minorRevision = 0) : majorRevision(majorRevision) , minorRevision(minorRevision) - {} + { + } bool operator<(const Version &version) const { @@ -487,12 +500,13 @@ private: } }; - void processVersion(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml, Version const& requiredVersion, QLatin1String item) + void processVersion(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml, Version const &requiredVersion, QLatin1String item) { auto &language = m_contextMap[hlName]; if (language.version < requiredVersion) { - qWarning().nospace() << hlFilename << " " << item << " in line " << xml.lineNumber() << " is only available since version " << requiredVersion.majorRevision << "." << requiredVersion.minorRevision << ". Please, increase kateversion."; + qWarning().nospace() << hlFilename << " " << item << " in line " << xml.lineNumber() << " is only available since version " << requiredVersion.majorRevision << "." << requiredVersion.minorRevision + << ". Please, increase kateversion."; // update the version to cancel future warnings language.version = requiredVersion; m_success = false; @@ -540,7 +554,8 @@ class AttributeChecker public: AttributeChecker(const QString &filename) : m_filename(filename) - {} + { + } void processElement(QXmlStreamReader &xml) { @@ -620,9 +635,8 @@ int main(int argc, char *argv[]) } // text attributes - const QStringList textAttributes = QStringList() << QStringLiteral("name") << QStringLiteral("section") << QStringLiteral("mimetype") - << QStringLiteral("extensions") << QStringLiteral("style") - << QStringLiteral("author") << QStringLiteral("license") << QStringLiteral("indenter"); + const QStringList textAttributes = QStringList() << QStringLiteral("name") << QStringLiteral("section") << QStringLiteral("mimetype") << QStringLiteral("extensions") << QStringLiteral("style") << QStringLiteral("author") + << QStringLiteral("license") << QStringLiteral("indenter"); // index all given highlightings ContextChecker contextChecker; @@ -632,7 +646,7 @@ int main(int argc, char *argv[]) for (const QString &hlFilename : qAsConst(hlFilenames)) { QFile hlFile(hlFilename); if (!hlFile.open(QIODevice::ReadOnly)) { - qWarning ("Failed to open %s", qPrintable(hlFilename)); + qWarning("Failed to open %s", qPrintable(hlFilename)); anyError = 3; continue; } @@ -750,7 +764,6 @@ int main(int argc, char *argv[]) if (!keywordIncludeChecker.check()) anyError = 7; - // bail out if any problem was seen if (anyError) return anyError; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt index 9e95772f6e3..02c889d7a26 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt @@ -23,6 +23,8 @@ ecm_qt_declare_logging_category(syntax_highlighting_srcs HEADER ksyntaxhighlighting_logging.h IDENTIFIER KSyntaxHighlighting::Log CATEGORY_NAME org.kde.ksyntaxhighlighting + DESCRIPTION "Syntax Highlighting" + EXPORT KSYNTAXHIGHLIGHTING ) add_library(KF5SyntaxHighlighting ${syntax_highlighting_srcs} $<TARGET_OBJECTS:SyntaxHighlightingData>) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp index c4ef86a7717..fc5c6278120 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp @@ -27,11 +27,11 @@ #include "definition_p.h" #include "foldingregion.h" #include "format.h" +#include "ksyntaxhighlighting_logging.h" #include "repository.h" #include "rule_p.h" #include "state.h" #include "state_p.h" -#include "ksyntaxhighlighting_logging.h" #include "theme.h" using namespace KSyntaxHighlighting; @@ -60,13 +60,13 @@ void AbstractHighlighterPrivate::ensureDefinitionLoaded() defData->load(); } -AbstractHighlighter::AbstractHighlighter() : - d_ptr(new AbstractHighlighterPrivate) +AbstractHighlighter::AbstractHighlighter() + : d_ptr(new AbstractHighlighterPrivate) { } -AbstractHighlighter::AbstractHighlighter(AbstractHighlighterPrivate *dd) : - d_ptr(dd) +AbstractHighlighter::AbstractHighlighter(AbstractHighlighterPrivate *dd) + : d_ptr(dd) { } @@ -102,7 +102,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(const QString &text) { for (int i = 0; i < text.length(); ++i) { if (!text[i].isSpace()) { @@ -112,7 +112,7 @@ static inline int firstNonSpaceChar(const QString & text) return text.size(); } -State AbstractHighlighter::highlightLine(const QString& text, const State &state) +State AbstractHighlighter::highlightLine(const QString &text, const State &state) { Q_D(AbstractHighlighter); @@ -156,12 +156,11 @@ State AbstractHighlighter::highlightLine(const QString& text, const State &state */ break; } - /** - * line end context switches only when lineEmptyContext is #stay. This avoids - * skipping empty lines after a line continuation character (see bug 405903) - */ - } else if (!stateData->topContext()->lineEndContext().isStay() && - !d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) + /** + * line end context switches only when lineEmptyContext is #stay. This avoids + * skipping empty lines after a line continuation character (see bug 405903) + */ + } else if (!stateData->topContext()->lineEndContext().isStay() && !d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) break; // guard against endless loops @@ -178,7 +177,15 @@ State AbstractHighlighter::highlightLine(const QString& text, const State &state int offset = 0, beginOffset = 0; bool lineContinuation = false; - QHash<Rule*, int> skipOffsets; + + /** + * for expensive rules like regexes we do: + * - match them for the complete line, as this is faster than re-trying them at all positions + * - store the result of the first position that matches (or -1 for no match in the full line) in the skipOffsets hash for re-use + * - have capturesForLastDynamicSkipOffset as guard for dynamic regexes to invalidate the cache if they might have changed + */ + QHash<Rule *, int> skipOffsets; + QStringList capturesForLastDynamicSkipOffset; /** * current active format @@ -248,21 +255,31 @@ State AbstractHighlighter::highlightLine(const QString& text, const State &state * shall we skip application of this rule? two cases: * - rule can't match at all => currentSkipOffset < 0 * - rule will only match for some higher offset => currentSkipOffset > offset + * + * we need to invalidate this if we are dynamic and have different captures then last time */ + if (rule->isDynamic() && (capturesForLastDynamicSkipOffset != stateData->topCaptures())) { + skipOffsets.clear(); + } const auto currentSkipOffset = skipOffsets.value(rule.get()); if (currentSkipOffset < 0 || currentSkipOffset > offset) continue; - const auto newResult = rule->doMatch(text, offset, stateData->topCaptures()); newOffset = newResult.offset(); /** * update skip offset if new one rules out any later match or is larger than current one */ - if (newResult.skipOffset() < 0 || newResult.skipOffset() > currentSkipOffset) + if (newResult.skipOffset() < 0 || newResult.skipOffset() > currentSkipOffset) { skipOffsets.insert(rule.get(), newResult.skipOffset()); + // remember new captures, if dynamic to enforce proper reset above on change! + if (rule->isDynamic()) { + capturesForLastDynamicSkipOffset = stateData->topCaptures(); + } + } + if (newOffset <= offset) continue; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h index 2b887296972..575a7235270 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h @@ -34,8 +34,8 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class AbstractHighlighterPrivate; class Definition; class FoldingRegion; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h index bdfdf23bc12..c36932c29df 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h @@ -31,8 +31,8 @@ QT_BEGIN_NAMESPACE class QStringList; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class ContextSwitch; class StateData; @@ -43,7 +43,7 @@ public: virtual ~AbstractHighlighterPrivate(); void ensureDefinitionLoaded(); - bool switchContext(StateData* data, const ContextSwitch &contextSwitch, const QStringList &captures); + bool switchContext(StateData *data, const ContextSwitch &contextSwitch, const QStringList &captures); Definition m_definition; Theme m_theme; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp index 9d5597e7d28..2327cfe584e 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp @@ -24,9 +24,9 @@ #include "context_p.h" #include "definition_p.h" #include "format.h" +#include "ksyntaxhighlighting_logging.h" #include "repository.h" #include "rule_p.h" -#include "ksyntaxhighlighting_logging.h" #include "xml_p.h" #include <QString> @@ -52,7 +52,7 @@ bool Context::indentationBasedFoldingEnabled() const return m_def.definition().indentationBasedFoldingEnabled(); } -void Context::load(QXmlStreamReader& reader) +void Context::load(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("context")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); @@ -68,24 +68,23 @@ void Context::load(QXmlStreamReader& reader) reader.readNext(); while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - { - auto rule = Rule::create(reader.name()); - if (rule) { - rule->setDefinition(m_def.definition()); - if (rule->load(reader)) - m_rules.push_back(rule); - } else { - reader.skipCurrentElement(); - } - reader.readNext(); - break; + case QXmlStreamReader::StartElement: { + auto rule = Rule::create(reader.name()); + if (rule) { + rule->setDefinition(m_def.definition()); + if (rule->load(reader)) + m_rules.push_back(rule); + } else { + reader.skipCurrentElement(); } - case QXmlStreamReader::EndElement: - return; - default: - reader.readNext(); - break; + reader.readNext(); + break; + } + case QXmlStreamReader::EndElement: + return; + default: + reader.readNext(); + break; } } } @@ -133,7 +132,7 @@ void Context::resolveIncludes() ++it; continue; } - Context* context = nullptr; + Context *context = nullptr; auto myDefData = DefinitionData::get(m_def.definition()); if (inc->definitionName().isEmpty()) { // local include context = myDefData->contextByName(inc->contextName()); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h index a034d0e27d6..5d23ee24001 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h @@ -24,11 +24,11 @@ #ifndef KSYNTAXHIGHLIGHTING_CONTEXT_P_H #define KSYNTAXHIGHLIGHTING_CONTEXT_P_H -#include "rule_p.h" #include "contextswitch_p.h" #include "definition.h" #include "definitionref_p.h" #include "format.h" +#include "rule_p.h" #include <QString> @@ -38,8 +38,8 @@ QT_BEGIN_NAMESPACE class QXmlStreamReader; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Context { public: @@ -98,12 +98,7 @@ public: private: Q_DISABLE_COPY(Context) - enum ResolveState { - Unknown, - Unresolved, - Resolving, - Resolved - }; + enum ResolveState { Unknown, Unresolved, Resolving, Resolved }; ResolveState resolveState(); DefinitionRef m_def; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp index a4d1dbbd852..25367921545 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp @@ -24,9 +24,8 @@ #include "contextswitch_p.h" #include "definition.h" #include "definition_p.h" -#include "repository.h" #include "ksyntaxhighlighting_logging.h" - +#include "repository.h" using namespace KSyntaxHighlighting; @@ -40,12 +39,12 @@ int ContextSwitch::popCount() const return m_popCount; } -Context* ContextSwitch::context() const +Context *ContextSwitch::context() const { return m_context; } -void ContextSwitch::parse(const QStringRef& contextInstr) +void ContextSwitch::parse(const QStringRef &contextInstr) { if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) return; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h index 669855af7a5..79fb86f044e 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h @@ -26,8 +26,8 @@ #include <QString> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Context; class Definition; @@ -40,7 +40,7 @@ public: bool isStay() const; int popCount() const; - Context* context() const; + Context *context() const; void parse(const QStringRef &contextInstr); void resolve(const Definition &def); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp index 6a204dc3ac0..bc43473bf28 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp @@ -23,7 +23,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include "definition.h" #include "definition_p.h" #include "definitionref_p.h" @@ -31,11 +30,11 @@ #include "context_p.h" #include "format.h" #include "format_p.h" +#include "ksyntaxhighlighting_logging.h" +#include "ksyntaxhighlighting_version.h" #include "repository.h" #include "repository_p.h" #include "rule_p.h" -#include "ksyntaxhighlighting_logging.h" -#include "ksyntaxhighlighting_version.h" #include "xml_p.h" #include <QCoreApplication> @@ -61,24 +60,24 @@ DefinitionData::~DefinitionData() qDeleteAll(contexts); } -DefinitionData* DefinitionData::get(const Definition &def) +DefinitionData *DefinitionData::get(const Definition &def) { return def.d.get(); } -Definition::Definition() : - d(new DefinitionData) +Definition::Definition() + : d(new DefinitionData) { } -Definition::Definition(const Definition &other) : - d(other.d) +Definition::Definition(const Definition &other) + : d(other.d) { d->q = *this; } -Definition::Definition(const std::shared_ptr<DefinitionData> &dd) : - d(dd) +Definition::Definition(const std::shared_ptr<DefinitionData> &dd) + : d(dd) { } @@ -86,7 +85,7 @@ Definition::~Definition() { } -Definition& Definition::operator=(const Definition &rhs) +Definition &Definition::operator=(const Definition &rhs) { d = rhs.d; return *this; @@ -97,7 +96,7 @@ bool Definition::operator==(const Definition &other) const return d->fileName == other.d->fileName; } -bool Definition::operator!=(const Definition& other) const +bool Definition::operator!=(const Definition &other) const { return d->fileName != other.d->fileName; } @@ -226,23 +225,21 @@ QStringList Definition::keywordLists() const return d->keywordLists.keys(); } -QStringList Definition::keywordList(const QString& name) const +QStringList Definition::keywordList(const QString &name) const { d->load(DefinitionData::OnlyKeywords(true)); const auto list = d->keywordList(name); return list ? list->keywords() : QStringList(); } -bool Definition::setKeywordList(const QString& name, const QStringList& content) +bool Definition::setKeywordList(const QString &name, const QStringList &content) { d->load(DefinitionData::OnlyKeywords(true)); - KeywordList* list = d->keywordList(name); - if (list) - { + KeywordList *list = d->keywordList(name); + if (list) { list->setKeywordList(content); return true; - } - else + } else return false; } @@ -252,9 +249,7 @@ QVector<Format> Definition::formats() const // sort formats so that the order matches the order of the itemDatas in the xml files. auto formatList = QVector<Format>::fromList(d->formats.values()); - std::sort(formatList.begin(), formatList.end(), [](const KSyntaxHighlighting::Format & lhs, const KSyntaxHighlighting::Format & rhs){ - return lhs.id() < rhs.id(); - }); + std::sort(formatList.begin(), formatList.end(), [](const KSyntaxHighlighting::Format &lhs, const KSyntaxHighlighting::Format &rhs) { return lhs.id() < rhs.id(); }); return formatList; } @@ -264,13 +259,13 @@ QVector<Definition> Definition::includedDefinitions() const d->load(); // init worklist and result used as guard with this definition - QVector<Definition> queue{*this}; - QVector<Definition> definitions{*this}; + QVector<Definition> queue {*this}; + QVector<Definition> definitions {*this}; while (!queue.isEmpty()) { // 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 : qAsConst(definition.d->contexts)) { // handle context switch attributes of this context itself for (const auto switchContext : {context->lineEndContext().context(), context->lineEmptyContext().context(), context->fallthroughContext().context()}) { if (switchContext) { @@ -321,7 +316,7 @@ CommentPosition Definition::singleLineCommentPosition() const QPair<QString, QString> Definition::multiLineCommentMarker() const { d->load(); - return { d->multiLineCommentStartMarker, d->multiLineCommentEndMarker }; + return {d->multiLineCommentStartMarker, d->multiLineCommentEndMarker}; } QVector<QPair<QChar, QString>> Definition::characterEncodings() const @@ -330,13 +325,13 @@ QVector<QPair<QChar, QString>> Definition::characterEncodings() const return d->characterEncodings; } -Context* DefinitionData::initialContext() const +Context *DefinitionData::initialContext() const { Q_ASSERT(!contexts.isEmpty()); return contexts.first(); } -Context* DefinitionData::contextByName(const QString& wantedName) const +Context *DefinitionData::contextByName(const QString &wantedName) const { for (const auto context : contexts) { if (context->name() == wantedName) @@ -345,7 +340,7 @@ Context* DefinitionData::contextByName(const QString& wantedName) const return nullptr; } -KeywordList *DefinitionData::keywordList(const QString& wantedName) +KeywordList *DefinitionData::keywordList(const QString &wantedName) { auto it = keywordLists.find(wantedName); return (it == keywordLists.end()) ? nullptr : &it.value(); @@ -356,7 +351,7 @@ bool DefinitionData::isWordDelimiter(QChar c) const return std::binary_search(wordDelimiters.constBegin(), wordDelimiters.constEnd(), c); } -Format DefinitionData::formatByName(const QString& wantedName) const +Format DefinitionData::formatByName(const QString &wantedName) const { const auto it = formats.constFind(wantedName); if (it != formats.constEnd()) @@ -440,7 +435,7 @@ void DefinitionData::clear() hidden = false; } -bool DefinitionData::loadMetaData(const QString& definitionFileName) +bool DefinitionData::loadMetaData(const QString &definitionFileName) { fileName = definitionFileName; @@ -463,22 +458,30 @@ bool DefinitionData::loadMetaData(const QString& definitionFileName) bool DefinitionData::loadMetaData(const QString &file, const QJsonObject &obj) { - name = obj.value(QLatin1String("name")).toString(); - section = obj.value(QLatin1String("section")).toString(); - version = obj.value(QLatin1String("version")).toInt(); + name = obj.value(QLatin1String("name")).toString(); + section = obj.value(QLatin1String("section")).toString(); + version = obj.value(QLatin1String("version")).toInt(); priority = obj.value(QLatin1String("priority")).toInt(); - style = obj.value(QLatin1String("style")).toString(); - author = obj.value(QLatin1String("author")).toString(); - license = obj.value(QLatin1String("license")).toString(); + style = obj.value(QLatin1String("style")).toString(); + author = obj.value(QLatin1String("author")).toString(); + license = obj.value(QLatin1String("license")).toString(); indenter = obj.value(QLatin1String("indenter")).toString(); - hidden = obj.value(QLatin1String("hidden")).toBool(); + hidden = obj.value(QLatin1String("hidden")).toBool(); fileName = file; const auto exts = obj.value(QLatin1String("extensions")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) for (const auto &ext : exts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else + for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif extensions.push_back(ext); const auto mts = obj.value(QLatin1String("mimetype")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) for (const auto &mt : mts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else + for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif mimetypes.push_back(mt); return true; @@ -503,17 +506,25 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader) author = reader.attributes().value(QStringLiteral("author")).toString(); license = reader.attributes().value(QStringLiteral("license")).toString(); const auto exts = reader.attributes().value(QStringLiteral("extensions")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) for (const auto &ext : exts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else + for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif extensions.push_back(ext); const auto mts = reader.attributes().value(QStringLiteral("mimetype")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) for (const auto &mt : mts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else + for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif mimetypes.push_back(mt); if (reader.attributes().hasAttribute(QStringLiteral("casesensitive"))) caseSensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; return true; } -void DefinitionData::loadHighlighting(QXmlStreamReader& reader, OnlyKeywords onlyKeywords) +void DefinitionData::loadHighlighting(QXmlStreamReader &reader, OnlyKeywords onlyKeywords) { Q_ASSERT(reader.name() == QLatin1String("highlighting")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); @@ -523,35 +534,34 @@ void DefinitionData::loadHighlighting(QXmlStreamReader& reader, OnlyKeywords onl while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - if (reader.name() == QLatin1String("list")) { - if (!keywordIsLoaded) { - KeywordList keywords; - keywords.load(reader); - keywordLists.insert(keywords.name(), keywords); - } - else { - reader.skipCurrentElement(); - reader.readNext(); // Skip </list> - } - } else if (bool(onlyKeywords)) { - resolveIncludeKeywords(); - return; - } else if (reader.name() == QLatin1String("contexts")) { - resolveIncludeKeywords(); - loadContexts(reader); - reader.readNext(); - } else if (reader.name() == QLatin1String("itemDatas")) { - loadItemData(reader); + case QXmlStreamReader::StartElement: + if (reader.name() == QLatin1String("list")) { + if (!keywordIsLoaded) { + KeywordList keywords; + keywords.load(reader); + keywordLists.insert(keywords.name(), keywords); } else { - reader.readNext(); + reader.skipCurrentElement(); + reader.readNext(); // Skip </list> } - break; - case QXmlStreamReader::EndElement: + } else if (bool(onlyKeywords)) { + resolveIncludeKeywords(); return; - default: + } else if (reader.name() == QLatin1String("contexts")) { + resolveIncludeKeywords(); + loadContexts(reader); reader.readNext(); - break; + } else if (reader.name() == QLatin1String("itemDatas")) { + loadItemData(reader); + } else { + reader.readNext(); + } + break; + case QXmlStreamReader::EndElement: + return; + default: + reader.readNext(); + break; } } } @@ -569,60 +579,60 @@ void DefinitionData::resolveIncludeKeywords() } } -void DefinitionData::loadContexts(QXmlStreamReader& reader) +void DefinitionData::loadContexts(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("contexts")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - if (reader.name() == QLatin1String("context")) { - auto context = new Context; - context->setDefinition(q); - context->load(reader); - contexts.push_back(context); - } - reader.readNext(); - break; - case QXmlStreamReader::EndElement: - return; - default: - reader.readNext(); - break; + case QXmlStreamReader::StartElement: + if (reader.name() == QLatin1String("context")) { + auto context = new Context; + context->setDefinition(q); + context->load(reader); + contexts.push_back(context); + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + return; + default: + reader.readNext(); + break; } } } -void DefinitionData::loadItemData(QXmlStreamReader& reader) +void DefinitionData::loadItemData(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("itemDatas")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - if (reader.name() == QLatin1String("itemData")) { - Format f; - auto formatData = FormatPrivate::detachAndGet(f); - formatData->definition = q; - formatData->load(reader); - formatData->id = RepositoryPrivate::get(repo)->nextFormatId(); - formats.insert(f.name(), f); - reader.readNext(); - } + case QXmlStreamReader::StartElement: + if (reader.name() == QLatin1String("itemData")) { + Format f; + auto formatData = FormatPrivate::detachAndGet(f); + formatData->definition = q; + formatData->load(reader); + formatData->id = RepositoryPrivate::get(repo)->nextFormatId(); + formats.insert(f.name(), f); reader.readNext(); - break; - case QXmlStreamReader::EndElement: - return; - default: - reader.readNext(); - break; + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + return; + default: + reader.readNext(); + break; } } } -void DefinitionData::loadGeneral(QXmlStreamReader& reader) +void DefinitionData::loadGeneral(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("general")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); @@ -633,49 +643,49 @@ void DefinitionData::loadGeneral(QXmlStreamReader& reader) while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - ++elementRefCounter; - - if (reader.name() == QLatin1String("keywords")) { - if (reader.attributes().hasAttribute(QStringLiteral("casesensitive"))) - caseSensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; - - // adapt sorted wordDelimiters - wordDelimiters += reader.attributes().value(QStringLiteral("additionalDeliminator")); - std::sort(wordDelimiters.begin(), wordDelimiters.end()); - auto it = std::unique(wordDelimiters.begin(), wordDelimiters.end()); - wordDelimiters.truncate(std::distance(wordDelimiters.begin(), it)); - for (const auto c : reader.attributes().value(QLatin1String("weakDeliminator"))) - wordDelimiters.remove(c); - - // adaptWordWrapDelimiters, and sort - wordWrapDelimiters = reader.attributes().value(QStringLiteral("wordWrapDeliminator")).toString(); - std::sort(wordWrapDelimiters.begin(), wordWrapDelimiters.end()); - if (wordWrapDelimiters.isEmpty()) - wordWrapDelimiters = wordDelimiters; - } else if (reader.name() == QLatin1String("folding")) { - if (reader.attributes().hasAttribute(QStringLiteral("indentationsensitive"))) - indentationBasedFolding = Xml::attrToBool(reader.attributes().value(QStringLiteral("indentationsensitive"))); - } else if (reader.name() == QLatin1String("emptyLines")) { - loadFoldingIgnoreList(reader); - } else if (reader.name() == QLatin1String("comments")) { - loadComments(reader); - } else if (reader.name() == QLatin1String("spellchecking")) { - loadSpellchecking(reader); - } else { - reader.skipCurrentElement(); - } - reader.readNext(); - break; - case QXmlStreamReader::EndElement: - --elementRefCounter; - if (elementRefCounter == 0) - return; - reader.readNext(); - break; - default: - reader.readNext(); - break; + case QXmlStreamReader::StartElement: + ++elementRefCounter; + + if (reader.name() == QLatin1String("keywords")) { + if (reader.attributes().hasAttribute(QStringLiteral("casesensitive"))) + caseSensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; + + // adapt sorted wordDelimiters + wordDelimiters += reader.attributes().value(QStringLiteral("additionalDeliminator")); + std::sort(wordDelimiters.begin(), wordDelimiters.end()); + auto it = std::unique(wordDelimiters.begin(), wordDelimiters.end()); + wordDelimiters.truncate(std::distance(wordDelimiters.begin(), it)); + for (const auto c : reader.attributes().value(QLatin1String("weakDeliminator"))) + wordDelimiters.remove(c); + + // adaptWordWrapDelimiters, and sort + wordWrapDelimiters = reader.attributes().value(QStringLiteral("wordWrapDeliminator")).toString(); + std::sort(wordWrapDelimiters.begin(), wordWrapDelimiters.end()); + if (wordWrapDelimiters.isEmpty()) + wordWrapDelimiters = wordDelimiters; + } else if (reader.name() == QLatin1String("folding")) { + if (reader.attributes().hasAttribute(QStringLiteral("indentationsensitive"))) + indentationBasedFolding = Xml::attrToBool(reader.attributes().value(QStringLiteral("indentationsensitive"))); + } else if (reader.name() == QLatin1String("emptyLines")) { + loadFoldingIgnoreList(reader); + } else if (reader.name() == QLatin1String("comments")) { + loadComments(reader); + } else if (reader.name() == QLatin1String("spellchecking")) { + loadSpellchecking(reader); + } else { + reader.skipCurrentElement(); + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + --elementRefCounter; + if (elementRefCounter == 0) + return; + reader.readNext(); + break; + default: + reader.readNext(); + break; } } } @@ -691,35 +701,35 @@ void DefinitionData::loadComments(QXmlStreamReader &reader) while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - ++elementRefCounter; - if (reader.name() == QLatin1String("comment")) { - const bool isSingleLine = reader.attributes().value(QStringLiteral("name")) == QStringLiteral("singleLine"); - if (isSingleLine) { - singleLineCommentMarker = reader.attributes().value(QStringLiteral("start")).toString(); - const bool afterWhiteSpace = reader.attributes().value(QStringLiteral("position")).toString() == QStringLiteral("afterwhitespace"); - singleLineCommentPosition = afterWhiteSpace ? CommentPosition::AfterWhitespace : CommentPosition::StartOfLine; - } else { - multiLineCommentStartMarker = reader.attributes().value(QStringLiteral("start")).toString(); - multiLineCommentEndMarker = reader.attributes().value(QStringLiteral("end")).toString(); - } + case QXmlStreamReader::StartElement: + ++elementRefCounter; + if (reader.name() == QLatin1String("comment")) { + const bool isSingleLine = reader.attributes().value(QStringLiteral("name")) == QStringLiteral("singleLine"); + if (isSingleLine) { + singleLineCommentMarker = reader.attributes().value(QStringLiteral("start")).toString(); + const bool afterWhiteSpace = reader.attributes().value(QStringLiteral("position")).toString() == QStringLiteral("afterwhitespace"); + singleLineCommentPosition = afterWhiteSpace ? CommentPosition::AfterWhitespace : CommentPosition::StartOfLine; + } else { + multiLineCommentStartMarker = reader.attributes().value(QStringLiteral("start")).toString(); + multiLineCommentEndMarker = reader.attributes().value(QStringLiteral("end")).toString(); } - reader.readNext(); - break; - case QXmlStreamReader::EndElement: - --elementRefCounter; - if (elementRefCounter == 0) - return; - reader.readNext(); - break; - default: - reader.readNext(); - break; + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + --elementRefCounter; + if (elementRefCounter == 0) + return; + reader.readNext(); + break; + default: + reader.readNext(); + break; } } } -void DefinitionData::loadFoldingIgnoreList(QXmlStreamReader& reader) +void DefinitionData::loadFoldingIgnoreList(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("emptyLines")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); @@ -730,22 +740,22 @@ void DefinitionData::loadFoldingIgnoreList(QXmlStreamReader& reader) while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - ++elementRefCounter; - if (reader.name() == QLatin1String("emptyLine")) { - foldingIgnoreList << reader.attributes().value(QStringLiteral("regexpr")).toString(); - } - reader.readNext(); - break; - case QXmlStreamReader::EndElement: - --elementRefCounter; - if (elementRefCounter == 0) - return; - reader.readNext(); - break; - default: - reader.readNext(); - break; + case QXmlStreamReader::StartElement: + ++elementRefCounter; + if (reader.name() == QLatin1String("emptyLine")) { + foldingIgnoreList << reader.attributes().value(QStringLiteral("regexpr")).toString(); + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + --elementRefCounter; + if (elementRefCounter == 0) + return; + reader.readNext(); + break; + default: + reader.readNext(); + break; } } } @@ -761,31 +771,31 @@ void DefinitionData::loadSpellchecking(QXmlStreamReader &reader) while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - ++elementRefCounter; - if (reader.name() == QLatin1String("encoding")) { - const auto charRef = reader.attributes().value(QStringLiteral("char")); - if (!charRef.isEmpty()) { - const auto str = reader.attributes().value(QStringLiteral("string")).toString(); - characterEncodings.push_back({ charRef[0], str }); - } + case QXmlStreamReader::StartElement: + ++elementRefCounter; + if (reader.name() == QLatin1String("encoding")) { + const auto charRef = reader.attributes().value(QStringLiteral("char")); + if (!charRef.isEmpty()) { + const auto str = reader.attributes().value(QStringLiteral("string")).toString(); + characterEncodings.push_back({charRef[0], str}); } - reader.readNext(); - break; - case QXmlStreamReader::EndElement: - --elementRefCounter; - if (elementRefCounter == 0) - return; - reader.readNext(); - break; - default: - reader.readNext(); - break; + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + --elementRefCounter; + if (elementRefCounter == 0) + return; + reader.readNext(); + break; + default: + reader.readNext(); + break; } } } -bool DefinitionData::checkKateVersion(const QStringRef& verStr) +bool DefinitionData::checkKateVersion(const QStringRef &verStr) { const auto idx = verStr.indexOf(QLatin1Char('.')); if (idx <= 0) { @@ -813,8 +823,8 @@ DefinitionRef::DefinitionRef() { } -DefinitionRef::DefinitionRef(const Definition &def) : - d(def.d) +DefinitionRef::DefinitionRef(const Definition &def) + : d(def.d) { } @@ -822,7 +832,7 @@ DefinitionRef::~DefinitionRef() { } -DefinitionRef& DefinitionRef::operator=(const Definition &def) +DefinitionRef &DefinitionRef::operator=(const Definition &def) { d = def.d; return *this; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h index 3ba5be9a7a2..e47d2c42874 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h @@ -34,11 +34,11 @@ QT_BEGIN_NAMESPACE class QChar; class QString; class QStringList; -template <typename T> class QVector; +template<typename T> class QVector; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Context; class Format; class KeywordList; @@ -50,8 +50,7 @@ class DefinitionData; * @since 5.50 * @see Definition::singleLineCommentPosition() */ -enum class CommentPosition -{ +enum class CommentPosition { //! The comment marker is inserted at the beginning of a line at column 0 StartOfLine = 0, //! The comment marker is inserted after leading whitespaces right befire @@ -127,7 +126,7 @@ public: * Assignment operator. * Both this definition as well as @p rhs share the Definition data. */ - Definition& operator=(const Definition &rhs); + Definition &operator=(const Definition &rhs); /** * Checks two definitions for equality. @@ -330,7 +329,7 @@ public: * @since 5.49 * @see keywordLists(), setKeywordList() */ - QStringList keywordList(const QString& name) const; + QStringList keywordList(const QString &name) const; /** * Set the contents of the keyword list @p name to @p content. @@ -348,7 +347,7 @@ public: * @see keywordList(), keywordLists() * @since 5.62 */ - bool setKeywordList(const QString& name, const QStringList& content); + bool setKeywordList(const QString &name, const QStringList &content); /** * Returns a list of all Format items used by this definition. diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h index c73ca86eb95..f9b779482e2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h @@ -24,8 +24,8 @@ #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_P_H #define KSYNTAXHIGHLIGHTING_DEFINITION_P_H -#include "definitionref_p.h" #include "definition.h" +#include "definitionref_p.h" #include <QHash> #include <QString> @@ -36,8 +36,8 @@ class QXmlStreamReader; class QJsonObject; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Repository; class DefinitionData @@ -49,7 +49,7 @@ public: DefinitionData(const DefinitionData &) = delete; DefinitionData &operator=(const DefinitionData &) = delete; - static DefinitionData* get(const Definition &def); + static DefinitionData *get(const Definition &def); bool isLoaded() const; bool loadMetaData(const QString &definitionFileName); @@ -75,8 +75,8 @@ public: KeywordList *keywordList(const QString &name); bool isWordDelimiter(QChar c) const; - Context* initialContext() const; - Context* contextByName(const QString &name) const; + Context *initialContext() const; + Context *contextByName(const QString &name) const; Format formatByName(const QString &name) const; @@ -86,7 +86,7 @@ public: Repository *repo = nullptr; QHash<QString, KeywordList> keywordLists; - QVector<Context*> contexts; + QVector<Context *> contexts; QHash<QString, Format> formats; QString wordDelimiters; QString wordWrapDelimiters; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp index 89a5952a3e4..b1008dc44a7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp @@ -23,9 +23,9 @@ #include "definitiondownloader.h" #include "definition.h" -#include "repository.h" #include "ksyntaxhighlighting_logging.h" #include "ksyntaxhighlighting_version.h" +#include "repository.h" #include <QDir> #include <QFile> @@ -57,8 +57,9 @@ public: void DefinitionDownloaderPrivate::definitionListDownloadFinished(QNetworkReply *reply) { - if (reply->error() != QNetworkReply::NoError) { - qCWarning(Log) << reply->error(); + const auto networkError = reply->error(); + if (networkError != QNetworkReply::NoError) { + qCWarning(Log) << networkError; emit q->done(); // TODO return error return; } @@ -66,12 +67,12 @@ void DefinitionDownloaderPrivate::definitionListDownloadFinished(QNetworkReply * QXmlStreamReader parser(reply); while (!parser.atEnd()) { switch (parser.readNext()) { - case QXmlStreamReader::StartElement: - if (parser.name() == QLatin1String("Definition")) - updateDefinition(parser); - break; - default: - break; + case QXmlStreamReader::StartElement: + if (parser.name() == QLatin1String("Definition")) + updateDefinition(parser); + break; + default: + break; } } @@ -100,7 +101,7 @@ void DefinitionDownloaderPrivate::updateDefinition(QXmlStreamReader &parser) } } -void DefinitionDownloaderPrivate::downloadDefinition(const QUrl& downloadUrl) +void DefinitionDownloaderPrivate::downloadDefinition(const QUrl &downloadUrl) { if (!downloadUrl.isValid()) return; @@ -110,9 +111,7 @@ void DefinitionDownloaderPrivate::downloadDefinition(const QUrl& downloadUrl) QNetworkRequest req(url); auto reply = nam->get(req); - QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() { - downloadDefinitionFinished(reply); - }); + QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() { downloadDefinitionFinished(reply); }); ++pendingDownloads; needsReload = true; } @@ -120,8 +119,10 @@ void DefinitionDownloaderPrivate::downloadDefinition(const QUrl& downloadUrl) void DefinitionDownloaderPrivate::downloadDefinitionFinished(QNetworkReply *reply) { --pendingDownloads; - if (reply->error() != QNetworkReply::NoError) { - qCWarning(Log) << "Failed to download definition file" << reply->url() << reply->error(); + + const auto networkError = reply->error(); + if (networkError != QNetworkReply::NoError) { + qCWarning(Log) << "Failed to download definition file" << reply->url() << networkError; checkDone(); return; } @@ -154,7 +155,6 @@ void DefinitionDownloaderPrivate::checkDone() } } - DefinitionDownloader::DefinitionDownloader(Repository *repo, QObject *parent) : QObject(parent) , d(new DefinitionDownloaderPrivate()) @@ -178,15 +178,9 @@ DefinitionDownloader::~DefinitionDownloader() void DefinitionDownloader::start() { - const QString url = QLatin1String("https://www.kate-editor.org/syntax/update-") - + QString::number(SyntaxHighlighting_VERSION_MAJOR) - + QLatin1Char('.') - + QString::number(SyntaxHighlighting_VERSION_MINOR) - + QLatin1String(".xml"); + const QString url = QLatin1String("https://www.kate-editor.org/syntax/update-") + QString::number(SyntaxHighlighting_VERSION_MAJOR) + QLatin1Char('.') + QString::number(SyntaxHighlighting_VERSION_MINOR) + QLatin1String(".xml"); auto req = QNetworkRequest(QUrl(url)); req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); auto reply = d->nam->get(req); - QObject::connect(reply, &QNetworkReply::finished, this, [=]() { - d->definitionListDownloadFinished(reply); - }); + QObject::connect(reply, &QNetworkReply::finished, this, [=]() { d->definitionListDownloadFinished(reply); }); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h index 06e28f6a658..a1300d57e61 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h @@ -29,8 +29,8 @@ #include <QObject> #include <memory> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class DefinitionDownloaderPrivate; class Repository; 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 08604a4821b..0e072db415f 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h @@ -26,8 +26,8 @@ #include <memory> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Definition; class DefinitionData; class DefinitionPrivate; @@ -46,7 +46,7 @@ public: DefinitionRef(); explicit DefinitionRef(const Definition &def); ~DefinitionRef(); - DefinitionRef& operator=(const Definition &def); + DefinitionRef &operator=(const Definition &def); Definition definition() const; @@ -71,4 +71,3 @@ private: } #endif - diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp index e8f89bd788a..72a410cb2a7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp @@ -27,15 +27,15 @@ using namespace KSyntaxHighlighting; static_assert(sizeof(FoldingRegion) == 2, "FoldingRegion is size-sensitive to frequent use in KTextEditor!"); -FoldingRegion::FoldingRegion() : - m_type(None), - m_id(0) +FoldingRegion::FoldingRegion() + : m_type(None) + , m_id(0) { } -FoldingRegion::FoldingRegion(Type type, quint16 id) : - m_type(type), - m_id(id) +FoldingRegion::FoldingRegion(Type type, quint16 id) + : m_type(type) + , m_id(id) { } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h index 074b9478be2..ea26aba9b22 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h @@ -28,8 +28,8 @@ #include <QTypeInfo> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ /** Represents a begin or end of a folding region. * @since 5.28 */ class KSYNTAXHIGHLIGHTING_EXPORT FoldingRegion @@ -96,7 +96,7 @@ private: FoldingRegion(Type type, quint16 id); quint16 m_type : 2; - quint16 m_id: 14; + quint16 m_id : 14; }; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp index 3407fee9f3e..4c8adbedc65 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp @@ -22,9 +22,9 @@ */ #include "format.h" -#include "format_p.h" #include "definition.h" #include "definitionref_p.h" +#include "format_p.h" #include "textstyledata_p.h" #include "themedata_p.h" #include "xml_p.h" @@ -51,7 +51,7 @@ static Theme::TextStyle stringToDefaultFormat(const QStringRef &str) return static_cast<Theme::TextStyle>(value); } -FormatPrivate* FormatPrivate::detachAndGet(Format &format) +FormatPrivate *FormatPrivate::detachAndGet(Format &format) { format.d.detach(); return format.d.data(); @@ -71,12 +71,13 @@ static QExplicitlySharedDataPointer<FormatPrivate> &sharedDefaultPrivate() return def; } -Format::Format() : d(sharedDefaultPrivate()) +Format::Format() + : d(sharedDefaultPrivate()) { } -Format::Format(const Format &other) : - d(other.d) +Format::Format(const Format &other) + : d(other.d) { } @@ -84,7 +85,7 @@ Format::~Format() { } -Format& Format::operator=(const Format& other) +Format &Format::operator=(const Format &other) { d = other.d; return *this; @@ -112,21 +113,14 @@ Theme::TextStyle Format::textStyle() const bool Format::isDefaultTextStyle(const Theme &theme) const { - return (!hasTextColor(theme)) - && (!hasBackgroundColor(theme)) - && (selectedTextColor(theme) == theme.selectedTextColor(Theme::Normal)) - && (selectedBackgroundColor(theme) == theme.selectedBackgroundColor(Theme::Normal)) - && (isBold(theme) == theme.isBold(Theme::Normal)) - && (isItalic(theme) == theme.isItalic(Theme::Normal)) - && (isUnderline(theme) == theme.isUnderline(Theme::Normal)) - && (isStrikeThrough(theme) == theme.isStrikeThrough(Theme::Normal)); + return (!hasTextColor(theme)) && (!hasBackgroundColor(theme)) && (selectedTextColor(theme) == theme.selectedTextColor(Theme::Normal)) && (selectedBackgroundColor(theme) == theme.selectedBackgroundColor(Theme::Normal)) && + (isBold(theme) == theme.isBold(Theme::Normal)) && (isItalic(theme) == theme.isItalic(Theme::Normal)) && (isUnderline(theme) == theme.isUnderline(Theme::Normal)) && (isStrikeThrough(theme) == theme.isStrikeThrough(Theme::Normal)); } bool Format::hasTextColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - return textColor(theme) != theme.textColor(Theme::Normal) - && (d->style.textColor || theme.textColor(d->defaultStyle) || overrideStyle.textColor); + return textColor(theme) != theme.textColor(Theme::Normal) && (d->style.textColor || theme.textColor(d->defaultStyle) || overrideStyle.textColor); } QColor Format::textColor(const Theme &theme) const @@ -148,8 +142,7 @@ QColor Format::selectedTextColor(const Theme &theme) const bool Format::hasBackgroundColor(const Theme &theme) const { const auto overrideStyle = d->styleOverride(theme); - return backgroundColor(theme) != theme.backgroundColor(Theme::Normal) - && (d->style.backgroundColor || theme.backgroundColor(d->defaultStyle) || overrideStyle.backgroundColor); + return backgroundColor(theme) != theme.backgroundColor(Theme::Normal) && (d->style.backgroundColor || theme.backgroundColor(d->defaultStyle) || overrideStyle.backgroundColor); } QColor Format::backgroundColor(const Theme &theme) const @@ -165,8 +158,7 @@ QColor Format::selectedBackgroundColor(const Theme &theme) const const auto overrideStyle = d->styleOverride(theme); if (overrideStyle.selectedBackgroundColor) return overrideStyle.selectedBackgroundColor; - return d->style.selectedBackgroundColor ? d->style.selectedBackgroundColor - : theme.selectedBackgroundColor(d->defaultStyle); + return d->style.selectedBackgroundColor ? d->style.selectedBackgroundColor : theme.selectedBackgroundColor(d->defaultStyle); } bool Format::isBold(const Theme &theme) const @@ -246,8 +238,7 @@ bool Format::hasSelectedBackgroundColorOverride() const return d->style.selectedBackgroundColor; } - -void FormatPrivate::load(QXmlStreamReader& reader) +void FormatPrivate::load(QXmlStreamReader &reader) { name = reader.attributes().value(QStringLiteral("name")).toString(); defaultStyle = stringToDefaultFormat(reader.attributes().value(QStringLiteral("defStyleNum"))); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h index 7c1b9602bab..25491809aee 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h @@ -35,8 +35,8 @@ class QString; class QXmlStreamReader; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class DefinitionRef; class FormatPrivate; @@ -55,7 +55,7 @@ public: Format(const Format &other); ~Format(); - Format& operator=(const Format &other); + Format &operator=(const Format &other); /** Returns @c true if this is a valid format, ie. one that * was read from a syntax definition file. diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h index e79b26b6a70..91a4f1e912b 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h @@ -31,13 +31,13 @@ #include <QSharedData> #include <QString> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class FormatPrivate : public QSharedData { public: FormatPrivate() = default; - static FormatPrivate* detachAndGet(Format &format); + static FormatPrivate *detachAndGet(Format &format); TextStyleData styleOverride(const Theme &theme) const; void load(QXmlStreamReader &reader); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp index 224fb72c34d..1dad170744f 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp @@ -25,9 +25,9 @@ #include "htmlhighlighter.h" #include "definition.h" #include "format.h" +#include "ksyntaxhighlighting_logging.h" #include "state.h" #include "theme.h" -#include "ksyntaxhighlighting_logging.h" #include <QFile> #include <QFileInfo> @@ -53,7 +53,7 @@ HtmlHighlighter::~HtmlHighlighter() { } -void HtmlHighlighter::setOutputFile(const QString& fileName) +void HtmlHighlighter::setOutputFile(const QString &fileName) { d->file.reset(new QFile(fileName)); if (!d->file->open(QFile::WriteOnly | QFile::Truncate)) { @@ -70,7 +70,7 @@ void HtmlHighlighter::setOutputFile(FILE *fileHandle) d->out->setCodec("UTF-8"); } -void HtmlHighlighter::highlightFile(const QString& fileName, const QString& title) +void HtmlHighlighter::highlightFile(const QString &fileName, const QString &title) { QFileInfo fi(fileName); QFile f(fileName); @@ -85,7 +85,7 @@ void HtmlHighlighter::highlightFile(const QString& fileName, const QString& titl highlightData(&f, title); } -void HtmlHighlighter::highlightData(QIODevice *dev, const QString& title) +void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title) { if (!d->out) { qCWarning(Log) << "No output stream defined!"; @@ -124,7 +124,7 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString& title) d->file.reset(); } -void HtmlHighlighter::applyFormat(int offset, int length, const Format& format) +void HtmlHighlighter::applyFormat(int offset, int length, const Format &format) { if (length == 0) return; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h index b7eda02d549..7479ee2b633 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h @@ -24,11 +24,11 @@ #ifndef KSYNTAXHIGHLIGHTING_HTMLHIGHLIGHTER_H #define KSYNTAXHIGHLIGHTING_HTMLHIGHLIGHTER_H -#include "ksyntaxhighlighting_export.h" #include "abstracthighlighter.h" +#include "ksyntaxhighlighting_export.h" -#include <QString> #include <QIODevice> +#include <QString> #include <memory> @@ -37,8 +37,8 @@ class QFile; class QTextStream; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class HtmlHighlighterPrivate; class KSYNTAXHIGHLIGHTING_EXPORT HtmlHighlighter : public AbstractHighlighter diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp index 144ced2c00c..7cbbaecacf6 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp @@ -21,10 +21,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "keywordlist_p.h" -#include "repository.h" #include "definition_p.h" +#include "keywordlist_p.h" #include "ksyntaxhighlighting_logging.h" +#include "repository.h" #include <QXmlStreamReader> @@ -42,10 +42,10 @@ bool KeywordList::contains(const QStringRef &str, Qt::CaseSensitivity caseSensit /** * search with right predicate */ - return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), str, [caseSensitive] (const QStringRef &a, const QStringRef &b) { return a.compare(b, caseSensitive) < 0; }); + return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), str, [caseSensitive](const QStringRef &a, const QStringRef &b) { return a.compare(b, caseSensitive) < 0; }); } -void KeywordList::load(QXmlStreamReader& reader) +void KeywordList::load(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("list")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); @@ -54,25 +54,24 @@ void KeywordList::load(QXmlStreamReader& reader) while (!reader.atEnd()) { switch (reader.tokenType()) { - case QXmlStreamReader::StartElement: - if (reader.name() == QLatin1String("item")) { - m_keywords.append(reader.readElementText().trimmed()); - reader.readNextStartElement(); - break; - } - else if (reader.name() == QLatin1String("include")) { - m_includes.append(reader.readElementText().trimmed()); - reader.readNextStartElement(); - break; - } - reader.readNext(); + case QXmlStreamReader::StartElement: + if (reader.name() == QLatin1String("item")) { + m_keywords.append(reader.readElementText().trimmed()); + reader.readNextStartElement(); break; - case QXmlStreamReader::EndElement: - reader.readNext(); - return; - default: - reader.readNext(); + } else if (reader.name() == QLatin1String("include")) { + m_includes.append(reader.readElementText().trimmed()); + reader.readNextStartElement(); break; + } + reader.readNext(); + break; + case QXmlStreamReader::EndElement: + reader.readNext(); + return; + default: + reader.readNext(); + break; } } } @@ -107,7 +106,7 @@ void KeywordList::initLookupForCaseSensitivity(Qt::CaseSensitivity caseSensitive /** * sort with right predicate */ - std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive] (const QStringRef &a, const QStringRef &b) { return a.compare(b, caseSensitive) < 0; }); + std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive](const QStringRef &a, const QStringRef &b) { return a.compare(b, caseSensitive) < 0; }); } void KeywordList::resolveIncludeKeywords(DefinitionData &def) @@ -127,8 +126,7 @@ void KeywordList::resolveIncludeKeywords(DefinitionData &def) auto defData = DefinitionData::get(includeDef); defData->load(DefinitionData::OnlyKeywords(true)); keywords = defData->keywordList(listName); - } - else { + } else { qCWarning(Log) << "Unable to resolve external include keyword for definition" << defName << "in" << def.name; } } else { @@ -140,8 +138,7 @@ void KeywordList::resolveIncludeKeywords(DefinitionData &def) keywords->resolveIncludeKeywords(def); } m_keywords += keywords->m_keywords; - } - else { + } else { qCWarning(Log) << "Unresolved include keyword" << kw_include << "in" << def.name; } } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h index f99a027823e..e21149e9093 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h @@ -33,8 +33,8 @@ QT_BEGIN_NAMESPACE class QXmlStreamReader; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Repository; class DefinitionData; @@ -59,7 +59,7 @@ public: return m_keywords; } - void setKeywordList(const QStringList& keywords) + void setKeywordList(const QStringList &keywords) { m_keywords = keywords; m_keywordsSortedCaseSensitive.clear(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h index b1a05ee636d..c79801dd3df 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h @@ -26,8 +26,8 @@ #include <QStringList> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ /** * Storage for match result of a Rule. * Heavily used internally during highlightLine, therefore completely inline. @@ -73,7 +73,6 @@ public: return m_offset; } - /** * Skip offset of the match * @return skip offset of the match, no match possible until this offset is reached diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp index c4e4889fa29..f61365869e9 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp @@ -22,12 +22,12 @@ */ #include "repository.h" -#include "repository_p.h" #include "definition.h" #include "definition_p.h" +#include "ksyntaxhighlighting_logging.h" +#include "repository_p.h" #include "theme.h" #include "themedata_p.h" -#include "ksyntaxhighlighting_logging.h" #include "wildcardmatcher_p.h" #include <QDirIterator> @@ -52,13 +52,13 @@ static void initResource() Q_INIT_RESOURCE(theme_data); } -RepositoryPrivate* RepositoryPrivate::get(Repository *repo) +RepositoryPrivate *RepositoryPrivate::get(Repository *repo) { return repo->d.get(); } -Repository::Repository() : - d(new RepositoryPrivate) +Repository::Repository() + : d(new RepositoryPrivate) { initResource(); d->load(this); @@ -72,19 +72,17 @@ Repository::~Repository() DefinitionData::get(def)->repo = nullptr; } -Definition Repository::definitionForName(const QString& defName) const +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(); - }); + 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 +Definition Repository::definitionForFileName(const QString &fileName) const { return definitionsForFileName(fileName).value(0); } @@ -108,7 +106,7 @@ QVector<Definition> Repository::definitionsForFileName(const QString &fileName) return candidates; } -Definition Repository::definitionForMimeType(const QString& mimeType) const +Definition Repository::definitionForMimeType(const QString &mimeType) const { return definitionsForMimeType(mimeType).value(0); } @@ -273,9 +271,7 @@ static int themeRevision(const Theme &theme) void RepositoryPrivate::addTheme(const Theme &theme) { - const auto it = std::lower_bound(m_themes.begin(), m_themes.end(), theme, [](const Theme &lhs, const Theme &rhs) { - return lhs.name() < rhs.name(); - }); + const auto it = std::lower_bound(m_themes.begin(), m_themes.end(), theme, [](const Theme &lhs, const Theme &rhs) { return lhs.name() < rhs.name(); }); if (it == m_themes.end() || (*it).name() != theme.name()) { m_themes.insert(it, theme); return; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h index 2bc66965cf4..8c0ef763061 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h @@ -26,12 +26,12 @@ #include "ksyntaxhighlighting_export.h" -#include <qglobal.h> #include <memory> +#include <qglobal.h> QT_BEGIN_NAMESPACE class QString; -template <typename T> class QVector; +template<typename T> class QVector; QT_END_NAMESPACE /** @@ -43,8 +43,8 @@ QT_END_NAMESPACE * * @see Repository */ -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Definition; class RepositoryPrivate; class Theme; 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 9db876be59e..81cba479429 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h @@ -31,8 +31,8 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Definition; class Repository; class Theme; @@ -42,7 +42,7 @@ class RepositoryPrivate public: RepositoryPrivate() = default; - static RepositoryPrivate* get(Repository *repo); + static RepositoryPrivate *get(Repository *repo); void load(Repository *repo); void loadSyntaxFolder(Repository *repo, const QString &path); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp index 79b110d70a3..0d7d843c00d 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp @@ -22,10 +22,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "rule_p.h" #include "context_p.h" #include "definition_p.h" #include "ksyntaxhighlighting_logging.h" +#include "rule_p.h" #include "xml_p.h" #include <QString> @@ -40,13 +40,8 @@ static bool isOctalChar(QChar c) static bool isHexChar(QChar c) { - return c.isNumber() - || c == QLatin1Char('a') || c == QLatin1Char('A') - || c == QLatin1Char('b') || c == QLatin1Char('B') - || c == QLatin1Char('c') || c == QLatin1Char('C') - || c == QLatin1Char('d') || c == QLatin1Char('D') - || c == QLatin1Char('e') || c == QLatin1Char('E') - || c == QLatin1Char('f') || c == QLatin1Char('F'); + return c.isNumber() || c == QLatin1Char('a') || c == QLatin1Char('A') || c == QLatin1Char('b') || c == QLatin1Char('B') || c == QLatin1Char('c') || c == QLatin1Char('C') || c == QLatin1Char('d') || c == QLatin1Char('D') || + c == QLatin1Char('e') || c == QLatin1Char('E') || c == QLatin1Char('f') || c == QLatin1Char('F'); } static int matchEscapedChar(const QString &text, int offset) @@ -155,13 +150,13 @@ void Rule::resolveAttributeFormat(Context *lookupContext) } } -bool Rule::doLoad(QXmlStreamReader& reader) +bool Rule::doLoad(QXmlStreamReader &reader) { Q_UNUSED(reader); return true; } -Rule::Ptr Rule::create(const QStringRef& name) +Rule::Ptr Rule::create(const QStringRef &name) { Rule *rule = nullptr; if (name == QLatin1String("AnyChar")) @@ -212,8 +207,7 @@ bool Rule::isWordDelimiter(QChar c) const return m_wordDelimiter.contains(c); } - -bool AnyChar::doLoad(QXmlStreamReader& reader) +bool AnyChar::doLoad(QXmlStreamReader &reader) { m_chars = reader.attributes().value(QStringLiteral("String")).toString(); if (m_chars.size() == 1) @@ -221,15 +215,14 @@ bool AnyChar::doLoad(QXmlStreamReader& reader) return !m_chars.isEmpty(); } -MatchResult AnyChar::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult AnyChar::doMatch(const QString &text, int offset, const QStringList &) const { if (m_chars.contains(text.at(offset))) return offset + 1; return offset; } - -bool DetectChar::doLoad(QXmlStreamReader& reader) +bool DetectChar::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QStringLiteral("char")); if (s.isEmpty()) @@ -242,7 +235,7 @@ bool DetectChar::doLoad(QXmlStreamReader& reader) return true; } -MatchResult DetectChar::doMatch(const QString& text, int offset, const QStringList &captures) const +MatchResult DetectChar::doMatch(const QString &text, int offset, const QStringList &captures) const { if (m_dynamic) { if (m_captureIndex == 0 || captures.size() <= m_captureIndex || captures.at(m_captureIndex).isEmpty()) @@ -257,8 +250,7 @@ MatchResult DetectChar::doMatch(const QString& text, int offset, const QStringLi return offset; } - -bool Detect2Char::doLoad(QXmlStreamReader& reader) +bool Detect2Char::doLoad(QXmlStreamReader &reader) { const auto s1 = reader.attributes().value(QStringLiteral("char")); const auto s2 = reader.attributes().value(QStringLiteral("char1")); @@ -269,7 +261,7 @@ bool Detect2Char::doLoad(QXmlStreamReader& reader) return true; } -MatchResult Detect2Char::doMatch(const QString& text, int offset, const QStringList &) const +MatchResult Detect2Char::doMatch(const QString &text, int offset, const QStringList &) const { if (text.size() - offset < 2) return offset; @@ -278,8 +270,7 @@ MatchResult Detect2Char::doMatch(const QString& text, int offset, const QStringL return offset; } - -MatchResult DetectIdentifier::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult DetectIdentifier::doMatch(const QString &text, int offset, const QStringList &) const { if (!text.at(offset).isLetter() && text.at(offset) != QLatin1Char('_')) return offset; @@ -293,16 +284,14 @@ MatchResult DetectIdentifier::doMatch(const QString& text, int offset, const QSt return text.size(); } - -MatchResult DetectSpaces::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult DetectSpaces::doMatch(const QString &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; } - -MatchResult Float::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult Float::doMatch(const QString &text, int offset, const QStringList &) const { if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) return offset; @@ -339,8 +328,7 @@ MatchResult Float::doMatch(const QString& text, int offset, const QStringList&) return expOffset; } - -MatchResult HlCChar::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult HlCChar::doMatch(const QString &text, int offset, const QStringList &) const { if (text.size() < offset + 3) return offset; @@ -364,8 +352,7 @@ MatchResult HlCChar::doMatch(const QString& text, int offset, const QStringList& return offset; } - -MatchResult HlCHex::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult HlCHex::doMatch(const QString &text, int offset, const QStringList &) const { if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) return offset; @@ -388,8 +375,7 @@ MatchResult HlCHex::doMatch(const QString& text, int offset, const QStringList&) return offset; } - -MatchResult HlCOct::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult HlCOct::doMatch(const QString &text, int offset, const QStringList &) const { if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) return offset; @@ -410,13 +396,11 @@ MatchResult HlCOct::doMatch(const QString& text, int offset, const QStringList&) return offset; } - -MatchResult HlCStringChar::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult HlCStringChar::doMatch(const QString &text, int offset, const QStringList &) const { return matchEscapedChar(text, offset); } - QString IncludeRules::contextName() const { return m_contextName; @@ -432,10 +416,14 @@ bool IncludeRules::includeAttribute() const return m_includeAttribute; } -bool IncludeRules::doLoad(QXmlStreamReader& reader) +bool IncludeRules::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QLatin1String("context")); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) const auto split = s.split(QLatin1String("##"), QString::KeepEmptyParts); +#else + const auto split = s.split(QLatin1String("##"), Qt::KeepEmptyParts); +#endif if (split.isEmpty()) return false; m_contextName = split.at(0).toString(); @@ -446,26 +434,24 @@ bool IncludeRules::doLoad(QXmlStreamReader& reader) return !m_contextName.isEmpty() || !m_defName.isEmpty(); } -MatchResult IncludeRules::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult IncludeRules::doMatch(const QString &text, int offset, const QStringList &) const { Q_UNUSED(text); qCWarning(Log) << "Unresolved include rule for" << m_contextName << "##" << m_defName; return offset; } - -MatchResult Int::doMatch(const QString& text, int offset, const QStringList &) const +MatchResult Int::doMatch(const QString &text, int offset, const QStringList &) const { if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) return offset; - while(offset < text.size() && text.at(offset).isDigit()) + while (offset < text.size() && text.at(offset).isDigit()) ++offset; return offset; } - -bool KeywordListRule::doLoad(QXmlStreamReader& reader) +bool KeywordListRule::doLoad(QXmlStreamReader &reader) { /** * get our keyword list, if not found => bail out @@ -482,8 +468,7 @@ bool KeywordListRule::doLoad(QXmlStreamReader& reader) */ if (reader.attributes().hasAttribute(QLatin1String("insensitive"))) { m_hasCaseSensitivityOverride = true; - m_caseSensitivityOverride = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? - Qt::CaseInsensitive : Qt::CaseSensitive; + m_caseSensitivityOverride = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; m_keywordList->initLookupForCaseSensitivity(m_caseSensitivityOverride); } else { m_hasCaseSensitivityOverride = false; @@ -492,7 +477,7 @@ bool KeywordListRule::doLoad(QXmlStreamReader& reader) return !m_keywordList->isEmpty(); } -MatchResult KeywordListRule::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult KeywordListRule::doMatch(const QString &text, int offset, const QStringList &) const { auto newOffset = offset; while (text.size() > newOffset && !isWordDelimiter(text.at(newOffset))) @@ -512,8 +497,7 @@ MatchResult KeywordListRule::doMatch(const QString& text, int offset, const QStr return MatchResult(offset, newOffset); } - -bool LineContinue::doLoad(QXmlStreamReader& reader) +bool LineContinue::doLoad(QXmlStreamReader &reader) { const auto s = reader.attributes().value(QStringLiteral("char")); if (s.isEmpty()) @@ -523,15 +507,14 @@ bool LineContinue::doLoad(QXmlStreamReader& reader) return true; } -MatchResult LineContinue::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult LineContinue::doMatch(const QString &text, int offset, const QStringList &) const { if (offset == text.size() - 1 && text.at(offset) == m_char) return offset + 1; return offset; } - -bool RangeDetect::doLoad(QXmlStreamReader& reader) +bool RangeDetect::doLoad(QXmlStreamReader &reader) { const auto s1 = reader.attributes().value(QStringLiteral("char")); const auto s2 = reader.attributes().value(QStringLiteral("char1")); @@ -542,7 +525,7 @@ bool RangeDetect::doLoad(QXmlStreamReader& reader) return true; } -MatchResult RangeDetect::doMatch(const QString& text, int offset, const QStringList&) const +MatchResult RangeDetect::doMatch(const QString &text, int offset, const QStringList &) const { if (text.size() - offset < 2) return offset; @@ -558,15 +541,13 @@ MatchResult RangeDetect::doMatch(const QString& text, int offset, const QStringL return offset; } -bool RegExpr::doLoad(QXmlStreamReader& reader) +bool RegExpr::doLoad(QXmlStreamReader &reader) { m_regexp.setPattern(reader.attributes().value(QStringLiteral("String")).toString()); const auto isMinimal = Xml::attrToBool(reader.attributes().value(QStringLiteral("minimal"))); const auto isCaseInsensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))); - m_regexp.setPatternOptions( - (isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) | - (isCaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption)); + m_regexp.setPatternOptions((isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) | (isCaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption)); // optimize the pattern for the non-dynamic case, we use them OFTEN m_dynamic = Xml::attrToBool(reader.attributes().value(QStringLiteral("dynamic"))); @@ -583,7 +564,7 @@ bool RegExpr::doLoad(QXmlStreamReader& reader) return !m_regexp.pattern().isEmpty(); } -MatchResult RegExpr::doMatch(const QString& text, int offset, const QStringList &captures) const +MatchResult RegExpr::doMatch(const QString &text, int offset, const QStringList &captures) const { /** * for dynamic case: create new pattern with right instantiation @@ -612,14 +593,12 @@ MatchResult RegExpr::doMatch(const QString& text, int offset, const QStringList /** * no match - * the pattern of a dynamic regex depends on the previous contexts - * so that skipOffset cannot be computed + * we can always compute the skip offset as the highlighter will invalidate the cache for changed captures for dynamic rules! */ - return MatchResult(offset, m_dynamic ? 0 : result.capturedStart()); + return MatchResult(offset, result.capturedStart()); } - -bool StringDetect::doLoad(QXmlStreamReader& reader) +bool StringDetect::doLoad(QXmlStreamReader &reader) { m_string = reader.attributes().value(QStringLiteral("String")).toString(); m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; @@ -627,7 +606,7 @@ bool StringDetect::doLoad(QXmlStreamReader& reader) return !m_string.isEmpty(); } -MatchResult StringDetect::doMatch(const QString& text, int offset, const QStringList &captures) const +MatchResult StringDetect::doMatch(const QString &text, int offset, const QStringList &captures) const { /** * for dynamic case: create new pattern with right instantiation @@ -639,15 +618,14 @@ MatchResult StringDetect::doMatch(const QString& text, int offset, const QString return offset; } - -bool WordDetect::doLoad(QXmlStreamReader& reader) +bool WordDetect::doLoad(QXmlStreamReader &reader) { m_word = reader.attributes().value(QStringLiteral("String")).toString(); m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; return !m_word.isEmpty(); } -MatchResult WordDetect::doMatch(const QString& text, int offset, const QStringList &) const +MatchResult WordDetect::doMatch(const QString &text, int offset, const QStringList &) const { if (text.size() - 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 4ddee3cbfd9..c30ea29a546 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h @@ -41,8 +41,8 @@ QT_BEGIN_NAMESPACE class QXmlStreamReader; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Rule { public: @@ -69,6 +69,11 @@ public: return m_lookAhead; } + bool isDynamic() const + { + return m_dynamic; + } + bool firstNonSpace() const { return m_firstNonSpace; @@ -117,14 +122,16 @@ private: // cache for DefinitionData::wordDelimiters, is accessed VERY often QStringRef m_wordDelimiter; -}; +protected: + bool m_dynamic = false; +}; class AnyChar : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; private: QString m_chars; @@ -133,20 +140,19 @@ private: class DetectChar : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; private: QChar m_char; - bool m_dynamic = false; int m_captureIndex = 0; }; class Detect2Char : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; private: QChar m_char1; @@ -156,19 +162,19 @@ private: class DetectIdentifier : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class DetectSpaces : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class Float : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class IncludeRules : public Rule @@ -179,8 +185,8 @@ public: bool includeAttribute() const; protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; private: QString m_contextName; @@ -191,38 +197,38 @@ private: class Int : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; }; class HlCChar : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class HlCHex : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class HlCOct : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class HlCStringChar : public Rule { protected: - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; }; class KeywordListRule : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; private: KeywordList *m_keywordList; @@ -233,8 +239,8 @@ private: class LineContinue : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; private: QChar m_char; @@ -243,8 +249,8 @@ private: class RangeDetect : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList&) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &) const override; private: QChar m_begin; @@ -254,31 +260,29 @@ private: class RegExpr : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; private: QRegularExpression m_regexp; - bool m_dynamic = false; }; class StringDetect : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const override; private: QString m_string; Qt::CaseSensitivity m_caseSensitivity; - bool m_dynamic = false; }; class WordDetect : public Rule { protected: - bool doLoad(QXmlStreamReader & reader) override; - MatchResult doMatch(const QString & text, int offset, const QStringList &captures) const override; + bool doLoad(QXmlStreamReader &reader) override; + MatchResult doMatch(const QString &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 f970e13f8b6..4b4faa956db 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp @@ -31,7 +31,7 @@ using namespace KSyntaxHighlighting; -StateData* StateData::get(State &state) +StateData *StateData::get(State &state) { state.d.detach(); return state.d.data(); @@ -72,7 +72,7 @@ bool StateData::pop(int popCount) return initialContextSurvived; } -Context* StateData::topContext() const +Context *StateData::topContext() const { Q_ASSERT(!isEmpty()); return m_contextStack.last().first; @@ -84,13 +84,13 @@ const QStringList &StateData::topCaptures() const return m_contextStack.last().second; } -State::State() : - d(new StateData) +State::State() + : d(new StateData) { } -State::State(const State &other) : - d(other.d) +State::State(const State &other) + : d(other.d) { } @@ -98,7 +98,7 @@ State::~State() { } -State& State::operator=(const State &other) +State &State::operator=(const State &other) { d = other.d; return *this; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h index 865589f28e6..ed632746958 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h @@ -28,8 +28,8 @@ #include <QExplicitlySharedDataPointer> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class StateData; /** Opaque handle to the state of the highlighting engine. @@ -48,7 +48,7 @@ public: State(); State(const State &other); ~State(); - State& operator=(const State &rhs); + State &operator=(const State &rhs); /** Compares two states for equality. * For two equal states and identical text input, AbstractHighlighter diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h index a99192b4c65..fbc16861439 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h @@ -36,7 +36,6 @@ QT_END_NAMESPACE namespace KSyntaxHighlighting { - class Context; class StateData : public QSharedData @@ -46,7 +45,7 @@ class StateData : public QSharedData public: StateData() = default; - static StateData* get(State &state); + static StateData *get(State &state); bool isEmpty() const; void clear(); @@ -61,7 +60,7 @@ public: */ bool pop(int popCount); - Context* topContext() const; + Context *topContext() const; const QStringList &topCaptures() const; private: diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp index 89663d8af31..a6bccffdd42 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp @@ -29,12 +29,12 @@ #include "state.h" #include "theme.h" - Q_DECLARE_METATYPE(QTextBlock) using namespace KSyntaxHighlighting; -namespace KSyntaxHighlighting { +namespace KSyntaxHighlighting +{ class TextBlockUserData : public QTextBlockUserData { public: @@ -51,9 +51,9 @@ public: } -FoldingRegion SyntaxHighlighterPrivate::foldingRegion(const QTextBlock& startBlock) +FoldingRegion SyntaxHighlighterPrivate::foldingRegion(const QTextBlock &startBlock) { - const auto data = dynamic_cast<TextBlockUserData*>(startBlock.userData()); + const auto data = dynamic_cast<TextBlockUserData *>(startBlock.userData()); if (!data) return FoldingRegion(); for (int i = data->foldingRegions.size() - 1; i >= 0; --i) { @@ -63,16 +63,16 @@ FoldingRegion SyntaxHighlighterPrivate::foldingRegion(const QTextBlock& startBlo return FoldingRegion(); } -SyntaxHighlighter::SyntaxHighlighter(QObject* parent) : - QSyntaxHighlighter(parent), - AbstractHighlighter(new SyntaxHighlighterPrivate) +SyntaxHighlighter::SyntaxHighlighter(QObject *parent) + : QSyntaxHighlighter(parent) + , AbstractHighlighter(new SyntaxHighlighterPrivate) { qRegisterMetaType<QTextBlock>(); } -SyntaxHighlighter::SyntaxHighlighter(QTextDocument *document) : - QSyntaxHighlighter(document), - AbstractHighlighter(new SyntaxHighlighterPrivate) +SyntaxHighlighter::SyntaxHighlighter(QTextDocument *document) + : QSyntaxHighlighter(document) + , AbstractHighlighter(new SyntaxHighlighterPrivate) { qRegisterMetaType<QTextBlock>(); } @@ -81,7 +81,7 @@ SyntaxHighlighter::~SyntaxHighlighter() { } -void SyntaxHighlighter::setDefinition(const Definition& def) +void SyntaxHighlighter::setDefinition(const Definition &def) { const auto needsRehighlight = definition() != def; AbstractHighlighter::setDefinition(def); @@ -102,7 +102,7 @@ QTextBlock SyntaxHighlighter::findFoldingRegionEnd(const QTextBlock &startBlock) int depth = 1; while (block.isValid()) { block = block.next(); - const auto data = dynamic_cast<TextBlockUserData*>(block.userData()); + const auto data = dynamic_cast<TextBlockUserData *>(block.userData()); if (!data) continue; for (auto it = data->foldingRegions.constBegin(); it != data->foldingRegions.constEnd(); ++it) { @@ -120,21 +120,21 @@ QTextBlock SyntaxHighlighter::findFoldingRegionEnd(const QTextBlock &startBlock) return QTextBlock(); } -void SyntaxHighlighter::highlightBlock(const QString& text) +void SyntaxHighlighter::highlightBlock(const QString &text) { Q_D(SyntaxHighlighter); State state; if (currentBlock().position() > 0) { const auto prevBlock = currentBlock().previous(); - const auto prevData = dynamic_cast<TextBlockUserData*>(prevBlock.userData()); + const auto prevData = dynamic_cast<TextBlockUserData *>(prevBlock.userData()); if (prevData) state = prevData->state; } d->foldingRegions.clear(); state = highlightLine(text, state); - auto data = dynamic_cast<TextBlockUserData*>(currentBlockUserData()); + auto data = dynamic_cast<TextBlockUserData *>(currentBlockUserData()); if (!data) { // first time we highlight this data = new TextBlockUserData; data->state = state; @@ -153,7 +153,7 @@ void SyntaxHighlighter::highlightBlock(const QString& text) QMetaObject::invokeMethod(this, "rehighlightBlock", Qt::QueuedConnection, Q_ARG(QTextBlock, nextBlock)); } -void SyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format& format) +void SyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) { if (length == 0) return; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h index f5d2a5e2190..7f5dadefebc 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h @@ -30,8 +30,8 @@ #include <QSyntaxHighlighter> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class SyntaxHighlighterPrivate; /** A QSyntaxHighlighter implementation for use with QTextDocument. @@ -73,7 +73,7 @@ public: QTextBlock findFoldingRegionEnd(const QTextBlock &startBlock) const; protected: - void highlightBlock(const QString & text) override; + void highlightBlock(const QString &text) override; void applyFormat(int offset, int length, const Format &format) override; void applyFolding(int offset, int length, FoldingRegion region) override; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h index 50980e0aa02..4b6cef7e983 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h @@ -24,9 +24,10 @@ #ifndef KSYNTAXHIGHLIGHTING_TEXTSTYLEDATA_P_H #define KSYNTAXHIGHLIGHTING_TEXTSTYLEDATA_P_H +#include <QColor> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class TextStyleData { public: @@ -40,21 +41,22 @@ public: , hasItalic(false) , hasUnderline(false) , hasStrikeThrough(false) - {} + { + } QRgb textColor = 0x0; QRgb backgroundColor = 0x0; QRgb selectedTextColor = 0x0; QRgb selectedBackgroundColor = 0x0; - bool bold :1; - bool italic :1; - bool underline :1; - bool strikeThrough :1; - - bool hasBold :1; - bool hasItalic :1; - bool hasUnderline :1; - bool hasStrikeThrough :1; + bool bold : 1; + bool italic : 1; + bool underline : 1; + bool strikeThrough : 1; + + bool hasBold : 1; + bool hasItalic : 1; + bool hasUnderline : 1; + bool hasStrikeThrough : 1; }; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp index 57f62ef6ab2..c6f31a5182b 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp @@ -37,7 +37,7 @@ Theme::Theme(const Theme ©) m_data = copy.m_data; } -Theme::Theme(ThemeData* data) +Theme::Theme(ThemeData *data) : m_data(data) { } @@ -64,8 +64,7 @@ QString Theme::name() const QString Theme::translatedName() const { - return m_data ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) - : QString(); + return m_data ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) : QString(); } bool Theme::isReadOnly() const diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h index adb8431f6a1..3379aec853c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h @@ -28,11 +28,11 @@ #include <QColor> #include <QExplicitlySharedDataPointer> -#include <qobjectdefs.h> #include <QTypeInfo> +#include <qobjectdefs.h> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class ThemeData; class RepositoryPrivate; @@ -82,7 +82,6 @@ class KSYNTAXHIGHLIGHTING_EXPORT Theme { Q_GADGET public: - // TODO KF6: // - make TextStyle an enum class // - move out of Theme into KSyntaxHighlighting @@ -358,7 +357,7 @@ private: /** * Constructor taking a shared ThemeData instance. */ - explicit Theme(ThemeData* data); + explicit Theme(ThemeData *data); friend class RepositoryPrivate; friend class ThemeData; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp index 9e9f7b913c0..03a5ea8e323 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp @@ -22,8 +22,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "themedata_p.h" #include "ksyntaxhighlighting_logging.h" +#include "themedata_p.h" #include <QFile> #include <QFileInfo> @@ -32,10 +32,9 @@ #include <QJsonValue> #include <QMetaEnum> - using namespace KSyntaxHighlighting; -ThemeData* ThemeData::get(const Theme &theme) +ThemeData *ThemeData::get(const Theme &theme) { return theme.m_data.data(); } @@ -248,7 +247,7 @@ QRgb ThemeData::editorColor(Theme::EditorColorRole role) const return m_editorColors[role]; } -TextStyleData ThemeData::textStyleOverride(const QString& definitionName, const QString& attributeName) const +TextStyleData ThemeData::textStyleOverride(const QString &definitionName, const QString &attributeName) const { return m_textStyleOverrides.value(definitionName).value(attributeName); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h index 3b5f4637a9f..052d297599b 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h @@ -25,21 +25,21 @@ #ifndef KSYNTAXHIGHLIGHTING_THEMEDATA_P_H #define KSYNTAXHIGHLIGHTING_THEMEDATA_P_H -#include "theme.h" #include "textstyledata_p.h" +#include "theme.h" #include <QHash> #include <QSharedData> -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ /** * Data container for a Theme. */ class ThemeData : public QSharedData { public: - static ThemeData* get(const Theme &theme); + static ThemeData *get(const Theme &theme); /** * Default constructor, creating an uninitialized ThemeData instance. @@ -155,7 +155,7 @@ private: //! style overrides for individual itemData entries //! definition name -> attribute name -> style - QHash<QString, QHash<QString, TextStyleData> > m_textStyleOverrides; + QHash<QString, QHash<QString, TextStyleData>> m_textStyleOverrides; //! Editor area colors QRgb m_editorColors[Theme::TemplateReadOnlyPlaceholder + 1]; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp index 167295a9307..604318200b0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp @@ -25,11 +25,10 @@ using namespace KSyntaxHighlighting; -#include <QString> #include <QChar> +#include <QString> -static bool exactMatch(const QString &candidate, const QString &wildcard, int candidatePosFromRight, - int wildcardPosFromRight, bool caseSensitive = true) +static bool exactMatch(const QString &candidate, const QString &wildcard, int candidatePosFromRight, int wildcardPosFromRight, bool caseSensitive = true) { for (; wildcardPosFromRight >= 0; wildcardPosFromRight--) { const auto ch = wildcard.at(wildcardPosFromRight).unicode(); @@ -76,8 +75,7 @@ static bool exactMatch(const QString &candidate, const QString &wildcard, int ca return true; } -bool WildcardMatcher::exactMatch(const QString &candidate, const QString &wildcard, - bool caseSensitive) +bool WildcardMatcher::exactMatch(const QString &candidate, const QString &wildcard, bool caseSensitive) { return ::exactMatch(candidate, wildcard, candidate.length() - 1, wildcard.length() - 1, caseSensitive); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h index 016b10fe666..feeca662174 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h @@ -30,20 +30,20 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ namespace WildcardMatcher { - /** - * Matches a string against a given wildcard. - * The wildcard supports '*' (".*" in regex) and '?' ("." in regex), not more. - * - * @param candidate Text to match - * @param wildcard Wildcard to use - * @param caseSensitive Case-sensitivity flag - * @return True for an exact match, false otherwise - */ - bool exactMatch(const QString &candidate, const QString &wildcard, bool caseSensitive = true); +/** + * Matches a string against a given wildcard. + * The wildcard supports '*' (".*" in regex) and '?' ("." in regex), not more. + * + * @param candidate Text to match + * @param wildcard Wildcard to use + * @param caseSensitive Case-sensitivity flag + * @return True for an exact match, false otherwise + */ +bool exactMatch(const QString &candidate, const QString &wildcard, bool caseSensitive = true); } } 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 5f1f066dfd8..6d73edfb521 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h @@ -26,10 +26,11 @@ #include <QString> -namespace KSyntaxHighlighting { +namespace KSyntaxHighlighting +{ /** Utilities for XML parsing. */ -namespace Xml { - +namespace Xml +{ /** Parse a xs:boolean attribute. */ inline bool attrToBool(const QStringRef &str) { |