TextEditor: update ksyntaxhighlighting engine to v6.7.0

Task-number: QTCREATORBUG-22558
Change-Id: I0fadfa95784b78a40ebbb8910bd506df644fac4b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2024-10-24 11:09:55 +02:00
parent 197d15bd67
commit f24cc172ce
41 changed files with 2478 additions and 1291 deletions

View File

@@ -24,7 +24,6 @@ add_qtc_library(KSyntaxHighlighting
src/lib/contextswitch.cpp src/lib/contextswitch_p.h
src/lib/definition.cpp src/lib/definition.h
src/lib/definitiondownloader.cpp src/lib/definitiondownloader.h
src/lib/definitionref_p.h
src/lib/definition_p.h
src/lib/dynamicregexpcache_p.h
src/lib/foldingregion.cpp src/lib/foldingregion.h

View File

@@ -3,10 +3,10 @@
#ifndef KSYNTAXHIGHLIGHTING_VERSION_H
#define KSYNTAXHIGHLIGHTING_VERSION_H
#define KSYNTAXHIGHLIGHTING_VERSION_STRING "5.249.0"
#define KSYNTAXHIGHLIGHTING_VERSION_MAJOR 5
#define KSYNTAXHIGHLIGHTING_VERSION_MINOR 249
#define KSYNTAXHIGHLIGHTING_VERSION_STRING "6.7.0"
#define KSYNTAXHIGHLIGHTING_VERSION_MAJOR 6
#define KSYNTAXHIGHLIGHTING_VERSION_MINOR 7
#define KSYNTAXHIGHLIGHTING_VERSION_PATCH 0
#define KSYNTAXHIGHLIGHTING_VERSION ((5<<16)|(249<<8)|(0))
#define KSYNTAXHIGHLIGHTING_VERSION ((6<<16)|(7<<8)|(0))
#endif

View File

@@ -56,17 +56,22 @@
<!ENTITY arithmetic_as_subshell "\(((?:[^`'&quot;()$]++|\$\{[^`'&quot;(){}$]+\}|\$(?=[^{`'&quot;()])|`[^`]*+`|\((?1)(?:[)]|(?=['&quot;])))++)(?:[)](?=$|[^)])|[&quot;'])">
<!ENTITY unary_operators "-[abcdefghkprstuwxGLNOSovRnz]&eos;">
<!ENTITY binary_operators "(?:-(?:e[fq]|[nolg]t|[nlg]e)|==?|!=)&eos;">
<!ENTITY unary_operators "-[abcdefghkprstuwxGLNOSovRnz](?=\\?$|[ &tab;])">
<!ENTITY binary_operators "(?:-(?:e[fq]|[nolg]t|[nlg]e)|==?|!=)(?=\\?$|[ &tab;])">
<!ENTITY dblbracket_close "\]\](?=($|[ &tab;;|&amp;)]))">
<!ENTITY weakDeliminatorSymbols "^&#37;#[]$.{}:-/">
]>
<!--
https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS
current: bash-5.2
-->
<language
name="Bash"
version="51"
version="53"
kateversion="5.79"
section="Scripts"
extensions="*.sh;*.bash;*.ebuild;*.eclass;*.exlib;*.exheres-0;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD"
@@ -872,6 +877,7 @@
<!-- FindPathThenPopInAlternateValue consumes path in ${xx:here}-->
<context attribute="Normal Text" lineEndContext="#pop" name="FindPathThenPopInAlternateValue">
<DetectChar attribute="Variable" char="&amp;"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="?" char1="(" lookAhead="1"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="*" char1="(" lookAhead="1"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="+" char1="(" lookAhead="1"/>
@@ -1239,12 +1245,12 @@
<IncludeRules context="Start"/>
</context>
<!-- StringEsc eats till ', but escaping many characters -->
<!-- StringEsc eats till ', but escaping many characters in $'...' -->
<context attribute="String SingleQ" lineEndContext="#stay" name="StringEsc">
<DetectSpaces attribute="String SingleQ"/>
<DetectIdentifier attribute="String SingleQ"/>
<DetectChar attribute="String SingleQ" context="#pop" char="'"/>
<RegExpr attribute="String Escape" context="#stay" String="\\(?:[abefnrtv\\']|[0-7]{1,3}|x[A-Fa-f0-9]{1,2}|c.)"/>
<RegExpr attribute="String Escape" context="#stay" String="\\(?:[abeEfnrtv\\'&quot;?]|[0-7]{1,3}|x[A-Fa-f0-9]{1,2}|u[A-Fa-f0-9]{1,4}|U[A-Fa-f0-9]{1,8}|c.)"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="FindWord">
@@ -1368,7 +1374,7 @@
<!-- called as soon as ${xxx@ is encoutered -->
<context attribute="Normal Text" lineEndContext="#stay" name="VarTransformation" fallthroughContext="#pop!VarError">
<DetectChar attribute="Parameter Expansion" context="#pop" char="}"/>
<AnyChar attribute="Parameter Expansion" context="#stay" String="UuLQEPAKa"/>
<AnyChar attribute="Parameter Expansion" context="#stay" String="UuLQEPAKak"/>
</context>
<context attribute="Escape" lineEndContext="#pop" name="BraceExpansion">
@@ -1495,13 +1501,19 @@
<IncludeRules context="FindNormalText"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2" fallthroughContext="ExprBracketValue">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2" fallthroughContext="#pop!ExprBracketParam2_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2_Value" fallthroughContext="ExprBracketValue">
<DetectSpaces attribute="Normal Text" context="#pop!ExprBracketParam3"/>
<AnyChar context="TestMaybeBinary" String="-=!" lookAhead="1"/>
<IncludeRules context="FindExprBracketEnd"/>
</context>
<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3" fallthroughContext="ExprBracketValue">
<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3" fallthroughContext="#pop!ExprBracketParam3_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3_Value" fallthroughContext="ExprBracketValue">
<DetectSpaces attribute="Normal Text" context="#pop!ExprBracketFinal"/>
<IncludeRules context="FindExprBracketEnd"/>
</context>
@@ -1525,8 +1537,12 @@
<RegExpr attribute="Expression" context="#pop" String="&binary_operators;"/>
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="SkipSpaces" fallthroughContext="#pop">
<DetectSpaces context="#pop"/>
</context>
<!-- ExprDblBracket consumes an expression till ]] -->
<!-- ExprDblBracket consumes an expression till ]] in [[ ... ]] -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracket" fallthroughContext="#pop!ExprDblBracketNot">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
@@ -1641,7 +1657,10 @@
<DetectChar attribute="Operator" context="ExprDblBracketValuePattern" char=")" endRegion="expression" beginRegion="subshell"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2" fallthroughContext="ExprDblBracketValuePattern">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2" fallthroughContext="#pop!ExprDblBracketParam2_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2_Value" fallthroughContext="ExprDblBracketValuePattern">
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketParam3"/>
<AnyChar context="TestMaybeBinary2" String="-=!" lookAhead="1"/>
<AnyChar attribute="Expression" context="#pop!ExprDblBracketParam3Spe" String="&lt;>"/>
@@ -1657,7 +1676,10 @@
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketParam3"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3" fallthroughContext="ExprDblBracketValuePattern">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3" fallthroughContext="#pop!ExprDblBracketParam3_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3_Value" fallthroughContext="ExprDblBracketValuePattern">
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketFinal"/>
<IncludeRules context="FindExprDblBracketEnd"/>
<AnyChar attribute="Error" context="#stay" String="&lt;>"/>
@@ -1773,7 +1795,7 @@
<DetectChar attribute="Error" context="#pop" char="]"/>
</context>
<!-- SubShell consumes shell input till ) -->
<!-- SubShell consumes shell input till ) in (...) -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubShell" fallthroughContext="Command">
<DetectChar attribute="Keyword" context="#pop" char=")" endRegion="subshell"/>
<IncludeRules context="Start"/>
@@ -1788,7 +1810,7 @@
<IncludeRules context="NormalOption"/>
</context>
<!-- AssignArray consumes everything till ), marking assignments -->
<!-- AssignArray consumes everything till ) in var=(...), marking assignments -->
<context attribute="Normal Text" lineEndContext="#stay" name="AssignArray" fallthroughContext="NormalOption">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
@@ -1807,7 +1829,7 @@
<IncludeRules context="Start"/>
</context>
<!-- Subscript consumes anything till ], marks as Variable -->
<!-- Subscript consumes anything till ] in [ ... ], marks as Variable -->
<context attribute="Normal Text" lineEndContext="#stay" name="Subscript" fallthroughContext="#pop!Subscript2">
<DetectChar attribute="Parameter Expansion Operator" context="#pop" char="]"/>
<AnyChar attribute="Decimal" context="#stay" String="0123456789"/>

View File

