From 37f8fcd79113c4093f6984e94f507d05dde54090 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 9 Feb 2022 09:13:05 +0100 Subject: [PATCH] Editor: update ksyntaxhighlighting engine to v5.90.0 Task-number: QTCREATORBUG-22558 Change-Id: I7314c146a6de359ea8d60750d8a2c8e972b33fc9 Reviewed-by: Qt CI Bot Reviewed-by: Eike Ziller --- .../syntax-highlighting/CMakeLists.txt | 1 + .../ksyntaxhighlighting_version.h | 6 +- .../src/lib/ksyntaxhighlighting_export.h | 8 +- .../syntax-highlighting/data/CMakeLists.txt | 4 +- .../data/generators/cmake.xml.tpl | 145 +- .../data/generators/cmake.yaml | 1822 ++++++++- .../data/generators/generate-cmake-syntax.py | 37 +- .../data/generators/spdx-comments.xml.tpl | 11 +- .../data/schema/language.xsd | 4 +- .../syntax-highlighting/data/syntax/bash.xml | 50 +- .../syntax-highlighting/data/syntax/cmake.xml | 3615 ++++++++++++++++- .../data/syntax/markdown.xml | 41 +- .../data/syntax/spdx-comments.xml | 971 ++--- .../data/themes/oblivion.theme | 4 +- .../syntax-highlighting/src/CMakeLists.txt | 5 +- .../src/indexer/CMakeLists.txt | 3 +- .../src/indexer/katehighlightingindexer.cpp | 155 +- .../src/lib/CMakeLists.txt | 11 +- .../src/lib/abstracthighlighter.cpp | 8 +- .../src/lib/ansihighlighter.cpp | 26 +- .../syntax-highlighting/src/lib/context.cpp | 176 +- .../syntax-highlighting/src/lib/context_p.h | 51 +- .../src/lib/contextswitch.cpp | 72 +- .../src/lib/contextswitch_p.h | 24 +- .../src/lib/definition.cpp | 176 +- .../src/lib/definition_p.h | 18 +- .../src/lib/definitiondownloader.cpp | 3 +- .../src/lib/definitiondownloader.h | 2 +- .../src/lib/definitionref_p.h | 4 + .../src/lib/highlightingdata.cpp | 402 ++ .../src/lib/highlightingdata_p.hpp | 215 + .../src/lib/keywordlist_p.h | 10 +- .../syntax-highlighting/src/lib/rule.cpp | 466 +-- .../syntax-highlighting/src/lib/rule_p.h | 164 +- .../src/lib/wildcardmatcher.cpp | 1 - .../src/lib/worddelimiters.cpp | 9 +- .../src/lib/worddelimiters_p.h | 4 +- 37 files changed, 7284 insertions(+), 1440 deletions(-) create mode 100644 src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata.cpp create mode 100644 src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata_p.hpp diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index a8f5980862e..4d352af3d65 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -29,6 +29,7 @@ add_qtc_library(KSyntaxHighlighting SHARED src/lib/foldingregion.cpp src/lib/foldingregion.h src/lib/format.cpp src/lib/format.h src/lib/format_p.h src/lib/htmlhighlighter.cpp src/lib/htmlhighlighter.h + src/lib/highlightingdata.cpp src/lib/highlightingdata_p.hpp src/lib/keywordlist.cpp src/lib/keywordlist_p.h src/lib/matchresult_p.h src/lib/repository.cpp src/lib/repository.h src/lib/repository_p.h diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h index a8c5d74235a..4336b19ce5d 100644 --- a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h @@ -3,10 +3,10 @@ #ifndef SyntaxHighlighting_VERSION_H #define SyntaxHighlighting_VERSION_H -#define SyntaxHighlighting_VERSION_STRING "5.87.0" +#define SyntaxHighlighting_VERSION_STRING "5.90.0" #define SyntaxHighlighting_VERSION_MAJOR 5 -#define SyntaxHighlighting_VERSION_MINOR 87 +#define SyntaxHighlighting_VERSION_MINOR 90 #define SyntaxHighlighting_VERSION_PATCH 0 -#define SyntaxHighlighting_VERSION ((5<<16)|(87<<8)|(0)) +#define SyntaxHighlighting_VERSION ((5<<16)|(90<<8)|(0)) #endif diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h index 1213499635c..25fb987a978 100644 --- a/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/ksyntaxhighlighting_export.h @@ -88,7 +88,7 @@ #define KSYNTAXHIGHLIGHTING_BUILD_DEPRECATED_SINCE(major, minor) 1 #ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED -# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55700 +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55a00 #endif #ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS # define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0 @@ -98,7 +98,7 @@ # ifdef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT # define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT # else -# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55700 +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55a00 # endif #endif @@ -178,7 +178,7 @@ #define KSYNTAXHIGHLIGHTING_BUILD_DEPRECATED_SINCE(major, minor) 1 #ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED -# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55700 +# define KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT 0x55a00 #endif #ifdef KSYNTAXHIGHLIGHTING_NO_DEPRECATED_WARNINGS # define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0 @@ -188,7 +188,7 @@ # ifdef KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT # define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE KSYNTAXHIGHLIGHTING_DISABLE_DEPRECATED_BEFORE_AND_AT # else -# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55700 +# define KSYNTAXHIGHLIGHTING_DEPRECATED_WARNINGS_SINCE 0x55a00 # endif #endif diff --git a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt index acc2429ec84..6e86a05e9e3 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/data/CMakeLists.txt @@ -64,7 +64,7 @@ if (QRC_SYNTAX) # generate the qrc file manually, to make dependencies on generated files work... add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp" - COMMAND ${Qt5Core_RCC_EXECUTABLE} --name syntax_data -o "${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp" "${CMAKE_CURRENT_BINARY_DIR}/syntax-data.qrc" + COMMAND Qt${QT_MAJOR_VERSION}::rcc --name syntax_data -o "${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp" "${CMAKE_CURRENT_BINARY_DIR}/syntax-data.qrc" DEPENDS ${defs} ${CMAKE_CURRENT_BINARY_DIR}/index.katesyntax ) set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/qrc_syntax-data.cpp" PROPERTIES SKIP_AUTOMOC ON) @@ -79,5 +79,5 @@ endif() # 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) + target_link_libraries(SyntaxHighlightingData PRIVATE Qt${QT_MAJOR_VERSION}::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 1c1a3da4ba2..45057a8a054 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl @@ -1,7 +1,10 @@ + + + + ]> - + + + @@ -54,6 +59,9 @@ + + + @@ -87,6 +95,24 @@ + + + + + + + + + + + + + + + + + + @@ -94,25 +120,68 @@ beginRegion="" endRegion="" /> + + + - - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + @@ -132,9 +201,21 @@ + + + + + + + + + + + + - + @@ -153,33 +234,27 @@ - + + + - + + - - - - - - - - - - + - + @@ -198,7 +273,7 @@ - + @@ -229,6 +304,15 @@ + + + + + + + + + @@ -261,12 +345,12 @@ - - + + - + @@ -330,9 +414,12 @@ + + + @@ -351,8 +438,10 @@ - + + + @@ -360,7 +449,7 @@ - + diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml index ab26c2153b3..f5437900627 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml @@ -1,4 +1,4 @@ -version: 34 +version: 37 global-properties: - ALLOW_DUPLICATE_CUSTOM_TARGETS @@ -415,6 +415,7 @@ test-properties: - DEPENDS - DISABLED - ENVIRONMENT + - ENVIRONMENT_MODIFICATION # Since 3.22 - FAIL_REGULAR_EXPRESSION - FIXTURES_CLEANUP - FIXTURES_REQUIRED @@ -790,6 +791,7 @@ variables: - CMAKE_PROJECT_INCLUDE # Since 3.15 - CMAKE_PROJECT_INCLUDE_BEFORE # Since 3.15 - CMAKE_PROJECT__INCLUDE + - CMAKE_REQUIRE_FIND_PACKAGE_ # Since 3.22 - CMAKE_SKIP_INSTALL_ALL_DEPENDENCY - CMAKE_STAGING_PREFIX - CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS @@ -967,6 +969,7 @@ variables: - CMAKE__LINKER_LAUNCHER # Sine 3.21 - CMAKE__LINK_LIBRARY_FILE_FLAG # Sine 3.16 - CMAKE__LINK_LIBRARY_FLAG # Sine 3.16 + - CMAKE__LINK_WHAT_YOU_USE_FLAG # Since 3.22 - CMAKE__VISIBILITY_PRESET - CMAKE_LIBRARY_OUTPUT_DIRECTORY - CMAKE_LIBRARY_OUTPUT_DIRECTORY_ @@ -977,6 +980,7 @@ variables: - CMAKE_LINK_LIBRARY_FILE_FLAG - CMAKE_LINK_LIBRARY_FLAG - CMAKE_LINK_WHAT_YOU_USE + - CMAKE_LINK_WHAT_YOU_USE_CHECK # Since 3.22 - CMAKE_MACOSX_BUNDLE - CMAKE_MACOSX_RPATH - CMAKE_MAP_IMPORTED_CONFIG_ @@ -1055,6 +1059,10 @@ variables: - CMAKE_Fortran_MODDIR_DEFAULT - CMAKE_Fortran_MODDIR_FLAG - CMAKE_Fortran_MODOUT_FLAG + - CMAKE_HIP_ARCHITECTURES # Since 3.21 + - CMAKE_HIP_EXTENSIONS # Since 3.21 + - CMAKE_HIP_STANDARD # Since 3.21 + - CMAKE_HIP_STANDARD_REQUIRED # Since 3.21 - CMAKE_ISPC_HEADER_DIRECTORY # Since 3.19 - CMAKE_ISPC_HEADER_SUFFIX # Since 3.19.2 - CMAKE_ISPC_INSTRUCTION_SETS # Since 3.19 @@ -1075,6 +1083,8 @@ variables: - CMAKE__CREATE_SHARED_LIBRARY - CMAKE__CREATE_SHARED_MODULE - CMAKE__CREATE_STATIC_LIBRARY + - CMAKE__EXTENSIONS + - CMAKE__EXTENSIONS_DEFAULT # Since 3.22 - CMAKE__FLAGS - CMAKE__FLAGS_DEBUG - CMAKE__FLAGS_DEBUG_INIT @@ -1269,7 +1279,14 @@ variables: - CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM - CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL - CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND + # Fallback Interface Variables for `cmake_host_system_information` + # Since CMake 3.22 + - CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS + - CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ + - CMAKE_GET_OS_RELEASE_FALLBACK_RESULT # Well known CMake's official module's variables + # - BundleUtilities + - BU_CHMOD_BUNDLE_ITEMS # - CheckCompilerFlag # - CheckCCompilerFlag # - CheckSourceCompiles @@ -1289,6 +1306,13 @@ variables: # - CheckIncludeFile # - CheckIncludeFiles # - CheckLibraryExists + # - CheckPIESupported + - CMAKE_C_LINK_PIE_SUPPORTED + - CMAKE_CXX_LINK_PIE_SUPPORTED + - CMAKE_Fortran_LINK_PIE_SUPPORTED + - CMAKE_C_LINK_NO_PIE_SUPPORTED + - CMAKE_CXX_LINK_NO_PIE_SUPPORTED + - CMAKE_Fortran_LINK_NO_PIE_SUPPORTED # - CheckPrototypeDefinition # - CheckStructHasMember # - CheckSymbolExists @@ -1498,6 +1522,7 @@ variables: - CPACK_NSIS_BRANDING_TEXT # Since 3.20 - CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION # Since 3.20 - CPACK_NSIS_EXECUTABLE # Since 3.21 + - CPACK_NSIS_IGNORE_LICENSE_PAGE # Since 3.22 # - CPackNuGet (since 3.12) - CPACK_NUGET_COMPONENT_INSTALL - CPACK_NUGET_PACKAGE_NAME @@ -1655,6 +1680,7 @@ variables: - CPACK_RPM_SOURCE_PKG_BUILD_PARAMS - CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX - CPACK_RPM_BUILDREQUIRES + - CPACK_RPM_REQUIRES_EXCLUDE_FROM # Since 3.22 # - CPack - CPACK_PACKAGE_NAME - CPACK_PACKAGE_VENDOR @@ -1746,18 +1772,552 @@ variables: - ExternalData_CUSTOM_LOCATION - ExternalData_CUSTOM_FILE - ExternalData_CUSTOM_ERROR + # - FetchContent + - FETCHCONTENT_QUIET + - FETCHCONTENT_FULLY_DISCONNECTED + - FETCHCONTENT_UPDATES_DISCONNECTED + - FETCHCONTENT_SOURCE_DIR_ + - FETCHCONTENT_UPDATES_DISCONNECTED_ # - FindXXX module "standard" variables - _INCLUDE_DIRS - _LIBRARIES - _LIBRARY_DIRS - _VERSION_STRING + # NOTE For the other stanfard finders below variables matched + # the regular expressions above gonna be omitted. + # - FindALSA + - ALSA_LIBRARY + # - FindArmadillo + - ALSA_LIBRARY + # - FindASPELL + - ASPELL_EXECUTABLE + - ASPELL_DEFINITIONS + # - FindAVIFile + - AVIFILE_DEFINITIONS + # - FindBacktrace + - Backtrace_HEADER + - Backtrace_LIBRARY + # - FindBISON + - BISON_EXECUTABLE + - BISON__DEFINED + - BISON__INPUT + - BISON__OUTPUT_SOURCE + - BISON__OUTPUT_HEADER + - BISON__OUTPUTS + - BISON__COMPILE_FLAGS + # - FindBLAS + - BLA_STATIC + - BLA_VENDOR + - BLA_F95 + - BLA_PREFER_PKGCONFIG + - BLAS_LINKER_FLAGS + - BLA_SIZEOF_INTEGER # Since 3.22 + # - FindBoost + - Boost__LIBRARY + - Boost_VERSION_MACRO + - Boost_VERSION_COUNT + - Boost_INCLUDE_DIR + - Boost_LIBRARY_DIR_DEBUG + - Boost_LIBRARY_DIR_RELEASE + - Boost__LIBRARY_DEBUG + - Boost__LIBRARY_RELEASE + - BOOSTROOT + - BOOST_INCLUDEDIR + - BOOST_LIBRARYDIR + - Boost_NO_SYSTEM_PATHS + - Boost_ADDITIONAL_VERSIONS + - Boost_USE_DEBUG_LIBS + - Boost_USE_RELEASE_LIBS + - Boost_USE_MULTITHREADED + - Boost_USE_STATIC_LIBS + - Boost_USE_DEBUG_RUNTIME + - Boost_USE_DEBUG_PYTHON + - Boost_USE_STLPORT + - Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS + - Boost_COMPILER + - Boost_LIB_PREFIX + - Boost_ARCHITECTURE + - Boost_THREADAPI + - Boost_NAMESPACE + - Boost_DEBUG + - Boost_REALPATH + - Boost_NO_WARN_NEW_VERSIONS + # - FindBullet + # - FindBZip2 + - BZIP2_NEED_PREFIX + - BZIP2_INCLUDE_DIR + # - FindCABLE + - CABLE + - CABLE_TCL_LIBRARY + - CABLE_INCLUDE_DIR + # - FindCoin3D + # - FindCUDAToolkit + - CUDAToolkit_NVCC_EXECUTABLE + # - FindCups + - CUPS_INCLUDE_DIR + # - FindCURL + - CURL_NO_CURL_CMAKE + # - FindCurses + - CURSES_CFLAGS + - CURSES_HAVE_CURSES_H + - CURSES_HAVE_NCURSES_H + - CURSES_HAVE_NCURSES_NCURSES_H + - CURSES_HAVE_NCURSES_CURSES_H + - CURSES_NEED_NCURSES + - CURSES_NEED_WIDE + # - CURSES_LIBRARY deprecated + # - FindCVS + - CVS_EXECUTABLE + # - FindCxxTest + - CXXTEST_USE_PYTHON + - CXXTEST_TESTGEN_ARGS + - CXXTEST_PERL_TESTGEN_EXECUTABLE + - CXXTEST_PYTHON_TESTGEN_EXECUTABLE + - CXXTEST_TESTGEN_EXECUTABLE + - CXXTEST_TESTGEN_INTERPRETER + # - FindCygwin + # - FindDart + # - FindDCMTK + # - FindDevIL # - FindDoxygen - DOXYGEN_ + # - FindEnvModules + - EnvModules_COMMAND + # - FindEXPAT + # - FindFLEX + - FLEX_EXECUTABLE + # - FindFLTK + - FLTK_SKIP_OPENGL + - FLTK_SKIP_FORMS + - FLTK_SKIP_IMAGES + - FLTK_SKIP_FLUID + - FLTK_FLUID_EXECUTABLE + - FLTK_WRAP_UI + - FLTK_BASE_LIBRARY_RELEASE + - FLTK_BASE_LIBRARY_DEBUG + - FLTK_GL_LIBRARY_RELEASE + - FLTK_GL_LIBRARY_DEBUG + - FLTK_FORMS_LIBRARY_RELEASE + - FLTK_FORMS_LIBRARY_DEBUG + - FLTK_IMAGES_LIBRARY_RELEASE + - FLTK_IMAGES_LIBRARY_DEBUG + # - FindFLTK2 + - FLTK2_FLUID_EXECUTABLE + - FLTK2_WRAP_UI + - FLTK2_BASE_LIBRARY + - FLTK2_GL_LIBRARY + - FLTK2_IMAGES_LIBRARY + # - FindFontconfig + - Fontconfig_COMPILE_OPTIONS + # - FindFreetype + - FREETYPE_INCLUDE_DIR_ft2build + - FREETYPE_INCLUDE_DIR_freetype2 + # - FindGCCXML + - GCCXML + # - FindGDAL + - GDAL_LIBRARY + - FindGDAL_SKIP_GDAL_CONFIG + - GDAL_ADDITIONAL_LIBRARY_VERSIONS + # - FindGettext + - GETTEXT_MSGMERGE_EXECUTABLE + - GETTEXT_MSGFMT_EXECUTABLE + # - FindGIF + - GIF_LIBRARY + # - FindGit + - GIT_EXECUTABLE + # - FindGLEW + - GLEW_USE_STATIC_LIBS + - GLEW_VERBOSE + # - FindGLUT + - GLUT_glut_LIBRARY + - GLUT_Xmu_LIBRARY + - GLUT_Xi_LIBRARY + # - FindGnuplot + - GNUPLOT_EXECUTABLE + # - FindGnuTLS + - GNUTLS_DEFINITIONS + # - FindGSL + - GSL_CBLAS_LIBRARY + - GSL_CBLAS_LIBRARY_DEBUG + - GSL_CONFIG_EXECUTABLE + - GSL_LIBRARY + - GSL_LIBRARY_DEBUG + # - FindGTest + - GTEST_MSVC_SEARCH + # - FindGTK + # - FindGTK2 + - GTK2_TARGETS + - GTK2_DEFINITIONS + - GTK2_USE_IMPORTED_TARGETS + - GTK2_DEBUG + - GTK2_ADDITIONAL_SUFFIXES + # - FindHDF5 + - HDF5_DEFINITIONS + - HDF5_C_DEFINITIONS + - HDF5_CXX_DEFINITIONS + - HDF5_Fortran_DEFINITIONS + - HDF5_IS_PARALLEL + - HDF5_C_COMPILER_EXECUTABLE + - HDF5_CXX_COMPILER_EXECUTABLE + - HDF5_Fortran_COMPILER_EXECUTABLE + - HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE + - HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE + - HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE + - HDF5_DIFF_EXECUTABLE + - HDF5_PREFER_PARALLEL + - HDF5_FIND_DEBUG + - HDF5_NO_FIND_PACKAGE_CONFIG_FILE + # - FindHg + - HG_EXECUTABLE + #- _WC_CHANGESET + #- _WC_REVISION + # - FindHSPELL + # - FindHTMLHelp + - HTML_HELP_COMPILER + - HTML_HELP_LIBRARY + # - FindIce + # - FindIconv + - Iconv_IS_BUILT_IN + - Iconv_LIBRARY + # - FindIcotool + - ICOTOOL_EXECUTABLE + # - FindICU + - ICU_MAKEFILE_INC + - ICU_PKGDATA_INC + - ICU_

_EXECUTABLE + - ICU__LIBRARY + - ICU_DEBUG + # - FindImageMagick + # - FindIntl + - Intl_LIBRARY + - Intl_IS_BUILT_IN + # - FindITK + # - FindJasper + - JASPER_LIBRARY_RELEASE + - JASPER_LIBARRY_DEBUG + # - FindJava + - Java_JAVA_EXECUTABLE + - Java_JAVAC_EXECUTABLE + - Java_JAVAH_EXECUTABLE + - Java_JAVADOC_EXECUTABLE + - Java_IDLJ_EXECUTABLE + - Java_JAR_EXECUTABLE + - Java_JARSIGNER_EXECUTABLE + # - FindJNI + - JAVA_AWT_LIBRARY + - JAVA_JVM_LIBRARY + - JAVA_INCLUDE_PATH + - JAVA_INCLUDE_PATH2 + - JAVA_AWT_INCLUDE_PATH + # - FindJPEG + - JPEG_LIBRARY_RELEASE + - JPEG_LIBRARY_DEBUG + - JPEG_LIBRARY + # - FindKDE3 + # - FindKDE4 + # - FindLAPACK + - LAPACK_LINKER_FLAGS + # - FindLATEX + - LATEX_COMPILER + - PDFLATEX_COMPILER + - XELATEX_COMPILER + - LUALATEX_COMPILER + - BIBTEX_COMPILER + - BIBER_COMPILER + - MAKEINDEX_COMPILER + - XINDY_COMPILER + - DVIPS_CONVERTER + - DVIPDF_CONVERTER + - PS2PDF_CONVERTER + - PDFTOPS_CONVERTER + - LATEX2HTML_CONVERTER + - HTLATEX_COMPILER + # - FindLibArchive + # - FindLibinput + - Libinput_COMPILE_OPTIONS + # - FindLibLZMA + - LIBLZMA_HAS_AUTO_DECODER + - LIBLZMA_HAS_EASY_ENCODER + - LIBLZMA_HAS_LZMA_PRESET + # - FindLibXml2 + - LIBXML2_DEFINITIONS + - LIBXML2_XMLLINT_EXECUTABLE + - LIBXML2_LIBRARY + # - FindLibXslt + - LIBXSLT_DEFINITIONS + - LIBXSLT_XSLTPROC_EXECUTABLE + # - FindLTTngUST + - LTTNGUST_HAS_TRACEF + - LTTNGUST_HAS_TRACELOG + # - FindLua + # - FindLua50 + # - FindLua51 + # - FindMatlab + - MATLAB_FIND_DEBUG + - MATLAB_ADDITIONAL_VERSIONS + - Matlab_MAIN_PROGRAM + - Matlab_MEX_LIBRARY + - Matlab_MX_LIBRARY + - Matlab_ENG_LIBRARY + - Matlab_MAT_LIBRARY + - Matlab_ENGINE_LIBRARY + - Matlab_DATAARRAY_LIBRARY + - Matlab_MEX_COMPILER + - Matlab_MCC_COMPILER + - Matlab_MEX_EXTENSION + # - FindMFC + # - FindMotif + # - FindMPEG + - MPEG_mpeg2_LIBRARY + - MPEG_vo_LIBRARY + # - FindMPEG2 + - MPEG2_mpeg2_LIBRARY + - MPEG2_vo_LIBRARY + # - FindMPI + - MPI__COMPILER + - MPI__COMPILE_OPTIONS + - MPI__COMPILE_DEFINITIONS + - MPI_Fortran_HAVE_F77_HEADER + - MPI_Fortran_HAVE_F90_MODULE + - MPI_Fortran_HAVE_F08_MODULE + - MPIEXEC_EXECUTABLE + - MPIEXEC_NUMPROC_FLAG + - MPIEXEC_MAX_NUMPROCS + - MPIEXEC_PREFLAGS + - MPIEXEC_POSTFLAGS + - MPIEXEC_EXECUTABLE + - MPI_HOME + - MPI_COMPILER_FLAGS + - MPI_EXECUTABLE_SUFFIX + - MPI_GUESS_LIBRARY_NAME + - MPI_ASSUME_NO_BUILTIN_MPI + - MPI_SKIP_COMPILER_WRAPPER + - MPI_SKIP_GUESSING + - MPI_CXX_SKIP_MPICXX + - MPI__ADDITIONAL_INCLUDE_VARS + - MPI__LIBRARY + - MPI__LIB_NAMES + - MPI_DETERMINE_Fortran_CAPABILITIES + - MPI_SUBARRAYS_SUPPORTED + - MPI_ASYNC_PROTECTS_NONBLOCKING + - MPI_Fortran_F77_HEADER_SUBARRAYS + - MPI_Fortran_F77_HEADER_ASYNCPROT + - MPI_Fortran_F90_MODULE_SUBARRAYS + - MPI_Fortran_F90_MODULE_ASYNCPROT + - MPI_Fortran_F08_MODULE_SUBARRAYS + - MPI_Fortran_F08_MODULE_ASYNCPROT + # - FindMsys + # - FindODBC + - ODBC_CONFIG + - ODBC_LIBRARY + # - FindOpenACC + - OpenACC__FLAGS + - OpenACC__OPTIONS + - OpenACC__SPEC_DATE + - OpenACC_ACCEL_TARGET + # - FindOpenAL + - OPENAL_LIBRARY + # - FindOpenCL + - OpenCL_LIBRARY + # - FindOpenGL + - OPENGL_egl_LIBRARY + - OPENGL_glu_LIBRARY + - OPENGL_glx_LIBRARY + - OPENGL_opengl_LIBRARY + - OPENGL_gl_LIBRARY + - OpenGL_GL_PREFERENCE + # - FindOpenMP + - OpenMP__FLAGS + - OpenMP__LIB_NAMES + - OpenMP__LIBRARY + - OpenMP_Fortran_HAVE_OMPLIB_HEADER + - OpenMP_Fortran_HAVE_OMPLIB_MODULE + - OpenMP__SPEC_DATE + # - FindOpenSceneGraph + # - FindOpenSSL + - OPENSSL_CRYPTO_LIBRARY + - OPENSSL_SSL_LIBRARY + - OPENSSL_APPLINK_SOURCE + - OPENSSL_USE_STATIC_LIBS + - OPENSSL_MSVC_STATIC_RT + # - FindOpenThreads + # - Findosg + # - Findosg_functions + # - FindosgAnimation + # - FindosgDB + # - FindosgFX + # - FindosgGA + # - FindosgIntrospection + # - FindosgManipulator + # - FindosgParticle + # - FindosgPresentation + # - FindosgProducer + # - FindosgQt + # - FindosgShadow + # - FindosgSim + # - FindosgTerrain + # - FindosgText + # - FindosgUtil + # - FindosgViewer + # - FindosgVolume + # - FindosgWidget + # - FindPatch + - Patch_EXECUTABLE + # - FindPerl + - PERL_EXECUTABLE + # - FindPerlLibs + - PERL_SITESEARCH + - PERL_SITEARCH + - PERL_SITELIB + - PERL_VENDORARCH + - PERL_VENDORLIB + - PERL_ARCHLIB + - PERL_PRIVLIB + - PERL_UPDATE_ARCHLIB + - PERL_UPDATE_PRIVLIB + - PERL_EXTRA_C_FLAGS + # - FindPHP4 + - PHP4_INCLUDE_PATH + - PHP4_EXECUTABLE + # - FindPhysFS + - PHYSFS_LIBRARY + # - FindPike + - PIKE_INCLUDE_PATH + - PIKE_EXECUTABLE # - FindPkgConfig - PKG_CONFIG_EXECUTABLE - PKG_CONFIG_VERSION_STRING - PKG_CONFIG_USE_CMAKE_PREFIX_PATH - _MODULE_NAME # Since 3.16 + # - FindPNG + - PNG_DEFINITIONS + - PNG_LIBRARY + # - FindPostgreSQL + # - FindProducer + # - FindProtobuf + - Protobuf_SRC_ROOT_FOLDER + - Protobuf_IMPORT_DIRS + - Protobuf_DEBUG + - Protobuf_USE_STATIC_LIBS + - Protobuf_LIBRARY + - Protobuf_PROTOC_LIBRARY + - Protobuf_PROTOC_EXECUTABLE + - Protobuf_LIBRARY_DEBUG + - Protobuf_PROTOC_LIBRARY_DEBUG + - Protobuf_LITE_LIBRARY + - Protobuf_LITE_LIBRARY_DEBUG + # - FindPython + - Python_EXECUTABLE + - Python_INTERPRETER_ID + - Python_STDLIB + - Python_STDARCH + - Python_SITELIB + - Python_SITEARCH + - Python_SOABI + - Python_COMPILER + - Python_COMPILER_ID + - Python_DOTNET_LAUNCHER + - Python_LINK_OPTIONS + - Python_USE_STATIC_LIBS + - Python_FIND_ABI + - Python_FIND_STRATEGY + - Python_FIND_REGISTRY + - Python_FIND_FRAMEWORK + - Python_FIND_VIRTUALENV + - Python_FIND_IMPLEMENTATIONS + - Python_FIND_UNVERSIONED_NAMES + - Python_ARTIFACTS_INTERACTIVE + # - FindPython2 + - Python2_EXECUTABLE + - Python2_INTERPRETER_ID + - Python2_STDLIB + - Python2_STDARCH + - Python2_SITELIB + - Python2_SITEARCH + - Python2_SOABI + - Python2_COMPILER + - Python2_COMPILER_ID + - Python2_DOTNET_LAUNCHER + - Python2_LINK_OPTIONS + - Python2_USE_STATIC_LIBS + - Python2_FIND_ABI + - Python2_FIND_STRATEGY + - Python2_FIND_REGISTRY + - Python2_FIND_FRAMEWORK + - Python2_FIND_VIRTUALENV + - Python2_FIND_IMPLEMENTATIONS + - Python2_FIND_UNVERSIONED_NAMES + - Python2_ARTIFACTS_INTERACTIVE + # - FindPython3 + - Python3_EXECUTABLE + - Python3_INTERPRETER_ID + - Python3_STDLIB + - Python3_STDARCH + - Python3_SITELIB + - Python3_SITEARCH + - Python3_SOABI + - Python3_COMPILER + - Python3_COMPILER_ID + - Python3_DOTNET_LAUNCHER + - Python3_LINK_OPTIONS + - Python3_USE_STATIC_LIBS + - Python3_FIND_ABI + - Python3_FIND_STRATEGY + - Python3_FIND_REGISTRY + - Python3_FIND_FRAMEWORK + - Python3_FIND_VIRTUALENV + - Python3_FIND_IMPLEMENTATIONS + - Python3_FIND_UNVERSIONED_NAMES + - Python3_ARTIFACTS_INTERACTIVE + # - FindQt3 + # - FindQt4 + # - FindQuickTime + # - FindRTI + - RTI_DEFINITIONS + # - FindRuby + - Ruby_EXECUTABLE + - Ruby_FIND_VIRTUALENV + # - FindSDL + - SDL_LIBRARY + - SDL_BUILDING_LIBRARY + # - FindSDL_image + - SDLIMAGE_LIBRARY + # - FindSDL_mixer + - SDLMIXER_LIBRARY + # - FindSDL_net + - SDLNET_LIBRARY + # - FindSDL_sound + - SDL_SOUND_LIBRARY + # - FindSDL_ttf + - SDLTTF_LIBRARY + # - FindSelfPackers + # - FindSquish + - SQUISH_SERVER_EXECUTABLE + - SQUISH_CLIENT_EXECUTABLE + # - FindSQLite3 + # - FindSubversion + - Subversion_SVN_EXECUTABLE + - Subversion_VERSION_SVN + # _WC_URL + # _WC_ROOT + # _WC_REVISION + # _WC_LAST_CHANGED_AUTHOR + # _WC_LAST_CHANGED_DATE + # _WC_LAST_CHANGED_REV + # _WC_INFO + # - FindSWIG + - SWIG_EXECUTABLE + # - FindTCL + - TCL_INCLUDE_PATH + - TCL_TCLSH + - TK_LIBRARY + - TK_INCLUDE_PATH + - TK_WISH + # - FindTclsh + # - FindTclStub + - TCL_STUB_LIBRARY + - TK_STUB_LIBRARY + - TTK_STUB_LIBRARY # - FindThreads - CMAKE_THREAD_LIBS_INIT - CMAKE_USE_SPROC_INIT @@ -1766,6 +2326,62 @@ variables: - CMAKE_HP_PTHREADS_INIT - CMAKE_THREAD_PREFER_PTHREAD - THREADS_PREFER_PTHREAD_FLAG + # - FindTIFF + - TIFF_LIBRARY_RELEASE + - TIFF_LIBRARY_DEBUG + - TIFFXX_LIBRARY_RELEASE + - TIFFXX_LIBRARY_DEBUG + # - FindUnixCommands + # - FindVTK + # - FindVulkan + - Vulkan_LIBRARY + - Vulkan_GLSLC_EXECUTABLE + - Vulkan_GLSLANG_VALIDATOR_EXECUTABLE + # - FindWget + - WGET_EXECUTABLE + # - FindWish + # - FindwxWidgets + - wxWidgets_CONFIGURATION + - wxWidgets_EXCLUDE_COMMON_LIBRARIES + - wxWidgets_USE_DEBUG + - wxWidgets_USE_UNICODE + - wxWidgets_USE_UNIVERSAL + - wxWidgets_USE_STATIC + - wxWidgets_DEFINITIONS + - wxWidgets_DEFINITIONS_DEBUG + - wxWidgets_CXX_FLAGS + - wxWidgets_USE_FILE + # - FindX11 + # - FindXalanC + - XalanC_LIBRARY + # - FindXCTest + - XCTest_EXECUTABLE + # - FindXercesC + - XercesC_LIBRARY + # - FindXMLRPC + # - FindZLIB + # - FortranCInterface + # The following vars gonna match by regex + # - FortranCInterface_GLOBAL_FOUND + # - FortranCInterface_MODULE_FOUND + - FortranCInterface_GLOBAL_PREFIX + - FortranCInterface_GLOBAL_SUFFIX + - FortranCInterface_GLOBAL_CASE + - FortranCInterface_GLOBAL__PREFIX + - FortranCInterface_GLOBAL__SUFFIX + - FortranCInterface_GLOBAL__CASE + - FortranCInterface_MODULE_PREFIX + - FortranCInterface_MODULE_MIDDLE + - FortranCInterface_MODULE_SUFFIX + - FortranCInterface_MODULE_CASE + - FortranCInterface_MODULE__PREFIX + - FortranCInterface_MODULE__MIDDLE + - FortranCInterface_MODULE__SUFFIX + - FortranCInterface_MODULE__CASE + - FortranCInterface_VERIFIED_C + - FortranCInterface_VERIFIED_CXX + - FortranCInterface_GLOBAL_SYMBOLS + - FortranCInterface_MODULE_SYMBOLS # - GNUInstallDirs - CMAKE_INSTALL_BINDIR - CMAKE_INSTALL_FULL_BINDIR @@ -1799,6 +2415,8 @@ variables: - CMAKE_INSTALL_FULL_MANDIR - CMAKE_INSTALL_DOCDIR - CMAKE_INSTALL_FULL_DOCDIR + # - GoogleTest + - CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE # - InstallRequiredSystemLibraries - CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS - CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP @@ -1866,12 +2484,15 @@ environment-variables: # Environment Variables that Control the Build - CMAKE_APPLE_SILICON_PROCESSOR # Since 3.19.2 - CMAKE_BUILD_PARALLEL_LEVEL + - CMAKE_BUILD_TYPE # Since 3.22 + - CMAKE_CONFIGURATION_TYPES # Since 3.22 - CMAKE_CONFIG_TYPE - CMAKE_EXPORT_COMPILE_COMMANDS # Since 3.17 - CMAKE_GENERATOR - CMAKE_GENERATOR_INSTANCE - CMAKE_GENERATOR_PLATFORM - CMAKE_GENERATOR_TOOLSET + - CMAKE_INSTALL_MODE # Since 3.22 - CMAKE__COMPILER_LAUNCHER # Since 3.17 - CMAKE_MSVCIDE_RUN_PATH - CMAKE_NO_VERBOSE @@ -1951,6 +2572,9 @@ scripting-commands: , OS_RELEASE , OS_VERSION , OS_PLATFORM + # Since 3.22 + , DISTRIB_INFO + , DISTRIB_ ] - name: cmake_language @@ -2075,6 +2699,7 @@ scripting-commands: , IN_LIST , DEFINED ] + has-target-name-after-kw: TARGET nested-parentheses?: true - name: else @@ -2460,6 +3085,7 @@ scripting-commands: - name: if named-args: *if + has-target-name-after-kw: TARGET nested-parentheses?: true start-region: if - @@ -2671,6 +3297,7 @@ scripting-commands: - name: while named-args: *if + has-target-name-after-kw: TARGET nested-parentheses?: true start-region: while @@ -2703,6 +3330,7 @@ project-commands: , POST_BUILD ] nested-parentheses?: true + has-target-name-after-kw: TARGET - name: add_custom_target named-args: [ @@ -2721,17 +3349,22 @@ project-commands: , COMMAND_EXPAND_LISTS , SOURCES ] + first-arg-is-target?: true nested-parentheses?: true - name: add_definitions - name: add_dependencies + first-args-are-targets?: true - name: add_executable named-args: [WIN32, MACOSX_BUNDLE, EXCLUDE_FROM_ALL, IMPORTED, GLOBAL, ALIAS] + first-arg-is-target?: true - name: add_library named-args: [STATIC, SHARED, MODULE, OBJECT, EXCLUDE_FROM_ALL, IMPORTED, UNKNOWN, GLOBAL, ALIAS, INTERFACE] + first-arg-is-target?: true + has-target-name-after-kw: ALIAS - name: add_link_options - @@ -2750,6 +3383,7 @@ project-commands: , PARALLEL_LEVEL # Since 3.21 , TARGET ] + has-target-name-after-kw: TARGET - name: create_test_sourcelist named-args: [EXTRA_INCLUDE, FUNCTION] @@ -2760,7 +3394,7 @@ project-commands: - name: enable_language named-args: [OPTIONAL] - special-args: [ + special-args: &langs [ ASM , ASM-ATT , ASM_NASM @@ -2783,6 +3417,7 @@ project-commands: - name: export named-args: [EXPORT, NAMESPACE, FILE, TARGETS, APPEND, EXPORT_LINK_INTERFACE_LIBRARIES, ANDROID_MK] + has-target-names-after-kw: TARGETS - name: fltk_wrap_ui - @@ -2795,6 +3430,7 @@ project-commands: property-args: &get_source_file_property [source-properties] - name: get_target_property + second-arg-is-target?: true property-args: &get_target_property [target-properties] - name: get_test_property @@ -2882,6 +3518,7 @@ project-commands: , SETUID , SETGID ] + has-target-names-after-kw: TARGETS - name: link_directories named-args: [AFTER, BEFORE] @@ -2936,6 +3573,7 @@ project-commands: name: set_target_properties named-args: [PROPERTIES] property-args: *get_target_property + first-args-are-targets?: true # NOTE Multiple target args - name: set_tests_properties named-args: [PROPERTIES] @@ -2946,6 +3584,7 @@ project-commands: - name: target_compile_definitions named-args: &target_compile_definitions [INTERFACE, PUBLIC, PRIVATE] + first-arg-is-target?: true - name: target_compile_features named-args: *target_compile_definitions @@ -3032,9 +3671,11 @@ project-commands: , cuda_std_20 , cuda_std_23 # Since 3.21 ] + first-arg-is-target?: true - name: target_compile_options named-args: &target_compile_options [BEFORE, INTERFACE, PUBLIC, PRIVATE] + first-arg-is-target?: true - name: target_include_directories named-args: [ @@ -3045,23 +3686,29 @@ project-commands: , PUBLIC , PRIVATE ] + first-arg-is-target?: true - # Since 3.13 name: target_link_directories named-args: *target_compile_options + first-arg-is-target?: true - name: target_link_libraries named-args: *target_compile_definitions + first-arg-is-target?: true - name: target_link_options named-args: *target_compile_definitions + first-arg-is-target?: true - # Since 3.16 name: target_precompile_headers named-args: [INTERFACE, PUBLIC, PRIVATE, REUSE_FROM] + first-arg-is-target?: true - name: target_sources named-args: *target_compile_definitions + first-arg-is-target?: true - name: try_compile named-args: [ @@ -3191,3 +3838,1174 @@ ctest-commands: - name: ctest_upload named-args: [FILES, CAPTURE_CMAKE_ERROR, QUIET] + +modules: + # The modules listed here are part of the CMake distribution: + # https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html + utility: + - AndroidTestUtilities + - BundleUtilities + - CheckCCompilerFlag + - CheckCompilerFlag + - CheckCSourceCompiles + - CheckCSourceRuns + - CheckCXXCompilerFlag + - CheckCXXSourceCompiles + - CheckCXXSourceRuns + - CheckCXXSymbolExists + - CheckFortranCompilerFlag + - CheckFortranFunctionExists + - CheckFortranSourceCompiles + - CheckFortranSourceRuns + - CheckFunctionExists + - CheckIncludeFileCXX + - CheckIncludeFile + - CheckIncludeFiles + - CheckIPOSupported + - CheckLanguage + - CheckLibraryExists + - CheckLinkerFlag + - CheckOBJCCompilerFlag + - CheckOBJCSourceCompiles + - CheckOBJCSourceRuns + - CheckOBJCXXCompilerFlag + - CheckOBJCXXSourceCompiles + - CheckOBJCXXSourceRuns + - CheckPIESupported + - CheckPrototypeDefinition + - CheckSourceCompiles + - CheckSourceRuns + - CheckStructHasMember + - CheckSymbolExists + - CheckTypeSize + - CheckVariableExists + - CMakeAddFortranSubdirectory + - CMakeBackwardCompatibilityCXX + - CMakeDependentOption + - CMakeFindDependencyMacro + - CMakeFindFrameworks + # NOTE The commented modules below are not for `include()` + # - CMakeFindPackageMode + # - CMakeGraphVizOptions + - CMakePackageConfigHelpers + - CMakePrintHelpers + - CMakePrintSystemInformation + - CMakePushCheckState + # NOTE The commented module below is not for `include()` + # - CMakeVerifyManifest + - CPack + - CPackComponent + - CPackIFW + - CPackIFWConfigureFile + - CSharpUtilities + - CTest + - CTestCoverageCollectGCOV + - CTestScriptMode + - CTestUseLaunchers + - Dart + - DeployQt4 + - ExternalData + - ExternalProject + - FeatureSummary + - FetchContent + - FindPackageHandleStandardArgs + - FindPackageMessage + - FortranCInterface + - GenerateExportHeader + - GNUInstallDirs + - GoogleTest + - InstallRequiredSystemLibraries + - ProcessorCount + - SelectLibraryConfigurations + # NOTE The commented module below is not for `include()` + # - SquishTestScript + - TestForANSIForScope + - TestForANSIStreamHeaders + - TestForSSTREAM + - TestForSTDNamespace + - UseEcos + - UseJava + - UseSWIG + - UsewxWidgets + + finder: + - FindALSA + - FindArmadillo + - FindASPELL + - FindAVIFile + - FindBacktrace + - FindBISON + - FindBLAS + - FindBoost + - FindBullet + - FindBZip2 + - FindCABLE + - FindCoin3D + - FindCUDAToolkit + - FindCups + - FindCURL + - FindCurses + - FindCVS + - FindCxxTest + - FindCygwin + - FindDart + - FindDCMTK + - FindDevIL + - FindDoxygen + - FindEnvModules + - FindEXPAT + - FindFLEX + - FindFLTK + - FindFLTK2 + - FindFontconfig + - FindFreetype + - FindGCCXML + - FindGDAL + - FindGettext + - FindGIF + - FindGit + - FindGLEW + - FindGLUT + - FindGnuplot + - FindGnuTLS + - FindGSL + - FindGTest + - FindGTK + - FindGTK2 + - FindHDF5 + - FindHg + - FindHSPELL + - FindHTMLHelp + - FindIce + - FindIconv + - FindIcotool + - FindICU + - FindImageMagick + - FindIntl + - FindITK + - FindJasper + - FindJava + - FindJNI + - FindJPEG + - FindKDE3 + - FindKDE4 + - FindLAPACK + - FindLATEX + - FindLibArchive + - FindLibinput + - FindLibLZMA + - FindLibXml2 + - FindLibXslt + - FindLTTngUST + - FindLua + - FindLua50 + - FindLua51 + - FindMatlab + - FindMFC + - FindMotif + - FindMPEG + - FindMPEG2 + - FindMPI + - FindMsys + - FindODBC + - FindOpenACC + - FindOpenAL + - FindOpenCL + - FindOpenGL + - FindOpenMP + - FindOpenSceneGraph + - FindOpenSSL + - FindOpenThreads + - Findosg + - Findosg_functions + - FindosgAnimation + - FindosgDB + - FindosgFX + - FindosgGA + - FindosgIntrospection + - FindosgManipulator + - FindosgParticle + - FindosgPresentation + - FindosgProducer + - FindosgQt + - FindosgShadow + - FindosgSim + - FindosgTerrain + - FindosgText + - FindosgUtil + - FindosgViewer + - FindosgVolume + - FindosgWidget + - FindPatch + - FindPerl + - FindPerlLibs + - FindPHP4 + - FindPhysFS + - FindPike + - FindPkgConfig + - FindPNG + - FindPostgreSQL + - FindProducer + - FindProtobuf + - FindPython + - FindPython2 + - FindPython3 + - FindQt3 + - FindQt4 + - FindQuickTime + - FindRTI + - FindRuby + - FindSDL + - FindSDL_image + - FindSDL_mixer + - FindSDL_net + - FindSDL_sound + - FindSDL_ttf + - FindSelfPackers + - FindSquish + - FindSQLite3 + - FindSubversion + - FindSWIG + - FindTCL + - FindTclsh + - FindTclStub + - FindThreads + - FindTIFF + - FindUnixCommands + - FindVTK + - FindVulkan + - FindWget + - FindWish + - FindwxWidgets + - FindX11 + - FindXalanC + - FindXCTest + - FindXercesC + - FindXMLRPC + - FindZLIB + + deprecated: + # Deprecated Utility Modules + - AddFileDependencies + - CMakeDetermineVSServicePack + - CMakeExpandImportedTargets + - CMakeForceCompiler + - CMakeParseArguments + - Documentation + - MacroAddFileDependencies + - TestCXXAcceptsFlag + - UseJavaClassFilelist + - UseJavaSymlinks + - UsePkgConfig + - Use_wxWindows + - WriteBasicConfigVersionFile + - WriteCompilerDetectionHeader + # Deprecated Find Modules + - FindCUDA + - FindPythonInterp + - FindPythonLibs + - FindQt + - FindwxWindows + # Legacy CPack Modules + - CPackArchive + - CPackBundle + - CPackCygwin + - CPackDeb + - CPackDMG + - CPackFreeBSD + - CPackNSIS + - CPackNuGet + - CPackPackageMaker + - CPackProductBuild + - CPackRPM + - CPackWIX + # ATTENTION The following modules still in the list of the standard modules + # however, the docs claims that they have been deprecated + - GetPrerequisites + - TestBigEndian + +standard-module-commands: + # AndroidTestUtilities + - + name: android_add_test_data + named-args: + - FILES + - FILES_DEST + - LIBS + - LIBS_DEST + - DEVICE_OBJECT_STORE + - DEVICE_TEST_DIR + - NO_LINK_REGEX + # BundleUtilities + - name: fixup_bundle + - name: copy_and_fixup_bundle + - name: verify_app + - name: get_bundle_main_executable + - name: get_dotapp_dir + - name: get_bundle_and_executable + - name: get_bundle_all_executables + - name: get_item_key + - name: get_item_rpaths + - name: clear_bundle_keys + - name: set_bundle_key_values + - name: get_bundle_keys + - name: copy_resolved_item_into_bundle + - name: copy_resolved_framework_into_bundle + - name: fixup_bundle_item + - name: verify_bundle_prerequisites + - name: verify_bundle_symlinks + # CheckCCompilerFlag + - name: check_c_compiler_flag + # CheckCompilerFlag + - name: check_compiler_flag + # CheckCSourceCompiles + - + name: check_c_source_compiles + named-args: &ccsc [FAIL_REGEX] + # CheckCSourceRuns + - name: check_c_source_runs + # CheckCXXCompilerFlag + - name: check_cxx_compiler_flag + # CheckCXXSourceCompiles + - + name: check_cxx_source_compiles + named-args: *ccsc + # CheckCXXSourceRuns + - name: check_cxx_source_runs + # CheckCXXSymbolExists + - name: check_cxx_symbol_exists + # CheckFortranCompilerFlag + - name: check_fortran_compiler_flag + # CheckFortranFunctionExists + - name: check_fortran_function_exists + # CheckFortranSourceCompiles + - + name: check_fortran_source_compiles + named-args: &frse [FAIL_REGEX, SRC_EXT] + # CheckFortranSourceRuns + - + name: check_fortran_source_runs + named-args: &se [SRC_EXT] + # CheckFunctionExists + - name: check_function_exists + # CheckIncludeFileCXX + - name: check_include_file_cxx + # CheckIncludeFile + - name: check_include_file + # CheckIncludeFiles + - + name: check_include_files + named-args: &l [LANGUAGE] + special-args: &ccxx [C, CXX] + # CheckIPOSupported + - + name: check_ipo_supported + named-args: [RESULT, OUTPUT, LANGUAGES] + special-args: &ccxxf [C, CXX, Fortran] + # CheckLanguage + - + name: check_language + special-args: *langs + # CheckLibraryExists + - name: check_library_exists + # CheckLinkerFlag + - name: check_linker_flag + # CheckOBJCCompilerFlag + - name: check_objc_compiler_flag + # CheckOBJCSourceCompiles + - + name: check_objc_source_compiles + named-args: *ccsc + # CheckOBJCSourceRuns + - name: check_objc_source_runs + # CheckOBJCXXCompilerFlag + - name: check_objcxx_compiler_flag + # CheckOBJCXXSourceCompiles + - + name: check_objcxx_source_compiles + named-args: *ccsc + # CheckOBJCXXSourceRuns + - name: check_objcxx_source_runs + # CheckPIESupported + - + name: check_pie_supported + named-args: [OUTPUT_VARIABLE, LANGUAGES] + special-args: *ccxxf + # CheckPrototypeDefinition + - name: check_prototype_definition + # CheckSourceCompiles + - + name: check_source_compiles + named-args: *frse + # CheckSourceRuns + - + name: check_source_runs + named-args: *se + # CheckStructHasMember + - + name: check_struct_has_member + named-args: *l + special-args: *ccxx + # CheckSymbolExists + - name: check_symbol_exists + # CheckTypeSize + - + name: check_type_size + named-args: [BUILTIN_TYPES_ONLY, LANGUAGE] + special-args: *ccxx + # CheckVariableExists + - name: check_variable_exists + # CMakeAddFortranSubdirectory + - + name: cmake_add_fortran_subdirectory + named-args: + - PROJECT + - ARCHIVE_DIR + - RUNTIME_DIR + - LIBRARIES + - LINK_LIBRARIES + - LINK_LIBS + - CMAKE_COMMAND_LINE + - NO_EXTERNAL_INSTALL + # CMakeBackwardCompatibilityCXX + # CMakeDependentOption + - name: cmake_dependent_option + # CMakeFindDependencyMacro + - name: find_dependency + # CMakeFindFrameworks + # CMakeFindPackageMode + # CMakeGraphVizOptions + # CMakePackageConfigHelpers + - + name: configure_package_config_file + named-args: + - INSTALL_DESTINATION + - PATH_VARS + - NO_SET_AND_CHECK_MACRO + - NO_CHECK_REQUIRED_COMPONENTS_MACRO + - INSTALL_PREFIX + - + name: write_basic_package_version_file + named-args: + - VERSION + - COMPATIBILITY + - ARCH_INDEPENDENT + special-args: [AnyNewerVersion, SameMajorVersion, SameMinorVersion, ExactVersion] + # CMakePrintHelpers + - + name: cmake_print_properties + named-args: + - TARGETS + - SOURCES + - DIRECTORIES + - TESTS + - CACHE_ENTRIES + - PROPERTIES + has-target-names-after-kw: TARGETS + # CMakePrintSystemInformation + # CMakePushCheckState + - + name: cmake_push_check_state + named-args: [RESET] + - name: cmake_pop_check_state + - name: cmake_reset_check_state + # CMakeVerifyManifest + # CPack + # CPackComponent + - + name: cpack_add_component + named-args: + - DISPLAY_NAME + - DESCRIPTION + - HIDDEN + - REQUIRED + - DISABLED + - GROUP + - DEPENDS + - INSTALL_TYPES + - DOWNLOADED + - ARCHIVE_FILE + - PLIST + - + name: cpack_add_component_group + named-args: + - DISPLAY_NAME + - DESCRIPTION + - PARENT_GROUP + - EXPANDED + - BOLD_TITLE + - + name: cpack_add_install_type + named-args: [DISPLAY_NAME] + - + name: cpack_configure_downloads + named-args: + - UPLOAD_DIRECTORY + - ALL + - ADD_REMOVE + - NO_ADD_REMOVE + # CPackIFW + - + name: cpack_ifw_configure_component + named-args: + - COMMON + - ESSENTIAL + - VIRTUAL + - FORCED_INSTALLATION + - REQUIRES_ADMIN_RIGHTS] + - NAME + - DISPLAY_NAME + - DESCRIPTION + - UPDATE_TEXT + - VERSION + - RELEASE_DATE + - SCRIPT + - PRIORITY + - SORTING_PRIORITY + - DEPENDS + - DEPENDENCIES + - AUTO_DEPEND_ON + - LICENSES + - DEFAULT + - USER_INTERFACES + - TRANSLATIONS + - REPLACES + - CHECKABLE + - + name: cpack_ifw_configure_component_group + named-args: + - VIRTUAL + - FORCED_INSTALLATION + - REQUIRES_ADMIN_RIGHTS + - NAME + - DISPLAY_NAME + - DESCRIPTION + - UPDATE_TEXT + - VERSION + - RELEASE_DATE + - SCRIPT + - PRIORITY + - SORTING_PRIORITY + - DEPENDS + - DEPENDENCIES + - AUTO_DEPEND_ON + - LICENSES + - DEFAULT + - USER_INTERFACES + - TRANSLATIONS + - REPLACES + - CHECKABLE + - + name: cpack_ifw_add_repository + named-args: + - DISABLED + - URL + - USERNAME + - PASSWORD + - DISPLAY_NAME + - + name: cpack_ifw_update_repository + named-args: + - ADD + - REMOVE + - URL + - REPLACE + - OLD_URL + - NEW_URL + - USERNAME + - PASSWORD + - DISPLAY_NAME + - name: cpack_ifw_add_package_resources + # CPackIFWConfigureFile + - name: cpack_ifw_configure_file + # CSharpUtilities + - name: csharp_set_windows_forms_properties + - name: csharp_set_designer_cs_properties + - name: csharp_set_xaml_cs_properties + - name: csharp_get_filename_keys + - name: csharp_get_filename_key_base + - name: csharp_get_dependentupon_name + # CTest + # CTestCoverageCollectGCOV + - + name: ctest_coverage_collect_gcov + named-args: + - TARBALL + - TARBALL_COMPRESSION + - SOURCE + - BUILD + - GCOV_COMMAND + - GCOV_OPTIONS + - GLOB + - DELETE + - QUIET + # CTestScriptMode + # CTestUseLaunchers + # Dart + # DeployQt4 + - name: write_qt4_conf + - name: resolve_qt4_paths + - name: fixup_qt4_executable + - name: install_qt4_plugin_path + - name: install_qt4_plugin + - name: install_qt4_executable + # ExternalData + - name: ExternalData_Expand_Arguments + - name: ExternalData_Add_Test + - + name: ExternalData_Add_Target + named-args: [SHOW_PROGRESS] + # ExternalProject + - + name: ExternalProject_Add + named-args: + - PREFIX + - TMP_DIR + - STAMP_DIR + - LOG_DIR + - DOWNLOAD_DIR + - SOURCE_DIR + - BINARY_DIR + - INSTALL_DIR + - DOWNLOAD_COMMAND + - URL + - URL_HASH + - URL_MD5 + - DOWNLOAD_NAME + - DOWNLOAD_NO_EXTRACT + - DOWNLOAD_NO_PROGRESS + - TIMEOUT + - INACTIVITY_TIMEOUT + - HTTP_USERNAME + - HTTP_PASSWORD + - HTTP_HEADER + - TLS_VERIFY + - TLS_CAINFO + - NETRC + - NETRC_FILE + - GIT_REPOSITORY + - GIT_TAG + - GIT_REMOTE_NAME + - GIT_SUBMODULES + - GIT_SUBMODULES_RECURSE + - GIT_SHALLOW + - GIT_PROGRESS + - GIT_CONFIG + - GIT_REMOTE_UPDATE_STRATEGY + - SVN_REPOSITORY + - SVN_REVISION + - SVN_USERNAME + - SVN_PASSWORD + - SVN_TRUST_CERT + - HG_REPOSITORY + - HG_TAG + - CVS_REPOSITORY + - CVS_MODULE + - CVS_TAG + - UPDATE_COMMAND + - UPDATE_DISCONNECTED + - PATCH_COMMAND + - CONFIGURE_COMMAND + - CMAKE_COMMAND + - CMAKE_GENERATOR + - CMAKE_GENERATOR_PLATFORM + - CMAKE_GENERATOR_TOOLSET + - CMAKE_GENERATOR_INSTANCE + - CMAKE_ARGS + - CMAKE_CACHE_ARGS + - CMAKE_CACHE_DEFAULT_ARGS + - SOURCE_SUBDIR + - CONFIGURE_HANDLED_BY_BUILD + - BUILD_COMMAND + - BUILD_IN_SOURCE + - BUILD_ALWAYS + - BUILD_BYPRODUCTS + - INSTALL_COMMAND + - TEST_COMMAND + - TEST_BEFORE_INSTALL + - TEST_AFTER_INSTALL + - TEST_EXCLUDE_FROM_MAIN + - LOG_DOWNLOAD + - LOG_UPDATE + - LOG_PATCH + - LOG_CONFIGURE + - LOG_BUILD + - LOG_INSTALL + - LOG_TEST + - LOG_MERGED_STDOUTERR + - LOG_OUTPUT_ON_FAILURE + - USES_TERMINAL_DOWNLOAD + - USES_TERMINAL_UPDATE + - USES_TERMINAL_CONFIGURE + - USES_TERMINAL_BUILD + - USES_TERMINAL_INSTALL + - USES_TERMINAL_TEST + - DEPENDS + - EXCLUDE_FROM_ALL + - STEP_TARGETS + - INDEPENDENT_STEP_TARGETS + - LIST_SEPARATOR + - COMMAND + special-args: [IGNORED, OPTIONAL, REQUIRED, CHECKOUT, REBASE, REBASE_CHECKOUT] + property-args: *get_target_property + - name: ExternalProject_Get_Property + - + name: ExternalProject_Add_Step + named-args: + - COMMAND + - COMMENT + - DEPENDEES + - DEPENDERS + - DEPENDS + - INDEPENDENT + - BYPRODUCTS + - ALWAYS + - EXCLUDE_FROM_MAIN + - WORKING_DIRECTORY + - LOG + - USES_TERMINAL + - + name: ExternalProject_Add_StepTargets + named-args: + - NO_DEPENDS + - name: ExternalProject_Add_StepDependencies + # FeatureSummary + - + name: feature_summary + named-args: + - FILENAME + - APPEND + - VAR + - INCLUDE_QUIET_PACKAGES + - FATAL_ON_MISSING_REQUIRED_PACKAGES + - DESCRIPTION + - DEFAULT_DESCRIPTION + - QUIET_ON_EMPTY + - WHAT + - ALL + - PACKAGES_FOUND + - PACKAGES_NOT_FOUND + - ENABLED_FEATURES + - DISABLED_FEATURES + - + name: set_package_properties + named-args: + - PROPERTIES + - URL + - DESCRIPTION + - TYPE + - RUNTIME + - OPTIONAL + - RECOMMENDED + - REQUIRED + - PURPOSE + - name: add_feature_info + - name: set_package_info + - name: set_feature_info + - name: print_enabled_features + - name: print_disabled_features + # FetchContent + - + name: FetchContent_Declare + named-args: + - DOWNLOAD_COMMAND + - URL + - URL_HASH + - URL_MD5 + - DOWNLOAD_NAME + - DOWNLOAD_NO_EXTRACT + - DOWNLOAD_NO_PROGRESS + - TIMEOUT + - INACTIVITY_TIMEOUT + - HTTP_USERNAME + - HTTP_PASSWORD + - HTTP_HEADER + - TLS_VERIFY + - TLS_CAINFO + - NETRC + - NETRC_FILE + - GIT_REPOSITORY + - GIT_TAG + - GIT_REMOTE_NAME + - GIT_SUBMODULES + - GIT_SUBMODULES_RECURSE + - GIT_SHALLOW + - GIT_PROGRESS + - GIT_CONFIG + - GIT_REMOTE_UPDATE_STRATEGY + - SVN_REPOSITORY + - SVN_REVISION + - SVN_USERNAME + - SVN_PASSWORD + - SVN_TRUST_CERT + - HG_REPOSITORY + - HG_TAG + - CVS_REPOSITORY + - CVS_MODULE + - CVS_TAG + - UPDATE_COMMAND + - UPDATE_DISCONNECTED + - PATCH_COMMAND + - SOURCE_SUBDIR + - + name: FetchContent_Populate + named-args: + - QUIET + - SUBBUILD_DIR + - SOURCE_DIR + - BINARY_DIR + - DOWNLOAD_COMMAND + - URL + - URL_HASH + - URL_MD5 + - DOWNLOAD_NAME + - DOWNLOAD_NO_EXTRACT + - DOWNLOAD_NO_PROGRESS + - TIMEOUT + - INACTIVITY_TIMEOUT + - HTTP_USERNAME + - HTTP_PASSWORD + - HTTP_HEADER + - TLS_VERIFY + - TLS_CAINFO + - NETRC + - NETRC_FILE + - GIT_REPOSITORY + - GIT_TAG + - GIT_REMOTE_NAME + - GIT_SUBMODULES + - GIT_SUBMODULES_RECURSE + - GIT_SHALLOW + - GIT_PROGRESS + - GIT_CONFIG + - GIT_REMOTE_UPDATE_STRATEGY + - SVN_REPOSITORY + - SVN_REVISION + - SVN_USERNAME + - SVN_PASSWORD + - SVN_TRUST_CERT + - HG_REPOSITORY + - HG_TAG + - CVS_REPOSITORY + - CVS_MODULE + - CVS_TAG + - UPDATE_COMMAND + - UPDATE_DISCONNECTED + - PATCH_COMMAND + - SOURCE_SUBDIR + - + name: FetchContent_GetProperties + named-args: + - SOURCE_DIR + - BINARY_DIR + - POPULATED + - name: FetchContent_MakeAvailable + # FindPackageHandleStandardArgs + - + name: find_package_handle_standard_args + named-args: + - DEFAULT_MSG + - FOUND_VAR + - REQUIRED_VARS + - VERSION_VAR + - HANDLE_VERSION_RANGE + - HANDLE_COMPONENTS + - CONFIG_MODE + - NAME_MISMATCHED + - REASON_FAILURE_MESSAGE + - FAIL_MESSAGE + - + name: find_package_check_version + named-args: + - HANDLE_VERSION_RANGE + - RESULT_MESSAGE_VARIABLE + # FindPackageMessage + - name: find_package_message + # FortranCInterface + - + name: FortranCInterface_HEADER + named-args: + - MACRO_NAMESPACE + - SYMBOL_NAMESPACE + - SYMBOLS + - + name: FortranCInterface_VERIFY + named-args: [CXX, QUIET] + # GenerateExportHeader + - + name: generate_export_header + named-args: + - BASE_NAME + - EXPORT_MACRO_NAME + - EXPORT_FILE_NAME + - DEPRECATED_MACRO_NAME + - NO_EXPORT_MACRO_NAME + - INCLUDE_GUARD_NAME + - STATIC_DEFINE + - NO_DEPRECATED_MACRO_NAME + - DEFINE_NO_DEPRECATED + - PREFIX_NAME + - CUSTOM_CONTENT_FROM_VARIABLE + first-arg-is-target?: true + # GetPrerequisites (NOTE The module has functions but has been deprecated) + # GNUInstallDirs + - name: GNUInstallDirs_get_absolute_install_dir + # GoogleTest + - + name: gtest_add_tests + named-args: + - TARGET + - SOURCES + - EXTRA_ARGS + - WORKING_DIRECTORY + - TEST_PREFIX + - TEST_SUFFIX + - SKIP_DEPENDENCY + - TEST_LIST + has-target-name-after-kw: TARGET + - + name: gtest_discover_tests # Since 3.10 + named-args: + - EXTRA_ARGS + - WORKING_DIRECTORY + - TEST_PREFIX + - TEST_SUFFIX + - TEST_FILTER # Since 3.22 + - NO_PRETTY_TYPES + - NO_PRETTY_VALUES + - PROPERTIES + - TEST_LIST + - DISCOVERY_TIMEOUT + - XML_OUTPUT_DIR + - DISCOVERY_MODE + special-args: [POST_BUILD, PRE_TEST] + first-arg-is-target?: true + # InstallRequiredSystemLibraries + # ProcessorCount + - name: processorcount + # SelectLibraryConfigurations + - name: select_library_configurations + # SquishTestScript + # TestBigEndian + - name: test_big_endian + # TestForANSIForScope + # TestForANSIStreamHeaders + # TestForSSTREAM + # TestForSTDNamespace + # UseEcos + - name: ecos_add_include_directories + - name: ecos_add_executable + - name: ecos_add_target_lib + - name: ecos_adjust_directory + - name: ecos_use_arm_elf_tools + - name: ecos_use_i386_elf_tools + - name: ecos_use_ppc_eabi_tools + # UseJava + - + name: add_jar + named-args: + - SOURCES + - RESOURCES + - NAMESPACE + - INCLUDE_JARS + - ENTRY_POINT + - VERSION + - MANIFEST + - OUTPUT_NAME + - OUTPUT_DIR + - GENERATE_NATIVE_HEADERS + - DESTINATION + - INSTALL + - BUILD + first-arg-is-target?: true + - + name: install_jar + named-args: &dc [DESTINATION, COMPONENT] + first-arg-is-target?: true + - + name: install_jni_symlink + named-args: *dc + first-arg-is-target?: true + - + name: create_javah + named-args: + - TARGET + - GENERATED_FILES + - CLASSES + - CLASSPATH + - DEPENDS + - OUTPUT_NAME + - OUTPUT_DIR + has-target-name-after-kw: TARGET + - + name: install_jar_exports + named-args: + - TARGETS + - NAMESPACE + - FILE + - DESTINATION + - COMPONENT + has-target-names-after-kw: TARGETS + - + name: export_jars + named-args: + - TARGETS + - NAMESPACE + - FILE + has-target-names-after-kw: TARGETS + - + name: find_jar + named-args: + - NAMES + - PATHS + - ENV + - VERSIONS + - DOC + - + name: create_javadoc + named-args: + - PACKAGES + - FILES + - SOURCEPATH + - CLASSPATH + - INSTALLPATH + - DOCTITLE + - WINDOWTITLE + - AUTHOR + - USE + - VERSION + # UseSWIG + - + name: swig_add_library + named-args: + - TYPE + - SHARED + - MODULE + - STATIC + - USE_BUILD_SHARED_LIBS + - LANGUAGE + - NO_PROXY + - OUTPUT_DIR + - OUTFILE_DIR + - SOURCES + - name: swig_link_libraries + # UsewxWidgets + # NOTE Some standard finder modules also provide commands + # FindSquish + - + name: squish_add_test + named-args: + - AUT + - SUITE + - TEST + - SETTINGSGROUP + - PRE_COMMAND + - POST_COMMAND + # FindBISON + - + name: bison_target + named-args: + - COMPILE_FLAGS + - DEFINES_FILE + - VERBOSE + - REPORT_FILE + # FindCxxTest + - name: cxxtest_add_test + # FindDoxygen + - + name: doxygen_add_docs + named-args: [ALL, USE_STAMP_FILE, WORKING_DIRECTORY, COMMENT] + # FindEnvModules + - + name: env_module + named-args: [COMMAND, OUTPUT_VARIABLE, RESULT_VARIABLE] + - + name: env_module_swap + named-args: [OUTPUT_VARIABLE, RESULT_VARIABLE] + - name: env_module_list + - name: env_module_avail + # FindFLEX + - + name: flex_target + named-args: + - COMPILE_FLAGS + - DEFINES_FILE + - name: add_flex_bison_dependency + # FindGettext + - + name: gettext_create_translations + named-args: [ALL] + - + name: gettext_process_pot_file + named-args: [ALL, INSTALL_DESTINATION, LANGUAGES] + - + name: gettext_process_po_files + named-args: [ALL, INSTALL_DESTINATION, PO_FILES] + # FindHg + - name: hg_wc_info + # FindMatlab + - name: matlab_get_version_from_release_name + - name: matlab_get_release_name_from_version + - name: matlab_extract_all_installed_versions_from_registry + - name: matlab_get_all_valid_matlab_roots_from_registry + - name: matlab_get_mex_suffix + - name: matlab_get_version_from_matlab_run + - + name: matlab_add_unit_test + named-args: + - NAME + - UNITTEST_FILE + - CUSTOM_TEST_COMMAND + - UNITTEST_PRECOMMAND + - TIMEOUT + - ADDITIONAL_PATH + - MATLAB_ADDITIONAL_STARTUP_OPTIONS + - TEST_ARGS + - NO_UNITTEST_FRAMEWORK + - + name: matlab_add_mex + named-args: + - NAME + - EXECUTABLE + - MODULE + - SHARED + - SRC + - OUTPUT_NAME + - DOCUMENTATION + - LINK_TO + - EXCLUDE_FROM_ALL + special-args: [R2017b, R2018a] + # FindPkgConfig + - + name: pkg_check_modules + named-args: &pkgcm + - REQUIRED + - QUIET + - NO_CMAKE_PATH + - NO_CMAKE_ENVIRONMENT_PATH + - IMPORTED_TARGET + - GLOBAL + - + name: pkg_search_module + named-args: *pkgcm + - + name: pkg_get_variable + # FindProtobuf + - + name: protobuf_generate_cpp + named-args: [DESCRIPTORS, EXPORT_MACRO] + - + name: protobuf_generate_python + # FindPython + - + name: Python_add_library + named-args: [STATIC, SHARED, MODULE, WITH_SOABI] + # FindSubversion + - + name: Subversion_WC_INFO + named-args: [IGNORE_SVN_FAILURE] + - + name: Subversion_WC_LOG + # FindXCTest + - name: xctest_add_bundle + - name: xctest_add_test 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 24b1eb0d7cc..dfe77e4627e 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 @@ -57,7 +57,7 @@ def try_transform_placeholder_string_to_regex(name): if 'ARGV' in m: return 'ARGV[0-9]+' - return '&id_re;'.join(m) if 1 < len(m) else name + return '&var_ref_re;'.join(m) if 1 < len(m) else name def try_placeholders_to_regex(names): @@ -109,6 +109,26 @@ def transform_command(cmd): cmd['nested_parentheses'] = cmd['nested-parentheses?'] if 'nested-parentheses?' in cmd else False + if 'first-arg-is-target?' in cmd: + cmd['first_arg_is_target'] = cmd['first-arg-is-target?'] + can_be_nulary = False + + if 'first-args-are-targets?' in cmd: + cmd['first_args_are_targets'] = cmd['first-args-are-targets?'] + can_be_nulary = False + + if 'has-target-name-after-kw' in cmd: + cmd['has_target_name_after_kw'] = cmd['has-target-name-after-kw'] + can_be_nulary = False + + if 'has-target-names-after-kw' in cmd: + cmd['has_target_names_after_kw'] = cmd['has-target-names-after-kw'] + can_be_nulary = False + + if 'second-arg-is-target?' in cmd: + cmd['second_arg_is_target'] = cmd['second-arg-is-target?'] + can_be_nulary = False + if 'nulary?' in cmd and cmd['nulary?'] and not can_be_nulary: raise RuntimeError('Command `{}` w/ args declared nulary!?'.format(cmd['name'])) @@ -124,8 +144,7 @@ def transform_command(cmd): #BEGIN Jinja filters def cmd_is_nulary(cmd): - assert not ('named-args' in cmd or 'special-args' in cmd or 'property-args' in cmd) - return 'nulary?' in cmd and cmd['nulary?'] + return cmd.setdefault('nulary?', False) #END Jinja filters @@ -134,7 +153,7 @@ def cmd_is_nulary(cmd): @click.argument('input_yaml', type=click.File('r')) @click.argument('template', type=click.File('r'), default='./cmake.xml.tpl') def cli(input_yaml, template): - data = yaml.load(input_yaml) + data = yaml.load(input_yaml, Loader=yaml.BaseLoader) # Partition `variables` and `environment-variables` lists into "pure" (key)words and regexes to match for var_key in _VAR_KIND_LIST: @@ -164,8 +183,16 @@ def cli(input_yaml, template): data['commands'] = list( map( transform_command - , data['scripting-commands'] + data['project-commands'] + data['ctest-commands']) + , data['scripting-commands'] + data['project-commands'] + data['ctest-commands'] + ) ) + data['standard_module_commands'] = list( + map( + transform_command + , data['standard-module-commands'] + ) + ) + del data['standard-module-commands'] # Fix node names to be accessible from Jinja template data['generator_expressions'] = data['generator-expressions'] diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl b/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl index 58cc80f960b..b9944a2bd04 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/spdx-comments.xml.tpl @@ -1,7 +1,12 @@ + - - - + diff --git a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd index fa510e0d147..fdea0dd7521 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd +++ b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd @@ -130,8 +130,8 @@ extensions: A file glob or pattern to decide for which documents to use this syntax description style: The style that this highlighter provides. It is used through required-syntax-style by the indenters. [optional] mimetype: A list of mimetypes to decide for which documents to use this syntax description [optional] - version: Version number of this syntax description [optional] - kateversion: Kate version required for using this file [optional] + version: Version number of this syntax description + kateversion: Kate version required for using this file casesensitive: Whether text is matched case sensitive. [boolean, optional, default=true] FIXME: This is not implemented yet priority: Priority of this language, if more than one are usable for the file [optional] author: Name of author of this hl file [optional] diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml index c7b21cb2a01..72e200cce2d 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/bash.xml @@ -39,7 +39,7 @@ ]> - + arch awk + b2sum + base32 + base64 bash bunzip2 bzcat @@ -147,11 +150,15 @@ bzmore cat chattr + chcon chgrp chmod chown chvt + cksum cp + crontab + csplit date dd deallocvt @@ -165,9 +172,11 @@ dumpkeys ed egrep + expand false fgconsole fgrep + fold fuser gawk getkeycodes @@ -178,7 +187,9 @@ gunzip gzexe gzip + hostid hostname + iconv igawk install kbd_mode @@ -206,6 +217,7 @@ lzmainfo lzmore mapscrn + md5sum mesg mkdir mkfifo @@ -217,20 +229,29 @@ nano netstat nisdomainname + nproc nroff + numfmt openvt + paste + pathchk pgawk pidof ping + pinky + printenv ps pstree + ptx rbash readlink + realpath red resizecons rm rmdir run-parts + runcon sash sed setfont @@ -239,22 +260,33 @@ setmetamode setserial sh + sha1sum + sha224sum + sha256sum + sha384sum + sha512sum showkey shred + shuf sleep ssed stat + stdbuf stty su sync tar tempfile + timeout touch + tput troff true truncate + tty umount uname + unexpand unicode_start unicode_stop unlink @@ -263,6 +295,7 @@ utmpdump uuidgen vdir + vi wall wc xz @@ -336,6 +369,7 @@ gc gcc clang + clang++ valgrind xdg-open cmake @@ -464,6 +498,19 @@ + + + + + + + + + + + + + @@ -1104,6 +1151,7 @@ + diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml index d8676a250db..e94885b856f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml @@ -1,7 +1,10 @@ + + + + ]> - + + - + - + + - + + - + + - + + - + + - + + - + @@ -3102,154 +4678,175 @@ + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + - + + - + + - + + - + + - + + + - + + - + + - + + - + + - + @@ -3257,9 +4854,10 @@ + - + @@ -3267,17 +4865,19 @@ + - + + - + @@ -3294,101 +4894,116 @@ + - + + - + + - + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + @@ -3405,9 +5020,10 @@ + - + @@ -3424,186 +5040,239 @@ + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + - + + + + + + + + + + - + - + + - + - + + - - + + + + + + - + + + + + + + + + + - + - + + + + + + + + + + - + + + - + + - + + - + - + + - + + - + + + - + + - + @@ -3620,40 +5289,55 @@ + - + + - + + - + + + + + + + + + + + + - + + - + @@ -3661,122 +5345,159 @@ + - + + - + + - + + - + + - + + - + + + + + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + - + + + + + + + + + + + + - + @@ -3784,268 +5505,1824 @@ + - + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + - + + + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - + - + - + - + - - + + - + - + @@ -4069,6 +7346,15 @@ + + + + + + + + + @@ -4101,12 +7387,12 @@ - - + + - + @@ -4170,9 +7456,12 @@ + + + @@ -4191,8 +7480,10 @@ - + + + @@ -4200,7 +7491,7 @@ - + diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml index f03587977a4..b850cca6733 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml @@ -90,7 +90,7 @@ ]> - + @@ -149,32 +149,42 @@ - - - - - - - + + + + + + - + - + - + - + - + + + + + + + + + + + + @@ -320,6 +330,7 @@ + @@ -404,6 +415,10 @@ + + + + diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/spdx-comments.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/spdx-comments.xml index e64399098c3..7d893119279 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/spdx-comments.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/spdx-comments.xml @@ -1,7 +1,12 @@ + - 0BSD - AAL - ADSL - AFL-1.1 - AFL-1.2 - AFL-2.0 - AFL-2.1 - AFL-3.0 - AGPL-1.0-only - AGPL-1.0-or-later - AGPL-3.0-only - AGPL-3.0-or-later - AMDPLPA - AML - AMPAS - ANTLR-PD - ANTLR-PD-fallback - APAFML - APL-1.0 - APSL-1.0 - APSL-1.1 - APSL-1.2 - APSL-2.0 - Abstyles - Adobe-2006 - Adobe-Glyph - Afmparse - Aladdin - Apache-1.0 - Apache-1.1 - Apache-2.0 - Artistic-1.0 - Artistic-1.0-Perl - Artistic-1.0-cl8 - Artistic-2.0 - BSD-1-Clause - BSD-2-Clause - BSD-2-Clause-Patent - BSD-2-Clause-Views - BSD-3-Clause - BSD-3-Clause-Attribution - BSD-3-Clause-Clear - BSD-3-Clause-LBNL - BSD-3-Clause-No-Nuclear-License - BSD-3-Clause-No-Nuclear-License-2014 - BSD-3-Clause-No-Nuclear-Warranty - BSD-3-Clause-Open-MPI - BSD-4-Clause - BSD-4-Clause-UC - BSD-Protection - BSD-Source-Code - BSL-1.0 - BUSL-1.1 - Bahyph - Barr - Beerware - BitTorrent-1.0 - BitTorrent-1.1 - BlueOak-1.0.0 - Borceux - CAL-1.0 - CAL-1.0-Combined-Work-Exception - CATOSL-1.1 - CC-BY-1.0 - CC-BY-2.0 - CC-BY-2.5 - CC-BY-3.0 - CC-BY-3.0-AT - CC-BY-3.0-US - CC-BY-4.0 - CC-BY-NC-1.0 - CC-BY-NC-2.0 - CC-BY-NC-2.5 - CC-BY-NC-3.0 - CC-BY-NC-4.0 - CC-BY-NC-ND-1.0 - CC-BY-NC-ND-2.0 - CC-BY-NC-ND-2.5 - CC-BY-NC-ND-3.0 - CC-BY-NC-ND-3.0-IGO - CC-BY-NC-ND-4.0 - CC-BY-NC-SA-1.0 - CC-BY-NC-SA-2.0 - CC-BY-NC-SA-2.5 - CC-BY-NC-SA-3.0 - CC-BY-NC-SA-4.0 - CC-BY-ND-1.0 - CC-BY-ND-2.0 - CC-BY-ND-2.5 - CC-BY-ND-3.0 - CC-BY-ND-4.0 - CC-BY-SA-1.0 - CC-BY-SA-2.0 - CC-BY-SA-2.0-UK - CC-BY-SA-2.5 - CC-BY-SA-3.0 - CC-BY-SA-3.0-AT - CC-BY-SA-4.0 - CC-PDDC - CC0-1.0 - CDDL-1.0 - CDDL-1.1 - CDLA-Permissive-1.0 - CDLA-Sharing-1.0 - CECILL-1.0 - CECILL-1.1 - CECILL-2.0 - CECILL-2.1 - CECILL-B - CECILL-C - CERN-OHL-1.1 - CERN-OHL-1.2 - CERN-OHL-P-2.0 - CERN-OHL-S-2.0 - CERN-OHL-W-2.0 - CNRI-Jython - CNRI-Python - CNRI-Python-GPL-Compatible - CPAL-1.0 - CPL-1.0 - CPOL-1.02 - CUA-OPL-1.0 - Caldera - ClArtistic - Condor-1.1 - Crossword - CrystalStacker - Cube - D-FSL-1.0 - DOC - DSDP - Dotseqn - ECL-1.0 - ECL-2.0 - EFL-1.0 - EFL-2.0 - EPICS - EPL-1.0 - EPL-2.0 - EUDatagrid - EUPL-1.0 - EUPL-1.1 - EUPL-1.2 - Entessa - ErlPL-1.1 - Eurosym - FSFAP - FSFUL - FSFULLR - FTL - Fair - Frameworx-1.0 - FreeImage - GFDL-1.1-invariants-only - GFDL-1.1-invariants-or-later - GFDL-1.1-no-invariants-only - GFDL-1.1-no-invariants-or-later - GFDL-1.1-only - GFDL-1.1-or-later - GFDL-1.2-invariants-only - GFDL-1.2-invariants-or-later - GFDL-1.2-no-invariants-only - GFDL-1.2-no-invariants-or-later - GFDL-1.2-only - GFDL-1.2-or-later - GFDL-1.3-invariants-only - GFDL-1.3-invariants-or-later - GFDL-1.3-no-invariants-only - GFDL-1.3-no-invariants-or-later - GFDL-1.3-only - GFDL-1.3-or-later - GL2PS - GLWTPL - GPL-1.0-only - GPL-1.0-or-later - GPL-2.0-only - GPL-2.0-or-later - GPL-3.0-only - GPL-3.0-or-later - Giftware - Glide - Glulxe - HPND - HPND-sell-variant - HTMLTIDY - HaskellReport - Hippocratic-2.1 - IBM-pibs - ICU - IJG - IPA - IPL-1.0 - ISC - ImageMagick - Imlib2 - Info-ZIP - Intel - Intel-ACPI - Interbase-1.0 - JPNIC - JSON - JasPer-2.0 - LAL-1.2 - LAL-1.3 - LGPL-2.0-only - LGPL-2.0-or-later - LGPL-2.1-only - LGPL-2.1-or-later - LGPL-3.0-only - LGPL-3.0-or-later - LGPLLR - LPL-1.0 - LPL-1.02 - LPPL-1.0 - LPPL-1.1 - LPPL-1.2 - LPPL-1.3a - LPPL-1.3c - Latex2e - Leptonica - LiLiQ-P-1.1 - LiLiQ-R-1.1 - LiLiQ-Rplus-1.1 - Libpng - Linux-OpenIB - MIT - MIT-0 - MIT-CMU - MIT-advertising - MIT-enna - MIT-feh - MIT-open-group - MITNFA - MPL-1.0 - MPL-1.1 - MPL-2.0 - MPL-2.0-no-copyleft-exception - MS-PL - MS-RL - MTLL - MakeIndex - MirOS - Motosoto - MulanPSL-1.0 - MulanPSL-2.0 - Multics - Mup - NASA-1.3 - NBPL-1.0 - NCGL-UK-2.0 - NCSA - NGPL - NIST-PD - NIST-PD-fallback - NLOD-1.0 - NLPL - NOSL - NPL-1.0 - NPL-1.1 - NPOSL-3.0 - NRL - NTP - NTP-0 - Naumen - Net-SNMP - NetCDF - Newsletr - Nokia - Noweb - O-UDA-1.0 - OCCT-PL - OCLC-2.0 - ODC-By-1.0 - ODbL-1.0 - OFL-1.0 - OFL-1.0-RFN - OFL-1.0-no-RFN - OFL-1.1 - OFL-1.1-RFN - OFL-1.1-no-RFN - OGC-1.0 - OGL-Canada-2.0 - OGL-UK-1.0 - OGL-UK-2.0 - OGL-UK-3.0 - OGTSL - OLDAP-1.1 - OLDAP-1.2 - OLDAP-1.3 - OLDAP-1.4 - OLDAP-2.0 - OLDAP-2.0.1 - OLDAP-2.1 - OLDAP-2.2 - OLDAP-2.2.1 - OLDAP-2.2.2 - OLDAP-2.3 - OLDAP-2.4 - OLDAP-2.5 - OLDAP-2.6 - OLDAP-2.7 - OLDAP-2.8 - OML - OPL-1.0 - OSET-PL-2.1 - OSL-1.0 - OSL-1.1 - OSL-2.0 - OSL-2.1 - OSL-3.0 - OpenSSL - PDDL-1.0 - PHP-3.0 - PHP-3.01 - PSF-2.0 - Parity-6.0.0 - Parity-7.0.0 - Plexus - PolyForm-Noncommercial-1.0.0 - PolyForm-Small-Business-1.0.0 - PostgreSQL - Python-2.0 - QPL-1.0 - Qhull - RHeCos-1.1 - RPL-1.1 - RPL-1.5 - RPSL-1.0 - RSA-MD - RSCPL - Rdisc - Ruby - SAX-PD - SCEA - SGI-B-1.0 - SGI-B-1.1 - SGI-B-2.0 - SHL-0.5 - SHL-0.51 - SISSL - SISSL-1.2 - SMLNJ - SMPPL - SNIA - SPL-1.0 - SSH-OpenSSH - SSH-short - SSPL-1.0 - SWL - Saxpath - Sendmail - Sendmail-8.23 - SimPL-2.0 - Sleepycat - Spencer-86 - Spencer-94 - Spencer-99 - SugarCRM-1.1.3 - TAPR-OHL-1.0 - TCL - TCP-wrappers - TMate - TORQUE-1.1 - TOSL - TU-Berlin-1.0 - TU-Berlin-2.0 - UCL-1.0 - UPL-1.0 - Unicode-DFS-2015 - Unicode-DFS-2016 - Unicode-TOU - Unlicense - VOSTROM - VSL-1.0 - Vim - W3C - W3C-19980720 - W3C-20150513 - WTFPL - Watcom-1.0 - Wsuipa - X11 - XFree86-1.1 - XSkat - Xerox - Xnet - YPL-1.0 - YPL-1.1 - ZPL-1.1 - ZPL-2.0 - ZPL-2.1 - Zed - Zend-2.0 - Zimbra-1.3 - Zimbra-1.4 - Zlib - blessing - bzip2-1.0.5 bzip2-1.0.6 - copyleft-next-0.3.0 - copyleft-next-0.3.1 - curl - diffmark - dvipdfm + Intel-ACPI + XSkat + CC-BY-NC-SA-2.0 + Plexus + Giftware + BitTorrent-1.0 + APSL-1.1 + UPL-1.0 + Caldera + Zend-2.0 + CUA-OPL-1.0 + JPNIC + SAX-PD + CC-BY-ND-2.5 eGenix - etalab-2.0 - gSOAP-1.3b + LGPLLR + OLDAP-2.2.2 + CC-BY-ND-3.0-DE + IPA + NCSA + W3C + Adobe-2006 + Net-SNMP + CC-BY-SA-4.0 + YPL-1.0 + MITNFA + PHP-3.01 + BSD-Source-Code + CC-BY-SA-2.5 + Motosoto + OSL-1.1 + NGPL + CC-BY-2.5-AU + Unicode-TOU + BSD-3-Clause-No-Nuclear-License + OPUBL-1.0 + CC-BY-NC-SA-2.0-UK + NLOD-2.0 gnuplot + EPICS + Info-ZIP + OLDAP-2.0 + CERN-OHL-P-2.0 + BSD-3-Clause-No-Nuclear-Warranty + AML + MulanPSL-1.0 + Multics + VSL-1.0 + RSA-MD + CC-PDDC + CC-BY-SA-2.1-JP + LPPL-1.2 + Spencer-94 + OLDAP-1.2 + O-UDA-1.0 + OLDAP-2.7 + Glulxe iMatix - libpng-2.0 - libselinux-1.0 + TAPR-OHL-1.0 + NBPL-1.0 + LiLiQ-R-1.1 + Noweb + CC0-1.0 + BSD-Protection + CC-BY-NC-2.5 + Zlib + GFDL-1.3-invariants-or-later + CC-BY-3.0-AT + LPPL-1.3c + EPL-1.0 + GFDL-1.1-invariants-or-later + ANTLR-PD-fallback + OLDAP-2.4 + OLDAP-2.3 + ZPL-2.1 + Apache-2.0 + SGI-B-2.0 + Hippocratic-2.1 + CC-BY-SA-3.0-DE + CC-BY-NC-SA-1.0 + LGPL-2.1-or-later + CC-BY-3.0-US + TCP-wrappers + GFDL-1.2-invariants-or-later + Eurosym + LPPL-1.0 + SGI-B-1.0 + APL-1.0 libtiff - mpich2 - psfrag - psutils - xinetd + AFL-2.1 + CC-BY-NC-1.0 + GD + AFL-1.1 + CC-BY-NC-ND-3.0-IGO + Unicode-DFS-2015 + GFDL-1.2-only + MPL-1.1 + GPL-2.0-only + CC-BY-NC-4.0 + FreeImage + SHL-0.51 + CNRI-Jython + ZPL-1.1 + Afmparse + OLDAP-2.1 + Rdisc + Imlib2 + BSD-4-Clause-Shortened + Sendmail + CC-BY-2.5 + AAL + MPL-2.0-no-copyleft-exception + CC-BY-NC-ND-2.5 + CC-BY-3.0-NL + LPL-1.02 + ECL-1.0 + OFL-1.0-no-RFN + CC-BY-NC-SA-3.0-DE + CC-BY-SA-3.0 + NTP + MPL-2.0 + APSL-1.2 + GFDL-1.2-no-invariants-only + Artistic-2.0 + RSCPL + Sleepycat xpp + CDLA-Sharing-1.0 + ClArtistic + AGPL-1.0-only + CC-BY-3.0-DE + AFL-2.0 + Intel + GFDL-1.1-no-invariants-or-later + APAFML + SISSL + Naumen + HTMLTIDY + OLDAP-2.8 + blessing + CC-BY-ND-2.0 + OGTSL + LGPL-2.0-or-later + Parity-7.0.0 + CC-BY-ND-1.0 + dvipdfm + CNRI-Python + BSD-4-Clause-UC + NLOD-1.0 + MS-RL + CC-BY-NC-SA-4.0 + HaskellReport + CC-BY-1.0 + UCL-1.0 + Mup + SMPPL + PHP-3.0 + GL2PS + CrystalStacker + W3C-20150513 + NIST-PD-fallback + OGL-UK-1.0 + CPL-1.0 + LGPL-2.1-only + ZPL-2.0 + Frameworx-1.0 + AGPL-3.0-only + DRL-1.0 + EFL-2.0 + Spencer-99 + CAL-1.0-Combined-Work-Exception + GFDL-1.1-invariants-only + TCL + SHL-0.5 + OFL-1.0-RFN + CERN-OHL-W-2.0 + Glide + mpich2 + psutils + SPL-1.0 + Apache-1.1 + CC-BY-ND-4.0 + FreeBSD-DOC + SCEA + Latex2e + Artistic-1.0-cl8 + SGI-B-1.1 + NRL + SWL + Zed + CERN-OHL-1.1 + RHeCos-1.1 + JasPer-2.0 + SSPL-1.0 + OLDAP-1.4 + libpng-2.0 + CNRI-Python-GPL-Compatible + Aladdin + CECILL-1.0 + Ruby + NPL-1.1 + ImageMagick + Cube + GFDL-1.1-only + CC-BY-2.0 + AFL-1.2 + CC-BY-SA-2.0 + CECILL-2.0 + MIT-advertising + CC-BY-NC-SA-2.5 + Artistic-1.0 + OSL-3.0 + X11 + Bahyph + OLDAP-2.0.1 + EUDatagrid + MTLL + GFDL-1.2-invariants-only + GFDL-1.3-no-invariants-or-later + curl + LAL-1.3 + DSDP + CERN-OHL-1.2 + TOSL + CC-BY-3.0 + Qhull + GFDL-1.3-no-invariants-only + TORQUE-1.1 + MS-PL + Apache-1.0 + copyleft-next-0.3.1 + GFDL-1.2-or-later + MulanPSL-2.0 + FSFAP + Xerox + CDDL-1.0 + GFDL-1.3-invariants-only + etalab-2.0 + XFree86-1.1 + SNIA + LPPL-1.1 + CATOSL-1.1 + TU-Berlin-2.0 + GFDL-1.3-or-later + LAL-1.2 + ICU + FTL + MirOS + CC-BY-NC-ND-3.0 + OSET-PL-2.1 + CC-BY-NC-ND-2.0 + SISSL-1.2 + Wsuipa + Zimbra-1.4 + Linux-OpenIB + OLDAP-2.5 + AMPAS + GPL-1.0-or-later + BUSL-1.1 + Adobe-Glyph + 0BSD + W3C-19980720 + FSFUL + CC-BY-NC-SA-3.0 + DOC + TMate + MIT-open-group + AMDPLPA + Condor-1.1 + PolyForm-Noncommercial-1.0.0 + BSD-3-Clause-No-Military-License + CC-BY-4.0 + OGL-Canada-2.0 + CC-BY-NC-SA-3.0-IGO + EFL-1.0 + Newsletr + copyleft-next-0.3.0 + GPL-3.0-or-later + CDLA-Permissive-2.0 + CC-BY-ND-3.0 + C-UDA-1.0 + Barr + Vim + BitTorrent-1.1 + CDL-1.0 + CC-BY-SA-1.0 + ADSL + PostgreSQL + OFL-1.1 + NPL-1.0 + xinetd + LGPL-2.0-only zlib-acknowledgement + OLDAP-2.2.1 + APSL-1.0 + BSD-3-Clause-LBNL + GLWTPL + LGPL-3.0-only + OGC-1.0 + Dotseqn + MakeIndex + GPL-3.0-only + BSD-3-Clause-No-Nuclear-License-2014 + GPL-1.0-only + IJG + AGPL-1.0-or-later + OFL-1.1-no-RFN + BSL-1.0 + Libpng + CC-BY-NC-3.0 + CC-BY-NC-2.0 + Unlicense + LPL-1.0 + bzip2-1.0.5 + Entessa + BSD-2-Clause-Patent + ECL-2.0 + Crossword + CC-BY-NC-ND-1.0 + OCLC-2.0 + CECILL-1.1 + CECILL-2.1 + OGDL-Taiwan-1.0 + Abstyles + libselinux-1.0 + ANTLR-PD + GPL-2.0-or-later + IPL-1.0 + MIT-enna + CPOL-1.02 + CC-BY-SA-3.0-AT + BSD-1-Clause + NTP-0 + SugarCRM-1.1.3 + MIT + OFL-1.1-RFN + Watcom-1.0 + CC-BY-NC-SA-2.0-FR + ODbL-1.0 + FSFULLR + OLDAP-1.3 + SSH-OpenSSH + BSD-2-Clause + HPND + Zimbra-1.3 + Borceux + OLDAP-1.1 + OFL-1.0 + NASA-1.3 + VOSTROM + MIT-0 + ISC + Unicode-DFS-2016 + BlueOak-1.0.0 + LiLiQ-Rplus-1.1 + NOSL + SMLNJ + CPAL-1.0 + PSF-2.0 + RPL-1.5 + MIT-Modern-Variant + Nokia + GFDL-1.1-no-invariants-only + PDDL-1.0 + EUPL-1.0 + CDDL-1.1 + GFDL-1.3-only + OLDAP-2.6 + JSON + LGPL-3.0-or-later + Fair + OSL-2.1 + LPPL-1.3a + NAIST-2003 + CC-BY-NC-ND-4.0 + CC-BY-NC-3.0-DE + OPL-1.0 + HPND-sell-variant + QPL-1.0 + EUPL-1.2 + GFDL-1.2-no-invariants-or-later + NCGL-UK-2.0 + Beerware + BSD-3-Clause-Open-MPI + CECILL-B + EPL-2.0 + MIT-feh + RPL-1.1 + CDLA-Permissive-1.0 + Python-2.0 + MPL-1.0 + GFDL-1.1-or-later + diffmark + OpenSSL + OSL-1.0 + Parity-6.0.0 + YPL-1.1 + SSH-short + IBM-pibs + Xnet + TU-Berlin-1.0 + CAL-1.0 + AFL-3.0 + CECILL-C + OGL-UK-3.0 + BSD-3-Clause-Clear + BSD-3-Clause-Modification + CC-BY-SA-2.0-UK + Saxpath + NLPL + SimPL-2.0 + psfrag + Spencer-86 + OCCT-PL + CERN-OHL-S-2.0 + ErlPL-1.1 + MIT-CMU + NIST-PD + OSL-2.0 + APSL-2.0 + Leptonica + PolyForm-Small-Business-1.0.0 + LiLiQ-P-1.1 + NetCDF + OML + AGPL-3.0-or-later + OLDAP-2.2 + BSD-3-Clause + WTFPL + OGL-UK-2.0 + BSD-3-Clause-Attribution + RPSL-1.0 + CC-BY-NC-ND-3.0-DE + EUPL-1.1 + Sendmail-8.23 + ODC-By-1.0 + D-FSL-1.0 + BSD-4-Clause + BSD-2-Clause-Views + Artistic-1.0-Perl + NPOSL-3.0 + gSOAP-1.3b + Interbase-1.0 + GPL-1.0 + GPL-2.0-with-GCC-exception + wxWindows + Nunit + GFDL-1.1 + GPL-2.0 + GFDL-1.2 + LGPL-2.0 + GPL-3.0-with-autoconf-exception + GFDL-1.3 + BSD-2-Clause-NetBSD + LGPL-3.0 + GPL-2.0-with-classpath-exception + GPL-3.0-with-GCC-exception + BSD-2-Clause-FreeBSD + GPL-3.0 + GPL-2.0-with-font-exception + eCos-2.0 + GPL-2.0-with-bison-exception + GPL-2.0-with-autoconf-exception AGPL-1.0 AGPL-3.0 - BSD-2-Clause-FreeBSD - BSD-2-Clause-NetBSD - GFDL-1.1 - GFDL-1.2 - GFDL-1.3 - GPL-1.0 - GPL-2.0 - GPL-2.0-with-GCC-exception - GPL-2.0-with-autoconf-exception - GPL-2.0-with-bison-exception - GPL-2.0-with-classpath-exception - GPL-2.0-with-font-exception - GPL-3.0 - GPL-3.0-with-GCC-exception - GPL-3.0-with-autoconf-exception - LGPL-2.0 LGPL-2.1 - LGPL-3.0 - Nunit StandardML-NJ - eCos-2.0 - wxWindows - GCC-exception-2.0 - openvpn-openssl-exception - GPL-3.0-linking-exception - Fawkes-Runtime-exception - u-boot-exception-2.0 - PS-or-PDF-font-exception-20170817 - gnu-javamail-exception - LGPL-3.0-linking-exception - DigiRule-FOSS-exception - LLVM-exception - Linux-syscall-note - GPL-3.0-linking-source-exception - Qwt-exception-1.0 - 389-exception - mif-exception - eCos-exception-2.0 - CLISP-exception-2.0 - Bison-exception-2.2 - Libtool-exception - LZMA-exception - OpenJDK-assembly-exception-1.0 - Font-exception-2.0 - OCaml-LGPL-linking-exception - GCC-exception-3.1 - Bootloader-exception - SHL-2.0 - Classpath-exception-2.0 - Swift-exception - Autoconf-exception-2.0 - FLTK-exception - freertos-exception-2.0 - Universal-FOSS-exception-1.0 - WxWindows-exception-3.1 - OCCT-exception-1.0 - Autoconf-exception-3.0 - i2p-gpl-java-exception GPL-CC-1.0 - Qt-LGPL-exception-1.1 - SHL-2.1 + openvpn-openssl-exception + WxWindows-exception-3.1 + GPL-3.0-linking-exception + i2p-gpl-java-exception + OpenJDK-assembly-exception-1.0 + mif-exception + CLISP-exception-2.0 + freertos-exception-2.0 + Bison-exception-2.2 + OCCT-exception-1.0 + Autoconf-exception-2.0 + LLVM-exception + GCC-exception-3.1 + Font-exception-2.0 + Libtool-exception + u-boot-exception-2.0 + Swift-exception + eCos-exception-2.0 + OCaml-LGPL-linking-exception Qt-GPL-exception-1.0 + Linux-syscall-note + Bootloader-exception + PS-or-PDF-font-exception-20170817 + Universal-FOSS-exception-1.0 + Classpath-exception-2.0 + Qwt-exception-1.0 + LZMA-exception + Autoconf-exception-3.0 + DigiRule-FOSS-exception + 389-exception + SHL-2.0 + GCC-exception-2.0 + GPL-3.0-linking-source-exception + Qt-LGPL-exception-1.1 + Fawkes-Runtime-exception + gnu-javamail-exception + FLTK-exception + LGPL-3.0-linking-exception + SHL-2.1 diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/oblivion.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/oblivion.theme index a433fb883a4..87dac8a5d35 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/oblivion.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/oblivion.theme @@ -162,9 +162,9 @@ "MarkError": "#cc0000", "MarkExecution": "#888a85", "MarkWarning": "#ad7fa8", - "ModifiedLines": "#451e1a", + "ModifiedLines": "#cc0000", "ReplaceHighlight": "#356703", - "SavedLines": "#23321a", + "SavedLines": "#4e9a06", "SearchHighlight": "#4e9a06", "Separator": "#787775", "SpellChecking": "#e85848", diff --git a/src/libs/3rdparty/syntax-highlighting/src/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/CMakeLists.txt index beac3d50e89..419b8ed5b7c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/CMakeLists.txt @@ -1,8 +1,11 @@ add_subdirectory(indexer) -if(TARGET Qt5::Gui) +if(TARGET Qt${QT_MAJOR_VERSION}::Gui) add_subdirectory(lib) add_subdirectory(cli) endif() +if(TARGET Qt${QT_MAJOR_VERSION}::Quick) + add_subdirectory(quick) +endif() ecm_qt_install_logging_categories( EXPORT KSYNTAXHIGHLIGHTING diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt index 4a84696ad91..9aede60ad78 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt @@ -20,6 +20,7 @@ elseif(CMAKE_CROSSCOMPILING) -DECM_DIR=${ECM_DIR} -DCMAKE_PREFIX_PATH=${NATIVE_PREFIX} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} INSTALL_COMMAND "" + BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/native_katehighlightingindexer-prefix/src/native_katehighlightingindexer-build/bin/katehighlightingindexer ) add_executable(katehighlightingindexer IMPORTED GLOBAL) add_dependencies(katehighlightingindexer native_katehighlightingindexer) @@ -32,6 +33,6 @@ else() if(Qt5XmlPatterns_FOUND AND NOT ECM_ENABLE_SANITIZERS) target_link_libraries(katehighlightingindexer Qt5::XmlPatterns) else() - target_link_libraries(katehighlightingindexer Qt5::Core) + target_link_libraries(katehighlightingindexer Qt${QT_MAJOR_VERSION}::Core) endif() endif() diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp index 4de51ba7c89..d491e13ab99 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp @@ -350,7 +350,7 @@ private: friend uint qHash(const Item &item, uint seed = 0) { - return uint(qHash(item.content, seed)); + return qHash(item.content, seed); } friend bool operator==(const Item &item0, const Item &item1) @@ -513,7 +513,7 @@ private: static const QRegularExpression isDot(QStringLiteral(R"(^\(?\.(?:[*+][*+?]?|[*+]|\{1\})?\$?$)")); // remove "(?:" and ")" static const QRegularExpression removeParentheses(QStringLiteral(R"(\((?:\?:)?|\))")); - // remove parentheses on a double from the string + // remove parentheses on a copy of string auto reg = QString(string).replace(removeParentheses, QString()); isDotRegex = reg.contains(isDot); } @@ -719,7 +719,7 @@ private: friend uint qHash(const Style &style, uint seed = 0) { - return uint(qHash(style.name, seed)); + return qHash(style.name, seed); } friend bool operator==(const Style &style0, const Style &style1) @@ -995,7 +995,6 @@ private: } success = checkLookAhead(rule) && success; success = checkStringDetect(rule) && success; - success = checkAnyChar(rule) && success; success = checkKeyword(definition, rule, referencedKeywords) && success; success = checkRegExpr(filename, rule, context) && success; success = checkDelimiters(definition, rule) && success; @@ -1053,12 +1052,9 @@ private: "\\.\\*[?*]?" REG_CHAR "|" "\\[\\^(" REG_ESCAPE_CHAR "|.)\\]\\*[?*]?\\1" ")$")); - if (( rule.lookAhead == XmlBool::True - || rule.minimal == XmlBool::True - || rule.string.contains(QStringLiteral(".*?")) - || rule.string.contains(QStringLiteral("[^")) - ) && reg.contains(isRange) - ) { + if ((rule.lookAhead == XmlBool::True || rule.minimal == XmlBool::True || rule.string.contains(QStringLiteral(".*?")) + || rule.string.contains(QStringLiteral("[^"))) + && reg.contains(isRange)) { qWarning() << filename << "line" << rule.line << "RegExpr should be replaced by RangeDetect:" << rule.string; return false; } @@ -1079,13 +1075,10 @@ private: #undef REG_ESCAPE_CHAR // use minimal or lazy operator - static const QRegularExpression isMinimal(QStringLiteral( - R"([.][*+][^][?+*()|$]*$)")); - if (rule.lookAhead == XmlBool::True - && rule.minimal != XmlBool::True - && reg.contains(isMinimal) - ) { - qWarning() << filename << "line" << rule.line << "RegExpr should be have minimal=\"1\" or use lazy operator (i.g, '.*' -> '.*?'):" << rule.string; + static const QRegularExpression isMinimal(QStringLiteral(R"([.][*+][^][?+*()|$]*$)")); + if (rule.lookAhead == XmlBool::True && rule.minimal != XmlBool::True && reg.contains(isMinimal)) { + qWarning() << filename << "line" << rule.line + << "RegExpr should be have minimal=\"1\" or use lazy operator (i.g, '.*' -> '.*?'):" << rule.string; return false; } @@ -1179,19 +1172,18 @@ private: if (*first == QLatin1Char('^')) { hasStartOfLine = true; break; - } - else if (*first == QLatin1Char('(')) { + } else if (*first == QLatin1Char('(')) { if (last - first >= 3 && first[1] == QLatin1Char('?') && first[2] == QLatin1Char(':')) { first += 2; } - } - else { + } else { break; } } if (!hasStartOfLine) { - qWarning() << rule.filename << "line" << rule.line << "start of line missing in the pattern with column=\"0\" (i.e. abc -> ^abc):" << rule.string; + qWarning() << rule.filename << "line" << rule.line + << "start of line missing in the pattern with column=\"0\" (i.e. abc -> ^abc):" << rule.string; return false; } } @@ -1314,14 +1306,12 @@ private: } // unnecessary quantifier - static const QRegularExpression unnecessaryQuantifier1(QStringLiteral( - R"([*+?]([.][*+?]{0,2})?$)")); - static const QRegularExpression unnecessaryQuantifier2(QStringLiteral( - R"([*+?]([.][*+?]{0,2})?[)]*$)")); + static const QRegularExpression unnecessaryQuantifier1(QStringLiteral(R"([*+?]([.][*+?]{0,2})?$)")); + static const QRegularExpression unnecessaryQuantifier2(QStringLiteral(R"([*+?]([.][*+?]{0,2})?[)]*$)")); auto &unnecessaryQuantifier = useCapture ? unnecessaryQuantifier1 : unnecessaryQuantifier2; if (rule.lookAhead == XmlBool::True && rule.minimal != XmlBool::True && reg.contains(unnecessaryQuantifier)) { - qWarning() << filename << "line" << rule.line << "Last quantifier is not necessary (i.g., 'xyz*' -> 'xy', 'xyz+.' -> 'xyz.'):" - << rule.string; + qWarning() << filename << "line" << rule.line + << "Last quantifier is not necessary (i.g., 'xyz*' -> 'xy', 'xyz+.' -> 'xyz.'):" << rule.string; return false; } } @@ -1484,32 +1474,11 @@ private: qWarning() << rule.filename << "line" << rule.line << "broken regex:" << rule.string << "problem: dynamic=true but no %\\d+ placeholder"; return false; } - } else { - if (rule.string.size() <= 1) { - const auto replacement = rule.insensitive == XmlBool::True ? QStringLiteral("AnyChar") : QStringLiteral("DetectChar"); - qWarning() << rule.filename << "line" << rule.line << "StringDetect should be replaced by" << replacement; - return false; - } - - if (rule.string.size() <= 2 && rule.insensitive != XmlBool::True) { - qWarning() << rule.filename << "line" << rule.line << "StringDetect should be replaced by Detect2Chars"; - return false; - } } } return true; } - //! Check that AnyChar contains more that 1 character - bool checkAnyChar(const Context::Rule &rule) const - { - if (rule.type == Context::Rule::Type::AnyChar && rule.string.size() <= 1) { - qWarning() << rule.filename << "line" << rule.line << "AnyChar should be replaced by DetectChar"; - return false; - } - return true; - } - //! Check \ and delimiter in a keyword list bool checkKeywordsList(const Definition &definition, QSet &referencedKeywords) const { @@ -1895,7 +1864,7 @@ private: Rule4 detectIdentifierRule{}; // Contains includedRules and included includedRules - QMap includeContexts; + QMap includeContexts; DotRegex dotRegex; @@ -2232,8 +2201,7 @@ private: if (auto &ruleAndInclude = includeContexts[rule.context.context]) { updateUnreachable1(ruleAndInclude); - } - else { + } else { ruleAndInclude.rule = &rule; } @@ -2378,55 +2346,52 @@ private: const auto end = context.rules.end() - 1; for (; it < end; ++it) { - auto& rule1 = *it; - auto& rule2 = it[1]; + auto &rule1 = *it; + auto &rule2 = it[1]; - auto isCommonCompatible = [&]{ - return rule1.attribute == rule2.attribute - && rule1.beginRegion == rule2.beginRegion - && rule1.endRegion == rule2.endRegion - && rule1.lookAhead == rule2.lookAhead - && rule1.firstNonSpace == rule2.firstNonSpace - && rule1.context.context == rule2.context.context - && rule1.context.popCount == rule2.context.popCount - ; + auto isCommonCompatible = [&] { + return rule1.attribute == rule2.attribute && rule1.beginRegion == rule2.beginRegion && rule1.endRegion == rule2.endRegion + && rule1.lookAhead == rule2.lookAhead && rule1.firstNonSpace == rule2.firstNonSpace && rule1.context.context == rule2.context.context + && rule1.context.popCount == rule2.context.popCount; }; switch (rule1.type) { - // request to merge AnyChar/DetectChar - case Context::Rule::Type::AnyChar: - case Context::Rule::Type::DetectChar: - if ((rule2.type == Context::Rule::Type::AnyChar || rule2.type == Context::Rule::Type::DetectChar) && isCommonCompatible() && rule1.column == rule2.column) { - qWarning() << filename << "line" << rule2.line << "can be merged as AnyChar with the previous rule"; - success = false; - } - break; + // request to merge AnyChar/DetectChar + case Context::Rule::Type::AnyChar: + case Context::Rule::Type::DetectChar: + if ((rule2.type == Context::Rule::Type::AnyChar || rule2.type == Context::Rule::Type::DetectChar) && isCommonCompatible() + && rule1.column == rule2.column) { + qWarning() << filename << "line" << rule2.line << "can be merged as AnyChar with the previous rule"; + success = false; + } + break; - // request to merge multiple RegExpr - case Context::Rule::Type::RegExpr: - if (rule2.type == Context::Rule::Type::RegExpr && isCommonCompatible() && rule1.dynamic == rule2.dynamic && (rule1.column == rule2.column || (rule1.column <= 0 && rule2.column <= 0))) { - qWarning() << filename << "line" << rule2.line << "can be merged with the previous rule"; - success = false; - } - break; + // request to merge multiple RegExpr + case Context::Rule::Type::RegExpr: + if (rule2.type == Context::Rule::Type::RegExpr && isCommonCompatible() && rule1.dynamic == rule2.dynamic + && (rule1.column == rule2.column || (rule1.column <= 0 && rule2.column <= 0))) { + qWarning() << filename << "line" << rule2.line << "can be merged with the previous rule"; + success = false; + } + break; - case Context::Rule::Type::DetectSpaces: - case Context::Rule::Type::HlCChar: - case Context::Rule::Type::HlCHex: - case Context::Rule::Type::HlCOct: - case Context::Rule::Type::HlCStringChar: - case Context::Rule::Type::Int: - case Context::Rule::Type::Float: - case Context::Rule::Type::LineContinue: - case Context::Rule::Type::WordDetect: - case Context::Rule::Type::StringDetect: - case Context::Rule::Type::Detect2Chars: - case Context::Rule::Type::IncludeRules: - case Context::Rule::Type::DetectIdentifier: - case Context::Rule::Type::keyword: - case Context::Rule::Type::Unknown: - case Context::Rule::Type::RangeDetect: - break; + case Context::Rule::Type::DetectSpaces: + case Context::Rule::Type::HlCChar: + case Context::Rule::Type::HlCHex: + case Context::Rule::Type::HlCOct: + case Context::Rule::Type::HlCStringChar: + case Context::Rule::Type::Int: + case Context::Rule::Type::Float: + case Context::Rule::Type::LineContinue: + case Context::Rule::Type::WordDetect: + case Context::Rule::Type::StringDetect: + case Context::Rule::Type::Detect2Chars: + case Context::Rule::Type::IncludeRules: + case Context::Rule::Type::DetectIdentifier: + case Context::Rule::Type::keyword: + case Context::Rule::Type::Unknown: + case Context::Rule::Type::RangeDetect: + break; } } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt index 43a60cc19b0..2ab0e603a29 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt @@ -7,6 +7,7 @@ target_sources(KF5SyntaxHighlighting PRIVATE context.cpp contextswitch.cpp definitiondownloader.cpp + highlightingdata.cpp foldingregion.cpp format.cpp htmlhighlighter.cpp @@ -46,13 +47,13 @@ set_target_properties(KF5SyntaxHighlighting PROPERTIES SOVERSION ${SyntaxHighlighting_SOVERSION} EXPORT_NAME SyntaxHighlighting ) -target_include_directories(KF5SyntaxHighlighting INTERFACE "$") +target_include_directories(KF5SyntaxHighlighting INTERFACE "$") target_include_directories(KF5SyntaxHighlighting PUBLIC "$") target_link_libraries(KF5SyntaxHighlighting PUBLIC - Qt5::Gui + Qt${QT_MAJOR_VERSION}::Gui PRIVATE - Qt5::Network + Qt${QT_MAJOR_VERSION}::Network ) ecm_generate_headers(SyntaxHighlighting_HEADERS @@ -74,7 +75,7 @@ install(TARGETS KF5SyntaxHighlighting EXPORT KF5SyntaxHighlightingTargets ${KDE_ install(FILES ${SyntaxHighlighting_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_export.h - DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KSyntaxHighlighting) + DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KSyntaxHighlighting) if(BUILD_QCH) ecm_add_qch( @@ -104,6 +105,6 @@ ecm_generate_pri_file( KF5SyntaxHighlighting DEPS "gui" FILENAME_VAR PRI_FILENAME - INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KSyntaxHighlighting + INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF}/KSyntaxHighlighting ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp index d6f8cad0c71..5794291ff00 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp @@ -137,8 +137,7 @@ State AbstractHighlighter::highlightLine(QStringView text, const State &state) * see https://phabricator.kde.org/D18509 */ int endlessLoopingCounter = 0; - while (!stateData->topContext()->lineEmptyContext().isStay() - || (stateData->topContext()->lineEmptyContext().isStay() && !stateData->topContext()->lineEndContext().isStay())) { + while (!stateData->topContext()->lineEmptyContext().isStay() || !stateData->topContext()->lineEndContext().isStay()) { /** * line empty context switches */ @@ -153,8 +152,7 @@ State AbstractHighlighter::highlightLine(QStringView text, const State &state) * 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())) { + } else if (!d->switchContext(stateData, stateData->topContext()->lineEndContext(), QStringList())) { break; } @@ -305,7 +303,7 @@ State AbstractHighlighter::highlightLine(QStringView text, const State &state) d->switchContext(stateData, rule->context(), newResult.captures()); newFormat = rule->attributeFormat().isValid() ? &rule->attributeFormat() : &stateData->topContext()->attributeFormat(); - if (newOffset == text.size() && std::dynamic_pointer_cast(rule)) { + if (newOffset == text.size() && rule->isLineContinue()) { lineContinuation = true; } break; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp index 8ae47d80ebf..95517328045 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -539,7 +539,7 @@ double calculate_CIEDE2000(const CieLab &color1, const CieLab &color2) } struct AnsiBuffer { - using ColorCache = QMap; + using ColorCache = QHash; void append(char c) { @@ -683,7 +683,8 @@ struct GraphLine { int labelLineLength = 0; int nextLabelOffset = 0; - template void pushLabel(int offset, String const &s, int charCounter) + template + void pushLabel(int offset, String const &s, int charCounter) { Q_ASSERT(offset >= labelLineLength); const int n = offset - labelLineLength; @@ -693,7 +694,8 @@ struct GraphLine { nextLabelOffset = labelLineLength; } - template void pushGraph(int offset, String const &s, int charCounter) + template + void pushGraph(int offset, String const &s, int charCounter) { Q_ASSERT(offset >= graphLineLength); const int n = offset - graphLineLength; @@ -754,8 +756,15 @@ public: void setDefinition(const KSyntaxHighlighting::Definition &def) override { AbstractHighlighter::setDefinition(def); - m_defData = DefinitionData::get(def); m_contextCapture.setDefinition(def); + + const auto &definitions = def.includedDefinitions(); + for (const auto &definition : definitions) { + const auto *defData = DefinitionData::get(definition); + for (const auto &context : defData->contexts) { + m_defDataBycontexts.insert(&context, defData); + } + } } void highlightData(QTextStream &in, @@ -928,8 +937,8 @@ private: } const auto context = stateData->topContext(); - const auto defData = DefinitionData::get(context->definition()); - const auto contextName = (defData != m_defData) ? QString(QLatin1Char('<') % defData->name % QLatin1Char('>')) : QString(); + const auto defDataIt = m_defDataBycontexts.find(context); + const auto contextName = (defDataIt != m_defDataBycontexts.end()) ? QString(QLatin1Char('<') % (*defDataIt)->name % QLatin1Char('>')) : QString(); return QString(label % contextName % QLatin1Char('[') % context->name() % QLatin1Char(']')); } @@ -1128,12 +1137,13 @@ private: std::vector m_highlightedFragments; std::vector m_formatGraph; ContextCaptureHighlighter m_contextCapture; - DefinitionData *m_defData; int m_regionDepth = 0; std::vector m_regions; std::vector m_regionGraph; std::vector m_regionStyles; + + QHash m_defDataBycontexts; }; } // anonymous namespace diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp index 724f37a03f1..2bd940d8aa7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp @@ -18,177 +18,111 @@ using namespace KSyntaxHighlighting; -Definition Context::definition() const +Context::Context(const DefinitionData &def, const HighlightingContextData &data) + : m_name(data.name) + , m_attributeFormat(data.attribute.isEmpty() ? Format() : def.formatByName(data.attribute)) + , m_indentationBasedFolding(!data.noIndentationBasedFolding && def.indentationBasedFolding) { - return m_def.definition(); -} - -void Context::setDefinition(const DefinitionRef &def) -{ - m_def = def; + if (!data.attribute.isEmpty() && !m_attributeFormat.isValid()) { + qCWarning(Log) << "Context: Unknown format" << data.attribute << "in context" << m_name << "of definition" << def.name; + } } bool Context::indentationBasedFoldingEnabled() const { - if (m_noIndentationBasedFolding) { - return false; - } - - return m_def.definition().indentationBasedFoldingEnabled(); + return m_indentationBasedFolding; } -void Context::load(QXmlStreamReader &reader) +void Context::resolveContexts(DefinitionData &def, const HighlightingContextData &data) { - Q_ASSERT(reader.name() == QLatin1String("context")); - Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - - m_name = reader.attributes().value(QLatin1String("name")).toString(); - m_attribute = reader.attributes().value(QLatin1String("attribute")).toString(); - m_lineEndContext.parse(reader.attributes().value(QLatin1String("lineEndContext"))); - m_lineEmptyContext.parse(reader.attributes().value(QLatin1String("lineEmptyContext"))); - m_fallthroughContext.parse(reader.attributes().value(QLatin1String("fallthroughContext"))); + m_lineEndContext.resolve(def, data.lineEndContext); + m_lineEmptyContext.resolve(def, data.lineEmptyContext); + m_fallthroughContext.resolve(def, data.fallthroughContext); m_fallthrough = !m_fallthroughContext.isStay(); - m_noIndentationBasedFolding = Xml::attrToBool(reader.attributes().value(QLatin1String("noIndentationBasedFolding"))); - 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(std::move(rule)); - } - } else { - reader.skipCurrentElement(); - } - reader.readNext(); - break; - } - case QXmlStreamReader::EndElement: - return; - default: - reader.readNext(); - break; + m_rules.reserve(data.rules.size()); + for (const auto &ruleData : data.rules) { + m_rules.push_back(Rule::create(def, ruleData, m_name)); + if (!m_rules.back()) { + m_rules.pop_back(); } } } -void Context::resolveContexts() +void Context::resolveIncludes(DefinitionData &def) { - const auto def = m_def.definition(); - m_lineEndContext.resolve(def); - m_lineEmptyContext.resolve(def); - m_fallthroughContext.resolve(def); - for (const auto &rule : m_rules) { - rule->resolveContext(); - } -} - -Context::ResolveState Context::resolveState() -{ - if (m_resolveState == Unknown) { - for (const auto &rule : m_rules) { - auto inc = std::dynamic_pointer_cast(rule); - if (inc) { - m_resolveState = Unresolved; - return m_resolveState; - } - } - m_resolveState = Resolved; - } - return m_resolveState; -} - -void Context::resolveIncludes() -{ - if (resolveState() == Resolved) { + if (m_resolveState == Resolved) { return; } - if (resolveState() == Resolving) { + if (m_resolveState == Resolving) { qCWarning(Log) << "Cyclic dependency!"; return; } - Q_ASSERT(resolveState() == Unresolved); + Q_ASSERT(m_resolveState == Unresolved); m_resolveState = Resolving; // cycle guard for (auto it = m_rules.begin(); it != m_rules.end();) { - auto inc = std::dynamic_pointer_cast(*it); - if (!inc) { + const IncludeRules *includeRules = it->get()->castToIncludeRules(); + if (!includeRules) { ++it; continue; } + Context *context = nullptr; - auto myDefData = DefinitionData::get(m_def.definition()); - if (inc->definitionName().isEmpty()) { // local include - context = myDefData->contextByName(inc->contextName()); + DefinitionData *defData = &def; + + const auto &contextName = includeRules->contextName(); + const int idx = contextName.indexOf(QLatin1String("##")); + + if (idx == -1) { // local include + context = def.contextByName(contextName); } else { - auto def = myDefData->repo->definitionForName(inc->definitionName()); - if (!def.isValid()) { - qCWarning(Log) << "Unable to resolve external include rule for definition" << inc->definitionName() << "in" << m_def.definition().name(); + auto definitionName = contextName.mid(idx + 2); + auto includedDef = def.repo->definitionForName(definitionName); + if (!includedDef.isValid()) { + qCWarning(Log) << "Unable to resolve external include rule for definition" << definitionName << "in" << def.name; ++it; continue; } - auto defData = DefinitionData::get(def); + defData = DefinitionData::get(includedDef); + def.addImmediateIncludedDefinition(includedDef); defData->load(); - if (inc->contextName().isEmpty()) { + if (idx == 0) { context = defData->initialContext(); } else { - context = defData->contextByName(inc->contextName()); + context = defData->contextByName(contextName.left(idx)); } } + if (!context) { - qCWarning(Log) << "Unable to resolve include rule for definition" << inc->contextName() << "##" << inc->definitionName() << "in" - << m_def.definition().name(); + qCWarning(Log) << "Unable to resolve include rule for definition" << contextName << "in" << def.name; ++it; continue; } - context->resolveIncludes(); + + if (context == this) { + qCWarning(Log) << "Unable to resolve self include rule for definition" << contextName << "in" << def.name; + ++it; + continue; + } + + if (context->m_resolveState != Resolved) { + context->resolveIncludes(*defData); + } /** * handle included attribute * transitive closure: we might include attributes included from somewhere else */ - if (inc->includeAttribute()) { - m_attribute = context->m_attribute; - m_attributeContext = context->m_attributeContext ? context->m_attributeContext : context; + if (includeRules->includeAttribute()) { + m_attributeFormat = context->m_attributeFormat; } it = m_rules.erase(it); - for (const auto &rule : context->rules()) { - it = m_rules.insert(it, rule); - ++it; - } + it = m_rules.insert(it, context->rules().begin(), context->rules().end()); + it += context->rules().size(); } m_resolveState = Resolved; } - -void Context::resolveAttributeFormat() -{ - /** - * try to get our format from the definition we stem from - * we need to handle included attributes via m_attributeContext - */ - if (!m_attribute.isEmpty()) { - const auto def = m_attributeContext ? m_attributeContext->m_def.definition() : m_def.definition(); - m_attributeFormat = DefinitionData::get(def)->formatByName(m_attribute); - if (!m_attributeFormat.isValid()) { - if (m_attributeContext) { - qCWarning(Log) << "Context: Unknown format" << m_attribute << "in context" << m_name << "of definition" << m_def.definition().name() - << "from included context" << m_attributeContext->m_name << "of definition" << def.name(); - } else { - qCWarning(Log) << "Context: Unknown format" << m_attribute << "in context" << m_name << "of definition" << m_def.definition().name(); - } - } - } - - /** - * lookup formats for our rules - */ - for (const auto &rule : m_rules) { - rule->resolveAttributeFormat(this); - } -} 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 62630455370..7e077b5a244 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h @@ -8,9 +8,8 @@ #define KSYNTAXHIGHLIGHTING_CONTEXT_P_H #include "contextswitch_p.h" -#include "definition.h" -#include "definitionref_p.h" #include "format.h" +#include "highlightingdata_p.hpp" #include "rule_p.h" #include @@ -23,14 +22,18 @@ QT_END_NAMESPACE namespace KSyntaxHighlighting { +class DefinitionData; + class Context { public: - Context() = default; - ~Context() = default; + Q_DISABLE_COPY(Context) - Definition definition() const; - void setDefinition(const DefinitionRef &def); + Context(Context &&) = default; + Context &operator=(Context &&) = default; + + Context(const DefinitionData &def, const HighlightingContextData &data); + ~Context() = default; const QString &name() const { @@ -73,44 +76,28 @@ public: */ bool indentationBasedFoldingEnabled() const; - void load(QXmlStreamReader &reader); - void resolveContexts(); - void resolveIncludes(); - void resolveAttributeFormat(); + void resolveContexts(DefinitionData &def, const HighlightingContextData &data); + void resolveIncludes(DefinitionData &def); private: - Q_DISABLE_COPY(Context) + enum ResolveState : quint8 { Unresolved, Resolving, Resolved }; - enum ResolveState { Unknown, Unresolved, Resolving, Resolved }; - ResolveState resolveState(); + std::vector m_rules; - DefinitionRef m_def; QString m_name; - /** - * attribute name, to lookup our format - */ - QString m_attribute; - - /** - * context to use for lookup, if != this context - */ - const Context *m_attributeContext = nullptr; - - /** - * resolved format for our attribute, done in resolveAttributeFormat - */ - Format m_attributeFormat; - ContextSwitch m_lineEndContext; ContextSwitch m_lineEmptyContext; ContextSwitch m_fallthroughContext; - std::vector m_rules; + /** + * resolved format for our attribute, done in constructor and resolveIncludes + */ + Format m_attributeFormat; - ResolveState m_resolveState = Unknown; + ResolveState m_resolveState = Unresolved; bool m_fallthrough = false; - bool m_noIndentationBasedFolding = false; + bool m_indentationBasedFolding; }; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp index e829af463a3..9cab177dae1 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp @@ -7,69 +7,45 @@ #include "contextswitch_p.h" #include "definition.h" #include "definition_p.h" +#include "highlightingdata_p.hpp" #include "ksyntaxhighlighting_logging.h" #include "repository.h" using namespace KSyntaxHighlighting; -bool ContextSwitch::isStay() const +void ContextSwitch::resolve(DefinitionData &def, QStringView contextInstr) { - return m_popCount == 0 && !m_context && m_contextName.isEmpty() && m_defName.isEmpty(); -} + HighlightingContextData::ContextSwitch ctx(contextInstr); -int ContextSwitch::popCount() const -{ - return m_popCount; -} + m_popCount = ctx.popCount(); + m_isStay = !m_popCount; -Context *ContextSwitch::context() const -{ - return m_context; -} + auto contextName = ctx.contextName(); + auto defName = ctx.defName(); -void ContextSwitch::parse(QStringView contextInstr) -{ - if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) { + if (contextName.isEmpty() && defName.isEmpty()) { return; } - if (contextInstr.startsWith(QLatin1String("#pop!"))) { - ++m_popCount; - m_contextName = contextInstr.mid(5).toString(); - return; - } - - if (contextInstr.startsWith(QLatin1String("#pop"))) { - ++m_popCount; - parse(contextInstr.mid(4)); - return; - } - - const auto idx = contextInstr.indexOf(QLatin1String("##")); - if (idx >= 0) { - m_contextName = contextInstr.left(idx).toString(); - m_defName = contextInstr.mid(idx + 2).toString(); + if (defName.isEmpty()) { + m_context = def.contextByName(contextName.toString()); } else { - m_contextName = contextInstr.toString(); - } -} - -void ContextSwitch::resolve(const Definition &def) -{ - auto d = def; - if (!m_defName.isEmpty()) { - d = DefinitionData::get(def)->repo->definitionForName(m_defName); - auto data = DefinitionData::get(d); - data->load(); - if (m_contextName.isEmpty()) { - m_context = data->initialContext(); + auto d = def.repo->definitionForName(defName.toString()); + if (d.isValid()) { + auto data = DefinitionData::get(d); + def.addImmediateIncludedDefinition(d); + data->load(); + if (contextName.isEmpty()) { + m_context = data->initialContext(); + } else { + m_context = data->contextByName(contextName.toString()); + } } } - if (!m_contextName.isEmpty()) { - m_context = DefinitionData::get(d)->contextByName(m_contextName); - if (!m_context) { - qCWarning(Log) << "cannot find context" << m_contextName << "in" << def.name(); - } + if (!m_context) { + qCWarning(Log) << "cannot find context" << contextName << "in" << def.name; + } else { + m_isStay = false; } } 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 8230c4a3884..29b0e685e24 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h @@ -12,7 +12,7 @@ namespace KSyntaxHighlighting { class Context; -class Definition; +class DefinitionData; class ContextSwitch { @@ -20,19 +20,27 @@ public: ContextSwitch() = default; ~ContextSwitch() = default; - bool isStay() const; + bool isStay() const + { + return m_isStay; + } - int popCount() const; - Context *context() const; + int popCount() const + { + return m_popCount; + } - void parse(QStringView contextInstr); - void resolve(const Definition &def); + Context *context() const + { + return m_context; + } + + void resolve(DefinitionData &def, QStringView contextInstr); private: - QString m_defName; - QString m_contextName; Context *m_context = nullptr; int m_popCount = 0; + bool m_isStay = true; }; } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp index 068907a4e28..0fbc9187c09 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp @@ -14,6 +14,7 @@ #include "context_p.h" #include "format.h" #include "format_p.h" +#include "highlightingdata_p.hpp" #include "ksyntaxhighlighting_logging.h" #include "ksyntaxhighlighting_version.h" #include "repository.h" @@ -39,10 +40,7 @@ DefinitionData::DefinitionData() { } -DefinitionData::~DefinitionData() -{ - qDeleteAll(contexts); -} +DefinitionData::~DefinitionData() = default; DefinitionData *DefinitionData::get(const Definition &def) { @@ -237,45 +235,23 @@ QVector Definition::includedDefinitions() const d->load(); // init worklist and result used as guard with this definition - QVector queue{*this}; + QVector queue{d.get()}; QVector 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 : std::as_const(definition.d->contexts)) { - // handle context switch attributes of this context itself - for (const auto switchContext : - {context->lineEndContext().context(), context->lineEmptyContext().context(), context->fallthroughContext().context()}) { - if (switchContext) { - if (!definitions.contains(switchContext->definition())) { - queue.push_back(switchContext->definition()); - definitions.push_back(switchContext->definition()); - } - } - } - - // handle the embedded rules - for (const auto &rule : context->rules()) { - // handle include rules like inclusion - if (!definitions.contains(rule->definition())) { - queue.push_back(rule->definition()); - definitions.push_back(rule->definition()); - } - - // handle context switch context inclusion - if (auto switchContext = rule->context().context()) { - if (!definitions.contains(switchContext->definition())) { - queue.push_back(switchContext->definition()); - definitions.push_back(switchContext->definition()); - } - } + while (!queue.empty()) { + const auto *def = queue.back(); + queue.pop_back(); + for (const auto &defRef : def->immediateIncludedDefinitions) { + const auto definition = defRef.definition(); + if (!definitions.contains(definition)) { + definitions.push_back(definition); + queue.push_back(definition.d.get()); } } } // remove the 1st entry, since it is this Definition - definitions.pop_front(); + definitions.front() = std::move(definitions.back()); + definitions.pop_back(); return definitions; } @@ -304,17 +280,17 @@ QVector> Definition::characterEncodings() const return d->characterEncodings; } -Context *DefinitionData::initialContext() const +Context *DefinitionData::initialContext() { - Q_ASSERT(!contexts.isEmpty()); - return contexts.first(); + Q_ASSERT(!contexts.empty()); + return &contexts.front(); } -Context *DefinitionData::contextByName(const QString &wantedName) const +Context *DefinitionData::contextByName(const QString &wantedName) { - for (const auto context : contexts) { - if (context->name() == wantedName) { - return context; + for (auto &context : contexts) { + if (context.name() == wantedName) { + return &context; } } return nullptr; @@ -338,7 +314,7 @@ Format DefinitionData::formatByName(const QString &wantedName) const bool DefinitionData::isLoaded() const { - return !contexts.isEmpty(); + return !contexts.empty(); } bool DefinitionData::load(OnlyKeywords onlyKeywords) @@ -383,17 +359,7 @@ bool DefinitionData::load(OnlyKeywords onlyKeywords) it->setCaseSensitivity(caseSensitive); } - for (const auto context : std::as_const(contexts)) { - context->resolveContexts(); - context->resolveIncludes(); - context->resolveAttributeFormat(); - } - - for (const auto context : std::as_const(contexts)) { - for (const auto &rule : context->rules()) { - rule->resolvePostProcessing(); - } - } + resolveContexts(); return true; } @@ -402,9 +368,21 @@ void DefinitionData::clear() { // keep only name and repo, so we can re-lookup to make references persist over repo reloads keywordLists.clear(); - qDeleteAll(contexts); contexts.clear(); formats.clear(); + contextDatas.clear(); + immediateIncludedDefinitions.clear(); + wordDelimiters = WordDelimiters(); + wordWrapDelimiters = wordDelimiters; + keywordIsLoaded = false; + hasFoldingRegions = false; + indentationBasedFolding = false; + foldingIgnoreList.clear(); + singleLineCommentMarker.clear(); + singleLineCommentPosition = CommentPosition::StartOfLine; + multiLineCommentStartMarker.clear(); + multiLineCommentEndMarker.clear(); + characterEncodings.clear(); fileName.clear(); section.clear(); @@ -414,8 +392,6 @@ void DefinitionData::clear() license.clear(); mimetypes.clear(); extensions.clear(); - wordDelimiters = WordDelimiters(); - wordWrapDelimiters = wordDelimiters; caseSensitive = Qt::CaseSensitive; version = 0.0f; priority = 0; @@ -563,14 +539,14 @@ void DefinitionData::loadContexts(QXmlStreamReader &reader) Q_ASSERT(reader.name() == QLatin1String("contexts")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); + contextDatas.reserve(32); + 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); + contextDatas.push_back(HighlightingContextData()); + contextDatas.back().load(name, reader); } reader.readNext(); break; @@ -583,6 +559,50 @@ void DefinitionData::loadContexts(QXmlStreamReader &reader) } } +void DefinitionData::resolveContexts() +{ + contexts.reserve(contextDatas.size()); + + /** + * Transform all HighlightingContextData to Context. + * This is necessary so that Context::resolveContexts() can find the referenced contexts. + */ + for (const auto &contextData : std::as_const(contextDatas)) { + contexts.emplace_back(*this, contextData); + } + + /** + * Resolves contexts and rules. + */ + auto ctxIt = contexts.begin(); + for (const auto &contextData : std::as_const(contextDatas)) { + ctxIt->resolveContexts(*this, contextData); + ++ctxIt; + } + + /** + * To free the memory, constDatas is emptied because it is no longer used. + */ + contextDatas.clear(); + contextDatas.shrink_to_fit(); + + /** + * Resolved includeRules. + */ + for (auto &context : contexts) { + context.resolveIncludes(*this); + } + + /** + * Post-processing on rules. + */ + for (const auto &context : contexts) { + for (auto &rule : context.rules()) { + rule->resolvePostProcessing(); + } + } +} + void DefinitionData::loadItemData(QXmlStreamReader &reader) { Q_ASSERT(reader.name() == QLatin1String("itemDatas")); @@ -635,8 +655,7 @@ void DefinitionData::loadGeneral(QXmlStreamReader &reader) wordDelimiters.remove(reader.attributes().value(QLatin1String("weakDeliminator"))); // adapt WordWrapDelimiters - auto wordWrapDeliminatorAttr = reader.attributes().value( - QLatin1String("wordWrapDeliminator")); + auto wordWrapDeliminatorAttr = reader.attributes().value(QLatin1String("wordWrapDeliminator")); if (wordWrapDeliminatorAttr.isEmpty()) { wordWrapDelimiters = wordDelimiters; } else { @@ -803,21 +822,40 @@ quint16 DefinitionData::foldingRegionId(const QString &foldName) return RepositoryPrivate::get(repo)->foldingRegionId(name, foldName); } -DefinitionRef::DefinitionRef() +void DefinitionData::addImmediateIncludedDefinition(const Definition &def) { + if (get(def) != this) { + DefinitionRef defRef(def); + if (!immediateIncludedDefinitions.contains(defRef)) { + immediateIncludedDefinitions.push_back(std::move(defRef)); + } + } } +DefinitionRef::DefinitionRef() = default; + DefinitionRef::DefinitionRef(const Definition &def) : d(def.d) { } +DefinitionRef::DefinitionRef(Definition &&def) + : d(std::move(def.d)) +{ +} + DefinitionRef &DefinitionRef::operator=(const Definition &def) { d = def.d; return *this; } +DefinitionRef &DefinitionRef::operator=(Definition &&def) +{ + d = std::move(def.d); + return *this; +} + Definition DefinitionRef::definition() const { if (!d.expired()) { @@ -828,9 +866,5 @@ Definition DefinitionRef::definition() const bool DefinitionRef::operator==(const DefinitionRef &other) const { - if (d.expired() != other.d.expired()) { - return false; - } - - return d.expired() || d.lock().get() == other.d.lock().get(); + return !d.owner_before(other.d) && !other.d.owner_before(d); } 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 e5455e14e98..7d89a47a48d 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h @@ -8,14 +8,16 @@ #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_P_H #define KSYNTAXHIGHLIGHTING_DEFINITION_P_H -#include "definition.h" #include "definitionref_p.h" +#include "highlightingdata_p.hpp" #include "worddelimiters_p.h" #include #include #include +#include + QT_BEGIN_NAMESPACE class QCborMap; class QXmlStreamReader; @@ -55,23 +57,31 @@ public: void loadSpellchecking(QXmlStreamReader &reader); bool checkKateVersion(QStringView verStr); + void resolveContexts(); + void resolveIncludeKeywords(); KeywordList *keywordList(const QString &name); - Context *initialContext() const; - Context *contextByName(const QString &name) const; + Context *initialContext(); + Context *contextByName(const QString &name); Format formatByName(const QString &name) const; quint16 foldingRegionId(const QString &foldName); + void addImmediateIncludedDefinition(const Definition &def); + DefinitionRef q; Repository *repo = nullptr; QHash keywordLists; - QVector contexts; + std::vector contexts; QHash formats; + // data loaded from xml file and emptied after loading contexts + QVector contextDatas; + // Definition referenced by IncludeRules and ContextSwitch + QVector immediateIncludedDefinitions; WordDelimiters wordDelimiters; WordDelimiters wordWrapDelimiters; bool keywordIsLoaded = false; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp index b16139b731f..f9dbc298666 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp @@ -172,8 +172,7 @@ 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"); auto req = QNetworkRequest(QUrl(url)); - req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, - QNetworkRequest::NoLessSafeRedirectPolicy); + req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); auto reply = d->nam->get(req); 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 db0c6ee68ae..2eaf0561ef1 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h @@ -59,7 +59,7 @@ public: /** * Destructor. */ - ~DefinitionDownloader(); + ~DefinitionDownloader() override; /** * Starts the update procedure. 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 285fec3e206..a92fc988d90 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h @@ -7,6 +7,8 @@ #ifndef KSYNTAXHIGHLIGHTING_DEFINITIONREF_P_H #define KSYNTAXHIGHLIGHTING_DEFINITIONREF_P_H +#include "definition.h" + #include namespace KSyntaxHighlighting @@ -29,7 +31,9 @@ class DefinitionRef public: DefinitionRef(); explicit DefinitionRef(const Definition &def); + explicit DefinitionRef(Definition &&def); DefinitionRef &operator=(const Definition &def); + DefinitionRef &operator=(Definition &&def); Definition definition() const; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata.cpp new file mode 100644 index 00000000000..7f589e252b8 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata.cpp @@ -0,0 +1,402 @@ +/* + SPDX-FileCopyrightText: 2021 Jonathan Poelen + + SPDX-License-Identifier: MIT +*/ + +#include "highlightingdata_p.hpp" +#include "ksyntaxhighlighting_logging.h" +#include "xml_p.h" + +#include +#include + +using namespace KSyntaxHighlighting; + +template +static void initRuleData(Data &data, Args &&...args) +{ + new (&data) Data{std::move(args)...}; +} + +static Qt::CaseSensitivity attrToCaseSensitivity(QStringView str) +{ + return Xml::attrToBool(str) ? Qt::CaseInsensitive : Qt::CaseSensitive; +} + +static HighlightingContextData::Rule::WordDelimiters loadAdditionalWordDelimiters(QXmlStreamReader &reader) +{ + return HighlightingContextData::Rule::WordDelimiters{ + reader.attributes().value(QLatin1String("additionalDeliminator")).toString(), + reader.attributes().value(QLatin1String("weakDeliminator")).toString(), + }; +} + +static bool checkIsNotEmpty(QStringView str, const char *attrName, const QString &defName, QXmlStreamReader &reader) +{ + if (!str.isEmpty()) { + return true; + } + + qCWarning(Log) << defName << "at line" << reader.lineNumber() << ": " << attrName << "attribute is empty"; + return false; +} + +static bool checkIsChar(QStringView str, const char *attrName, const QString &defName, QXmlStreamReader &reader) +{ + if (str.size() == 1) { + return true; + } + + qCWarning(Log) << defName << "at line" << reader.lineNumber() << ": " << attrName << "attribute must contain exactly 1 character"; + return false; +} + +static bool loadRule(const QString &defName, HighlightingContextData::Rule &rule, QXmlStreamReader &reader) +{ + using Rule = HighlightingContextData::Rule; + + QStringView name = reader.name(); + const auto attrs = reader.attributes(); + bool isIncludeRules = false; + + if (name == QLatin1String("DetectChar")) { + const auto s = attrs.value(QLatin1String("char")); + if (!checkIsChar(s, "char", defName, reader)) { + return false; + } + const QChar c = s.at(0); + const bool dynamic = Xml::attrToBool(attrs.value(QLatin1String("dynamic"))); + + initRuleData(rule.data.detectChar, c, dynamic); + rule.type = Rule::Type::DetectChar; + } else if (name == QLatin1String("RegExpr")) { + const auto pattern = attrs.value(QLatin1String("String")); + if (!checkIsNotEmpty(pattern, "String", defName, reader)) { + return false; + } + + const auto isCaseInsensitive = attrToCaseSensitivity(attrs.value(QLatin1String("insensitive"))); + const auto isMinimal = Xml::attrToBool(attrs.value(QLatin1String("minimal"))); + const auto dynamic = Xml::attrToBool(attrs.value(QLatin1String("dynamic"))); + + initRuleData(rule.data.regExpr, pattern.toString(), isCaseInsensitive, isMinimal, dynamic); + rule.type = Rule::Type::RegExpr; + } else if (name == QLatin1String("IncludeRules")) { + const auto context = attrs.value(QLatin1String("context")); + if (!checkIsNotEmpty(context, "context", defName, reader)) { + return false; + } + const bool includeAttribute = Xml::attrToBool(attrs.value(QLatin1String("includeAttrib"))); + + initRuleData(rule.data.includeRules, context.toString(), includeAttribute); + rule.type = Rule::Type::IncludeRules; + isIncludeRules = true; + } else if (name == QLatin1String("Detect2Chars")) { + const auto s1 = attrs.value(QLatin1String("char")); + const auto s2 = attrs.value(QLatin1String("char1")); + if (!checkIsChar(s1, "char", defName, reader)) { + return false; + } + if (!checkIsChar(s2, "char1", defName, reader)) { + return false; + } + + initRuleData(rule.data.detect2Chars, s1.at(0), s2.at(0)); + rule.type = Rule::Type::Detect2Chars; + } else if (name == QLatin1String("keyword")) { + const auto s = attrs.value(QLatin1String("String")); + if (!checkIsNotEmpty(s, "String", defName, reader)) { + return false; + } + Qt::CaseSensitivity caseSensitivityOverride = Qt::CaseInsensitive; + bool hasCaseSensitivityOverride = false; + + /** + * we might overwrite the case sensitivity + * then we need to init the list for lookup of that sensitivity setting + */ + if (attrs.hasAttribute(QLatin1String("insensitive"))) { + hasCaseSensitivityOverride = true; + caseSensitivityOverride = attrToCaseSensitivity(attrs.value(QLatin1String("insensitive"))); + } + + initRuleData(rule.data.keyword, s.toString(), loadAdditionalWordDelimiters(reader), caseSensitivityOverride, hasCaseSensitivityOverride); + rule.type = Rule::Type::Keyword; + } else if (name == QLatin1String("DetectSpaces")) { + rule.type = Rule::Type::DetectSpaces; + } else if (name == QLatin1String("StringDetect")) { + const auto string = attrs.value(QLatin1String("String")); + if (!checkIsNotEmpty(string, "String", defName, reader)) { + return false; + } + const auto caseSensitivity = attrToCaseSensitivity(attrs.value(QLatin1String("insensitive"))); + const auto dynamic = Xml::attrToBool(attrs.value(QLatin1String("dynamic"))); + const bool isSensitive = (caseSensitivity == Qt::CaseSensitive); + + // String can be replaced with DetectChar or AnyChar + if (!dynamic && string.size() == 1) { + QChar c = string.at(0); + if (isSensitive || c.toLower() == c.toUpper()) { + initRuleData(rule.data.detectChar, c, dynamic); + rule.type = Rule::Type::DetectChar; + } else { + initRuleData(rule.data.anyChar, c.toLower() + c.toUpper()); + rule.type = Rule::Type::AnyChar; + } + } + // String can be replaced with Detect2Chars + else if (isSensitive && !dynamic && string.size() == 2) { + initRuleData(rule.data.detect2Chars, string.at(0), string.at(1)); + rule.type = Rule::Type::Detect2Chars; + } else { + initRuleData(rule.data.stringDetect, string.toString(), caseSensitivity, dynamic); + rule.type = Rule::Type::StringDetect; + } + } else if (name == QLatin1String("WordDetect")) { + const auto word = attrs.value(QLatin1String("String")); + if (!checkIsNotEmpty(word, "String", defName, reader)) { + return false; + } + const auto caseSensitivity = attrToCaseSensitivity(attrs.value(QLatin1String("insensitive"))); + + initRuleData(rule.data.wordDetect, word.toString(), loadAdditionalWordDelimiters(reader), caseSensitivity); + rule.type = Rule::Type::WordDetect; + } else if (name == QLatin1String("AnyChar")) { + const auto chars = attrs.value(QLatin1String("String")); + if (!checkIsNotEmpty(chars, "String", defName, reader)) { + return false; + } + + // AnyChar can be replaced with DetectChar + if (chars.size() == 1) { + initRuleData(rule.data.detectChar, chars.at(0), false); + rule.type = Rule::Type::DetectChar; + } else { + initRuleData(rule.data.anyChar, chars.toString()); + rule.type = Rule::Type::AnyChar; + } + } else if (name == QLatin1String("DetectIdentifier")) { + rule.type = Rule::Type::DetectIdentifier; + } else if (name == QLatin1String("LineContinue")) { + const auto s = attrs.value(QLatin1String("char")); + const QChar c = s.isEmpty() ? QLatin1Char('\\') : s.at(0); + + initRuleData(rule.data.lineContinue, c); + rule.type = Rule::Type::LineContinue; + } else if (name == QLatin1String("Int")) { + initRuleData(rule.data.detectInt, loadAdditionalWordDelimiters(reader)); + rule.type = Rule::Type::Int; + } else if (name == QLatin1String("Float")) { + initRuleData(rule.data.detectFloat, loadAdditionalWordDelimiters(reader)); + rule.type = Rule::Type::Float; + } else if (name == QLatin1String("HlCStringChar")) { + rule.type = Rule::Type::HlCStringChar; + } else if (name == QLatin1String("RangeDetect")) { + const auto s1 = attrs.value(QLatin1String("char")); + const auto s2 = attrs.value(QLatin1String("char1")); + if (!checkIsChar(s1, "char", defName, reader)) { + return false; + } + if (!checkIsChar(s2, "char1", defName, reader)) { + return false; + } + + initRuleData(rule.data.rangeDetect, s1.at(0), s2.at(0)); + rule.type = Rule::Type::RangeDetect; + } else if (name == QLatin1String("HlCHex")) { + initRuleData(rule.data.hlCHex, loadAdditionalWordDelimiters(reader)); + rule.type = Rule::Type::HlCHex; + } else if (name == QLatin1String("HlCChar")) { + rule.type = Rule::Type::HlCChar; + } else if (name == QLatin1String("HlCOct")) { + initRuleData(rule.data.hlCOct, loadAdditionalWordDelimiters(reader)); + rule.type = Rule::Type::HlCOct; + } else { + qCWarning(Log) << "Unknown rule type:" << name; + return false; + } + + if (!isIncludeRules) { + rule.common.contextName = attrs.value(QLatin1String("context")).toString(); + rule.common.beginRegionName = attrs.value(QLatin1String("beginRegion")).toString(); + rule.common.endRegionName = attrs.value(QLatin1String("endRegion")).toString(); + rule.common.attributeName = attrs.value(QLatin1String("attribute")).toString(); + rule.common.firstNonSpace = Xml::attrToBool(attrs.value(QLatin1String("firstNonSpace"))); + rule.common.lookAhead = Xml::attrToBool(attrs.value(QLatin1String("lookAhead"))); + bool colOk = false; + rule.common.column = attrs.value(QLatin1String("column")).toInt(&colOk); + if (!colOk) { + rule.common.column = -1; + } + } + + return true; +} + +template +static void dataRuleVisit(HighlightingContextData::Rule::Type type, Data1 &&data1, Data2 &&data2, Visitor &&visitor) +{ + using Rule = HighlightingContextData::Rule; + using Type = Rule::Type; + switch (type) { + case Type::AnyChar: + visitor(data1.anyChar, data2.anyChar); + break; + case Type::DetectChar: + visitor(data1.detectChar, data2.detectChar); + break; + case Type::Detect2Chars: + visitor(data1.detect2Chars, data2.detect2Chars); + break; + case Type::HlCOct: + visitor(data1.hlCOct, data2.hlCOct); + break; + case Type::IncludeRules: + visitor(data1.includeRules, data2.includeRules); + break; + case Type::Int: + visitor(data1.detectInt, data2.detectInt); + break; + case Type::Keyword: + visitor(data1.keyword, data2.keyword); + break; + case Type::LineContinue: + visitor(data1.lineContinue, data2.lineContinue); + break; + case Type::RangeDetect: + visitor(data1.rangeDetect, data2.rangeDetect); + break; + case Type::RegExpr: + visitor(data1.regExpr, data2.regExpr); + break; + case Type::StringDetect: + visitor(data1.stringDetect, data2.stringDetect); + break; + case Type::WordDetect: + visitor(data1.wordDetect, data2.wordDetect); + break; + case Type::Float: + visitor(data1.detectFloat, data2.detectFloat); + break; + case Type::HlCHex: + visitor(data1.hlCHex, data2.hlCHex); + break; + + case Type::HlCStringChar: + case Type::DetectIdentifier: + case Type::DetectSpaces: + case Type::HlCChar: + case Type::Unknown:; + } +} + +HighlightingContextData::Rule::Rule() noexcept = default; + +HighlightingContextData::Rule::Rule(Rule &&other) noexcept + : common(std::move(other.common)) +{ + dataRuleVisit(other.type, data, other.data, [](auto &data1, auto &data2) { + using Data = std::remove_reference_t; + new (&data1) Data(std::move(data2)); + }); + type = other.type; +} + +HighlightingContextData::Rule::Rule(const Rule &other) + : common(other.common) +{ + dataRuleVisit(other.type, data, other.data, [](auto &data1, auto &data2) { + using Data = std::remove_reference_t; + new (&data1) Data(data2); + }); + type = other.type; +} + +HighlightingContextData::Rule::~Rule() +{ + dataRuleVisit(type, data, data, [](auto &data, auto &) { + using Data = std::remove_reference_t; + data.~Data(); + }); +} + +HighlightingContextData::ContextSwitch::ContextSwitch(QStringView str) +{ + if (str.isEmpty() || str == QStringLiteral("#stay")) { + return; + } + + while (str.startsWith(QStringLiteral("#pop"))) { + ++m_popCount; + if (str.size() > 4 && str.at(4) == QLatin1Char('!')) { + str = str.mid(5); + break; + } + str = str.mid(4); + } + + if (str.isEmpty()) { + return; + } + + m_contextAndDefName = str.toString(); + m_defNameIndex = str.indexOf(QStringLiteral("##")); +} + +bool HighlightingContextData::ContextSwitch::isStay() const +{ + return m_popCount == -1 && m_contextAndDefName.isEmpty(); +} + +QStringView HighlightingContextData::ContextSwitch::contextName() const +{ + if (m_defNameIndex == -1) { + return m_contextAndDefName; + } + return QStringView(m_contextAndDefName).left(m_defNameIndex); +} + +QStringView HighlightingContextData::ContextSwitch::defName() const +{ + if (m_defNameIndex == -1) { + return QStringView(); + } + return QStringView(m_contextAndDefName).mid(m_defNameIndex + 2); +} + +void HighlightingContextData::load(const QString &defName, QXmlStreamReader &reader) +{ + Q_ASSERT(reader.name() == QLatin1String("context")); + Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); + + name = reader.attributes().value(QLatin1String("name")).toString(); + attribute = reader.attributes().value(QLatin1String("attribute")).toString(); + lineEndContext = reader.attributes().value(QLatin1String("lineEndContext")).toString(); + lineEmptyContext = reader.attributes().value(QLatin1String("lineEmptyContext")).toString(); + fallthroughContext = reader.attributes().value(QLatin1String("fallthroughContext")).toString(); + noIndentationBasedFolding = Xml::attrToBool(reader.attributes().value(QLatin1String("noIndentationBasedFolding"))); + + rules.reserve(8); + + reader.readNext(); + while (!reader.atEnd()) { + switch (reader.tokenType()) { + case QXmlStreamReader::StartElement: { + auto &rule = rules.emplace_back(); + if (!loadRule(defName, rule, reader)) { + rules.pop_back(); + } + // be done with this rule, skip all subelements, e.g. no longer supported sub-rules + reader.skipCurrentElement(); + reader.readNext(); + break; + } + case QXmlStreamReader::EndElement: + return; + default: + reader.readNext(); + break; + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata_p.hpp b/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata_p.hpp new file mode 100644 index 00000000000..80aeaf49340 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/highlightingdata_p.hpp @@ -0,0 +1,215 @@ +/* + SPDX-FileCopyrightText: 2021 Jonathan Poelen + + SPDX-License-Identifier: MIT +*/ + +#ifndef KSYNTAXHIGHLIGHTING_HIGHLIGHTING_DATA_P_H +#define KSYNTAXHIGHLIGHTING_HIGHLIGHTING_DATA_P_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE +class QXmlStreamReader; +QT_END_NAMESPACE + +namespace KSyntaxHighlighting +{ +/** + * Represents the raw xml data of a context and its rules. + * After resolving contexts, members of this class are no longer + * use and the instance can be freed to recover used memory. + */ +class HighlightingContextData +{ +public: + void load(const QString &defName, QXmlStreamReader &reader); + + struct ContextSwitch { + ContextSwitch() = default; + ContextSwitch(QStringView str); + + QStringView contextName() const; + QStringView defName() const; + + bool isStay() const; + + int popCount() const + { + return m_popCount; + } + + private: + int m_popCount = 0; + int m_defNameIndex = -1; + QString m_contextAndDefName; + }; + + struct Rule { + enum class Type : quint8 { + Unknown, + AnyChar, + Detect2Chars, + DetectChar, + HlCOct, + IncludeRules, + Int, + Keyword, + LineContinue, + RangeDetect, + RegExpr, + StringDetect, + WordDetect, + Float, + HlCStringChar, + DetectIdentifier, + DetectSpaces, + HlCChar, + HlCHex, + }; + + struct AnyChar { + QString chars; + }; + + struct Detect2Chars { + QChar char1; + QChar char2; + }; + + struct DetectChar { + QChar char1; + bool dynamic; + }; + + struct WordDelimiters { + QString additionalDeliminator; + QString weakDeliminator; + }; + + struct Float { + WordDelimiters wordDelimiters; + }; + + struct HlCHex { + WordDelimiters wordDelimiters; + }; + + struct HlCOct { + WordDelimiters wordDelimiters; + }; + + struct IncludeRules { + QString contextName; + bool includeAttribute; + }; + + struct Int { + WordDelimiters wordDelimiters; + }; + + struct Keyword { + QString name; + WordDelimiters wordDelimiters; + Qt::CaseSensitivity caseSensitivityOverride; + bool hasCaseSensitivityOverride; + }; + + struct LineContinue { + QChar char1; + }; + + struct RangeDetect { + QChar begin; + QChar end; + }; + + struct RegExpr { + QString pattern; + Qt::CaseSensitivity caseSensitivity; + bool isMinimal; + bool dynamic; + }; + + struct StringDetect { + QString string; + Qt::CaseSensitivity caseSensitivity; + bool dynamic; + }; + + struct WordDetect { + QString word; + WordDelimiters wordDelimiters; + Qt::CaseSensitivity caseSensitivity; + }; + + union Data { + AnyChar anyChar; + Detect2Chars detect2Chars; + DetectChar detectChar; + HlCOct hlCOct; + IncludeRules includeRules; + Int detectInt; + Keyword keyword; + LineContinue lineContinue; + RangeDetect rangeDetect; + RegExpr regExpr; + StringDetect stringDetect; + WordDetect wordDetect; + Float detectFloat; + HlCHex hlCHex; + + Data() noexcept + { + } + + ~Data() + { + } + }; + + struct Common { + QString contextName; + QString attributeName; + QString beginRegionName; + QString endRegionName; + int column = -1; + bool firstNonSpace = false; + bool lookAhead = false; + }; + + Type type = Type::Unknown; + Common common; + Data data; + + Rule() noexcept; + Rule(Rule &&other) noexcept; + Rule(const Rule &other); + ~Rule(); + + // since nothing is deleted in the rules vector, these functions do not need to be implemented + Rule &operator=(Rule &&other) = delete; + Rule &operator=(const Rule &other) = delete; + }; + + QString name; + + /** + * attribute name, to lookup our format + */ + QString attribute; + + QString lineEndContext; + QString lineEmptyContext; + QString fallthroughContext; + + std::vector rules; + + bool noIndentationBasedFolding = false; +}; +} + +#endif 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 3ff06952830..a8578522cba 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h @@ -44,6 +44,11 @@ public: return m_keywords; } + Qt::CaseSensitivity caseSensitivity() const + { + return m_caseSensitive; + } + void setKeywordList(const QStringList &keywords) { m_keywords = keywords; @@ -53,7 +58,10 @@ public: } /** Checks if @p str is a keyword in this list. */ - bool contains(QStringView str) const { return contains(str, m_caseSensitive); } + bool contains(QStringView str) const + { + return contains(str, m_caseSensitive); + } /** Checks if @p str is a keyword in this list, overriding the global case-sensitivity setting. */ bool contains(QStringView str, Qt::CaseSensitivity caseSensitive) const; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp index f4e88b719a7..0357dbf2a3c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp @@ -14,7 +14,6 @@ #include "xml_p.h" #include -#include using namespace KSyntaxHighlighting; @@ -97,172 +96,137 @@ static QString replaceCaptures(const QString &pattern, const QStringList &captur return result; } -Rule::~Rule() +static MatchResult matchString(QStringView pattern, QStringView text, int offset, Qt::CaseSensitivity caseSensitivity) { - if (!m_additionalDeliminator.isEmpty() || !m_weakDeliminator.isEmpty()) { - delete m_wordDelimiters; + if (offset + pattern.size() <= text.size() && text.mid(offset, pattern.size()).compare(pattern, caseSensitivity) == 0) { + return offset + pattern.size(); } + return offset; } -Definition Rule::definition() const +static void resolveAdditionalWordDelimiters(WordDelimiters &wordDelimiters, const HighlightingContextData::Rule::WordDelimiters &delimiters) { - return m_def.definition(); -} - -void Rule::setDefinition(const Definition &def) -{ - m_def = def; -} - -bool Rule::load(QXmlStreamReader &reader) -{ - Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - - m_attribute = reader.attributes().value(QLatin1String("attribute")).toString(); - if (reader.name() != QLatin1String("IncludeRules")) { // IncludeRules uses this with a different semantic - m_context.parse(reader.attributes().value(QLatin1String("context"))); - } - m_firstNonSpace = Xml::attrToBool(reader.attributes().value(QLatin1String("firstNonSpace"))); - m_lookAhead = Xml::attrToBool(reader.attributes().value(QLatin1String("lookAhead"))); - bool colOk = false; - m_column = reader.attributes().value(QLatin1String("column")).toInt(&colOk); - if (!colOk) { - m_column = -1; - } - - auto regionName = reader.attributes().value(QLatin1String("beginRegion")); - if (!regionName.isEmpty()) { - m_beginRegion = FoldingRegion(FoldingRegion::Begin, DefinitionData::get(m_def.definition())->foldingRegionId(regionName.toString())); - } - regionName = reader.attributes().value(QLatin1String("endRegion")); - if (!regionName.isEmpty()) { - m_endRegion = FoldingRegion(FoldingRegion::End, DefinitionData::get(m_def.definition())->foldingRegionId(regionName.toString())); - } - - auto result = doLoad(reader); - - if (m_lookAhead && m_context.isStay()) { - result = false; - } - - // be done with this rule, skip all subelements, e.g. no longer supported sub-rules - reader.skipCurrentElement(); - return result; -} - -void Rule::resolveContext() -{ - auto const &def = m_def.definition(); - - m_context.resolve(def); - // cache for DefinitionData::wordDelimiters, is accessed VERY often - m_wordDelimiters = &DefinitionData::get(def)->wordDelimiters; - if (!m_additionalDeliminator.isEmpty() || !m_weakDeliminator.isEmpty()) { - m_wordDelimiters = new WordDelimiters(*m_wordDelimiters); - m_wordDelimiters->append(m_additionalDeliminator); - m_wordDelimiters->remove(m_weakDeliminator); + if (!delimiters.additionalDeliminator.isEmpty() || !delimiters.weakDeliminator.isEmpty()) { + wordDelimiters.append(QStringView(delimiters.additionalDeliminator)); + wordDelimiters.remove(QStringView(delimiters.weakDeliminator)); } } -void Rule::resolveAttributeFormat(Context *lookupContext) +Rule::~Rule() = default; + +const IncludeRules *Rule::castToIncludeRules() const { + if (m_type != Type::IncludeRules) { + return nullptr; + } + return static_cast(this); +} + +bool Rule::resolveCommon(DefinitionData &def, const HighlightingContextData::Rule &ruleData, QStringView lookupContextName) +{ + switch (ruleData.type) { + // IncludeRules uses this with a different semantic + case HighlightingContextData::Rule::Type::IncludeRules: + m_type = Type::IncludeRules; + return true; + case HighlightingContextData::Rule::Type::LineContinue: + m_type = Type::LineContinue; + break; + default: + m_type = Type::OtherRule; + break; + } + /** * try to get our format from the definition we stem from */ - if (!m_attribute.isEmpty()) { - m_attributeFormat = DefinitionData::get(definition())->formatByName(m_attribute); + if (!ruleData.common.attributeName.isEmpty()) { + m_attributeFormat = def.formatByName(ruleData.common.attributeName); if (!m_attributeFormat.isValid()) { - qCWarning(Log) << "Rule: Unknown format" << m_attribute << "in context" << lookupContext->name() << "of definition" << definition().name(); + qCWarning(Log) << "Rule: Unknown format" << ruleData.common.attributeName << "in context" << lookupContextName << "of definition" << def.name; } } + + m_firstNonSpace = ruleData.common.firstNonSpace; + m_lookAhead = ruleData.common.lookAhead; + m_column = ruleData.common.column; + + if (!ruleData.common.beginRegionName.isEmpty()) { + m_beginRegion = FoldingRegion(FoldingRegion::Begin, def.foldingRegionId(ruleData.common.beginRegionName)); + } + if (!ruleData.common.endRegionName.isEmpty()) { + m_endRegion = FoldingRegion(FoldingRegion::End, def.foldingRegionId(ruleData.common.endRegionName)); + } + + m_context.resolve(def, ruleData.common.contextName); + + return !(m_lookAhead && m_context.isStay()); } -bool Rule::doLoad(QXmlStreamReader &reader) +static Rule::Ptr createRule(DefinitionData &def, const HighlightingContextData::Rule &ruleData, QStringView lookupContextName) { - Q_UNUSED(reader); - return true; -} + using Type = HighlightingContextData::Rule::Type; -void Rule::loadAdditionalWordDelimiters(QXmlStreamReader &reader) -{ - m_additionalDeliminator = reader.attributes().value(QLatin1String("additionalDeliminator")).toString(); - m_weakDeliminator = reader.attributes().value(QLatin1String("weakDeliminator")).toString(); -} - -Rule::Ptr Rule::create(QStringView name) -{ - if (name == QLatin1String("AnyChar")) { - return std::make_shared(); - } - if (name == QLatin1String("DetectChar")) { - return std::make_shared(); - } - if (name == QLatin1String("Detect2Chars")) { - return std::make_shared(); - } - if (name == QLatin1String("DetectIdentifier")) { - return std::make_shared(); - } - if (name == QLatin1String("DetectSpaces")) { - return std::make_shared(); - } - if (name == QLatin1String("Float")) { - return std::make_shared(); - } - if (name == QLatin1String("Int")) { - return std::make_shared(); - } - if (name == QLatin1String("HlCChar")) { - return std::make_shared(); - } - if (name == QLatin1String("HlCHex")) { - return std::make_shared(); - } - if (name == QLatin1String("HlCOct")) { - return std::make_shared(); - } - if (name == QLatin1String("HlCStringChar")) { + switch (ruleData.type) { + case Type::AnyChar: + return std::make_shared(ruleData.data.anyChar); + case Type::DetectChar: + return std::make_shared(ruleData.data.detectChar); + case Type::Detect2Chars: + return std::make_shared(ruleData.data.detect2Chars); + case Type::IncludeRules: + return std::make_shared(ruleData.data.includeRules); + case Type::Int: + return std::make_shared(def, ruleData.data.detectInt); + case Type::Keyword: + return KeywordListRule::create(def, ruleData.data.keyword, lookupContextName); + case Type::LineContinue: + return std::make_shared(ruleData.data.lineContinue); + case Type::RangeDetect: + return std::make_shared(ruleData.data.rangeDetect); + case Type::RegExpr: + return std::make_shared(ruleData.data.regExpr); + case Type::StringDetect: + if (ruleData.data.stringDetect.dynamic) { + return std::make_shared(ruleData.data.stringDetect); + } + return std::make_shared(ruleData.data.stringDetect); + case Type::WordDetect: + return std::make_shared(def, ruleData.data.wordDetect); + case Type::Float: + return std::make_shared(def, ruleData.data.detectFloat); + case Type::HlCOct: + return std::make_shared(def, ruleData.data.hlCOct); + case Type::HlCStringChar: return std::make_shared(); - } - if (name == QLatin1String("IncludeRules")) { - return std::make_shared(); - } - if (name == QLatin1String("keyword")) { - return std::make_shared(); - } - if (name == QLatin1String("LineContinue")) { - return std::make_shared(); - } - if (name == QLatin1String("RangeDetect")) { - return std::make_shared(); - } - if (name == QLatin1String("RegExpr")) { - return std::make_shared(); - } - if (name == QLatin1String("StringDetect")) { - return std::make_shared(); - } - if (name == QLatin1String("WordDetect")) { - return std::make_shared(); + case Type::DetectIdentifier: + return std::make_shared(); + case Type::DetectSpaces: + return std::make_shared(); + case Type::HlCChar: + return std::make_shared(); + case Type::HlCHex: + return std::make_shared(def, ruleData.data.hlCHex); + + case Type::Unknown:; } - qCWarning(Log) << "Unknown rule type:" << name; - return Ptr(nullptr); + return Rule::Ptr(nullptr); } -bool Rule::isWordDelimiter(QChar c) const +Rule::Ptr Rule::create(DefinitionData &def, const HighlightingContextData::Rule &ruleData, QStringView lookupContextName) { - return m_wordDelimiters->contains(c); + auto rule = createRule(def, ruleData, lookupContextName); + if (rule && !rule->resolveCommon(def, ruleData, lookupContextName)) { + rule.reset(); + } + return rule; } -bool AnyChar::doLoad(QXmlStreamReader &reader) +AnyChar::AnyChar(const HighlightingContextData::Rule::AnyChar &data) + : m_chars(data.chars) { - m_chars = reader.attributes().value(QLatin1String("String")).toString(); - if (m_chars.size() == 1) { - qCDebug(Log) << "AnyChar rule with just one char: use DetectChar instead."; - } - return !m_chars.isEmpty(); } MatchResult AnyChar::doMatch(QStringView text, int offset, const QStringList &) const @@ -273,18 +237,11 @@ MatchResult AnyChar::doMatch(QStringView text, int offset, const QStringList &) return offset; } -bool DetectChar::doLoad(QXmlStreamReader &reader) +DetectChar::DetectChar(const HighlightingContextData::Rule::DetectChar &data) + : m_char(data.char1) + , m_captureIndex(data.dynamic ? data.char1.digitValue() : 0) { - const auto s = reader.attributes().value(QLatin1String("char")); - if (s.isEmpty()) { - return false; - } - m_char = s.at(0); - m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); - if (m_dynamic) { - m_captureIndex = m_char.digitValue(); - } - return true; + m_dynamic = data.dynamic; } MatchResult DetectChar::doMatch(QStringView text, int offset, const QStringList &captures) const @@ -305,19 +262,13 @@ MatchResult DetectChar::doMatch(QStringView text, int offset, const QStringList return offset; } -bool Detect2Char::doLoad(QXmlStreamReader &reader) +Detect2Chars::Detect2Chars(const HighlightingContextData::Rule::Detect2Chars &data) + : m_char1(data.char1) + , m_char2(data.char2) { - const auto s1 = reader.attributes().value(QLatin1String("char")); - const auto s2 = reader.attributes().value(QLatin1String("char1")); - if (s1.isEmpty() || s2.isEmpty()) { - return false; - } - m_char1 = s1.at(0); - m_char2 = s2.at(0); - return true; } -MatchResult Detect2Char::doMatch(QStringView text, int offset, const QStringList &) const +MatchResult Detect2Chars::doMatch(QStringView text, int offset, const QStringList &) const { if (text.size() - offset < 2) { return offset; @@ -352,15 +303,15 @@ MatchResult DetectSpaces::doMatch(QStringView text, int offset, const QStringLis return offset; } -bool Float::doLoad(QXmlStreamReader &reader) +Float::Float(DefinitionData &def, const HighlightingContextData::Rule::Float &data) + : m_wordDelimiters(def.wordDelimiters) { - loadAdditionalWordDelimiters(reader); - return true; + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult Float::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { + if (offset > 0 && !m_wordDelimiters.contains(text.at(offset - 1))) { return offset; } @@ -432,15 +383,15 @@ MatchResult HlCChar::doMatch(QStringView text, int offset, const QStringList &) return offset; } -bool HlCHex::doLoad(QXmlStreamReader &reader) +HlCHex::HlCHex(DefinitionData &def, const HighlightingContextData::Rule::HlCHex &data) + : m_wordDelimiters(def.wordDelimiters) { - loadAdditionalWordDelimiters(reader); - return true; + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult HlCHex::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { + if (offset > 0 && !m_wordDelimiters.contains(text.at(offset - 1))) { return offset; } @@ -466,15 +417,15 @@ MatchResult HlCHex::doMatch(QStringView text, int offset, const QStringList &) c return offset; } -bool HlCOct::doLoad(QXmlStreamReader &reader) +HlCOct::HlCOct(DefinitionData &def, const HighlightingContextData::Rule::HlCOct &data) + : m_wordDelimiters(def.wordDelimiters) { - loadAdditionalWordDelimiters(reader); - return true; + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult HlCOct::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { + if (offset > 0 && !m_wordDelimiters.contains(text.at(offset - 1))) { return offset; } @@ -503,53 +454,28 @@ MatchResult HlCStringChar::doMatch(QStringView text, int offset, const QStringLi return matchEscapedChar(text, offset); } -QString IncludeRules::contextName() const +IncludeRules::IncludeRules(const HighlightingContextData::Rule::IncludeRules &data) + : m_contextName(data.contextName) + , m_includeAttribute(data.includeAttribute) { - return m_contextName; -} - -QString IncludeRules::definitionName() const -{ - return m_defName; -} - -bool IncludeRules::includeAttribute() const -{ - return m_includeAttribute; -} - -bool IncludeRules::doLoad(QXmlStreamReader &reader) -{ - const auto s = reader.attributes().value(QLatin1String("context")); - const auto split = s.split(QString::fromLatin1("##"), Qt::KeepEmptyParts); - if (split.isEmpty()) { - return false; - } - m_contextName = split.at(0).toString(); - if (split.size() > 1) { - m_defName = split.at(1).toString(); - } - m_includeAttribute = Xml::attrToBool(reader.attributes().value(QLatin1String("includeAttrib"))); - - return !m_contextName.isEmpty() || !m_defName.isEmpty(); } MatchResult IncludeRules::doMatch(QStringView text, int offset, const QStringList &) const { Q_UNUSED(text); - qCWarning(Log) << "Unresolved include rule for" << m_contextName << "##" << m_defName; + qCWarning(Log) << "Unresolved include rule"; return offset; } -bool Int::doLoad(QXmlStreamReader &reader) +Int::Int(DefinitionData &def, const HighlightingContextData::Rule::Int &data) + : m_wordDelimiters(def.wordDelimiters) { - loadAdditionalWordDelimiters(reader); - return true; + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult Int::doMatch(QStringView text, int offset, const QStringList &) const { - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) { + if (offset > 0 && !m_wordDelimiters.contains(text.at(offset - 1))) { return offset; } @@ -559,67 +485,61 @@ MatchResult Int::doMatch(QStringView text, int offset, const QStringList &) cons return offset; } -bool KeywordListRule::doLoad(QXmlStreamReader &reader) +Rule::Ptr KeywordListRule::create(DefinitionData &def, const HighlightingContextData::Rule::Keyword &data, QStringView lookupContextName) { /** * get our keyword list, if not found => bail out */ - auto defData = DefinitionData::get(definition()); - m_keywordList = defData->keywordList(reader.attributes().value(QLatin1String("String")).toString()); - if (!m_keywordList) { - return false; + auto *keywordList = def.keywordList(data.name); + if (!keywordList) { + qCWarning(Log) << "Rule: Unknown keyword list" << data.name << "in context" << lookupContextName << "of definition" << def.name; + return Rule::Ptr(); + } + + if (keywordList->isEmpty()) { + return Rule::Ptr(); } /** * we might overwrite the case sensitivity * then we need to init the list for lookup of that sensitivity setting */ - if (reader.attributes().hasAttribute(QLatin1String("insensitive"))) { - m_hasCaseSensitivityOverride = true; - m_caseSensitivityOverride = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; - m_keywordList->initLookupForCaseSensitivity(m_caseSensitivityOverride); - } else { - m_hasCaseSensitivityOverride = false; + if (data.hasCaseSensitivityOverride) { + keywordList->initLookupForCaseSensitivity(data.caseSensitivityOverride); } - loadAdditionalWordDelimiters(reader); + return std::make_shared(*keywordList, def, data); +} - return !m_keywordList->isEmpty(); +KeywordListRule::KeywordListRule(const KeywordList &keywordList, DefinitionData &def, const HighlightingContextData::Rule::Keyword &data) + : m_wordDelimiters(def.wordDelimiters) + , m_keywordList(keywordList) + , m_caseSensitivity(data.hasCaseSensitivityOverride ? data.caseSensitivityOverride : keywordList.caseSensitivity()) +{ + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult KeywordListRule::doMatch(QStringView text, int offset, const QStringList &) const { auto newOffset = offset; - while (text.size() > newOffset && !isWordDelimiter(text.at(newOffset))) { + while (text.size() > newOffset && !m_wordDelimiters.contains(text.at(newOffset))) { ++newOffset; } if (newOffset == offset) { return offset; } - if (m_hasCaseSensitivityOverride) { - if (m_keywordList->contains(text.mid(offset, newOffset - offset), m_caseSensitivityOverride)) { - return newOffset; - } - } else { - if (m_keywordList->contains(text.mid(offset, newOffset - offset))) { - return newOffset; - } + if (m_keywordList.contains(text.mid(offset, newOffset - offset), m_caseSensitivity)) { + return newOffset; } // we don't match, but we can skip until newOffset as we can't start a keyword in-between return MatchResult(offset, newOffset); } -bool LineContinue::doLoad(QXmlStreamReader &reader) +LineContinue::LineContinue(const HighlightingContextData::Rule::LineContinue &data) + : m_char(data.char1) { - const auto s = reader.attributes().value(QLatin1String("char")); - if (s.isEmpty()) { - m_char = QLatin1Char('\\'); - } else { - m_char = s.at(0); - } - return true; } MatchResult LineContinue::doMatch(QStringView text, int offset, const QStringList &) const @@ -630,16 +550,10 @@ MatchResult LineContinue::doMatch(QStringView text, int offset, const QStringLis return offset; } -bool RangeDetect::doLoad(QXmlStreamReader &reader) +RangeDetect::RangeDetect(const HighlightingContextData::Rule::RangeDetect &data) + : m_begin(data.begin) + , m_end(data.end) { - const auto s1 = reader.attributes().value(QLatin1String("char")); - const auto s2 = reader.attributes().value(QLatin1String("char1")); - if (s1.isEmpty() || s2.isEmpty()) { - return false; - } - m_begin = s1.at(0); - m_end = s2.at(0); - return true; } MatchResult RangeDetect::doMatch(QStringView text, int offset, const QStringList &) const @@ -661,25 +575,20 @@ MatchResult RangeDetect::doMatch(QStringView text, int offset, const QStringList return offset; } -bool RegExpr::doLoad(QXmlStreamReader &reader) +RegExpr::RegExpr(const HighlightingContextData::Rule::RegExpr &data) { - m_regexp.setPattern(reader.attributes().value(QLatin1String("String")).toString()); - - const auto isMinimal = Xml::attrToBool(reader.attributes().value(QLatin1String("minimal"))); - const auto isCaseInsensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))); - m_regexp.setPatternOptions((isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) - | (isCaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption) + m_regexp.setPattern(data.pattern); + m_regexp.setPatternOptions((data.isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) + | (data.caseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption) // DontCaptureOption is removed by resolvePostProcessing() when necessary | QRegularExpression::DontCaptureOption // ensure Unicode support is enabled | QRegularExpression::UseUnicodePropertiesOption); - m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); - - return !m_regexp.pattern().isEmpty(); + m_dynamic = data.dynamic; } -void KSyntaxHighlighting::RegExpr::resolvePostProcessing() +void RegExpr::resolvePostProcessing() { if (m_isResolved) { return; @@ -728,11 +637,7 @@ MatchResult RegExpr::doMatch(QStringView text, int offset, const QStringList &ca /** * match the pattern */ -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2) - const auto result = regexp.match(text.toString(), offset, QRegularExpression::NormalMatch, QRegularExpression::DontCheckSubjectStringMatchOption); -#else const auto result = regexp.match(text, offset, QRegularExpression::NormalMatch, QRegularExpression::DontCheckSubjectStringMatchOption); -#endif if (result.capturedStart() == offset) { /** * we only need to compute the captured texts if we have real capture groups @@ -756,33 +661,39 @@ MatchResult RegExpr::doMatch(QStringView text, int offset, const QStringList &ca return MatchResult(offset, result.capturedStart()); } -bool StringDetect::doLoad(QXmlStreamReader &reader) +StringDetect::StringDetect(const HighlightingContextData::Rule::StringDetect &data) + : m_string(data.string) + , m_caseSensitivity(data.caseSensitivity) { - m_string = reader.attributes().value(QLatin1String("String")).toString(); - m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; - m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); - return !m_string.isEmpty(); } -MatchResult StringDetect::doMatch(QStringView text, int offset, const QStringList &captures) const +MatchResult StringDetect::doMatch(QStringView text, int offset, const QStringList &) const +{ + return matchString(m_string, text, offset, m_caseSensitivity); +} + +DynamicStringDetect::DynamicStringDetect(const HighlightingContextData::Rule::StringDetect &data) + : m_string(data.string) + , m_caseSensitivity(data.caseSensitivity) +{ + m_dynamic = true; +} + +MatchResult DynamicStringDetect::doMatch(QStringView text, int offset, const QStringList &captures) const { /** * for dynamic case: create new pattern with right instantiation */ - const auto &pattern = m_dynamic ? replaceCaptures(m_string, captures, false) : m_string; - - if (offset + pattern.size() <= text.size() && text.mid(offset, pattern.size()).compare(pattern, m_caseSensitivity) == 0) { - return offset + pattern.size(); - } - return offset; + const auto pattern = replaceCaptures(m_string, captures, false); + return matchString(pattern, text, offset, m_caseSensitivity); } -bool WordDetect::doLoad(QXmlStreamReader &reader) +WordDetect::WordDetect(DefinitionData &def, const HighlightingContextData::Rule::WordDetect &data) + : m_wordDelimiters(def.wordDelimiters) + , m_word(data.word) + , m_caseSensitivity(data.caseSensitivity) { - m_word = reader.attributes().value(QLatin1String("String")).toString(); - m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; - loadAdditionalWordDelimiters(reader); - return !m_word.isEmpty(); + resolveAdditionalWordDelimiters(m_wordDelimiters, data.wordDelimiters); } MatchResult WordDetect::doMatch(QStringView text, int offset, const QStringList &) const @@ -795,7 +706,7 @@ MatchResult WordDetect::doMatch(QStringView text, int offset, const QStringList * detect delimiter characters on the inner and outer boundaries of the string * NOTE: m_word isn't empty */ - if (offset > 0 && !isWordDelimiter(text.at(offset - 1)) && !isWordDelimiter(text.at(offset))) { + if (offset > 0 && !m_wordDelimiters.contains(text.at(offset - 1)) && !m_wordDelimiters.contains(text.at(offset))) { return offset; } @@ -803,7 +714,8 @@ MatchResult WordDetect::doMatch(QStringView text, int offset, const QStringList return offset; } - if (text.size() == offset + m_word.size() || isWordDelimiter(text.at(offset + m_word.size())) || isWordDelimiter(text.at(offset + m_word.size() - 1))) { + if (text.size() == offset + m_word.size() || m_wordDelimiters.contains(text.at(offset + m_word.size())) + || m_wordDelimiters.contains(text.at(offset + m_word.size() - 1))) { return offset + m_word.size(); } 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 374eb87dfaf..faf2a97f484 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h @@ -9,25 +9,24 @@ #define KSYNTAXHIGHLIGHTING_RULE_P_H #include "contextswitch_p.h" -#include "definition.h" #include "definitionref_p.h" #include "foldingregion.h" #include "format.h" +#include "highlightingdata_p.hpp" #include "keywordlist_p.h" #include "matchresult_p.h" +#include "worddelimiters_p.h" #include #include #include -QT_BEGIN_NAMESPACE -class QXmlStreamReader; -QT_END_NAMESPACE - namespace KSyntaxHighlighting { class WordDelimiters; +class DefinitionData; +class IncludeRules; class Rule { @@ -37,9 +36,6 @@ public: typedef std::shared_ptr Ptr; - Definition definition() const; - void setDefinition(const Definition &def); - const Format &attributeFormat() const { return m_attributeFormat; @@ -80,51 +76,51 @@ public: return m_endRegion; } - bool load(QXmlStreamReader &reader); - void resolveContext(); - void resolveAttributeFormat(Context *lookupContext); + const IncludeRules *castToIncludeRules() const; + + bool isLineContinue() const + { + return m_type == Type::LineContinue; + } + virtual void resolvePostProcessing() { } virtual MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const = 0; - static Rule::Ptr create(QStringView name); - -protected: - virtual bool doLoad(QXmlStreamReader &reader); - - bool isWordDelimiter(QChar c) const; - - void loadAdditionalWordDelimiters(QXmlStreamReader &reader); + static Rule::Ptr create(DefinitionData &def, const HighlightingContextData::Rule &ruleData, QStringView lookupContextName); private: Q_DISABLE_COPY(Rule) - DefinitionRef m_def; - QString m_attribute; + bool resolveCommon(DefinitionData &def, const HighlightingContextData::Rule &ruleData, QStringView lookupContextName); + + enum class Type : quint8 { + OtherRule, + LineContinue, + IncludeRules, + }; + Format m_attributeFormat; ContextSwitch m_context; int m_column = -1; FoldingRegion m_beginRegion; FoldingRegion m_endRegion; + Type m_type; bool m_firstNonSpace = false; bool m_lookAhead = false; - // cache for DefinitionData::wordDelimiters, is accessed VERY often - WordDelimiters *m_wordDelimiters = nullptr; - - QString m_additionalDeliminator; - QString m_weakDeliminator; - protected: bool m_dynamic = false; }; class AnyChar final : public Rule { +public: + AnyChar(const HighlightingContextData::Rule::AnyChar &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: @@ -133,20 +129,24 @@ private: class DetectChar final : public Rule { +public: + DetectChar(const HighlightingContextData::Rule::DetectChar &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QChar m_char; int m_captureIndex = 0; }; -class Detect2Char final : public Rule +class Detect2Chars final : public Rule { +public: + Detect2Chars(const HighlightingContextData::Rule::Detect2Chars &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QChar m_char1; @@ -167,33 +167,49 @@ protected: class Float final : public Rule { +public: + Float(DefinitionData &def, const HighlightingContextData::Rule::Float &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; + +private: + WordDelimiters m_wordDelimiters; }; class IncludeRules final : public Rule { public: - QString contextName() const; - QString definitionName() const; - bool includeAttribute() const; + IncludeRules(const HighlightingContextData::Rule::IncludeRules &data); + + const QString &contextName() const + { + return m_contextName; + } + + bool includeAttribute() const + { + return m_includeAttribute; + } protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QString m_contextName; - QString m_defName; bool m_includeAttribute; }; class Int final : public Rule { +public: + Int(DefinitionData &def, const HighlightingContextData::Rule::Int &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; + +private: + WordDelimiters m_wordDelimiters; }; class HlCChar final : public Rule @@ -204,16 +220,26 @@ protected: class HlCHex final : public Rule { +public: + HlCHex(DefinitionData &def, const HighlightingContextData::Rule::HlCHex &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; + +private: + WordDelimiters m_wordDelimiters; }; class HlCOct final : public Rule { +public: + HlCOct(DefinitionData &def, const HighlightingContextData::Rule::HlCOct &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; + +private: + WordDelimiters m_wordDelimiters; }; class HlCStringChar final : public Rule @@ -224,20 +250,26 @@ protected: class KeywordListRule final : public Rule { +public: + KeywordListRule(const KeywordList &keywordList, DefinitionData &def, const HighlightingContextData::Rule::Keyword &data); + + static Rule::Ptr create(DefinitionData &def, const HighlightingContextData::Rule::Keyword &data, QStringView lookupContextName); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: - KeywordList *m_keywordList; - bool m_hasCaseSensitivityOverride; - Qt::CaseSensitivity m_caseSensitivityOverride; + WordDelimiters m_wordDelimiters; + const KeywordList &m_keywordList; + Qt::CaseSensitivity m_caseSensitivity; }; class LineContinue final : public Rule { +public: + LineContinue(const HighlightingContextData::Rule::LineContinue &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: @@ -246,8 +278,10 @@ private: class RangeDetect final : public Rule { +public: + RangeDetect(const HighlightingContextData::Rule::RangeDetect &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: @@ -257,10 +291,12 @@ private: class RegExpr final : public Rule { +public: + RegExpr(const HighlightingContextData::Rule::RegExpr &data); + protected: + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; void resolvePostProcessing() override; - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; private: QRegularExpression m_regexp; @@ -269,9 +305,24 @@ private: class StringDetect final : public Rule { +public: + StringDetect(const HighlightingContextData::Rule::StringDetect &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; + +private: + QString m_string; + Qt::CaseSensitivity m_caseSensitivity; +}; + +class DynamicStringDetect final : public Rule +{ +public: + DynamicStringDetect(const HighlightingContextData::Rule::StringDetect &data); + +protected: + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: QString m_string; @@ -280,11 +331,14 @@ private: class WordDetect final : public Rule { +public: + WordDetect(DefinitionData &def, const HighlightingContextData::Rule::WordDetect &data); + protected: - bool doLoad(QXmlStreamReader &reader) override; - MatchResult doMatch(QStringView text, int offset, const QStringList &captures) const override; + MatchResult doMatch(QStringView text, int offset, const QStringList &) const override; private: + WordDelimiters m_wordDelimiters; QString m_word; Qt::CaseSensitivity m_caseSensitivity; }; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp index 98daff19d6e..ab62f88b7e3 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp @@ -9,7 +9,6 @@ using namespace KSyntaxHighlighting; #include -#include namespace { diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp index f9079ea1f3d..c5401a57cc9 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp @@ -12,15 +12,14 @@ WordDelimiters::WordDelimiters() : asciiDelimiters{} { for (const char *p = "\t !%&()*+,-./:;<=>?[\\]^{|}~"; *p; ++p) { - // int(*p) fix -Wchar-subscripts - asciiDelimiters[int(*p)] = true; + asciiDelimiters.set(*p); } } bool WordDelimiters::contains(QChar c) const { if (c.unicode() < 128) { - return asciiDelimiters[c.unicode()]; + return asciiDelimiters.test(c.unicode()); } // perf tells contains is MUCH faster than binary search here, very short array return notAsciiDelimiters.contains(c); @@ -30,7 +29,7 @@ void WordDelimiters::append(QStringView s) { for (QChar c : s) { if (c.unicode() < 128) { - asciiDelimiters[c.unicode()] = true; + asciiDelimiters.set(c.unicode()); } else { notAsciiDelimiters.append(c); } @@ -41,7 +40,7 @@ void WordDelimiters::remove(QStringView s) { for (QChar c : s) { if (c.unicode() < 128) { - asciiDelimiters[c.unicode()] = false; + asciiDelimiters.set(c.unicode(), false); } else { notAsciiDelimiters.remove(c); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h index c1afaaa6bb0..ccad679a4ef 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h @@ -9,6 +9,8 @@ #include +#include + namespace KSyntaxHighlighting { /** @@ -44,7 +46,7 @@ private: * An array which represents ascii characters for very fast lookup. * The character is used as an index and the value @c true indicates a word delimiter. */ - bool asciiDelimiters[128]; + std::bitset<128> asciiDelimiters; /** * Contains characters that are not ascii and is empty for most syntax definition.