@@ -18,14 +18,13 @@
-->
<!-- ***** THIS FILE WAS GENERATED BY A SCRIPT - DO NOT EDIT *****
cd data/generators
# increase version of cmake.xml.tpl then
./generate-cmake-syntax.py cmake.yaml > ../syntax/cmake.xml
$ cd data/generators
$ ./generate-cmake-syntax.py cmake.yaml > ../syntax/cmake.xml
-->
<language
name="CMake"
version="50"
version="52"
kateversion="5.62"
section="Other"
extensions="CMakeLists.txt;*.cmake;*.cmake.in"
@@ -214,6 +213,7 @@
<item>DEFER</item>
<item>DIRECTORY</item>
<item>EVAL</item>
<item>EXIT</item>
<item>GET_CALL</item>
<item>GET_CALL_IDS</item>
<item>GET_MESSAGE_LOG_LEVEL</item>
@@ -315,8 +315,11 @@
<item>IN_LIST</item>
<item>IS_ABSOLUTE</item>
<item>IS_DIRECTORY</item>
<item>IS_EXECUTABLE</item>
<item>IS_NEWER_THAN</item>
<item>IS_READABLE</item>
<item>IS_SYMLINK</item>
<item>IS_WRITABLE</item>
<item>LESS</item>
<item>LESS_EQUAL</item>
<item>MATCHES</item>
@@ -480,6 +483,7 @@
<item>TIMESTAMP</item>
<item>TLS_CAINFO</item>
<item>TLS_VERIFY</item>
<item>TLS_VERSION</item>
<item>TOUCH</item>
<item>TOUCH_NOCREATE</item>
<item>TO_CMAKE_PATH</item>
@@ -970,11 +974,17 @@
<list name="export_nargs">
<item>ANDROID_MK</item>
<item>APPEND</item>
<item>AUTO</item>
<item>ENABLED</item>
<item>EXPORT</item>
<item>EXPORT_LINK_INTERFACE_LIBRARIES</item>
<item>FILE</item>
<item>NAMESPACE</item>
<item>PACKAGE_DEPENDENCY</item>
<item>SETUP</item>
<item>TARGET</item>
<item>TARGETS</item>
<item>XCFRAMEWORK_LOCATION</item>
</list>
<list name="get_source_file_property_nargs">
<item>DIRECTORY</item>
@@ -1358,8 +1368,10 @@
<item>EXCLUDE_FIXTURE</item>
<item>EXCLUDE_FIXTURE_CLEANUP</item>
<item>EXCLUDE_FIXTURE_SETUP</item>
<item>EXCLUDE_FROM_FILE</item>
<item>EXCLUDE_LABEL</item>
<item>INCLUDE</item>
<item>INCLUDE_FROM_FILE</item>
<item>INCLUDE_LABEL</item>
<item>PARALLEL_LEVEL</item>
<item>QUIET</item>
@@ -1468,6 +1480,28 @@
<item>SameMajorVersion</item>
<item>SameMinorVersion</item>
</list>
<list name="generate_apple_platform_selection_file_nargs">
<item>INSTALL_DESTINATION</item>
<item>INSTALL_PREFIX</item>
<item>IOS_INCLUDE_FILE</item>
<item>IOS_SIMULATOR_INCLUDE_FILE</item>
<item>MACOS_INCLUDE_FILE</item>
<item>TVOS_INCLUDE_FILE</item>
<item>TVOS_SIMULATOR_INCLUDE_FILE</item>
<item>VISIONOS_INCLUDE_FILE</item>
<item>VISIONOS_SIMULATOR_INCLUDE_FILE</item>
<item>WATCHOS_INCLUDE_FILE</item>
<item>WATCHOS_SIMULATOR_INCLUDE_FILE</item>
</list>
<list name="generate_apple_architecture_selection_file_nargs">
<item>ERROR_VARIABLE</item>
<item>INSTALL_DESTINATION</item>
<item>INSTALL_PREFIX</item>
<item>SINGLE_ARCHITECTURES</item>
<item>SINGLE_ARCHITECTURE_INCLUDE_FILES</item>
<item>UNIVERSAL_ARCHITECTURES</item>
<item>UNIVERSAL_INCLUDE_FILE</item>
</list>
<list name="cmake_print_properties_nargs">
<item>CACHE_ENTRIES</item>
<item>DIRECTORIES</item>
@@ -1667,6 +1701,7 @@
<item>TIMEOUT</item>
<item>TLS_CAINFO</item>
<item>TLS_VERIFY</item>
<item>TLS_VERSION</item>
<item>TMP_DIR</item>
<item>UPDATE_COMMAND</item>
<item>UPDATE_DISCONNECTED</item>
@@ -2165,7 +2200,6 @@
<item>CMAKE_AUTOMOC_EXECUTABLE</item>
<item>CMAKE_AUTOMOC_MOC_OPTIONS</item>
<item>CMAKE_AUTOMOC_PATH_PREFIX</item>
<item>CMAKE_AUTOMOC_RELAXED_MODE</item>
<item>CMAKE_AUTORCC</item>
<item>CMAKE_AUTORCC_EXECUTABLE</item>
<item>CMAKE_AUTORCC_OPTIONS</item>
@@ -2173,7 +2207,6 @@
<item>CMAKE_AUTOUIC_EXECUTABLE</item>
<item>CMAKE_AUTOUIC_OPTIONS</item>
<item>CMAKE_AUTOUIC_SEARCH_PATHS</item>
<item>CMAKE_BACKWARDS_COMPATIBILITY</item>
<item>CMAKE_BINARY_DIR</item>
<item>CMAKE_BUILD_RPATH</item>
<item>CMAKE_BUILD_RPATH_USE_ORIGIN</item>
@@ -2195,9 +2228,6 @@
<item>CMAKE_COLOR_MAKEFILE</item>
<item>CMAKE_COMMAND</item>
<item>CMAKE_COMPILER_2005</item>
<item>CMAKE_COMPILER_IS_GNUCC</item>
<item>CMAKE_COMPILER_IS_GNUCXX</item>
<item>CMAKE_COMPILER_IS_GNUG77</item>
<item>CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY</item>
<item>CMAKE_COMPILE_WARNING_AS_ERROR</item>
<item>CMAKE_CONFIGURATION_TYPES</item>
@@ -2268,7 +2298,6 @@
<item>CMAKE_EXPORT_COMPILE_COMMANDS</item>
<item>CMAKE_EXPORT_NO_PACKAGE_REGISTRY</item>
<item>CMAKE_EXPORT_PACKAGE_REGISTRY</item>
<item>CMAKE_EXTRA_GENERATOR</item>
<item>CMAKE_EXTRA_INCLUDE_FILES</item>
<item>CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES</item>
<item>CMAKE_FIND_APPBUNDLE</item>
@@ -2280,8 +2309,6 @@
<item>CMAKE_FIND_LIBRARY_SUFFIXES</item>
<item>CMAKE_FIND_NO_INSTALL_PREFIX</item>
<item>CMAKE_FIND_PACKAGE_NAME</item>
<item>CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY</item>
<item>CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY</item>
<item>CMAKE_FIND_PACKAGE_PREFER_CONFIG</item>
<item>CMAKE_FIND_PACKAGE_REDIRECTS_DIR</item>
<item>CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS</item>
@@ -2424,6 +2451,7 @@
<item>CMAKE_LIBRARY_OUTPUT_DIRECTORY</item>
<item>CMAKE_LIBRARY_PATH</item>
<item>CMAKE_LIBRARY_PATH_FLAG</item>
<item>CMAKE_LINKER_TYPE</item>
<item>CMAKE_LINK_DEF_FILE_FLAG</item>
<item>CMAKE_LINK_DEPENDS_NO_SHARED</item>
<item>CMAKE_LINK_DEPENDS_USE_LINKER</item>
@@ -2523,6 +2551,7 @@
<item>CMAKE_SKIP_INSTALL_RPATH</item>
<item>CMAKE_SKIP_INSTALL_RULES</item>
<item>CMAKE_SKIP_RPATH</item>
<item>CMAKE_SKIP_TEST_ALL_DEPENDENCY</item>
<item>CMAKE_SOURCE_DIR</item>
<item>CMAKE_STAGING_PREFIX</item>
<item>CMAKE_STATIC_LIBRARY_PREFIX</item>
@@ -2549,9 +2578,12 @@
<item>CMAKE_SYSTEM_PROCESSOR</item>
<item>CMAKE_SYSTEM_PROGRAM_PATH</item>
<item>CMAKE_SYSTEM_VERSION</item>
<item>CMAKE_Swift_COMPILATION_MODE</item>
<item>CMAKE_Swift_LANGUAGE_VERSION</item>
<item>CMAKE_Swift_MODULE_DIRECTORY</item>
<item>CMAKE_Swift_NUM_THREADS</item>
<item>CMAKE_TASKING_TOOLSET</item>
<item>CMAKE_TEST_LAUNCHER</item>
<item>CMAKE_THREAD_LIBS_INIT</item>
<item>CMAKE_THREAD_PREFER_PTHREAD</item>
<item>CMAKE_TOOLCHAIN_FILE</item>
@@ -2564,7 +2596,6 @@
<item>CMAKE_UNITY_BUILD_BATCH_SIZE</item>
<item>CMAKE_USER_MAKE_RULES_OVERRIDE</item>
<item>CMAKE_USE_PTHREADS_INIT</item>
<item>CMAKE_USE_RELATIVE_PATHS</item>
<item>CMAKE_USE_SPROC_INIT</item>
<item>CMAKE_USE_WIN32_THREADS_INIT</item>
<item>CMAKE_VERBOSE_MAKEFILE</item>
@@ -2600,6 +2631,7 @@
<item>CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER</item>
<item>CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION</item>
<item>CMAKE_VS_TARGET_FRAMEWORK_VERSION</item>
<item>CMAKE_VS_USE_DEBUG_LIBRARIES</item>
<item>CMAKE_VS_VERSION_BUILD_NUMBER</item>
<item>CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION</item>
<item>CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION</item>
@@ -2852,10 +2884,15 @@
<item>CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME</item>
<item>CPACK_NUGET_PACKAGE_NAME</item>
<item>CPACK_NUGET_PACKAGE_OWNERS</item>
<item>CPACK_NUGET_PACKAGE_README</item>
<item>CPACK_NUGET_PACKAGE_RELEASE_NOTES</item>
<item>CPACK_NUGET_PACKAGE_REPOSITORY_BRANCH</item>
<item>CPACK_NUGET_PACKAGE_REPOSITORY_COMMIT</item>
<item>CPACK_NUGET_PACKAGE_REPOSITORY_TYPE</item>
<item>CPACK_NUGET_PACKAGE_REPOSITORY_URL</item>
<item>CPACK_NUGET_PACKAGE_TAGS</item>
<item>CPACK_NUGET_PACKAGE_TFMS</item>
<item>CPACK_NUGET_PACKAGE_TITLE</item>
<item>CPACK_NUGET_PACKAGE_VERSION</item>
<item>CPACK_OBJCOPY_EXECUTABLE</item>
<item>CPACK_OBJDUMP_EXECUTABLE</item>
<item>CPACK_OUTPUT_CONFIG_FILE</item>
@@ -2987,6 +3024,7 @@
<item>CPACK_WIX_EXTENSIONS</item>
<item>CPACK_WIX_EXTRA_OBJECTS</item>
<item>CPACK_WIX_EXTRA_SOURCES</item>
<item>CPACK_WIX_INSTALL_SCOPE</item>
<item>CPACK_WIX_LICENSE_RTF</item>
<item>CPACK_WIX_PATCH_FILE</item>
<item>CPACK_WIX_PRODUCT_GUID</item>
@@ -3033,7 +3071,6 @@
<item>CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION</item>
<item>CTEST_CUSTOM_WARNING_EXCEPTION</item>
<item>CTEST_CUSTOM_WARNING_MATCH</item>
<item>CTEST_CVS_CHECKOUT</item>
<item>CTEST_CVS_COMMAND</item>
<item>CTEST_CVS_UPDATE_OPTIONS</item>
<item>CTEST_DROP_LOCATION</item>
@@ -3062,7 +3099,6 @@
<item>CTEST_P4_UPDATE_OPTIONS</item>
<item>CTEST_RESOURCE_SPEC_FILE</item>
<item>CTEST_RUN_CURRENT_SCRIPT</item>
<item>CTEST_SCP_COMMAND</item>
<item>CTEST_SITE</item>
<item>CTEST_SOURCE_DIRECTORY</item>
<item>CTEST_SUBMIT_INACTIVITY_TIMEOUT</item>
@@ -3072,7 +3108,8 @@
<item>CTEST_SVN_UPDATE_OPTIONS</item>
<item>CTEST_TEST_LOAD</item>
<item>CTEST_TEST_TIMEOUT</item>
<item>CTEST_TRIGGER_SITE</item>
<item>CTEST_TLS_VERIFY</item>
<item>CTEST_TLS_VERSION</item>
<item>CTEST_UPDATE_COMMAND</item>
<item>CTEST_UPDATE_OPTIONS</item>
<item>CTEST_UPDATE_VERSION_ONLY</item>
@@ -3297,15 +3334,6 @@
<item>MPI_SKIP_GUESSING</item>
<item>MPI_SUBARRAYS_SUPPORTED</item>
<item>MSVC</item>
<item>MSVC10</item>
<item>MSVC11</item>
<item>MSVC12</item>
<item>MSVC14</item>
<item>MSVC60</item>
<item>MSVC70</item>
<item>MSVC71</item>
<item>MSVC80</item>
<item>MSVC90</item>
<item>MSVC_IDE</item>
<item>MSVC_TOOLSET_VERSION</item>
<item>MSVC_VERSION</item>
@@ -3337,6 +3365,7 @@
<item>OpenGL_GL_PREFERENCE</item>
<item>OpenMP_Fortran_HAVE_OMPLIB_HEADER</item>
<item>OpenMP_Fortran_HAVE_OMPLIB_MODULE</item>
<item>OpenMP_RUNTIME_MSVC</item>
<item>PACKAGE_FIND_NAME</item>
<item>PACKAGE_FIND_VERSION_COMPLETE</item>
<item>PACKAGE_FIND_VERSION_COUNT</item>
@@ -3409,8 +3438,10 @@
<item>Python2_ARTIFACTS_INTERACTIVE</item>
<item>Python2_COMPILER</item>
<item>Python2_COMPILER_ID</item>
<item>Python2_DEBUG_POSTFIX</item>
<item>Python2_DOTNET_LAUNCHER</item>
<item>Python2_EXECUTABLE</item>
<item>Python2_EXECUTABLE_DEBUG</item>
<item>Python2_FIND_ABI</item>
<item>Python2_FIND_FRAMEWORK</item>
<item>Python2_FIND_IMPLEMENTATIONS</item>
@@ -3418,6 +3449,7 @@
<item>Python2_FIND_STRATEGY</item>
<item>Python2_FIND_UNVERSIONED_NAMES</item>
<item>Python2_FIND_VIRTUALENV</item>
<item>Python2_INTERPRETER</item>
<item>Python2_INTERPRETER_ID</item>
<item>Python2_LINK_OPTIONS</item>
<item>Python2_SITEARCH</item>
@@ -3429,8 +3461,10 @@
<item>Python3_ARTIFACTS_INTERACTIVE</item>
<item>Python3_COMPILER</item>
<item>Python3_COMPILER_ID</item>
<item>Python3_DEBUG_POSTFIX</item>
<item>Python3_DOTNET_LAUNCHER</item>
<item>Python3_EXECUTABLE</item>
<item>Python3_EXECUTABLE_DEBUG</item>
<item>Python3_FIND_ABI</item>
<item>Python3_FIND_FRAMEWORK</item>
<item>Python3_FIND_IMPLEMENTATIONS</item>
@@ -3438,19 +3472,23 @@
<item>Python3_FIND_STRATEGY</item>
<item>Python3_FIND_UNVERSIONED_NAMES</item>
<item>Python3_FIND_VIRTUALENV</item>
<item>Python3_INTERPRETER</item>
<item>Python3_INTERPRETER_ID</item>
<item>Python3_LINK_OPTIONS</item>
<item>Python3_SITEARCH</item>
<item>Python3_SITELIB</item>
<item>Python3_SOABI</item>
<item>Python3_SOSABI</item>
<item>Python3_STDARCH</item>
<item>Python3_STDLIB</item>
<item>Python3_USE_STATIC_LIBS</item>
<item>Python_ARTIFACTS_INTERACTIVE</item>
<item>Python_COMPILER</item>
<item>Python_COMPILER_ID</item>
<item>Python_DEBUG_POSTFIX</item>
<item>Python_DOTNET_LAUNCHER</item>
<item>Python_EXECUTABLE</item>
<item>Python_EXECUTABLE_DEBUG</item>
<item>Python_FIND_ABI</item>
<item>Python_FIND_FRAMEWORK</item>
<item>Python_FIND_IMPLEMENTATIONS</item>
@@ -3458,11 +3496,13 @@
<item>Python_FIND_STRATEGY</item>
<item>Python_FIND_UNVERSIONED_NAMES</item>
<item>Python_FIND_VIRTUALENV</item>
<item>Python_INTERPRETER</item>
<item>Python_INTERPRETER_ID</item>
<item>Python_LINK_OPTIONS</item>
<item>Python_SITEARCH</item>
<item>Python_SITELIB</item>
<item>Python_SOABI</item>
<item>Python_SOSABI</item>
<item>Python_STDARCH</item>
<item>Python_STDLIB</item>
<item>Python_USE_STATIC_LIBS</item>
@@ -3529,8 +3569,16 @@
</list>
<list name="deprecated-or-internal-variables">
<item>CMAKE_AUTOMOC_RELAXED_MODE</item>
<item>CMAKE_BACKWARDS_COMPATIBILITY</item>
<item>CMAKE_COMPILER_IS_GNUCC</item>
<item>CMAKE_COMPILER_IS_GNUCXX</item>
<item>CMAKE_COMPILER_IS_GNUG77</item>
<item>CMAKE_ENABLE_EXPORTS</item>
<item>CMAKE_EXTRA_GENERATOR</item>
<item>CMAKE_FILES_DIRECTORY</item>
<item>CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY</item>
<item>CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY</item>
<item>CMAKE_HOME_DIRECTORY</item>
<item>CMAKE_INTERNAL_PLATFORM_ABI</item>
<item>CMAKE_IOS_INSTALL_COMBINED</item>
@@ -3539,6 +3587,7 @@
<item>CMAKE_SUPPRESS_DEVELOPER_ERRORS</item>
<item>CMAKE_SUPPRESS_DEVELOPER_WARNINGS</item>
<item>CMAKE_SYSTEM_ARCH</item>
<item>CMAKE_USE_RELATIVE_PATHS</item>
<item>CMAKE_VS_INTEL_Fortran_PROJECT_VERSION</item>
<item>CPACK_INSTALL_PREFIX</item>
<item>CPACK_INSTALL_SCRIPT</item>
@@ -3546,6 +3595,18 @@
<item>CPACK_PACKAGE_RELOCATABLE</item>
<item>CPACK_TEMPORARY_DIRECTORY</item>
<item>CPACK_TOPLEVEL_DIRECTORY</item>
<item>CTEST_CVS_CHECKOUT</item>
<item>CTEST_SCP_COMMAND</item>
<item>CTEST_TRIGGER_SITE</item>
<item>MSVC10</item>
<item>MSVC11</item>
<item>MSVC12</item>
<item>MSVC14</item>
<item>MSVC60</item>
<item>MSVC70</item>
<item>MSVC71</item>
<item>MSVC80</item>
<item>MSVC90</item>
</list>
<list name="environment-variables">
@@ -3567,11 +3628,18 @@
<item>CMAKE_GENERATOR_INSTANCE</item>
<item>CMAKE_GENERATOR_PLATFORM</item>
<item>CMAKE_GENERATOR_TOOLSET</item>
<item>CMAKE_INCLUDE_PATH</item>
<item>CMAKE_INSTALL_MODE</item>
<item>CMAKE_INSTALL_PREFIX</item>
<item>CMAKE_LIBRARY_PATH</item>
<item>CMAKE_MAXIMUM_RECURSION_DEPTH</item>
<item>CMAKE_MSVCIDE_RUN_PATH</item>
<item>CMAKE_NO_VERBOSE</item>
<item>CMAKE_OSX_ARCHITECTURES</item>
<item>CMAKE_PREFIX_PATH</item>
<item>CMAKE_PROGRAM_PATH</item>
<item>CMAKE_TLS_VERIFY</item>
<item>CMAKE_TLS_VERSION</item>
<item>CMAKE_TOOLCHAIN_FILE</item>
<item>CSFLAGS</item>
<item>CTEST_INTERACTIVE_DEBUG_MODE</item>
@@ -3639,6 +3707,7 @@
<item>PACKAGES_FOUND</item>
<item>PACKAGES_NOT_FOUND</item>
<item>PREDEFINED_TARGETS_FOLDER</item>
<item>PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE</item>
<item>REPORT_UNDEFINED_PROPERTIES</item>
<item>RULE_LAUNCH_COMPILE</item>
<item>RULE_LAUNCH_CUSTOM</item>
@@ -3914,9 +3983,14 @@
<item>STATIC_LIBRARY_OPTIONS</item>
<item>SUFFIX</item>
<item>SYSTEM</item>
<item>Swift_COMPILATION_MODE</item>
<item>Swift_DEPENDENCIES_FILE</item>
<item>Swift_LANGUAGE_VERSION</item>
<item>Swift_MODULE_DIRECTORY</item>
<item>Swift_MODULE_NAME</item>
<item>TEST_LAUNCHER</item>
<item>TRANSITIVE_COMPILE_PROPERTIES</item>
<item>TRANSITIVE_LINK_PROPERTIES</item>
<item>TYPE</item>
<item>UNITY_BUILD</item>
<item>UNITY_BUILD_BATCH_SIZE</item>
@@ -3939,6 +4013,7 @@
<item>VS_DOTNET_STARTUP_OBJECT</item>
<item>VS_DOTNET_TARGET_FRAMEWORK_VERSION</item>
<item>VS_DPI_AWARE</item>
<item>VS_FILTER_PROPS</item>
<item>VS_GLOBAL_KEYWORD</item>
<item>VS_GLOBAL_PROJECT_TYPES</item>
<item>VS_GLOBAL_ROOTNAMESPACE</item>
@@ -3959,6 +4034,7 @@
<item>VS_SDK_REFERENCES</item>
<item>VS_SOLUTION_DEPLOY</item>
<item>VS_USER_PROPS</item>
<item>VS_USE_DEBUG_LIBRARIES</item>
<item>VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION</item>
<item>VS_WINRT_COMPONENT</item>
<item>VS_WINRT_EXTENSIONS</item>
@@ -4144,6 +4220,14 @@
<item>Fortran_COMPILER_ID</item>
<item>HIP_COMPILER_ID</item>
<item>ISPC_COMPILER_ID</item>
<item>C_COMPILER_FRONTEND_VARIANT</item>
<item>CXX_COMPILER_FRONTEND_VARIANT</item>
<item>CUDA_COMPILER_FRONTEND_VARIANT</item>
<item>OBJC_COMPILER_FRONTEND_VARIANT</item>
<item>OBJCXX_COMPILER_FRONTEND_VARIANT</item>
<item>Fortran_COMPILER_FRONTEND_VARIANT</item>
<item>HIP_COMPILER_FRONTEND_VARIANT</item>
<item>ISPC_COMPILER_FRONTEND_VARIANT</item>
<item>COMPILE_LANGUAGE</item>
<item>COMPILE_LANG_AND_ID</item>
<item>COMPILE_FEATURES</item>
@@ -4200,6 +4284,7 @@
<item>ANGLE-R</item>
<item>COMMA</item>
<item>SEMICOLON</item>
<item>QUOTE</item>
</list>
<list name="genex-LIST-subcommands">
<item>LENGTH</item>
@@ -4719,6 +4804,8 @@
<WordDetect String="find_dependency" insensitive="true" attribute="CMake Provided Function/Macro" context="function_ctx"/>
<WordDetect String="configure_package_config_file" insensitive="true" attribute="CMake Provided Function/Macro" context="configure_package_config_file_ctx"/>
<WordDetect String="write_basic_package_version_file" insensitive="true" attribute="CMake Provided Function/Macro" context="write_basic_package_version_file_ctx"/>
<WordDetect String="generate_apple_platform_selection_file" insensitive="true" attribute="CMake Provided Function/Macro" context="generate_apple_platform_selection_file_ctx"/>
<WordDetect String="generate_apple_architecture_selection_file" insensitive="true" attribute="CMake Provided Function/Macro" context="generate_apple_architecture_selection_file_ctx"/>
<WordDetect String="cmake_print_properties" insensitive="true" attribute="CMake Provided Function/Macro" context="cmake_print_properties_ctx"/>
<WordDetect String="cmake_push_check_state" insensitive="true" attribute="CMake Provided Function/Macro" context="cmake_push_check_state_ctx"/>
<WordDetect String="cmake_pop_check_state" insensitive="true" attribute="CMake Provided Function/Macro" context="function_ctx"/>
@@ -5469,13 +5556,14 @@
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<WordDetect String="TARGETS" attribute="Named Args" context="export_tgts"/>
<WordDetect String="TARGET" attribute="Named Args" context="export_tgts"/>
<keyword attribute="Named Args" context="#stay" String="export_nargs"/>
<IncludeRules context="User Function Args"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="export_tgts">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#pop" String="export_nargs"/>
<keyword attribute="Named Args" context="#pop" String="export_nargs" lookAhead="true"/>
<IncludeRules context="Detect Aliased Targets"/>
<IncludeRules context="Detect Targets"/>
<IncludeRules context="User Function Args"/>
@@ -5550,7 +5638,7 @@
<context attribute="Normal Text" lineEndContext="#stay" name="install_tgts">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#pop" String="install_nargs"/>
<keyword attribute="Named Args" context="#pop" String="install_nargs" lookAhead="true"/>
<IncludeRules context="Detect Aliased Targets"/>
<IncludeRules context="Detect Targets"/>
<IncludeRules context="User Function Args"/>
@@ -6023,6 +6111,26 @@
<keyword attribute="Special Args" context="#stay" String="write_basic_package_version_file_sargs"/>
<IncludeRules context="User Function Args"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="generate_apple_platform_selection_file_ctx">
<DetectChar attribute="Normal Text" context="generate_apple_platform_selection_file_ctx_op" char="("/>
<DetectChar attribute="Normal Text" context="#pop" char=")"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="generate_apple_platform_selection_file_ctx_op">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#stay" String="generate_apple_platform_selection_file_nargs"/>
<IncludeRules context="User Function Args"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="generate_apple_architecture_selection_file_ctx">
<DetectChar attribute="Normal Text" context="generate_apple_architecture_selection_file_ctx_op" char="("/>
<DetectChar attribute="Normal Text" context="#pop" char=")"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="generate_apple_architecture_selection_file_ctx_op">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#stay" String="generate_apple_architecture_selection_file_nargs"/>
<IncludeRules context="User Function Args"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="cmake_print_properties_ctx">
<DetectChar attribute="Normal Text" context="cmake_print_properties_ctx_op" char="("/>
<DetectChar attribute="Normal Text" context="#pop" char=")"/>
@@ -6037,7 +6145,7 @@
<context attribute="Normal Text" lineEndContext="#stay" name="cmake_print_properties_tgts">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#pop" String="cmake_print_properties_nargs"/>
<keyword attribute="Named Args" context="#pop" String="cmake_print_properties_nargs" lookAhead="true"/>
<IncludeRules context="Detect Aliased Targets"/>
<IncludeRules context="Detect Targets"/>
<IncludeRules context="User Function Args"/>
@@ -6381,7 +6489,7 @@
<context attribute="Normal Text" lineEndContext="#stay" name="install_jar_exports_tgts">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#pop" String="install_jar_exports_nargs"/>
<keyword attribute="Named Args" context="#pop" String="install_jar_exports_nargs" lookAhead="true"/>
<IncludeRules context="Detect Aliased Targets"/>
<IncludeRules context="Detect Targets"/>
<IncludeRules context="User Function Args"/>
@@ -6401,7 +6509,7 @@
<context attribute="Normal Text" lineEndContext="#stay" name="export_jars_tgts">
<DetectSpaces/>
<DetectChar attribute="Normal Text" context="#pop" char=")" lookAhead="true"/>
<keyword attribute="Named Args" context="#pop" String="export_jars_nargs"/>
<keyword attribute="Named Args" context="#pop" String="export_jars_nargs" lookAhead="true"/>
<IncludeRules context="Detect Aliased Targets"/>
<IncludeRules context="Detect Targets"/>
<IncludeRules context="User Function Args"/>
@@ -6632,7 +6740,7 @@
<context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables">
<RegExpr attribute="CMake Internal Variable" context="#stay" String="\b(?:CMAKE_&var_ref_re;_(COMPILER_(ABI|ARCHITECTURE_ID|VERSION_INTERNAL)|PLATFORM_ID))\b"/>
<RegExpr attribute="Builtin Variable" context="#stay" String="\b(?:&var_ref_re;_(((STATIC_)?LINK_)?LIBRARIES|(BINARY|SOURCE)_DIR|(C|LD)FLAGS(_OTHER)?|(INCLUDE|LIBRARY)_DIRS|CONFIG|CONSIDERED_(CONFIGS|VERSIONS)|DESCRIPTION|FIND_(COMPONENTS|REQUIRED(_&var_ref_re;)?|VERSION_(COMPLETE|COUNT|EXACT|M(AX|IN)(_(COUNT|MAJOR|MINOR|PATCH|TWEAK))?|RANGE(_(MAX|MIN))?)|QUIETLY)|FOUND|HOMEPAGE_URL|IS_TOP_LEVEL|KEYWORDS_MISSING_VALUES|MODULE_NAME|ROOT|UNPARSED_ARGUMENTS|VERSION(_(MAJOR|MINOR|PATCH|TWEAK|COUNT|STRING))?)|&var_ref_re;__TRYRUN_OUTPUT|(DOXYGEN|ExternalData_(CUSTOM_SCRIPT|URL_ALGO)|FETCHCONTENT_(SOURCE_DIR|UPDATES_DISCONNECTED))_&var_ref_re;|ARGV[0-9]+|BISON_&var_ref_re;_(COMPILE_FLAGS|DEFINED|INPUT|OUTPUT(S|_(HEADER|SOURCE)))|Boost_&var_ref_re;_LIBRARY(_(DEBUG|RELEASE))?|CMAKE_(&var_ref_re;_(ANDROID_TOOLCHAIN_((PRE|SUF)FIX|MACHINE)|ARCHIVE_(APPEND|CREATE|FINISH)|BYTE_ORDER|CLANG_TIDY(_EXPORT_FIXES_DIR)?|COMPILER(_(AR|EXTERNAL_TOOLCHAIN|FRONTEND_VARIANT|ID|LAUNCHER|LOADED|RANLIB|TARGET|VERSION))?|COMPILE_OBJECT|CPP(CHECK|LINT)|CREATE_(SHARED_(LIBRARY|MODULE)|STATIC_LIBRARY)|EXTENSIONS(_DEFAULT)?|FLAGS(_((DEBUG|MINSIZEREL|REL(EASE|WITHDEBINFO)|&var_ref_re;)(_INIT)?|INIT))?|GHS_KERNEL_FLAGS_(DEBUG|MINSIZEREL|REL(EASE|WITHDEBINFO))|IGNORE_EXTENSIONS|IMPLICIT_(INCLUDE_DIRECTORIES|LINK_((FRAMEWORK_)?DIRECTORIES|LIBRARIES))|INCLUDE_WHAT_YOU_USE|LIBRARY_ARCHITECTURE|LINKER_(LAUNCHER|PREFERENCE(_PROPAGATES)?|WRAPPER_FLAG(_SEP)?)|LINK_(EXECUTABLE|GROUP_USING_&var_ref_re;(_SUPPORTED)?|LIBRARY_(FILE_FLAG|FLAG|USING_&var_ref_re;(_SUPPORTED)?)|WHAT_YOU_USE_FLAG)|OUTPUT_EXTENSION|POSTFIX|SIMULATE_(ID|VERSION)|SIZEOF_DATA_PTR|SOURCE_FILE_EXTENSIONS|STANDARD_(INCLUDE_DIRECTO|LIBRA)RIES|VISIBILITY_PRESET)|((ARCHIVE|(COMPILE_)?PDB|LIBRARY|RUNTIME)_OUTPUT_DIRECTORY|(DISABLE|REQUIRE)_FIND_PACKAGE|FRAMEWORK_MULTI_CONFIG_POSTFIX|GET_OS_RELEASE_FALLBACK_RESULT|INTERPROCEDURAL_OPTIMIZATION|MAP_IMPORTED_CONFIG|USER_MAKE_RULES_OVERRIDE|XCODE_ATTRIBUTE)_&var_ref_re;|(EXE|MODULE|SHARED|STATIC)_LINKER_FLAGS_&var_ref_re;(_INIT)?|LINK_(GROUP|LIBRARY)_USING_&var_ref_re;(_SUPPORTED)?|PROJECT_&var_ref_re;_INCLUDE(_BEFORE)?)|CMAKE_(ARGV|MATCH_)[0-9]+|CMAKE_POLICY_(DEFAULT|WARNING)_CMP[0-9]{4}|CPACK_(&var_ref_re;_COMPONENT_INSTALL|ARCHIVE_&var_ref_re;_FILE_NAME|BINARY_&var_ref_re;|COMPONENT_&var_ref_re;_(DEPENDS|DESCRIPTION|DIS(ABLED|PLAY_NAME)|GROUP|HIDDEN|REQUIRED)|DEBIAN_&var_ref_re;_(DESCRIPTION|FILE_NAME|PACKAGE_((PRE)?DEPENDS|ARCHITECTURE|BREAKS|CONFLICTS|CONTROL_(EXTRA|STRICT_PERMISSION)|ENHANCES|NAME|PRIORITY|PROVIDES|RECOMMENDS|REPLACES|SECTION|SHLIBDEPS|SOURCE|SUGGESTS)|DEBUGINFO_PACKAGE)|DMG_&var_ref_re;_FILE_NAME|INNOSETUP_(&var_ref_re;_INSTALL_DIRECTORY|(DEFINE|SETUP)_&var_ref_re;)|NSIS_&var_ref_re;_INSTALL_DIRECTORY|NUGET_(&var_ref_re;_PACKAGE_(AUTHORS|COPYRIGHT|DEPENDENCIES(_&var_ref_re;_VERSION)?|DESCRIPTION(_SUMMARY)?|HOMEPAGE_URL|ICON(URL)?|LANGUAGE|LICENSE(URL|_(EXPRESSION|FILE_NAME))|NAME|OWNERS|RELEASE_NOTES|TAGS|TITLE|VERSION)|PACKAGE_DEPENDENCIES_&var_ref_re;_VERSION)|P(RE|OST)FLIGHT_&var_ref_re;_SCRIPT|RPM_(&var_ref_re;_(DEFAULT_((DIR|FILE)_PERMISSIONS|GROUP|USER)|BUILD_SOURCE_DIRS_PREFIX|DEBUGINFO_(FILE_NAME|PACKAGE)|FILE_NAME|PACKAGE_(ARCHITECTURE|AUTO(PROV|REQ(PROV)?)|CONFLICTS|DESCRIPTION|GROUP|NAME|OBSOLETES|PREFIX|PROVIDES|REQUIRES(_P(RE|OST)(UN)?)?|SUGGESTS|SUMMARY|URL)|USER_(FILELIST|BINARY_SPECFILE))|NO_&var_ref_re;_INSTALL_PREFIX_RELOCATION)|WIX_(&var_ref_re;_EXT(ENSIONS|RA_FLAGS)|PROPERTY_&var_ref_re;))|ICU_&var_ref_re;_(LIBRARY|EXECUTABLE)|MPI_&var_ref_re;_(ADDITIONAL_INCLUDE_VARS|COMPILE(R|_(DEFINI|OP)TIONS)|LIB(_NAMES|RARY))|OpenACC_&var_ref_re;_(FLAGS|OPTIONS|SPEC_DATE)|OpenMP_&var_ref_re;_(FLAGS|LIB(_NAMES|RARY)|SPEC_DATE)|SWIG_MODULE_&var_ref_re;_EXTRA_DEPS)\b"/>
<RegExpr attribute="Builtin Variable" context="#stay" String="\b(?:&var_ref_re;_(((STATIC_)?LINK_)?LIBRARIES|(BINARY|SOURCE)_DIR|(C|LD)FLAGS(_OTHER)?|(INCLUDE|LIBRARY)_DIRS|CONFIG|CONSIDERED_(CONFIGS|VERSIONS)|DESCRIPTION|FIND_(COMPONENTS|REQUIRED(_&var_ref_re;)?|VERSION_(COMPLETE|COUNT|EXACT|M(AX|IN)(_(COUNT|MAJOR|MINOR|PATCH|TWEAK))?|RANGE(_(MAX|MIN))?)|QUIETLY)|FOUND|HOMEPAGE_URL|IS_TOP_LEVEL|KEYWORDS_MISSING_VALUES|MODULE_NAME|ROOT|UNPARSED_ARGUMENTS|VERSION(_(MAJOR|MINOR|PATCH|TWEAK|COUNT|STRING))?)|&var_ref_re;__TRYRUN_OUTPUT|(DOXYGEN|ExternalData_(CUSTOM_SCRIPT|URL_ALGO)|FETCHCONTENT_(SOURCE_DIR|UPDATES_DISCONNECTED))_&var_ref_re;|ARGV[0-9]+|BISON_&var_ref_re;_(COMPILE_FLAGS|DEFINED|INPUT|OUTPUT(S|_(HEADER|SOURCE)))|Boost_&var_ref_re;_LIBRARY(_(DEBUG|RELEASE))?|CMAKE_(&var_ref_re;_(ANDROID_TOOLCHAIN_((PRE|SUF)FIX|MACHINE)|ARCHIVE_(APPEND|CREATE|FINISH)|BYTE_ORDER|CLANG_TIDY(_EXPORT_FIXES_DIR)?|COMPILER(_(AR|EXTERNAL_TOOLCHAIN|FRONTEND_VARIANT|ID|LAUNCHER|LINKER(_(FRONTEND_VARIANT|ID|VERSION))?|LOADED|RANLIB|TARGET|VERSION))?|COMPILE_OBJECT|CPP(CHECK|LINT)|CREATE_(SHARED_(LIBRARY|MODULE)|STATIC_LIBRARY)|EXTENSIONS(_DEFAULT)?|FLAGS(_((DEBUG|MINSIZEREL|REL(EASE|WITHDEBINFO)|&var_ref_re;)(_INIT)?|INIT))?|GHS_KERNEL_FLAGS_(DEBUG|MINSIZEREL|REL(EASE|WITHDEBINFO))|IGNORE_EXTENSIONS|IMPLICIT_(INCLUDE_DIRECTORIES|LINK_((FRAMEWORK_)?DIRECTORIES|LIBRARIES))|INCLUDE_WHAT_YOU_USE|LIBRARY_ARCHITECTURE|LINKER_(LAUNCHER|PREFERENCE(_PROPAGATES)?|WRAPPER_FLAG(_SEP)?)|LINK_(EXECUTABLE|GROUP_USING_&var_ref_re;(_SUPPORTED)?|LIBRARY_(FILE_FLAG|FLAG|USING_&var_ref_re;(_SUPPORTED)?)|WHAT_YOU_USE_FLAG)|OUTPUT_EXTENSION|POSTFIX|SIMULATE_(ID|VERSION)|SIZEOF_DATA_PTR|SOURCE_FILE_EXTENSIONS|STANDARD_((INCLUDE_DIRECTO|LIBRA)RIES|LATEST)|USING_LINKER_(&var_ref_re;|MODE)|VISIBILITY_PRESET)|((ARCHIVE|(COMPILE_)?PDB|LIBRARY|RUNTIME)_OUTPUT_DIRECTORY|(DISABLE|REQUIRE)_FIND_PACKAGE|FRAMEWORK_MULTI_CONFIG_POSTFIX|GET_OS_RELEASE_FALLBACK_RESULT|INTERPROCEDURAL_OPTIMIZATION|MAP_IMPORTED_CONFIG|USER_MAKE_RULES_OVERRIDE|XCODE_ATTRIBUTE)_&var_ref_re;|(EXE|MODULE|SHARED|STATIC)_LINKER_FLAGS_&var_ref_re;(_INIT)?|LINK_(GROUP_USING_&var_ref_re;(_SUPPORTED)?|LIBRARY_(&var_ref_re;_ATTRIBUTES|USING_&var_ref_re;(_SUPPORTED)?))|PROJECT_&var_ref_re;_INCLUDE(_BEFORE)?)|CMAKE_(ARGV|MATCH_)[0-9]+|CMAKE_POLICY_(DEFAULT|WARNING)_CMP[0-9]{4}|CPACK_(&var_ref_re;_COMPONENT_INSTALL|ARCHIVE_&var_ref_re;_FILE_NAME|BINARY_&var_ref_re;|COMPONENT_&var_ref_re;_(DEPENDS|DESCRIPTION|DIS(ABLED|PLAY_NAME)|GROUP|HIDDEN|REQUIRED)|DEBIAN_&var_ref_re;_(DESCRIPTION|FILE_NAME|PACKAGE_((PRE)?DEPENDS|ARCHITECTURE|BREAKS|CONFLICTS|CONTROL_(EXTRA|STRICT_PERMISSION)|ENHANCES|NAME|PRIORITY|PROVIDES|RECOMMENDS|REPLACES|SECTION|SHLIBDEPS|SOURCE|SUGGESTS)|DEBUGINFO_PACKAGE)|DMG_&var_ref_re;_FILE_NAME|INNOSETUP_(&var_ref_re;_INSTALL_DIRECTORY|(DEFINE|SETUP)_&var_ref_re;)|NSIS_&var_ref_re;_INSTALL_DIRECTORY|NUGET_(&var_ref_re;_(PACKAGE_(AUTHORS|COPYRIGHT|DEPENDENCIES(_&var_ref_re;)?|DESCRIPTION(_SUMMARY)?|HOMEPAGE_URL|ICON(URL)?|LANGUAGE|LICENSE(URL|_(EXPRESSION|FILE_NAME))|NAME|OWNERS|README|RELEASE_NOTES|TAGS|TFMS|TITLE)|REPOSITORY_(BRANCH|COMMIT|TYPE|URL))|PACKAGE_DEPENDENCIES_&var_ref_re;)|P(RE|OST)FLIGHT_&var_ref_re;_SCRIPT|RPM_(&var_ref_re;_(DEFAULT_((DIR|FILE)_PERMISSIONS|GROUP|USER)|BUILD_SOURCE_DIRS_PREFIX|DEBUGINFO_(FILE_NAME|PACKAGE)|FILE_NAME|PACKAGE_(ARCHITECTURE|AUTO(PROV|REQ(PROV)?)|CONFLICTS|DESCRIPTION|GROUP|NAME|OBSOLETES|PREFIX|PROVIDES|REQUIRES(_P(RE|OST)(UN)?)?|SUGGESTS|SUMMARY|URL)|USER_(FILELIST|BINARY_SPECFILE))|NO_&var_ref_re;_INSTALL_PREFIX_RELOCATION)|WIX_(&var_ref_re;_EXT(ENSIONS|RA_FLAGS)|PROPERTY_&var_ref_re;))|ICU_&var_ref_re;_(LIBRARY|EXECUTABLE)|MPI_&var_ref_re;_(ADDITIONAL_INCLUDE_VARS|COMPILE(R|_(DEFINI|OP)TIONS)|LIB(_NAMES|RARY))|OpenACC_&var_ref_re;_(FLAGS|OPTIONS|SPEC_DATE)|OpenMP_&var_ref_re;_(FLAGS|LIB(_NAMES|RARY)|SPEC_DATE)|SWIG_MODULE_&var_ref_re;_EXTRA_DEPS)\b"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions">

View File

@@ -13,7 +13,7 @@
** https://www.json.org/json-en.html
***************************************************************************
-->
<language name="JSON" section="Markup" version="8" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.geojson;*.gltf;*.theme" mimetype="application/json" author="Sebastian Pipping (sebastian@pipping.org)" license="GPL">
<language name="JSON" section="Markup" version="9" kateversion="2.4" extensions="*.json;*.jsonl;.kateproject;.arcconfig;*.geojson;*.gltf;*.theme;*.cast" mimetype="application/json" author="Sebastian Pipping (sebastian@pipping.org)" license="GPL">
<highlighting>
<list name="Constants">
<item>null</item>
@@ -62,7 +62,7 @@
<keyword String="Constants" context="#stay" attribute="Style_Keyword" />
<RegExpr String="-?\b([1-9][0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?)" context="#stay" attribute="Style_Float" />
<RegExpr String="-?\b((0\b|[1-9][0-9]*)\.[0-9]+(?:[eE][+-]?[0-9]+)?)" context="#stay" attribute="Style_Float" />
<RegExpr String="-?\b(0\b|[1-9][0-9]*(?:[eE][+-]?[0-9]+)?)" context="#stay" attribute="Style_Decimal" />
</context>

View File

@@ -94,7 +94,7 @@
<!ENTITY checkbox "\[[ x]\](?=\s)">
]>
<language name="Markdown" version="30" kateversion="5.79" section="Markup" extensions="*.md;*.mmd;*.markdown;*.md.html" mimetype="text/markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD">
<language name="Markdown" version="31" kateversion="5.79" section="Markup" extensions="*.md;*.mmd;*.markdown;*.md.html" mimetype="text/markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD">
<highlighting>
<contexts>
<!-- Start of the Markdown document: find metadata or code block -->
@@ -369,7 +369,8 @@
<RegExpr attribute="Fenced Code" context="#pop!r-code" String="&fcode;\s*(?:r|rprofile|rscript)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!raku-code" String="&fcode;\s*(?:raku(?:mod|doc|test)?|perl6|p[lm]?6|pod6|nqp)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!rest-code" String="&fcode;\s*(?:rst|rest|restructuredtext)&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the CMake definition -->
<RegExpr attribute="Fenced Code" context="#pop!ruby-code" String="&fcode;\s*(?:ruby|rbx?|rjs|rake|f?cgi|gemspec|irbrc|ru|prawn|Appraisals|(?:Rake|Cap|Chef|Gem|Guard|Hobo|Vagrant||Rant|Berks|Thor|Puppet)file|rxml|(?:xml|js)\.erb)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!ruby-code" String="&fcode;\s*(?:ruby|rbx?|rjs|rake|f?cgi|gemspec|irbrc|ru|prawn|Appraisals|(?:Rake|Cap|Chef|Gem|Guard|Hobo|Vagrant||Rant|Berks|Thor|Puppet)file|rxml)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!rhtml-code" String="&fcode;\s*((?:xml\.|js\.)?erb)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!rust-code" String="&fcode;\s*(?:rust|rs)&end;" insensitive="true" beginRegion="code-block"/>
<RegExpr attribute="Fenced Code" context="#pop!mysql-code" String="&fcode;\s*(?:mysql|sql|ddl)&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the PHP definition -->
<RegExpr attribute="Fenced Code" context="#pop!nim-code" String="&fcode;\s*(?:nims?)&end;" insensitive="true" beginRegion="code-block"/>
@@ -492,9 +493,13 @@
<IncludeRules context="code"/>
<IncludeRules context="##reStructuredText" includeAttrib="true"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ruby-code">
<context attribute="Normal Text" lineEndContext="#stay" name="ruby-code" fallthroughContext="Expr##Ruby">
<IncludeRules context="code"/>
<IncludeRules context="##Ruby" includeAttrib="true"/>
<IncludeRules context="Ruby##Ruby" includeAttrib="true"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="rhtml-code">
<IncludeRules context="code"/>
<IncludeRules context="##Ruby/Rails/RHTML" includeAttrib="true"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="rust-code">
<IncludeRules context="code"/>

View File

@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
<!ENTITY space " ">
<!ENTITY end "&#59;">
]>
<!DOCTYPE language>
<!--
Copyright (c) 2012-2014 by Alex Turbov (i.zaufi@gmail.com)
-->
<language name="Modelines"
version="6"
version="7"
kateversion="5.0"
section="Other"
extensions=""
@@ -33,15 +29,15 @@
<list name="Booleans">
<item>auto-brackets</item>
<!-- NOTE Deprecated -->
<!-- <item>auto-insert-doxygen</item> -->
<!--<item>auto-insert-doxygen</item> -->
<item>automatic-spell-checking</item> <!-- NOTE Since KDE 4.?? -->
<item>backspace-indents</item>
<item>block-selection</item>
<item>bookmark-sorting</item>
<item>bom</item>
<item>byte-order-marker</item>
<item>byte-order-mark</item>
<item>dynamic-word-wrap</item>
<item>enter-to-insert-completion</item>
<item>folding-markers</item>
<item>folding-preview</item> <!-- Since KTextEditor 5.24 -->
<item>icon-border</item>
@@ -55,7 +51,8 @@
<!-- <item>remove-trailing-space</item> -->
<item>replace-tabs-save</item>
<item>replace-tabs</item>
<item>replace-trailing-space-save</item>
<!-- NOTE Deprecated since KDE 4.10 -->
<!-- <item>replace-trailing-space-save</item> -->
<item>smart-home</item>
<item>scrollbar-minimap</item> <!-- Since KTextEditor 5.24 -->
<item>scrollbar-preview</item> <!-- Since KTextEditor 5.24 -->
@@ -64,7 +61,6 @@
<item>show-trailing-spaces</item> <!-- NOTE Since KDE 4.?? -->
<item>tab-indents</item>
<item>word-wrap</item>
<item>wrap-cursor</item>
</list>
<list name="True">
@@ -82,10 +78,10 @@
<list name="Integrals">
<item>auto-center-lines</item>
<item>font-size</item>
<item>indent-mode</item>
<item>indent-width</item>
<item>tab-width</item>
<item>undo-steps</item>
<!-- NOTE Deprecated since KDE 4 -->
<!-- <item>undo-steps</item> -->
<item>word-wrap-column</item>
</list>
@@ -100,6 +96,7 @@
<item>font</item>
<item>hl</item>
<item>icon-bar-color</item>
<item>indent-mode</item>
<item>mode</item> <!-- NOTE Since KDE 4.?? -->
<item>scheme</item>
<item>selection-color</item>
@@ -129,7 +126,6 @@
<contexts>
<context name="Normal" attribute="Comment" lineEndContext="#stay">
<keyword String="ModelineStartKeyword" context="Modeline" attribute="Keyword" />
<RegExpr String="\bkate-(?:mimetype|wildcard)\(.*\):" context="Modeline" attribute="Keyword" />
</context>
<context name="Modeline" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
@@ -141,31 +137,28 @@
</context>
<context name="Booleans" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces />
<keyword String="True" attribute="Option ON" context="#stay" />
<keyword String="False" attribute="Option OFF" context="#stay" />
<DetectChar char="&end;" context="#pop" attribute="Variable" />
<IncludeRules context="SpacesEnd"/>
<keyword String="True" attribute="Option ON" context="#pop!SpacesEnd" />
<keyword String="False" attribute="Option OFF" context="#pop!SpacesEnd" />
</context>
<context name="Integrals" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces />
<Int attribute="Number" context="#stay" />
<DetectChar char="&end;" context="#pop" attribute="Variable" />
<IncludeRules context="SpacesEnd"/>
<Int attribute="Number" context="#pop!SpacesEnd" />
</context>
<context name="Strings" attribute="String" lineEndContext="#pop">
<DetectSpaces />
<RegExpr String="[^&end;&space;]" context="#stay" />
<DetectChar char="&end;" context="#pop" attribute="Variable" />
<IncludeRules context="SpacesEnd"/>
</context>
<context name="RemoveSpaces" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces />
<keyword String="RemoveSpacesOptions" attribute="Value" context="#pop!RemoveSpacesEnd" />
<DetectChar char="&end;" context="#pop" attribute="Variable" />
<IncludeRules context="SpacesEnd"/>
<keyword String="RemoveSpacesOptions" attribute="Value" context="#pop!SpacesEnd" />
</context>
<context name="RemoveSpacesEnd" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectChar char="&end;" context="#pop" attribute="Variable" />
<context name="SpacesEnd" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces/>
<DetectChar char=";" context="#pop" attribute="Variable" />
</context>
</contexts>

View File

@@ -39,7 +39,7 @@
Enhance tr/// and y/// support.
-->
<language name="Perl" version="19" kateversion="5.0" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
<language name="Perl" alternativeNames="PL" version="20" kateversion="5.0" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
<highlighting>
<list name="keywords">
<item>if</item>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<!-- Author: Dominik Holland <dominik.holland@qt.io> -->
<language name="QFace" version="1" kateversion="5.0" section="Scripts" extensions="*.qface"
<language name="QFace" version="3" kateversion="5.0" section="Scripts" extensions="*.qface"
mimetype="text/x-qface;application/x-qface" indenter="cstyle"
author="Dominik Holland (dominik.holland@qt.io)" license="MIT">
<highlighting>
@@ -32,8 +32,8 @@
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal Text">
<DetectSpaces/>
<WordDetect attribute="Module" context="Module" String="module "/>
<WordDetect attribute="Module" context="Module" String="import "/>
<WordDetect attribute="Module" context="Module" String="module"/>
<WordDetect attribute="Module" context="Module" String="import"/>
<keyword attribute="Elements" context="Object" String="objects" />
<keyword attribute="Elements" context="Element" String="elements" />
<IncludeRules context="Basic" />
@@ -99,7 +99,7 @@
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="Object Context">
<DetectSpaces />
<WordDetect attribute="Signal" context="Signal" String="signal "/>
<WordDetect attribute="Signal" context="Signal" String="signal"/>
<keyword attribute="Keyword" String="other_keywords" />
<keyword attribute="Property Type" context="Property" String="types" />
<DetectChar attribute="Normal Text" char="}" endRegion="Brace" context="#pop#pop" />

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
<!ENTITY name "(?![0-9])[\w_:][\w.:_-]*">
<!ENTITY entref "&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
]>
<language name="XML" version="20" kateversion="5.0" section="Markup" extensions="*.page;*.docbook;*.xml;*ui.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml;*.xbel;*.dae;*.sch;*.brd" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/x-xbel;application/xml;application/scxml+xml;application/vnd.oasis.opendocument.text-flat-xml;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.presentation-flat-xml;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/gpx+xml" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
<language name="XML" version="22" kateversion="5.0" section="Markup" extensions="*.page;*.docbook;*.xml;*ui.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml;*.xbel;*.dae;*.sch;*.brd;*.fb2" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/x-xbel;application/xml;application/scxml+xml;application/vnd.oasis.opendocument.text-flat-xml;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.presentation-flat-xml;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/gpx+xml;application/x-fictionbook+xml" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
<highlighting>
<contexts>
@@ -99,6 +99,7 @@
</context>
<context name="Doctype Markupdecl VariableName" attribute="Other Text" lineEndContext="#pop!Doctype Markupdecl" fallthrough="true" fallthroughContext="#pop!Doctype Markupdecl">
<DetectSpaces />
<DetectChar attribute="Doctype Symbols" char="%"/>
<RegExpr attribute="Doctype Name" context="#pop!Doctype Markupdecl" String="&name;" />
</context>
<context name="Doctype Markupdecl" attribute="Other Text" lineEndContext="#stay">

View File

@@ -53,8 +53,8 @@
<!-- Modifications (YAML 1.2), values & support for literal/folded style:
Nibaldo González S. <nibgonz@gmail.com>
These modifications are under the MIT license. //-->
<language name="YAML" version="11" kateversion="5.0" section="Markup"
extensions="*.yaml;*.yml" mimetype="text/yaml" priority="9"
<language name="YAML" alternativeNames="YML" version="13" kateversion="5.0" section="Markup"
extensions="*.yaml;*.yml;.clang-format;.clang-tidy" mimetype="text/yaml" priority="9"
author="Dr Orlovsky MA (dr.orlovsky@gmail.com), Nibaldo González (nibgonz@gmail.com)" license="LGPL">
<highlighting>
<contexts>

View File

@@ -17,7 +17,7 @@
#include <QCoreApplication>
#include <QFile>
#include <iostream>
#include <cstdio>
using namespace KSyntaxHighlighting;
@@ -93,16 +93,15 @@ int main(int argc, char **argv)
app.translate("SyntaxHighlightingCLI", "theme"));
parser.addOption(themeName);
QCommandLineOption outputFormatOption(
QStringList() << QStringLiteral("f") << QStringLiteral("output-format"),
app.translate("SyntaxHighlightingCLI", "Use the specified format instead of html. Must be html, ansi or ansi256Colors."),
QCommandLineOption outputFormatOption(QStringList() << QStringLiteral("f") << QStringLiteral("output-format"),
app.translate("SyntaxHighlightingCLI", "Use the specified format instead of html. Must be html, ansi or ansi256."),
app.translate("SyntaxHighlightingCLI", "format"),
QStringLiteral("html"));
parser.addOption(outputFormatOption);
QCommandLineOption traceOption(QStringList() << QStringLiteral("syntax-trace"),
app.translate("SyntaxHighlightingCLI",
"Add information to debug a syntax file. Only works with --output-format=ansi or ansi256Colors. Possible "
"Add information to debug a syntax file. Only works with --output-format=ansi or ansi256. Possible "
"values are format, region, context, stackSize and all."),
app.translate("SyntaxHighlightingCLI", "type"));
parser.addOption(traceOption);
@@ -111,8 +110,13 @@ int main(int argc, char **argv)
app.translate("SyntaxHighlightingCLI", "Disable ANSI background for the default color."));
parser.addOption(noAnsiEditorBg);
QCommandLineOption bgRole(QStringList() << QStringLiteral("B") << QStringLiteral("background-role"),
app.translate("SyntaxHighlightingCLI", "Select background color role from theme."),
app.translate("SyntaxHighlightingCLI", "role"));
parser.addOption(bgRole);
QCommandLineOption unbufferedAnsi(QStringList() << QStringLiteral("U") << QStringLiteral("unbuffered"),
app.translate("SyntaxHighlightingCLI", "For ansi and ansi256Colors formats, flush the output buffer on each line."));
app.translate("SyntaxHighlightingCLI", "For ansi and ansi256 formats, flush the output buffer on each line."));
parser.addOption(unbufferedAnsi);
QCommandLineOption titleOption(
@@ -127,22 +131,84 @@ int main(int argc, char **argv)
if (parser.isSet(listDefs)) {
for (const auto &def : repo.definitions()) {
std::cout << qPrintable(def.name()) << std::endl;
fprintf(stdout, "%s\n", qPrintable(def.name()));
}
return 0;
}
if (parser.isSet(listThemes)) {
for (const auto &theme : repo.themes()) {
std::cout << qPrintable(theme.name()) << std::endl;
fprintf(stdout, "%s\n", qPrintable(theme.name()));
}
return 0;
}
Theme::EditorColorRole bgColorRole = Theme::BackgroundColor;
if (parser.isSet(bgRole)) {
/*
* Theme::EditorColorRole contains border, foreground and background colors.
* To ensure that only the background colors used in text editing are used,
* QMetaEnum is avoided and values are listed in hard.
*/
struct BgRole {
QStringView name;
Theme::EditorColorRole role;
// name for display
const char *asciiName;
};
#define BG_ROLE(role) \
BgRole \
{ \
QStringView(u"" #role, sizeof(#role) - 1), Theme::role, #role \
}
constexpr BgRole bgRoles[] = {
BG_ROLE(BackgroundColor),
BG_ROLE(TextSelection),
BG_ROLE(CurrentLine),
BG_ROLE(SearchHighlight),
BG_ROLE(ReplaceHighlight),
BG_ROLE(BracketMatching),
BG_ROLE(CodeFolding),
BG_ROLE(MarkBookmark),
BG_ROLE(MarkBreakpointActive),
BG_ROLE(MarkBreakpointReached),
BG_ROLE(MarkBreakpointDisabled),
BG_ROLE(MarkExecution),
BG_ROLE(MarkWarning),
BG_ROLE(MarkError),
BG_ROLE(TemplateBackground),
BG_ROLE(TemplatePlaceholder),
BG_ROLE(TemplateFocusedPlaceholder),
BG_ROLE(TemplateReadOnlyPlaceholder),
};
#undef BG_ROLE
const auto role = parser.value(bgRole);
bool ok = false;
for (const auto &def : bgRoles) {
if (def.name == role) {
bgColorRole = def.role;
ok = true;
break;
}
}
if (!ok) {
fprintf(stderr, "Unknown background role. Expected:\n");
for (const auto &def : bgRoles) {
fprintf(stderr, " - %s\n", def.asciiName);
}
return 1;
}
}
if (parser.isSet(updateDefs)) {
DefinitionDownloader downloader(&repo);
QObject::connect(&downloader, &DefinitionDownloader::informationMessage, [](const QString &msg) {
std::cout << qPrintable(msg) << std::endl;
QObject::connect(&downloader, &DefinitionDownloader::informationMessage, &app, [](const QString &msg) {
fprintf(stdout, "%s\n", qPrintable(msg));
});
QObject::connect(&downloader, &DefinitionDownloader::done, &app, &QCoreApplication::quit);
downloader.start();
@@ -179,7 +245,7 @@ int main(int argc, char **argv)
}
if (!def.isValid()) {
std::cerr << "Unknown syntax." << std::endl;
fprintf(stderr, "Unknown syntax.\n");
return 1;
}
@@ -192,14 +258,16 @@ int main(int argc, char **argv)
HtmlHighlighter highlighter;
highlighter.setDefinition(def);
highlighter.setBackgroundRole(bgColorRole);
highlighter.setTheme(theme(repo, parser.value(themeName), Repository::LightTheme));
applyHighlighter(highlighter, parser, fromFileName, inFileName, outputName, title);
} else {
auto AnsiFormat = AnsiHighlighter::AnsiFormat::TrueColor;
if (0 == outputFormat.compare(QLatin1String("ansi256Colors"), Qt::CaseInsensitive)) {
// compatible with the old ansi256Colors value
if (outputFormat.startsWith(QLatin1String("ansi256"), Qt::CaseInsensitive)) {
AnsiFormat = AnsiHighlighter::AnsiFormat::XTerm256Color;
} else if (0 != outputFormat.compare(QLatin1String("ansi"), Qt::CaseInsensitive)) {
std::cerr << "Unknown output format." << std::endl;
fprintf(stderr, "Unknown output format.\n");
return 2;
}
@@ -220,7 +288,7 @@ int main(int argc, char **argv)
} else if (option == QStringLiteral("all")) {
options |= AnsiHighlighter::Option::TraceAll;
} else {
std::cerr << "Unknown trace name." << std::endl;
fprintf(stderr, "Unknown trace name.\n");
return 2;
}
}
@@ -228,6 +296,7 @@ int main(int argc, char **argv)
AnsiHighlighter highlighter;
highlighter.setDefinition(def);
highlighter.setBackgroundRole(bgColorRole);
highlighter.setTheme(theme(repo, parser.value(themeName), Repository::DarkTheme));
applyHighlighter(highlighter, parser, fromFileName, inFileName, outputName, AnsiFormat, options);
}

View File

@@ -31,15 +31,17 @@ AbstractHighlighterPrivate::~AbstractHighlighterPrivate()
void AbstractHighlighterPrivate::ensureDefinitionLoaded()
{
auto defData = DefinitionData::get(m_definition);
if (Q_UNLIKELY(!m_definition.isValid() && defData->repo && !m_definition.name().isEmpty())) {
if (Q_UNLIKELY(!m_definition.isValid())) {
if (defData->repo && !defData->name.isEmpty()) {
qCDebug(Log) << "Definition became invalid, trying re-lookup.";
m_definition = defData->repo->definitionForName(m_definition.name());
m_definition = defData->repo->definitionForName(defData->name);
defData = DefinitionData::get(m_definition);
}
if (Q_UNLIKELY(!defData->repo && !defData->fileName.isEmpty())) {
qCCritical(Log) << "Repository got deleted while a highlighter is still active!";
}
}
if (m_definition.isValid()) {
defData->load();

View File

@@ -17,7 +17,6 @@
#include <QColor>
#include <QFile>
#include <QFileInfo>
#include <QHash>
#include <QIODevice>
#include <QTextStream>
@@ -717,7 +716,7 @@ void fillString(QString &s, int n, QStringView fill)
for (; n > fill.size(); n -= fill.size()) {
s += fill;
}
s += fill.left(n);
s += fill.sliced(0, n);
}
}
@@ -728,8 +727,8 @@ struct GraphLine {
int labelLineLength = 0;
int nextLabelOffset = 0;
template<class String>
void pushLabel(int offset, String const &s, int numberDisplayableChar)
template<class StringBuilder>
void pushLabel(int offset, StringBuilder const &s, int numberDisplayableChar)
{
Q_ASSERT(offset >= labelLineLength);
const int n = offset - labelLineLength;
@@ -739,20 +738,20 @@ struct GraphLine {
nextLabelOffset = labelLineLength;
}
template<class String>
void pushGraph(int offset, String const &s, int numberDisplayableChar)
template<class StringBuilder>
void pushGraph(int offset, StringBuilder const &s, int numberDisplayableChar)
{
Q_ASSERT(offset >= graphLineLength);
const int n = offset - graphLineLength;
graphLineLength += numberDisplayableChar + n;
fillLine(graphLine, n);
const int ps1 = graphLine.size();
const qsizetype ps1 = graphLine.size();
graphLine += s;
if (offset >= labelLineLength) {
const int n2 = offset - labelLineLength;
labelLineLength += n2 + 1;
fillLine(labelLine, n2);
labelLine += QStringView(graphLine).right(graphLine.size() - ps1);
labelLine += QStringView(graphLine).sliced(ps1);
}
}
@@ -852,7 +851,7 @@ public:
for (const auto &fragment : m_highlightedFragments) {
auto const &ansiStyle = ansiStyles[fragment.formatId];
out << ansiStyle.first << QStringView(currentLine).mid(fragment.offset, fragment.length) << ansiStyle.second;
out << ansiStyle.first << QStringView(currentLine).sliced(fragment.offset, fragment.length) << ansiStyle.second;
}
out << QStringLiteral("\x1b[K\n");
@@ -955,7 +954,7 @@ private:
m_contextCapture.offsetNext = 0;
m_contextCapture.lengthNext = 0;
// truncate the line to deduce the context from the format
const auto lineFragment = currentLine.mid(0, fragment.offset + fragment.length + 1);
const auto lineFragment = currentLine.sliced(0, fragment.offset + fragment.length + 1);
newState = m_contextCapture.highlightLine(lineFragment, state);
// Deduced context does not start at the position of the format.
@@ -1207,6 +1206,7 @@ public:
QStringView currentLine;
// pairs of startColor / resetColor
std::vector<QPair<QString, QString>> ansiStyles;
Theme::EditorColorRole bgRole = Theme::BackgroundColor;
};
AnsiHighlighter::AnsiHighlighter()
@@ -1216,6 +1216,12 @@ AnsiHighlighter::AnsiHighlighter()
AnsiHighlighter::~AnsiHighlighter() = default;
void KSyntaxHighlighting::AnsiHighlighter::setBackgroundRole(Theme::EditorColorRole bgRole)
{
Q_D(AnsiHighlighter);
d->bgRole = bgRole;
}
void AnsiHighlighter::setOutputFile(const QString &fileName)
{
Q_D(AnsiHighlighter);
@@ -1239,7 +1245,6 @@ void AnsiHighlighter::setOutputFile(FILE *fileHandle)
void AnsiHighlighter::highlightFile(const QString &fileName, AnsiFormat format, Options options)
{
QFileInfo fi(fileName);
QFile f(fileName);
if (!f.open(QFile::ReadOnly)) {
qCWarning(Log) << "Failed to open input file" << fileName << ":" << f.errorString();
@@ -1273,17 +1278,31 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, Options o
QLatin1String backgroundDefaultColor;
const bool useEditorBackground = options.testFlag(Option::UseEditorBackground);
const bool useSelectedText = useEditorBackground && d->bgRole == Theme::TextSelection;
const auto toRGB = [](QRgb argb) {
return argb & 0xff'ff'ffu;
};
const QRgb foregroundColor = [&] {
if (useSelectedText) {
const auto fg = theme.selectedTextColor(Theme::Normal);
if (fg) {
return toRGB(fg);
}
}
return useEditorBackground ? toRGB(theme.textColor(Theme::Normal)) : 0;
}();
const QRgb backgroundColor = useEditorBackground ? toRGB(theme.editorColor(d->bgRole)) : 0;
// https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
if (useEditorBackground) {
const QRgb foregroundColor = theme.textColor(Theme::Normal);
const QRgb backgroundColor = theme.editorColor(Theme::BackgroundColor);
foregroundColorBuffer.appendForeground(foregroundColor, is256Colors, colorCache);
backgroundColorBuffer.append(QLatin1String("\x1b["));
backgroundColorBuffer.appendBackground(backgroundColor, is256Colors, colorCache);
foregroundDefaultColor = foregroundColorBuffer.latin1();
backgroundDefaultColor = backgroundColorBuffer.latin1().mid(2);
backgroundDefaultColor = backgroundColorBuffer.latin1().sliced(2);
}
int maxId = 0;
@@ -1303,20 +1322,22 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, Options o
buffer.append(QLatin1String("\x1b["));
const bool hasFg = format.hasTextColor(theme);
const bool hasBg = format.hasBackgroundColor(theme);
const auto fg = useSelectedText ? format.selectedTextColor(theme).rgba() : format.textColor(theme).rgba();
const auto bg = useSelectedText ? format.selectedBackgroundColor(theme).rgba() : format.backgroundColor(theme).rgba();
const bool hasFg = fg && (!useEditorBackground || toRGB(fg) != foregroundColor);
const bool hasBg = bg && (!useEditorBackground || toRGB(bg) != backgroundColor);
const bool hasBold = format.isBold(theme);
const bool hasItalic = format.isItalic(theme);
const bool hasUnderline = format.isUnderline(theme);
const bool hasStrikeThrough = format.isStrikeThrough(theme);
if (hasFg) {
buffer.appendForeground(format.textColor(theme).rgb(), is256Colors, colorCache);
buffer.appendForeground(toRGB(fg), is256Colors, colorCache);
} else {
buffer.append(foregroundDefaultColor);
}
if (hasBg) {
buffer.appendBackground(format.backgroundColor(theme).rgb(), is256Colors, colorCache);
buffer.appendBackground(toRGB(bg), is256Colors, colorCache);
}
if (hasBold) {
buffer.append(QLatin1String("1;"));
@@ -1418,5 +1439,5 @@ void AnsiHighlighter::applyFormat(int offset, int length, const Format &format)
{
Q_D(AnsiHighlighter);
auto const &ansiStyle = d->ansiStyles[format.id()];
d->out << ansiStyle.first << d->currentLine.mid(offset, length) << ansiStyle.second;
d->out << ansiStyle.first << d->currentLine.sliced(offset, length) << ansiStyle.second;
}

View File

@@ -9,6 +9,7 @@
#include "abstracthighlighter.h"
#include "ksyntaxhighlighting_export.h"
#include "theme.h"
#include <QFlags>
#include <QString>
@@ -53,6 +54,8 @@ public:
void setOutputFile(const QString &fileName);
void setOutputFile(FILE *fileHandle);
void setBackgroundRole(Theme::EditorColorRole bgRole);
protected:
void applyFormat(int offset, int length, const Format &format) override;

View File

@@ -9,7 +9,6 @@
#include "definition_p.h"
#include "format.h"
#include "ksyntaxhighlighting_logging.h"
#include "repository.h"
#include "rule_p.h"
#include "xml_p.h"
@@ -78,40 +77,33 @@ void Context::resolveIncludes(DefinitionData &def)
continue;
}
const QStringView includeContext = includeRules->contextName();
const qsizetype idx = includeContext.indexOf(QLatin1String("##"));
Context *context = nullptr;
DefinitionData *defData = &def;
const auto &contextName = includeRules->contextName();
const int idx = contextName.indexOf(QLatin1String("##"));
if (idx == -1) { // local include
context = def.contextByName(contextName);
if (idx <= -1) { // local include
context = def.contextByName(includeContext);
} else {
auto definitionName = contextName.mid(idx + 2);
auto includedDef = def.repo->definitionForName(definitionName);
if (!includedDef.isValid()) {
const auto definitionName = includeContext.sliced(idx + 2);
const auto contextName = includeContext.sliced(0, idx);
auto resolvedContext = def.resolveIncludedContext(definitionName, contextName);
defData = resolvedContext.def;
context = resolvedContext.context;
if (!defData) {
qCWarning(Log) << "Unable to resolve external include rule for definition" << definitionName << "in" << def.name;
++it;
continue;
}
defData = DefinitionData::get(includedDef);
def.addImmediateIncludedDefinition(includedDef);
defData->load();
if (idx == 0) {
context = defData->initialContext();
} else {
context = defData->contextByName(QStringView(contextName).left(idx));
}
}
if (!context) {
qCWarning(Log) << "Unable to resolve include rule for definition" << contextName << "in" << def.name;
qCWarning(Log) << "Unable to resolve include rule for definition" << includeContext << "in" << def.name;
++it;
continue;
}
if (context == this) {
qCWarning(Log) << "Unable to resolve self include rule for definition" << contextName << "in" << def.name;
qCWarning(Log) << "Unable to resolve self include rule for definition" << includeContext << "in" << def.name;
++it;
continue;
}

View File

@@ -1,51 +1,46 @@
/*
SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2024 Jonathan Poelen <jonathan.poelen@gmail.com>
SPDX-License-Identifier: MIT
*/
#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;
void ContextSwitch::resolve(DefinitionData &def, QStringView contextInstr)
void ContextSwitch::resolve(DefinitionData &def, QStringView context)
{
HighlightingContextData::ContextSwitch ctx(contextInstr);
m_popCount = ctx.popCount();
m_isStay = !m_popCount;
auto contextName = ctx.contextName();
auto defName = ctx.defName();
if (contextName.isEmpty() && defName.isEmpty()) {
if (context.isEmpty() || context == QStringLiteral("#stay")) {
return;
}
if (defName.isEmpty()) {
m_context = def.contextByName(contextName);
} else {
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);
}
while (context.startsWith(QStringLiteral("#pop"))) {
++m_popCount;
if (context.size() > 4 && context.at(4) == QLatin1Char('!')) {
context = context.sliced(5);
break;
}
context = context.sliced(4);
}
if (!m_context) {
qCWarning(Log) << "cannot find context" << contextName << "in" << def.name;
} else {
m_isStay = !m_popCount;
if (context.isEmpty()) {
return;
}
const qsizetype defNameIndex = context.indexOf(QStringLiteral("##"));
auto defName = (defNameIndex <= -1) ? QStringView() : context.sliced(defNameIndex + 2);
auto contextName = (defNameIndex <= -1) ? context : context.sliced(0, defNameIndex);
m_context = def.resolveIncludedContext(defName, contextName).context;
if (m_context) {
m_isStay = false;
} else {
qCWarning(Log) << "cannot find context" << contextName << "in" << def.name;
}
}

View File

@@ -7,7 +7,7 @@
#ifndef KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H
#define KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H
#include <QString>
#include <QStringView>
namespace KSyntaxHighlighting
{
@@ -35,7 +35,7 @@ public:
return m_context;
}
void resolve(DefinitionData &def, QStringView contextInstr);
void resolve(DefinitionData &def, QStringView context);
private:
Context *m_context = nullptr;

View File

@@ -9,7 +9,6 @@
#include "definition.h"
#include "definition_p.h"
#include "definitionref_p.h"
#include "context_p.h"
#include "format.h"
@@ -26,6 +25,7 @@
#include <QCborMap>
#include <QCoreApplication>
#include <QFile>
#include <QStringTokenizer>
#include <QXmlStreamReader>
#include <algorithm>
@@ -44,7 +44,7 @@ DefinitionData::~DefinitionData() = default;
Definition::Definition()
: d(std::make_shared<DefinitionData>())
{
d->q = *this;
d->q = d;
}
Definition::Definition(Definition &&other) noexcept = default;
@@ -53,12 +53,9 @@ Definition::~Definition() = default;
Definition &Definition::operator=(Definition &&other) noexcept = default;
Definition &Definition::operator=(const Definition &) = default;
Definition::Definition(std::shared_ptr<DefinitionData> &&dd)
: d(std::move(dd))
Definition::Definition(const DefinitionData &defData)
: d(defData.q.lock())
{
if (!d) {
Definition().d.swap(d);
}
}
bool Definition::operator==(const Definition &other) const
@@ -86,6 +83,11 @@ QString Definition::name() const
return d->name;
}
QStringList Definition::alternativeNames() const
{
return d->alternativeNames;
}
QString Definition::translatedName() const
{
if (d->translatedName.isEmpty()) {
@@ -167,21 +169,11 @@ bool Definition::isWordWrapDelimiter(QChar c) const
bool Definition::foldingEnabled() const
{
if (d->foldingRegionsState == DefinitionData::FoldingRegionsState::Undetermined) {
d->load();
if (d->hasFoldingRegions || indentationBasedFoldingEnabled()) {
return true;
}
// check included definitions
const auto defs = includedDefinitions();
for (const auto &def : defs) {
if (def.foldingEnabled()) {
d->hasFoldingRegions = true;
break;
}
}
return d->hasFoldingRegions;
return d->foldingRegionsState == DefinitionData::FoldingRegionsState::ContainsFoldingRegions || d->indentationBasedFolding;
}
bool Definition::indentationBasedFoldingEnabled() const
@@ -236,19 +228,24 @@ QList<Format> Definition::formats() const
QList<Definition> Definition::includedDefinitions() const
{
QList<Definition> definitions;
if (isValid()) {
d->load();
// init worklist and result used as guard with this definition
QList<const DefinitionData *> queue{d.get()};
QList<Definition> definitions{*this};
QVarLengthArray<const DefinitionData *, 4> queue{d.get()};
definitions.push_back(*this);
while (!queue.empty()) {
const auto *def = queue.back();
queue.pop_back();
for (const auto &defRef : std::as_const(def->immediateIncludedDefinitions)) {
const auto definition = defRef.definition();
if (!definitions.contains(definition)) {
definitions.push_back(definition);
queue.push_back(definition.d.get());
for (const auto *defData : def->immediateIncludedDefinitions) {
auto pred = [defData](const Definition &def) {
return DefinitionData::get(def) == defData;
};
if (std::find_if(definitions.begin(), definitions.end(), pred) == definitions.end()) {
definitions.push_back(Definition(*defData));
queue.push_back(defData);
}
}
}
@@ -256,6 +253,7 @@ QList<Definition> Definition::includedDefinitions() const
// remove the 1st entry, since it is this Definition
definitions.front() = std::move(definitions.back());
definitions.pop_back();
}
return definitions;
}
@@ -306,7 +304,7 @@ KeywordList *DefinitionData::keywordList(const QString &wantedName)
return (it == keywordLists.end()) ? nullptr : &it.value();
}
Format DefinitionData::formatByName(const QString &wantedName) const
Format DefinitionData::formatByName(QStringView wantedName) const
{
const auto it = formats.constFind(wantedName);
if (it != formats.constEnd()) {
@@ -328,14 +326,14 @@ std::atomic<uint64_t> definitionId{1};
bool DefinitionData::load(OnlyKeywords onlyKeywords)
{
if (fileName.isEmpty()) {
return false;
}
if (isLoaded()) {
return true;
}
if (fileName.isEmpty()) {
return false;
}
if (bool(onlyKeywords) && keywordIsLoaded) {
return true;
}
@@ -364,8 +362,8 @@ bool DefinitionData::load(OnlyKeywords onlyKeywords)
}
}
for (auto it = keywordLists.begin(); it != keywordLists.end(); ++it) {
it->setCaseSensitivity(caseSensitive);
for (auto &kw : keywordLists) {
kw.setCaseSensitivity(caseSensitive);
}
resolveContexts();
@@ -378,6 +376,7 @@ bool DefinitionData::load(OnlyKeywords onlyKeywords)
void DefinitionData::clear()
{
// keep only name and repo, so we can re-lookup to make references persist over repo reloads
// see AbstractHighlighterPrivate::ensureDefinitionLoaded()
id = 0;
keywordLists.clear();
contexts.clear();
@@ -387,7 +386,7 @@ void DefinitionData::clear()
wordDelimiters = WordDelimiters();
wordWrapDelimiters = wordDelimiters;
keywordIsLoaded = false;
hasFoldingRegions = false;
foldingRegionsState = FoldingRegionsState::Undetermined;
indentationBasedFolding = false;
foldingIgnoreList.clear();
singleLineCommentMarker.clear();
@@ -443,6 +442,9 @@ bool DefinitionData::loadMetaData(const QString &definitionFileName)
bool DefinitionData::loadMetaData(const QString &file, const QCborMap &obj)
{
name = obj.value(QLatin1String("name")).toString();
if (name.isEmpty()) {
return false;
}
nameUtf8 = obj.value(QLatin1String("name")).toByteArray();
section = obj.value(QLatin1String("section")).toString();
sectionUtf8 = obj.value(QLatin1String("section")).toByteArray();
@@ -455,6 +457,9 @@ bool DefinitionData::loadMetaData(const QString &file, const QCborMap &obj)
hidden = obj.value(QLatin1String("hidden")).toBool();
fileName = file;
const auto names = obj.value(QLatin1String("alternativeNames")).toString();
alternativeNames = names.split(QLatin1Char(';'), Qt::SkipEmptyParts);
const auto exts = obj.value(QLatin1String("extensions")).toString();
extensions = exts.split(QLatin1Char(';'), Qt::SkipEmptyParts);
@@ -474,6 +479,13 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader)
}
name = reader.attributes().value(QLatin1String("name")).toString();
if (name.isEmpty()) {
return false;
}
const auto names = reader.attributes().value(QLatin1String("alternativeNames"));
for (const auto &n : QStringTokenizer(names, u';', Qt::SkipEmptyParts)) {
alternativeNames.push_back(n.toString());
}
section = reader.attributes().value(QLatin1String("section")).toString();
// toFloat instead of toInt for backward compatibility with old Kate files
version = reader.attributes().value(QLatin1String("version")).toFloat();
@@ -484,11 +496,11 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader)
author = reader.attributes().value(QLatin1String("author")).toString();
license = reader.attributes().value(QLatin1String("license")).toString();
const auto exts = reader.attributes().value(QLatin1String("extensions"));
for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) {
for (const auto &ext : QStringTokenizer(exts, u';', Qt::SkipEmptyParts)) {
extensions.push_back(ext.toString());
}
const auto mts = reader.attributes().value(QLatin1String("mimetype"));
for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) {
for (const auto &mt : QStringTokenizer(mts, u';', Qt::SkipEmptyParts)) {
mimetypes.push_back(mt.toString());
}
if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) {
@@ -547,8 +559,8 @@ void DefinitionData::resolveIncludeKeywords()
keywordIsLoaded = true;
for (auto it = keywordLists.begin(); it != keywordLists.end(); ++it) {
it->resolveIncludeKeywords(*this);
for (auto &kw : keywordLists) {
kw.resolveIncludeKeywords(*this);
}
}
@@ -563,8 +575,7 @@ void DefinitionData::loadContexts(QXmlStreamReader &reader)
switch (reader.tokenType()) {
case QXmlStreamReader::StartElement:
if (reader.name() == QLatin1String("context")) {
contextDatas.push_back(HighlightingContextData());
contextDatas.back().load(name, reader);
contextDatas.emplace_back().load(name, reader);
}
reader.readNext();
break;
@@ -610,6 +621,11 @@ void DefinitionData::resolveContexts()
for (auto &context : contexts) {
context.resolveIncludes(*this);
}
// when a context includes a folding region this value is Yes, otherwise it remains undetermined
if (foldingRegionsState == FoldingRegionsState::Undetermined) {
foldingRegionsState = FoldingRegionsState::NoFoldingRegions;
}
}
void DefinitionData::loadItemData(QXmlStreamReader &reader)
@@ -814,8 +830,8 @@ bool DefinitionData::checkKateVersion(QStringView verStr)
qCWarning(Log) << "Skipping" << fileName << "due to having no valid kateversion attribute:" << verStr;
return false;
}
const auto major = verStr.left(idx).toInt();
const auto minor = verStr.mid(idx + 1).toInt();
const auto major = verStr.sliced(0, idx).toInt();
const auto minor = verStr.sliced(idx + 1).toInt();
if (major > KSYNTAXHIGHLIGHTING_VERSION_MAJOR || (major == KSYNTAXHIGHLIGHTING_VERSION_MAJOR && minor > KSYNTAXHIGHLIGHTING_VERSION_MINOR)) {
qCWarning(Log) << "Skipping" << fileName << "due to being too new, version:" << verStr;
@@ -827,46 +843,36 @@ bool DefinitionData::checkKateVersion(QStringView verStr)
quint16 DefinitionData::foldingRegionId(const QString &foldName)
{
hasFoldingRegions = true;
foldingRegionsState = FoldingRegionsState::ContainsFoldingRegions;
return RepositoryPrivate::get(repo)->foldingRegionId(name, foldName);
}
void DefinitionData::addImmediateIncludedDefinition(const Definition &def)
DefinitionData::ResolvedContext DefinitionData::resolveIncludedContext(QStringView defName, QStringView contextName)
{
if (get(def) != this) {
DefinitionRef defRef(def);
if (!immediateIncludedDefinitions.contains(defRef)) {
immediateIncludedDefinitions.push_back(std::move(defRef));
if (defName.isEmpty()) {
return {this, contextByName(contextName)};
}
auto d = repo->definitionForName(defName.toString());
if (d.isValid()) {
auto *resolvedDef = get(d);
if (resolvedDef != this) {
if (std::find(immediateIncludedDefinitions.begin(), immediateIncludedDefinitions.end(), resolvedDef) == immediateIncludedDefinitions.end()) {
immediateIncludedDefinitions.push_back(resolvedDef);
resolvedDef->load();
if (resolvedDef->foldingRegionsState == FoldingRegionsState::ContainsFoldingRegions) {
foldingRegionsState = FoldingRegionsState::ContainsFoldingRegions;
}
}
}
if (contextName.isEmpty()) {
return {resolvedDef, resolvedDef->initialContext()};
} else {
return {resolvedDef, resolvedDef->contextByName(contextName)};
}
}
}
DefinitionRef::DefinitionRef() = default;
DefinitionRef::DefinitionRef(const Definition &def) noexcept
: d(def.d)
{
}
DefinitionRef &DefinitionRef::operator=(const Definition &def) noexcept
{
d = def.d;
return *this;
}
Definition DefinitionRef::definition() const
{
return Definition(d.lock());
}
bool DefinitionRef::operator==(const DefinitionRef &other) const
{
return !d.owner_before(other.d) && !other.d.owner_before(d);
}
bool DefinitionRef::operator==(const Definition &other) const
{
return !d.owner_before(other.d) && !other.d.owner_before(d);
return {nullptr, nullptr};
}
#include "moc_definition.cpp"

View File

@@ -162,6 +162,13 @@ public:
*/
QString name() const;
/**
* Alternate names the syntax can be referred to by.
*
* @since 6.1
*/
QStringList alternativeNames() const;
/**
* Translated name for display.
*/
@@ -404,8 +411,7 @@ public:
private:
friend class DefinitionData;
friend class DefinitionRef;
KSYNTAXHIGHLIGHTING_NO_EXPORT explicit Definition(std::shared_ptr<DefinitionData> &&dd);
KSYNTAXHIGHLIGHTING_NO_EXPORT explicit Definition(const DefinitionData &defData);
std::shared_ptr<DefinitionData> d;
};

View File

@@ -8,7 +8,7 @@
#ifndef KSYNTAXHIGHLIGHTING_DEFINITION_P_H
#define KSYNTAXHIGHLIGHTING_DEFINITION_P_H
#include "definitionref_p.h"
#include "definition.h"
#include "highlightingdata_p.hpp"
#include "state.h"
#include "worddelimiters_p.h"
@@ -17,6 +17,7 @@
#include <QList>
#include <QSet>
#include <QString>
#include <QVarLengthArray>
#include <vector>
@@ -71,27 +72,38 @@ public:
Context *initialContext();
Context *contextByName(QStringView name);
Format formatByName(const QString &name) const;
Format formatByName(QStringView name) const;
quint16 foldingRegionId(const QString &foldName);
void addImmediateIncludedDefinition(const Definition &def);
struct ResolvedContext {
DefinitionData *def;
Context *context;
};
DefinitionRef q;
ResolvedContext resolveIncludedContext(QStringView defName, QStringView contextName);
enum class FoldingRegionsState : uint8_t {
Undetermined,
ContainsFoldingRegions,
NoFoldingRegions,
};
std::weak_ptr<DefinitionData> q;
uint64_t id = 0;
Repository *repo = nullptr;
QHash<QString, KeywordList> keywordLists;
std::vector<Context> contexts;
QHash<QString, Format> formats;
QHash<QStringView, Format> formats;
// data loaded from xml file and emptied after loading contexts
QList<HighlightingContextData> contextDatas;
std::vector<HighlightingContextData> contextDatas;
// Definition referenced by IncludeRules and ContextSwitch
QList<DefinitionRef> immediateIncludedDefinitions;
QVarLengthArray<const DefinitionData *, 4> immediateIncludedDefinitions;
WordDelimiters wordDelimiters;
WordDelimiters wordWrapDelimiters;
bool keywordIsLoaded = false;
bool hasFoldingRegions = false;
FoldingRegionsState foldingRegionsState = FoldingRegionsState::Undetermined;
bool indentationBasedFolding = false;
QStringList foldingIgnoreList;
QString singleLineCommentMarker;
@@ -102,6 +114,7 @@ public:
QString fileName;
QString name = QStringLiteral(QT_TRANSLATE_NOOP("Language", "None"));
QStringList alternativeNames;
QByteArray nameUtf8;
mutable QString translatedName;
QString section;

View File

@@ -75,14 +75,14 @@ void DefinitionDownloaderPrivate::updateDefinition(QXmlStreamReader &parser)
auto localDef = repo->definitionForName(name.toString());
if (!localDef.isValid()) {
Q_EMIT q->informationMessage(QObject::tr("Downloading new syntax definition for '%1'...").arg(name));
Q_EMIT q->informationMessage(QObject::tr("Downloading new syntax definition for '%1'", "@info").arg(name));
downloadDefinition(QUrl(parser.attributes().value(QLatin1String("url")).toString()));
return;
}
const auto version = parser.attributes().value(QLatin1String("version"));
if (localDef.version() < version.toFloat()) {
Q_EMIT q->informationMessage(QObject::tr("Updating syntax definition for '%1' to version %2...").arg(name, version));
Q_EMIT q->informationMessage(QObject::tr("Updating syntax definition for '%1' to version %2", "@info").arg(name, version));
downloadDefinition(QUrl(parser.attributes().value(QLatin1String("url")).toString()));
}
}

View File

@@ -1,71 +0,0 @@
/*
SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: MIT
*/
#ifndef KSYNTAXHIGHLIGHTING_DEFINITIONREF_P_H
#define KSYNTAXHIGHLIGHTING_DEFINITIONREF_P_H
#include "definition.h"
#include <memory>
namespace KSyntaxHighlighting
{
class Definition;
class DefinitionData;
/** Weak reference for Definition instances.
*
* This must be used when holding Definition instances
* in objects hold directly or indirectly by Definition
* to avoid reference count loops and thus memory leaks.
*
* This class follows the rule of zero. It is implicitly movable and copyable.
*
* @internal
*/
class DefinitionRef
{
public:
DefinitionRef();
explicit DefinitionRef(const Definition &def) noexcept;
DefinitionRef &operator=(const Definition &def) noexcept;
Definition definition() const;
/**
* Checks two definition references for equality.
*/
bool operator==(const DefinitionRef &other) const;
/**
* Checks two definition references for inequality.
*/
bool operator!=(const DefinitionRef &other) const
{
return !(*this == other);
}
/**
* Checks two definition for equality.
*/
bool operator==(const Definition &other) const;
/**
* Checks two definition for inequality.
*/
bool operator!=(const Definition &other) const
{
return !(*this == other);
}
private:
friend class DefinitionData;
std::weak_ptr<DefinitionData> d;
};
}
#endif

View File

@@ -7,7 +7,6 @@
#include "format.h"
#include "definition.h"
#include "definitionref_p.h"
#include "format_p.h"
#include "textstyledata_p.h"
#include "themedata_p.h"
@@ -28,7 +27,7 @@ static Theme::TextStyle stringToDefaultFormat(QStringView str)
const auto metaEnum = QMetaEnum::fromType<Theme::TextStyle>();
bool ok = false;
const auto value = metaEnum.keyToValue(str.mid(2).toLatin1().constData(), &ok);
const auto value = metaEnum.keyToValue(str.sliced(2).toLatin1().constData(), &ok);
if (!ok || value < 0) {
return Theme::Normal;
}

View File

@@ -324,50 +324,6 @@ HighlightingContextData::Rule::~Rule()
});
}
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"));

View File

@@ -8,7 +8,6 @@
#define KSYNTAXHIGHLIGHTING_HIGHLIGHTING_DATA_P_H
#include <QString>
#include <QStringList>
#include <vector>
@@ -28,26 +27,6 @@ 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,

View File

@@ -28,6 +28,7 @@ public:
std::unique_ptr<QFile> file;
QString currentLine;
std::vector<QString> htmlStyles;
Theme::EditorColorRole bgRole = Theme::BackgroundColor;
};
HtmlHighlighter::HtmlHighlighter()
@@ -39,6 +40,12 @@ HtmlHighlighter::~HtmlHighlighter()
{
}
void HtmlHighlighter::setBackgroundRole(Theme::EditorColorRole bgRole)
{
Q_D(HtmlHighlighter);
d->bgRole = bgRole;
}
void HtmlHighlighter::setOutputFile(const QString &fileName)
{
Q_D(HtmlHighlighter);
@@ -60,7 +67,6 @@ void HtmlHighlighter::setOutputFile(FILE *fileHandle)
void HtmlHighlighter::highlightFile(const QString &fileName, const QString &title)
{
QFileInfo fi(fileName);
QFile f(fileName);
if (!f.open(QFile::ReadOnly)) {
qCWarning(Log) << "Failed to open input file" << fileName << ":" << f.errorString();
@@ -68,38 +74,51 @@ void HtmlHighlighter::highlightFile(const QString &fileName, const QString &titl
}
if (title.isEmpty()) {
QFileInfo fi(fileName);
highlightData(&f, fi.fileName());
} else {
highlightData(&f, title);
}
}
namespace
{
/**
* @brief toHtmlRgba
* Converts QColor -> #RRGGBBAA if there is an alpha channel
* Converts QRgb -> #RRGGBBAA if there is an alpha channel
* otherwise it will just return the hexcode. This is because QColor
* outputs #AARRGGBB, whereas browser support #RRGGBBAA.
*
* @param color
* @return
*/
static QString toHtmlRgbaString(const QColor &color)
{
if (color.alpha() == 0xFF) {
return color.name();
struct HtmlColor {
HtmlColor(QRgb argb)
{
static const char16_t *digits = u"0123456789abcdef";
hexcode[0] = u'#';
hexcode[1] = digits[qRed(argb) >> 4];
hexcode[2] = digits[qRed(argb) & 0xf];
hexcode[3] = digits[qGreen(argb) >> 4];
hexcode[4] = digits[qGreen(argb) & 0xf];
hexcode[5] = digits[qBlue(argb) >> 4];
hexcode[6] = digits[qBlue(argb) & 0xf];
if (qAlpha(argb) == 0xff) {
len = 7;
} else {
hexcode[7] = digits[qAlpha(argb) >> 4];
hexcode[8] = digits[qAlpha(argb) & 0xf];
len = 9;
}
static const char16_t digits[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
}
QStringView sv() const
{
return QStringView(hexcode, len);
}
private:
QChar hexcode[9];
hexcode[0] = QLatin1Char('#');
hexcode[1] = digits[color.red() >> 4];
hexcode[2] = digits[color.red() & 0xf];
hexcode[3] = digits[color.green() >> 4];
hexcode[4] = digits[color.green() & 0xf];
hexcode[5] = digits[color.blue() >> 4];
hexcode[6] = digits[color.blue() & 0xf];
hexcode[7] = digits[color.alpha() >> 4];
hexcode[8] = digits[color.alpha() & 0xf];
return QString(hexcode, 9);
qsizetype len;
};
}
void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title)
@@ -120,10 +139,22 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title)
const auto &theme = d->m_theme;
const auto &definition = d->m_definition;
const bool useSelectedText = d->bgRole == Theme::TextSelection;
auto definitions = definition.includedDefinitions();
definitions.append(definition);
const auto mainTextColor = [&] {
if (useSelectedText) {
const auto fg = theme.selectedTextColor(Theme::Normal);
if (fg) {
return fg;
}
}
return theme.textColor(Theme::Normal);
}();
const auto mainBgColor = theme.editorColor(d->bgRole);
int maxId = 0;
for (const auto &definition : std::as_const(definitions)) {
for (const auto &format : std::as_const(DefinitionData::get(definition)->formats)) {
@@ -138,11 +169,14 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title)
for (const auto &definition : std::as_const(definitions)) {
for (const auto &format : std::as_const(DefinitionData::get(definition)->formats)) {
auto &buffer = d->htmlStyles[format.id()];
if (format.hasTextColor(theme)) {
buffer += QStringLiteral("color:") + toHtmlRgbaString(format.textColor(theme)) + QStringLiteral(";");
const auto textColor = useSelectedText ? format.selectedTextColor(theme).rgba() : format.textColor(theme).rgba();
if (textColor && textColor != mainTextColor) {
buffer += QStringLiteral("color:") + HtmlColor(textColor).sv() + u';';
}
if (format.hasBackgroundColor(theme)) {
buffer += QStringLiteral("background-color:") + toHtmlRgbaString(format.backgroundColor(theme)) + QStringLiteral(";");
const auto bgColor = useSelectedText ? format.selectedBackgroundColor(theme).rgba() : format.backgroundColor(theme).rgba();
if (bgColor && bgColor != mainBgColor) {
buffer += QStringLiteral("background-color:") + HtmlColor(bgColor).sv() + u';';
}
if (format.isBold(theme)) {
buffer += QStringLiteral("font-weight:bold;");
@@ -173,10 +207,8 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title)
*d->out << "<title>" << htmlTitle << "</title>\n";
*d->out << "<meta name=\"generator\" content=\"KF5::SyntaxHighlighting - Definition (" << definition.name() << ") - Theme (" << theme.name() << ")\"/>\n";
*d->out << "</head><body";
*d->out << " style=\"background-color:" << toHtmlRgbaString(QColor::fromRgba(theme.editorColor(Theme::BackgroundColor)));
if (theme.textColor(Theme::Normal)) {
*d->out << ";color:" << toHtmlRgbaString(QColor::fromRgba(theme.textColor(Theme::Normal)));
}
*d->out << " style=\"background-color:" << HtmlColor(mainBgColor).sv();
*d->out << ";color:" << HtmlColor(mainTextColor).sv();
*d->out << "\"><pre>\n";
QTextStream in(dev);
@@ -206,7 +238,7 @@ void HtmlHighlighter::applyFormat(int offset, int length, const Format &format)
*d->out << htmlStyle;
}
for (QChar ch : QStringView(d->currentLine).mid(offset, length)) {
for (QChar ch : QStringView(d->currentLine).sliced(offset, length)) {
if (ch == u'<')
*d->out << QStringLiteral("&lt;");
else if (ch == u'&')

View File

@@ -9,6 +9,7 @@
#include "abstracthighlighter.h"
#include "ksyntaxhighlighting_export.h"
#include "theme.h"
#include <QString>
@@ -32,6 +33,8 @@ public:
void setOutputFile(const QString &fileName);
void setOutputFile(FILE *fileHandle);
void setBackgroundRole(Theme::EditorColorRole bgRole);
protected:
void applyFormat(int offset, int length, const Format &format) override;

View File

@@ -121,10 +121,10 @@ void KeywordList::resolveIncludeKeywords(DefinitionData &def)
KeywordList *keywords = nullptr;
if (idx >= 0) {
auto defName = kw_include.mid(idx + 2);
auto defName = kw_include.sliced(idx + 2);
auto includeDef = def.repo->definitionForName(defName);
if (includeDef.isValid()) {
auto listName = kw_include.left(idx);
auto listName = kw_include.sliced(0, idx);
auto defData = DefinitionData::get(includeDef);
defData->load(DefinitionData::OnlyKeywords(true));
keywords = defData->keywordList(listName);

View File

@@ -7,7 +7,6 @@
#include "repository.h"
#include "definition.h"
#include "definition_p.h"
#include "ksyntaxhighlighting_logging.h"
#include "repository_p.h"
#include "theme.h"
#include "themedata_p.h"
@@ -62,7 +61,7 @@ auto anyMimeTypeEquals(QStringView mimeTypeName)
// The two function templates below take defs - a map sorted by highlighting name - to be deterministic and independent of translations.
template<typename UnaryPredicate>
Definition findHighestPriorityDefinitionIf(const QMap<QString, Definition> &defs, UnaryPredicate predicate)
Definition findHighestPriorityDefinitionIf(const QList<Definition> &defs, UnaryPredicate predicate)
{
const Definition *match = nullptr;
auto matchPriority = std::numeric_limits<int>::lowest();
@@ -77,7 +76,7 @@ Definition findHighestPriorityDefinitionIf(const QMap<QString, Definition> &defs
}
template<typename UnaryPredicate>
QList<Definition> findDefinitionsIf(const QMap<QString, Definition> &defs, UnaryPredicate predicate)
QList<Definition> findDefinitionsIf(const QList<Definition> &defs, UnaryPredicate predicate)
{
QList<Definition> matches;
std::copy_if(defs.cbegin(), defs.cend(), std::back_inserter(matches), predicate);
@@ -112,34 +111,34 @@ Repository::~Repository()
{
// reset repo so we can detect in still alive definition instances
// that the repo was deleted
for (const auto &def : std::as_const(d->m_sortedDefs)) {
for (const auto &def : std::as_const(d->m_flatDefs)) {
DefinitionData::get(def)->repo = nullptr;
}
}
Definition Repository::definitionForName(const QString &defName) const
{
return d->m_defs.value(defName);
return d->m_fullDefs.value(defName.toLower());
}
Definition Repository::definitionForFileName(const QString &fileName) const
{
return findHighestPriorityDefinitionIf(d->m_defs, anyWildcardMatches(fileNameFromFilePath(fileName)));
return findHighestPriorityDefinitionIf(d->m_flatDefs, anyWildcardMatches(fileNameFromFilePath(fileName)));
}
QList<Definition> Repository::definitionsForFileName(const QString &fileName) const
{
return findDefinitionsIf(d->m_defs, anyWildcardMatches(fileNameFromFilePath(fileName)));
return findDefinitionsIf(d->m_flatDefs, anyWildcardMatches(fileNameFromFilePath(fileName)));
}
Definition Repository::definitionForMimeType(const QString &mimeType) const
{
return findHighestPriorityDefinitionIf(d->m_defs, anyMimeTypeEquals(mimeType));
return findHighestPriorityDefinitionIf(d->m_flatDefs, anyMimeTypeEquals(mimeType));
}
QList<Definition> Repository::definitionsForMimeType(const QString &mimeType) const
{
return findDefinitionsIf(d->m_defs, anyMimeTypeEquals(mimeType));
return findDefinitionsIf(d->m_flatDefs, anyMimeTypeEquals(mimeType));
}
QList<Definition> Repository::definitions() const
@@ -208,7 +207,7 @@ Theme Repository::themeForPalette(const QPalette &palette) const
void RepositoryPrivate::load(Repository *repo)
{
// always add invalid default "None" highlighting
addDefinition(Definition());
m_defs.emplace(QString(), Definition());
// do lookup in standard paths, if not disabled
#ifndef NO_STANDARD_PATHS
@@ -241,17 +240,7 @@ void RepositoryPrivate::load(Repository *repo)
loadSyntaxFolder(repo, path + QStringLiteral("/syntax"));
}
m_sortedDefs.reserve(m_defs.size());
for (auto it = m_defs.constBegin(); it != m_defs.constEnd(); ++it) {
m_sortedDefs.push_back(it.value());
}
std::sort(m_sortedDefs.begin(), m_sortedDefs.end(), [](const Definition &left, const Definition &right) {
auto comparison = left.translatedSection().compare(right.translatedSection(), Qt::CaseInsensitive);
if (comparison == 0) {
comparison = left.translatedName().compare(right.translatedName(), Qt::CaseInsensitive);
}
return comparison < 0;
});
computeAlternativeDefLists();
// load themes
@@ -276,6 +265,33 @@ void RepositoryPrivate::load(Repository *repo)
}
}
void RepositoryPrivate::computeAlternativeDefLists()
{
m_flatDefs.clear();
m_flatDefs.reserve(m_defs.size());
for (const auto &[_, def] : m_defs) {
m_flatDefs.push_back(def);
}
m_sortedDefs = m_flatDefs;
std::sort(m_sortedDefs.begin(), m_sortedDefs.end(), [](const Definition &left, const Definition &right) {
auto comparison = left.translatedSection().compare(right.translatedSection(), Qt::CaseInsensitive);
if (comparison == 0) {
comparison = left.translatedName().compare(right.translatedName(), Qt::CaseInsensitive);
}
return comparison < 0;
});
m_fullDefs.clear();
for (const auto &def : std::as_const(m_sortedDefs)) {
m_fullDefs.insert(def.name().toLower(), def);
const auto &alternativeNames = def.alternativeNames();
for (const auto &altName : alternativeNames) {
m_fullDefs.insert(altName.toLower(), def);
}
}
}
void RepositoryPrivate::loadSyntaxFolder(Repository *repo, const QString &path)
{
QDirIterator it(path, QStringList() << QLatin1String("*.xml"), QDir::Files);
@@ -284,7 +300,7 @@ void RepositoryPrivate::loadSyntaxFolder(Repository *repo, const QString &path)
auto defData = DefinitionData::get(def);
defData->repo = repo;
if (defData->loadMetaData(it.next())) {
addDefinition(def);
addDefinition(std::move(def));
}
}
}
@@ -308,25 +324,24 @@ bool RepositoryPrivate::loadSyntaxFolderFromIndex(Repository *repo, const QStrin
auto defData = DefinitionData::get(def);
defData->repo = repo;
if (defData->loadMetaData(fileName, defMap)) {
addDefinition(def);
addDefinition(std::move(def));
}
}
return true;
}
void RepositoryPrivate::addDefinition(const Definition &def)
void RepositoryPrivate::addDefinition(Definition &&def)
{
const auto it = m_defs.constFind(def.name());
if (it == m_defs.constEnd()) {
m_defs.insert(def.name(), def);
const auto [it, inserted] = m_defs.try_emplace(def.name(), std::move(def));
if (inserted) {
return;
}
if (it.value().version() >= def.version()) {
if (it->second.version() >= def.version()) {
return;
}
m_defs.insert(def.name(), def);
it->second = std::move(def);
}
void RepositoryPrivate::loadThemeFolder(const QString &path)
@@ -382,11 +397,13 @@ void Repository::reload()
{
Q_EMIT aboutToReload();
for (const auto &def : std::as_const(d->m_sortedDefs)) {
for (const auto &def : std::as_const(d->m_flatDefs)) {
DefinitionData::get(def)->clear();
}
d->m_defs.clear();
d->m_flatDefs.clear();
d->m_sortedDefs.clear();
d->m_fullDefs.clear();
d->m_themes.clear();
@@ -402,8 +419,14 @@ void Repository::reload()
void Repository::addCustomSearchPath(const QString &path)
{
Q_EMIT aboutToReload();
d->m_customSearchPaths.append(path);
reload();
d->loadThemeFolder(path + QStringLiteral("/themes"));
d->loadSyntaxFolder(this, path + QStringLiteral("/syntax"));
d->computeAlternativeDefLists();
Q_EMIT reloaded();
}
QList<QString> Repository::customSearchPaths() const

View File

@@ -141,9 +141,10 @@ public:
* If no Definition is found, Definition::isValid() of the returned instance
* returns false.
*
* @note This uses case sensitive, untranslated names. For instance,
* the javascript.xml definition file sets its name to @e JavaScript.
* Therefore, only the string "JavaScript" will return a valid
* @note The search is @e Qt::CaseInsensitive using untranslated names or
* alternative names. For instance, the cpp.xml definition file sets
* its name to @e C++ with an alternative name of @e CPP. Therefore, the
* strings "C++", "c++", "CPP" and "cpp" will all return a valid
* Definition file.
*/
Q_INVOKABLE KSyntaxHighlighting::Definition definitionForName(const QString &defName) const;

View File

@@ -9,9 +9,10 @@
#include <QHash>
#include <QList>
#include <QMap>
#include <QString>
#include <map>
#include "dynamicregexpcache_p.h"
namespace KSyntaxHighlighting
@@ -30,8 +31,9 @@ public:
void load(Repository *repo);
void loadSyntaxFolder(Repository *repo, const QString &path);
bool loadSyntaxFolderFromIndex(Repository *repo, const QString &path);
void computeAlternativeDefLists();
void addDefinition(const Definition &def);
void addDefinition(Definition &&def);
void loadThemeFolder(const QString &path);
void addTheme(const Theme &theme);
@@ -41,8 +43,13 @@ public:
QList<QString> m_customSearchPaths;
// sorted map to have deterministic iteration order for e.g. definitionsForFileName
QMap<QString, Definition> m_defs;
// sorted map to have deterministic iteration order
std::map<QString, Definition> m_defs;
// flat version of m_defs for speed up iterations for e.g. definitionsForFileName
QList<Definition> m_flatDefs;
// map relating all names and alternative names, case insensitively to the correct definition.
QHash<QString, Definition> m_fullDefs;
// this vector is sorted by translated sections/names
QList<Definition> m_sortedDefs;

View File

@@ -97,7 +97,7 @@ static QString replaceCaptures(const QString &pattern, const QStringList &captur
static MatchResult matchString(QStringView pattern, QStringView text, int offset, Qt::CaseSensitivity caseSensitivity)
{
if (offset + pattern.size() <= text.size() && text.mid(offset, pattern.size()).compare(pattern, caseSensitivity) == 0) {
if (offset + pattern.size() <= text.size() && text.sliced(offset, pattern.size()).compare(pattern, caseSensitivity) == 0) {
return offset + pattern.size();
}
return offset;
@@ -533,7 +533,7 @@ MatchResult KeywordListRule::doMatch(QStringView text, int offset, const QString
return offset;
}
if (m_keywordList.contains(text.mid(offset, newOffset - offset), m_caseSensitivity)) {
if (m_keywordList.contains(text.sliced(offset, newOffset - offset), m_caseSensitivity)) {
return newOffset;
}
@@ -609,11 +609,7 @@ static MatchResult regexMatch(const QRegularExpression &regexp, QStringView text
/**
* match the pattern
*/
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
const auto result = regexp.matchView(text, 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
@@ -745,7 +741,7 @@ MatchResult WordDetect::doMatch(QStringView text, int offset, const QStringList
return offset;
}
if (text.mid(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) {
if (text.sliced(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) {
return offset;
}

View File

@@ -9,7 +9,6 @@
#define KSYNTAXHIGHLIGHTING_RULE_P_H
#include "contextswitch_p.h"
#include "definitionref_p.h"
#include "foldingregion.h"
#include "format.h"
#include "highlightingdata_p.hpp"

View File

@@ -62,7 +62,7 @@ public:
private:
friend class StateData;
KSYNTAXHIGHLIGHTING_EXPORT friend std::size_t qHash(const State &, std::size_t);
friend std::size_t qHash(const State &, std::size_t);
QExplicitlySharedDataPointer<StateData> d;
};
}

View File

@@ -13,8 +13,6 @@
#include <QSharedData>
#include <QStringList>
#include "definitionref_p.h"
namespace KSyntaxHighlighting
{
class Context;

View File

@@ -77,6 +77,9 @@ static inline TextStyleData readThemeData(const QJsonObject &obj)
bool ThemeData::load(const QString &filePath)
{
// flag first as done for the error cases
m_completelyLoaded = true;
QFile loadFile(filePath);
if (!loadFile.open(QIODevice::ReadOnly)) {
return false;
@@ -93,7 +96,7 @@ bool ThemeData::load(const QString &filePath)
}
QJsonParseError parseError;
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData.mid(start, (end + 1) - start), &parseError);
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData.sliced(start, (end + 1) - start), &parseError);
if (parseError.error != QJsonParseError::NoError) {
qCWarning(Log) << "Failed to parse theme file" << filePath << ":" << parseError.errorString();
return false;
@@ -101,6 +104,9 @@ bool ThemeData::load(const QString &filePath)
m_filePath = filePath;
// we need more data later
m_completelyLoaded = false;
// read metadata
QJsonObject metadata = jsonDoc.object();
m_name = metadata.value(QLatin1String("name")).toString();

View File

@@ -145,7 +145,8 @@ private:
//! on disk (in a read-only or a writeable location).
QString m_filePath;
bool m_completelyLoaded = false;
// default is loaded, we have no file per default, set to false on start of load
bool m_completelyLoaded = true;
//! TextStyles
std::vector<TextStyleData> m_textStyles;

View File

@@ -57,7 +57,6 @@ Project {
"definition_p.h",
"definitiondownloader.cpp",
"definitiondownloader.h",
"definitionref_p.h",
"dynamicregexpcache_p.h",
"foldingregion.cpp",
"foldingregion.h",