diff options
author | David Schulz <david.schulz@qt.io> | 2020-11-04 10:05:42 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-11-16 06:40:26 +0000 |
commit | b49a9c2d8b13cd7ff20cb28139e7387a09faf0d9 (patch) | |
tree | 71e1bc9dbe7d8b1cf8d3c700af48e64786090d81 | |
parent | 1eb0b02ce9a118cbb46d18857d18970f1f7ebf8c (diff) |
Editor: update KSyntaxHighlighting to v5.75.0
Change-Id: Ibef1526fccf52920d0d557c8b8f3a52bec5550f8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
94 files changed, 4563 insertions, 3319 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index e451df24d8..8c37bf1731 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -32,6 +32,7 @@ add_qtc_library(KSyntaxHighlighting SHARED src/lib/theme.cpp src/lib/theme.h src/lib/themedata.cpp src/lib/themedata_p.h src/lib/wildcardmatcher.cpp src/lib/wildcardmatcher_p.h + src/lib/worddelimiters.cpp src/lib/worddelimiters_p.h src/lib/xml_p.h ) qtc_add_public_header(autogenerated/src/lib/State) diff --git a/src/libs/3rdparty/syntax-highlighting/README.md b/src/libs/3rdparty/syntax-highlighting/README.md index c1b82c63d1..c090d06163 100644 --- a/src/libs/3rdparty/syntax-highlighting/README.md +++ b/src/libs/3rdparty/syntax-highlighting/README.md @@ -2,6 +2,17 @@ Syntax highlighting engine for Kate syntax definitions +## Table of contents + +1. [Introduction](#introduction) +2. [Out of scope](#out-of-scope) +3. [Syntax Definition Files](#syntax-definition-files) +4. [Build it](#build-it) +5. [How to contribute](#how-to-contribute) +6. [Adding unit tests for a syntax definition](#adding-unit-tests-for-a-syntax-definition) +7. [Report bug or help to fix them](#report-bug-or-help-to-fix-them) +8. [Updating the kate-editor.org/syntax website](#updating-the-kate-editororgsyntax-website) + ## Introduction This is a stand-alone implementation of the Kate syntax highlighting engine. @@ -9,15 +20,6 @@ It's meant as a building block for text editors as well as for simple highlighte text rendering (e.g. as HTML), supporting both integration with a custom editor as well as a ready-to-use QSyntaxHighlighter sub-class. -## Syntax Definition Files - -This library uses Kate syntax definition files for the actual highlighting, -the file format is documented [here](https://docs.kde.org/stable5/en/applications/katepart/highlight.html). - -More than 250 syntax definition files are included, additional ones are -picked up from the file system if present, so you can easily extend this -by application-specific syntax definitions for example. - ## Out of scope To not turn this into yet another text editor, the following things are considered @@ -31,19 +33,170 @@ out of scope: If you need any of this, check out [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/). +## Syntax Definition Files + +This library uses Kate syntax definition files for the actual highlighting, +the file format is documented [here](https://docs.kde.org/?application=katepart&branch=trunk5&path=highlight.html). + +More than 300 syntax definition files are included, that are located +in **data/syntax/** and have the **.xml** extension. Additional ones are +picked up from the file system if present, so you can easily extend this +by application-specific syntax definitions for example. + +To install or test a syntax definiton file locally, place it in +**org.kde.syntax-highlighting/syntax/**, which is located in your user directory. +Usually it is: + +<table> + <tr> + <td>For local user</td> + <td>$HOME/.local/share/org.kde.syntax-highlighting/syntax/</td> + </tr> + <tr> + <td>For <a href="https://flathub.org/apps/details/org.kde.kate">Kate's Flatpak package</a></td> + <td>$HOME/.var/app/org.kde.kate/data/org.kde.syntax-highlighting/syntax/</td> + </tr> + <tr> + <td>For <a href="https://snapcraft.io/kate">Kate's Snap package</a></td> + <td>$HOME/snap/kate/current/.local/share/org.kde.syntax-highlighting/syntax/</td> + </tr> + <tr> + <td>On Windows®</td> + <td>%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\ </td> + </tr> +</table> + +For more details, see ["The Highlight Definition XML Format" (Working with Syntax Highlighting, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=trunk5&path=highlight.html#katehighlight-xml-format). + +Also, in **data/schema/** there is a script to validate the syntax definiton XML +files. Use the command `validatehl.sh mySyntax.xml`. + +## Build it + +1. Create and change into a build directory. Usually, a folder called **build** + is created inside the **syntax-highlighting** source directory. + + ```bash + mkdir <build-directory> + cd <build-directory> + ``` + +2. Run the configure process with *cmake* and compile: + + ```bash + cmake <source-directory> + make + ``` + + For more details see ["Building Kate from Sources on Linux" (Kate Editor Website)](https://kate-editor.org/build-it/). + + **NOTE:** If running *cmake* shows an error related to your version of KDE + Frameworks, you edit the **CMakeLists.txt** file in the line + `find_package(ECM 5.XX.X ...)`. + +3. To run tests: + + ```bash + make test + ``` + + The tests are located in the **autotests** directory. + This command can be used to check changes to units test after modifying some + syntax definition file. To add a unit test or update the references, see the + section ["Adding unit tests for a syntax definition"](#adding-unit-tests-for-a-syntax-definition). + +## How to contribute + +KDE uses a GitLab instance at **invent.kde.org** for code review. The official +repository of the KSyntaxHighlighting framework is [here](https://invent.kde.org/frameworks/syntax-highlighting). + +All the necessary information to send contributions is [here](https://community.kde.org/Infrastructure/GitLab). + +### Licensing + +Contributions to KSyntaxHighlighting shall be licensed under [MIT](LICENSES/MIT.txt). + +All files shall contain a proper "SPDX-License-Identifier: MIT" identifier inside a header like: + +```cpp +/* + SPDX-FileCopyrightText: 2020 Christoph Cullmann <cullmann@kde.org> + + SPDX-License-Identifier: MIT +*/ +``` + +### What you should know before working with syntax definition files and sending a patch + +* If you are modifying an existing syntax definition XML file, you must increase + the version number of the language. + +* Do not use hard-coded colors, as they may not look good or be illegible in some color + themes. Prefer to use the default color styles. + + For more information, see: + + * [Available Default Styles (Working with Syntax Highlighting, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=trunk5&path=highlight.html#kate-highlight-default-styles) + * [Kate Part (KF5): New Default Styles for better Color Schemes (Kate Editor Website)](https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/) + +* Important: add test files, these are found in **autotests/input/**. + If you are going to add a new syntax XML file, create a new test file; if you + are going to modify a XML file, adds examples to existing test files. + + Then, it is necessary to generate and update the files in **autotests/folding/**, + **autotests/html/** and **autotests/reference/**, which must be included in the + patches. The instructions are in the [next section](#adding-unit-tests-for-a-syntax-definition). + ## Adding unit tests for a syntax definition -* add an input file into the autotests/input/ folder, lets call it test.<language-extension> +1. Add an input file into the **autotests/input/** folder, lets call it + **test.<language-extension>**. + +2. If the file extension is not sufficient to trigger the right syntax definition, you can add an + second file **testname.<language-extension>.syntax** that contains the syntax definition name + to enforce the use of the right extension. + +3. Do `make && make test`. + + Note that after adding or modifying something in + **<source-directory>/autotests/input/**, an error will be showed when + running `make test`, because the references in the source directory do not + match the ones now generated. + +4. Inspect the outputs found in your binary directory **autotests/folding.out/**, + **autotests/html.output/** and **autotests/output/**. + +5. If OK, run in the binary folder `./autotests/update-reference-data.sh` + to copy the results to the right location. + That script updates the references in the source directory in + **autotest/folding/**, **autotest/html/** and **autotest/reference/**. + +6. Add the result references after the copying to the git. + +## Report bug or help to fix them + +KDE uses Bugzilla to management of bugs at **bugs.kde.org**. You can see the bugs +reported of **frameworks-syntax-highlighting** [here](https://bugs.kde.org/describecomponents.cgi?product=frameworks-syntax-highlighting). + +Also, you can report a bug [here](https://bugs.kde.org/enter_bug.cgi?product=frameworks-syntax-highlighting). + +However, some users often report bugs related to syntax highlighting in +[kate/syntax](https://bugs.kde.org/buglist.cgi?component=syntax&product=kate&resolution=---) +and [kile/editor](https://bugs.kde.org/buglist.cgi?component=editor&product=kile&resolution=---). -* if the file extension is not sufficient to trigger the right syntax definition, you can add an - second file testname.<language-extension>.syntax that contains the syntax definition name - to enforce the use of the right extension +## Updating the kate-editor.org/syntax website -* do "make && make test" +To update the [kate-editor.org/syntax](https://kate-editor.org/syntax/) website +including the update site & all linked examples/files, +please run after successful **build** & **test** the following make target: -* inspect the outputs found in your binary directory autotests/folding.out, autotests/html.output and autotests/output +```bash +make update_kate_editor_org +``` -* if ok, run in the binary folder "./autotests/update-reference-data.sh" to copy the results to the right location +This will clone the [kate-editor.org git](https://invent.kde.org/websites/kate-editor-org) +from *invent.kde.org* into **kate-editor-org** inside the build directory and update the needed things. -* add the result references after the copying to the git +You can afterwards step into **kate-editor-org** and commit & push the change after review. +The [kate-editor.org](https://kate-editor.org) webserver will update itself periodically from the repository on *invent.kde.org*. diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h index 9f87fd1beb..df0317ed7c 100644 --- a/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/ksyntaxhighlighting_version.h @@ -3,10 +3,10 @@ #ifndef SyntaxHighlighting_VERSION_H #define SyntaxHighlighting_VERSION_H -#define SyntaxHighlighting_VERSION_STRING "5.73.0" +#define SyntaxHighlighting_VERSION_STRING "5.75.0" #define SyntaxHighlighting_VERSION_MAJOR 5 -#define SyntaxHighlighting_VERSION_MINOR 73 +#define SyntaxHighlighting_VERSION_MINOR 75 #define SyntaxHighlighting_VERSION_PATCH 0 -#define SyntaxHighlighting_VERSION ((5<<16)|(73<<8)|(0)) +#define SyntaxHighlighting_VERSION ((5<<16)|(75<<8)|(0)) #endif diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl index f52084c569..be60d19959 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl @@ -4,35 +4,20 @@ <!ENTITY id_re "[_A-Za-z][\-_0-9A-Za-z]*"> ]> <!-- - This file is part of KDE's kate project. - - Copyright 2004 Alexander Neundorf (neundorf@kde.org) - Copyright 2005 Dominik Haumann (dhdev@gmx.de) - Copyright 2007,2008,2013,2014 Matthew Woehlke (mw_triad@users.sourceforge.net) - Copyright 2013-2015,2017-2020 Alex Turbov (i.zaufi@gmail.com) - - ********************************************************************** - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - ********************************************************************** + This file is part of KDE's kate project. + + SPDX-FileCopyrightText: 2004 Alexander Neundorf <neundorf@kde.org> + SPDX-FileCopyrightText: 2005 Dominik Haumann <dhdev@gmx.de> + SPDX-FileCopyrightText: 2007, 2008, 2013, 2014 Matthew Woehlke <mw_triad@users.sourceforge.net> + SPDX-FileCopyrightText: 2013-2015, 2017-2020 Alex Turbov <i.zaufi@gmail.com> + + SPDX-License-Identifier: LGPL-2.0-or-later --> <language name="CMake" - version="22" - kateversion="2.4" + version="25" + kateversion="5.0" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" style="CMake" @@ -70,6 +55,12 @@ {%- endfor %} </list> + <list name="deprecated-or-internal-variables"> + {%- for var in deprecated_or_internal_variables.kw %} + <item>{{var}}</item> + {%- endfor %} + </list> + <list name="environment-variables"> {%- for var in environment_variables.kw %} <item>{{var}}</item> @@ -95,11 +86,9 @@ <context attribute="Normal Text" lineEndContext="#stay" name="Normal Text"> <DetectSpaces/> {% for command in commands -%} - <WordDetect String="{{command.name}}" insensitive="true" attribute="Command" context="{{command.name}}_ctx" /> + <WordDetect String="{{command.name}}" insensitive="true" attribute="Command" context="{{command.name}}_ctx"{% if command.start_region %} beginRegion="{{command.start_region}}"{% endif -%} {%- if command.end_region %} endRegion="{{command.end_region}}"{% endif %} /> {% endfor -%} - <RegExpr attribute="Region Marker" context="RST Documentation" String="^#\[(=*)\[\.rst:" column="0" /> - <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" /> - <DetectChar attribute="Comment" context="Comment" char="#" /> + <DetectChar attribute="Comment" context="Match Comments and Docs" char="#" lookAhead="true" /> <DetectIdentifier attribute="User Function/Macro" context="User Function" /> <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" /> <!-- Include keywords matching for language autocompleter work --> @@ -192,11 +181,15 @@ <context attribute="Normal Text" lineEndContext="#stay" name="Detect Builtin Variables"> <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" /> + <keyword attribute="CMake Internal Variable" context="#stay" String="deprecated-or-internal-variables" insensitive="false" /> <keyword attribute="Builtin Variable" context="#stay" String="variables" insensitive="false" /> <IncludeRules context="Detect More Builtin Variables" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables"> + {%- for var in deprecated_or_internal_variables.re %} + <RegExpr attribute="CMake Internal Variable" context="#stay" String="{{var}}" /> + {%- endfor %} {%- for var in variables.re %} <RegExpr attribute="Builtin Variable" context="#stay" String="{{var}}" /> {%- endfor %} @@ -204,24 +197,19 @@ <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions"> <RegExpr attribute="Cache Variable Substitution" context="#stay" String="\$CACHE\{\s*[\w-]+\s*\}" /> - <RegExpr attribute="Environment Variable Substitution" context="EnvVarSubst" String="\$ENV\{\s*[\w-]+\s*\}" lookAhead="true" /> + <RegExpr attribute="Environment Variable Substitution" context="EnvVarSubst" String="\$?ENV\{" /> <Detect2Chars attribute="Variable Substitution" context="VarSubst" char="$" char1="{" /> <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" /> </context> <context attribute="Environment Variable Substitution" lineEndContext="#pop" name="EnvVarSubst"> - <DetectIdentifier /> - <DetectChar attribute="Environment Variable Substitution" context="EnvVarSubstVar" char="{" /> - <DetectChar attribute="Environment Variable Substitution" context="#pop" char="}" /> - </context> - - <context attribute="Environment Variable Substitution" lineEndContext="#pop" name="EnvVarSubstVar"> <keyword attribute="Standard Environment Variable" context="#stay" String="environment-variables" insensitive="false" /> {%- for var in environment_variables.re %} <RegExpr attribute="Standard Environment Variable" context="#stay" String="{{var}}" /> {%- endfor %} <DetectIdentifier /> - <DetectChar attribute="Environment Variable Substitution" context="#pop#pop" char="}" /> + <IncludeRules context="Detect Variable Substitutions" /> + <DetectChar attribute="Environment Variable Substitution" context="#pop" char="}" /> </context> <context attribute="Variable Substitution" lineEndContext="#pop" name="VarSubst"> @@ -232,6 +220,7 @@ </context> <context attribute="@Variable Substitution" lineEndContext="#pop" name="@VarSubst"> + <IncludeRules context="Detect Builtin Variables" /> <DetectChar attribute="@Variable Substitution" context="VarSubst@" char="@" /> </context> @@ -244,11 +233,13 @@ <context attribute="Normal Text" lineEndContext="#stay" name="User Function Args"> <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="(" /> <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=")" /> - <RegExpr attribute="Escapes" context="#stay" String="\\["$n\\]" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1=""" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="$" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="n" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="\" /> <DetectChar attribute="Strings" context="String" char=""" /> - <RegExpr attribute="Strings" context="Bracketed String" String="\[(=*)\[" /> - <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" /> - <DetectChar attribute="Comment" context="Comment" char="#" /> + <RegExpr attribute="Strings" context="Bracketed String" String="\[(=*)\[" beginRegion="BracketedString" /> + <DetectChar attribute="Comment" context="Match Comments" char="#" lookAhead="true" /> <IncludeRules context="Detect Builtin Variables" /> <IncludeRules context="Detect Variable Substitutions" /> <IncludeRules context="Detect Special Values" /> @@ -257,42 +248,62 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Special Values"> - <RegExpr attribute="True Special Arg" context="#stay" String="\b(TRUE|ON)\b" /> - <RegExpr attribute="False Special Arg" context="#stay" String="\b(FALSE|OFF|(&id_re;-)?NOTFOUND)\b" /> + <WordDetect attribute="True Special Arg" context="#stay" String="TRUE" /> + <WordDetect attribute="True Special Arg" context="#stay" String="ON" /> + <WordDetect attribute="False Special Arg" context="#stay" String="FALSE" /> + <WordDetect attribute="False Special Arg" context="#stay" String="OFF" /> + <RegExpr attribute="False Special Arg" context="#stay" String="\b(?:&id_re;-)?NOTFOUND\b" /> <RegExpr attribute="Special Args" context="#stay" String="\bCMP[0-9][0-9][0-9]\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Aliased Targets"> - <RegExpr attribute="Aliased Targets" context="#stay" String="\b&id_re;::&id_re;(::&id_re;)*\b" /> + <RegExpr attribute="Aliased Targets" context="#stay" String="\b&id_re;::&id_re;(?:\:\:&id_re;)*\b" /> + </context> + + <context attribute="Comment" lineEndContext="#pop" name="Match Comments"> + <RegExpr attribute="Comment" context="#pop!Bracketed Comment" String="#\[(=*)\[" beginRegion="BracketedComment" /> + <DetectChar attribute="Comment" context="#pop!Comment" char="#" /> + </context> + + <context attribute="Comment" lineEndContext="#pop" name="Match Comments and Docs"> + <RegExpr attribute="Region Marker" context="#pop!RST Documentation" String="^#\[(=*)\[\.rst:" column="0" beginRegion="RSTDocumentation" /> + <IncludeRules context="Match Comments" /> </context> <context attribute="Comment" lineEndContext="#pop" name="Comment"> <LineContinue attribute="Comment" context="#pop" /> + <DetectSpaces /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> <context attribute="Comment" lineEndContext="#stay" name="RST Documentation" dynamic="true"> - <RegExpr attribute="Region Marker" context="#pop" String="^#?\]%1\]" dynamic="true" column="0" /> + <RegExpr attribute="Region Marker" context="#pop" String="^#?\]%1\]" dynamic="true" column="0" endRegion="RSTDocumentation" /> <IncludeRules context="##reStructuredText" /> </context> <context attribute="Comment" lineEndContext="#stay" name="Bracketed Comment" dynamic="true"> <LineContinue attribute="Comment" context="#stay" /> - <RegExpr attribute="Comment" context="#pop" String=".*\]%1\]" dynamic="true" /> + <DetectSpaces /> + <StringDetect attribute="Comment" context="#pop" String="]%1]" dynamic="true" endRegion="BracketedComment" /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> <context attribute="Strings" lineEndContext="#stay" name="String"> <RegExpr attribute="Strings" context="#pop" String=""(?=[ );]|$)" /> - <RegExpr attribute="Escapes" context="#stay" String="\\["$nrt\\]" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1=""" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="$" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="n" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="r" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="t" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="\" /> <IncludeRules context="Detect Variable Substitutions" /> <IncludeRules context="Detect Generator Expressions" /> </context> <context attribute="Strings" lineEndContext="#stay" name="Bracketed String" dynamic="true"> - <RegExpr attribute="Strings" context="#pop" String="\]%1\]" dynamic="true" /> + <StringDetect attribute="Strings" context="#pop" String="]%1]" dynamic="true" endRegion="BracketedString" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Generator Expressions"> @@ -321,9 +332,10 @@ <itemData name="True Special Arg" defStyleNum="dsOthers" color="#30a030" selColor="#30a030" spellChecking="false" /> <itemData name="False Special Arg" defStyleNum="dsOthers" color="#e05050" selColor="#e05050" spellChecking="false" /> <itemData name="Strings" defStyleNum="dsString" spellChecking="true" /> - <itemData name="Escapes" defStyleNum="dsChar" spellChecking="false" /> + <itemData name="Escapes" defStyleNum="dsSpecialChar" spellChecking="false" /> <itemData name="Builtin Variable" defStyleNum="dsDecVal" color="#c09050" selColor="#c09050" spellChecking="false" /> - <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" /> + <itemData name="CMake Internal Variable" defStyleNum="dsVariable" spellChecking="false" /> + <itemData name="Internal Name" defStyleNum="dsVariable" spellChecking="false" /> <itemData name="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" /> <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" /> <itemData name="Cache Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> @@ -339,10 +351,11 @@ <general> <comments> - <comment name="singleLine" start="#" /> + <comment name="singleLine" start="#" position="afterwhitespace" /> + <comment name="multiLine" start="#[[" end="]]" region="BracketedComment"/> </comments> <keywords casesensitive="1" /> </general> </language> -<!-- kate: indent-width 2; tab-width 2; --> +<!-- kate: replace-tabs on; indent-width 2; tab-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml index 3b1e8327ca..e776c2508f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml @@ -148,6 +148,7 @@ target-properties: - <CONFIG>_OUTPUT_NAME - <CONFIG>_POSTFIX - CROSSCOMPILING_EMULATOR + - CUDA_ARCHITECTURES # Since 3.18 - CUDA_PTX_COMPILATION - CUDA_SEPARABLE_COMPILATION - CUDA_RESOLVE_DEVICE_SYMBOLS @@ -176,7 +177,9 @@ target-properties: - FOLDER - Fortran_FORMAT - Fortran_MODULE_DIRECTORY + - Fortran_PREPROCESS # Since 3.18 - FRAMEWORK + - FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG> # Since 3.18 - FRAMEWORK_VERSION - GENERATOR_FILE_NAME - GNUtoMS @@ -259,6 +262,8 @@ target-properties: - LINK_WHAT_YOU_USE - LOCATION_<CONFIG> - LOCATION + - MACHO_COMPATIBILITY_VERSION # Since 3.17 + - MACHO_CURRENT_VERSION # Since 3.17 - MACOSX_BUNDLE_INFO_PLIST - MACOSX_BUNDLE - MACOSX_FRAMEWORK_INFO_PLIST @@ -275,6 +280,7 @@ target-properties: - OSX_COMPATIBILITY_VERSION # Since 3.17 - OUTPUT_NAME_<CONFIG> - OUTPUT_NAME + - PCH_WARN_INVALID # Since 3.18 - PDB_NAME_<CONFIG> - PDB_NAME - PDB_OUTPUT_DIRECTORY_<CONFIG> @@ -310,6 +316,7 @@ target-properties: - UNITY_BUILD_BATCH_SIZE # Since 3.16 - UNITY_BUILD_CODE_AFTER_INCLUDE # Since 3.16 - UNITY_BUILD_CODE_BEFORE_INCLUDE # Since 3.16 + - UNITY_BUILD_MODE # Since 3.18 - VERSION - VISIBILITY_INLINES_HIDDEN - VS_CONFIGURATION_TYPE @@ -336,13 +343,15 @@ target-properties: - VS_MOBILE_EXTENSIONS_VERSION - VS_NO_SOLUTION_DEPLOY # Since 3.15 - VS_PACKAGE_REFERENCES # Since 3.15 + - VS_PLATFORM_TOOLSET # Since 3.18 - VS_PROJECT_IMPORT # Since 3.15 - - VS_PACKAGE_REFERENCES - VS_SCC_AUXPATH - VS_SCC_LOCALPATH - VS_SCC_PROJECTNAME - VS_SCC_PROVIDER - VS_SDK_REFERENCES + - VS_SOLUTION_DEPLOY # Since 3.18 + - VS_SOURCE_SETTINGS_<tool> # Since 3.18 - VS_USER_PROPS - VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION - VS_WINRT_COMPONENT @@ -412,6 +421,7 @@ source-properties: - COMPILE_OPTIONS # Since 3.11 - EXTERNAL_OBJECT - Fortran_FORMAT + - Fortran_PREPROCESS # Since 3.18 - GENERATED - HEADER_FILE_ONLY - INCLUDE_DIRECTORIES # Since 3.11 @@ -437,6 +447,7 @@ source-properties: - VS_DEPLOYMENT_LOCATION - VS_INCLUDE_IN_VSIX - VS_RESOURCE_GENERATOR + - VS_SETTINGS # Since 3.18 - VS_SHADER_DISABLE_OPTIMIZATIONS # Since 3.11 - VS_SHADER_ENABLE_DEBUG # Since 3.11 - VS_SHADER_ENTRYPOINT @@ -503,6 +514,10 @@ generator-expressions: - COMPILE_FEATURES - COMPILE_LANG_AND_ID # Since 3.15 - COMPILE_LANGUAGE + - LINK_LANG_AND_ID # Since 3.18 + - LINK_LANGUAGE # Since 3.18 + - DEVICE_LINK # Since 3.18 + - HOST_LINK # Since 3.18 # String-Valued Generator Expressions # * Escaped Characters - ANGLE-R @@ -555,7 +570,7 @@ generator-expressions: - SHELL_PATH variables: - # Variables that Provide Information + # Variables that Provide Information - CMAKE_AR - CMAKE_ARGC - CMAKE_ARGV<n> @@ -596,7 +611,6 @@ variables: - CMAKE_GENERATOR_NO_COMPILER_ENV # "Professional CMake" §17.4 - CMAKE_GENERATOR_PLATFORM - CMAKE_GENERATOR_TOOLSET - - CMAKE_HOME_DIRECTORY - CMAKE_IMPORT_LIBRARY_PREFIX - CMAKE_IMPORT_LIBRARY_SUFFIX - CMAKE_JOB_POOL_COMPILE @@ -648,7 +662,6 @@ variables: - CMAKE_VERBOSE_MAKEFILE - CMAKE_VERSION - CMAKE_VS_DEVENV_COMMAND - - CMAKE_VS_INTEL_Fortran_PROJECT_VERSION - CMAKE_VS_MSBUILD_COMMAND - CMAKE_VS_NsightTegra_VERSION - CMAKE_VS_PLATFORM_NAME @@ -739,7 +752,6 @@ variables: - CMAKE_MAXIMUM_RECURSION_DEPTH # Since 3.14 - CMAKE_MFC_FLAG - CMAKE_MODULE_PATH - - CMAKE_NOT_USING_CONFIG_FLAGS - CMAKE_POLICY_DEFAULT_CMP<NNNN> - CMAKE_POLICY_WARNING_CMP<NNNN> - CMAKE_PREFIX_PATH @@ -768,7 +780,7 @@ variables: - CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY # Since 3.13 - CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER # Since 3.13 - CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN # Since 3.13 - - CMAKE_XCODE_SCHEME_WORKING_DIRECTORY # Since 3.1? + - CMAKE_XCODE_SCHEME_WORKING_DIRECTORY # Since 3.17 - CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING # Since 3.16 - CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER # Since 3.13 - CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE # Since 3.13 @@ -784,8 +796,6 @@ variables: - CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER # Since 3.13 - CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP # Since 3.13 - CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS # Since 3.13 - - CMAKE_SUPPRESS_DEVELOPER_WARNINGS # Undocumented yet (CMake <= 3.10) - - CMAKE_SUPPRESS_DEVELOPER_ERRORS # Undocumented yet (CMake <= 3.10) # Variables that Describe the System - ANDROID - APPLE @@ -896,8 +906,10 @@ variables: - CMAKE_EXE_LINKER_FLAGS_INIT - CMAKE_FOLDER # Since 3.12 - CMAKE_FRAMEWORK # Since 3.15 + - CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG> # Since 3.18 - CMAKE_Fortran_FORMAT - CMAKE_Fortran_MODULE_DIRECTORY + - CMAKE_Fortran_PREPROCESS # Since 3.18 - CMAKE_GLOBAL_AUTOGEN_TARGET # Since 3.14 - CMAKE_GLOBAL_AUTOGEN_TARGET_NAME # Since 3.14 - CMAKE_GLOBAL_AUTORCC_TARGET # Since 3.14 @@ -942,6 +954,7 @@ variables: - CMAKE_OSX_ARCHITECTURES - CMAKE_OSX_DEPLOYMENT_TARGET - CMAKE_OSX_SYSROOT + - CMAKE_PCH_WARN_INVALID # Since 3.18 - CMAKE_PDB_OUTPUT_DIRECTORY - CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> - CMAKE_POSITION_INDEPENDENT_CODE @@ -984,6 +997,7 @@ variables: - CMAKE_COMPILER_IS_GNUCC - CMAKE_COMPILER_IS_GNUCXX - CMAKE_COMPILER_IS_GNUG77 + - CMAKE_CUDA_ARCHITECTURES # Since 3.18 - CMAKE_CUDA_COMPILE_FEATURES # Since 3.17 - CMAKE_CUDA_HOST_COMPILER # Since 3.17 - CMAKE_CUDA_EXTENSIONS @@ -1001,7 +1015,6 @@ variables: - CMAKE_Fortran_MODDIR_DEFAULT - CMAKE_Fortran_MODDIR_FLAG - CMAKE_Fortran_MODOUT_FLAG - - CMAKE_INTERNAL_PLATFORM_ABI - CMAKE_<LANG>_ANDROID_TOOLCHAIN_MACHINE - CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX - CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX @@ -1009,7 +1022,6 @@ variables: - CMAKE_<LANG>_ARCHIVE_CREATE - CMAKE_<LANG>_ARCHIVE_FINISH - CMAKE_<LANG>_COMPILER - - CMAKE_<LANG>_COMPILER_ABI - CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN - CMAKE_<LANG>_COMPILER_ID - CMAKE_<LANG>_COMPILER_LOADED @@ -1045,7 +1057,6 @@ variables: - CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP # Since 3.13 - CMAKE_<LANG>_LINK_EXECUTABLE - CMAKE_<LANG>_OUTPUT_EXTENSION - - CMAKE_<LANG>_PLATFORM_ID - CMAKE_<LANG>_SIMULATE_ID - CMAKE_<LANG>_SIMULATE_VERSION - CMAKE_<LANG>_SIZEOF_DATA_PTR @@ -1111,6 +1122,8 @@ variables: - CTEST_P4_COMMAND - CTEST_P4_OPTIONS - CTEST_P4_UPDATE_OPTIONS + - CTEST_RESOURCE_SPEC_FILE # Since 3.18 + - CTEST_RUN_CURRENT_SCRIPT # Since 3.11 - CTEST_SCP_COMMAND - CTEST_SITE - CTEST_SUBMIT_URL # Since 3.14 @@ -1132,7 +1145,6 @@ variables: - CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION - CPACK_INCLUDE_TOPLEVEL_DIRECTORY - CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS # Since 3.11 - - CPACK_INSTALL_SCRIPT # Deprecated since 3.16 - CPACK_INSTALL_SCRIPTS # Since 3.16 - CPACK_PACKAGING_INSTALL_PREFIX - CPACK_SET_DESTDIR @@ -1169,6 +1181,14 @@ variables: # Other standard variables/patterns # - `try_run` - <RUN_RESULT_VAR>__TRYRUN_OUTPUT + # - `function` + - ARGC + - ARGN + - ARGV + - ARGV<n> + # - `cmake_parse_arguments` + - <pfx>_UNPARSED_ARGUMENTS + - <pfx>_KEYWORDS_MISSING_VALUES # Well known CMake's official module's variables # - CheckCCompilerFlag # - CheckCSourceCompiles @@ -1221,6 +1241,7 @@ variables: - CPACK_ARCHIVE_FILE_NAME - CPACK_ARCHIVE_<COMPONENT>_FILE_NAME - CPACK_ARCHIVE_COMPONENT_INSTALL + - CPACK_ARCHIVE_THREADS # Since 3.18 # - CPackBundle - CPACK_BUNDLE_NAME - CPACK_BUNDLE_PLIST @@ -1313,9 +1334,9 @@ variables: - CPACK_COMMAND_SETFILE - CPACK_COMMAND_REZ # -CPackExt (Since 3.13) - - CPACK_EXT_REQUESTED_VERSIONS - - CPACK_EXT_ENABLE_STAGING - - CPACK_EXT_PACKAGE_SCRIPT + - CPACK_EXTERNAL_REQUESTED_VERSIONS + - CPACK_EXTERNAL_ENABLE_STAGING + - CPACK_EXTERNAL_PACKAGE_SCRIPT # - CPackIFW - CPACK_IFW_ROOT - QTIFWDIR @@ -1386,6 +1407,7 @@ variables: - CPACK_NSIS_FINISH_TITLE # Since 3.17 - CPACK_NSIS_FINISH_TITLE_3LINES # Since 3.17 - CPACK_NSIS_MUI_HEADERIMAGE # Since 3.17 + - CPACK_NSIS_MANIFEST_DPI_AWARE # Since 3.18 # - CPackNuGet (since 3.12) - CPACK_NUGET_COMPONENT_INSTALL - CPACK_NUGET_PACKAGE_NAME @@ -1497,8 +1519,10 @@ variables: - CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - CPACK_RPM_PRE_INSTALL_SCRIPT_FILE - CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE + - CPACK_RPM_PRE_TRANS_SCRIPT_FILE # Since 3.18 - CPACK_RPM_POST_INSTALL_SCRIPT_FILE - CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE + - CPACK_RPM_POST_TRANS_SCRIPT_FILE # Since 3.18 - CPACK_RPM_USER_FILELIST - CPACK_RPM_<COMPONENT>_USER_FILELIST - CPACK_RPM_CHANGELOG_FILE @@ -1536,7 +1560,6 @@ variables: # - CPack - CPACK_PACKAGE_NAME - CPACK_PACKAGE_VENDOR - - CPACK_PACKAGE_CONTACT - CPACK_PACKAGE_DIRECTORY - CPACK_PACKAGE_VERSION_MAJOR - CPACK_PACKAGE_VERSION_MINOR @@ -1574,12 +1597,6 @@ variables: - CPACK_PACKAGE_INSTALL_REGISTRY_KEY - CPACK_CREATE_DESKTOP_LINKS - CPACK_BINARY_<GENNAME> - # The following variables used by CPack and some CMake modules, - # but not documented (yet): - # used by some modules like Deb and NSIS - - CPACK_PACKAGE_CONTACT - # - used in CPack.cmake as default value for `CPACK_RPM_PACKAGE_RELOCATABLE` - - CPACK_PACKAGE_RELOCATABLE # - CPackWIX - CPACK_WIX_UPGRADE_GUID - CPACK_WIX_PRODUCT_GUID @@ -1705,6 +1722,30 @@ variables: - SWIG_MODULE_<name>_EXTRA_DEPS - SWIG_SOURCE_FILE_EXTENSIONS # Since 3.14 +deprecated-or-internal-variables: + - CMAKE_HOME_DIRECTORY + - CMAKE_INTERNAL_PLATFORM_ABI + - CMAKE_<LANG>_COMPILER_ABI + - CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID + - CMAKE_<LANG>_COMPILER_VERSION_INTERNAL + - CMAKE_<LANG>_PLATFORM_ID + - CMAKE_NOT_USING_CONFIG_FLAGS + - CMAKE_VS_INTEL_Fortran_PROJECT_VERSION + - CPACK_INSTALL_SCRIPT # Deprecated since 3.16 + # Various undocumented variables (yet) + - CMAKE_SUPPRESS_DEVELOPER_WARNINGS # CMake <= 3.10 + - CMAKE_SUPPRESS_DEVELOPER_ERRORS # CMake <= 3.10 + # The following variables used by CPack and some CMake modules, + # but not documented (yet): + # used by some modules like Deb and NSIS + - CPACK_PACKAGE_CONTACT + # used in CPack.cmake as default value for `CPACK_RPM_PACKAGE_RELOCATABLE` + - CPACK_PACKAGE_RELOCATABLE + # mentioned in CPack External generator but not documented (yet) + - CPACK_TEMPORARY_DIRECTORY + - CPACK_TOPLEVEL_DIRECTORY + - CPACK_INSTALL_PREFIX + # https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html # NOTE Added to syntax file version 14 at 3.15.0 version of CMake environment-variables: @@ -1795,6 +1836,9 @@ scripting-commands: , OS_PLATFORM ] - + name: cmake_language + named-args: [CALL, EVAL, CODE] + - name: cmake_minimum_required named-args: [VERSION, FATAL_ERROR] - @@ -1817,12 +1861,12 @@ scripting-commands: NOT , AND , OR + , COMMAND , POLICY , TARGET , TEST , EXISTS , IS_NEWER_THAN - , IS_NEWER_THAN , IS_DIRECTORY , IS_SYMLINK , IS_ABSOLUTE @@ -1852,18 +1896,23 @@ scripting-commands: - name: endforeach nulary?: true + end-region: foreach - name: endfunction nulary?: true + end-region: function - name: endif nulary?: true + end-region: if - name: endmacro nulary?: true + end-region: macro - name: endwhile nulary?: true + end-region: while - name: execute_process named-args: [ @@ -1883,6 +1932,8 @@ scripting-commands: , OUTPUT_STRIP_TRAILING_WHITESPACE , ERROR_STRIP_TRAILING_WHITESPACE , ENCODING + , ECHO_OUTPUT_VARIABLE # Since 3.18 + , ECHO_ERROR_VARIABLE # Since 3.18 ] special-args: [ NONE @@ -1985,6 +2036,19 @@ scripting-commands: , SIZE # New sub-options since 3.16 , GET_RUNTIME_DEPENDENCIES + # New sub-options since 3.18 + , ARCHIVE_CREATE + , FILES + , FORMAT + , TYPE + , MTIME + , VERBOSE + , ARCHIVE_EXTRACT + , LIST_ONLY + , CONFIGURE + , ESCAPE_QUOTES + , "@ONLY" + , NEWLINE_STYLE ] special-args: [ UTF-8 @@ -2006,9 +2070,29 @@ scripting-commands: , WORLD_EXECUTE , SETUID , SETGID - , IGNORED # NETRC options since 3.11 + # Special args for NETRC options since 3.11 + , IGNORED , OPTIONAL , REQUIRED + # Special args for `FORMAT` named argument since 3.18 + , 7zip + , gnutar + , pax + , paxr + , raw + , zip + # Special args for `TYPE` named argument since 3.18 + , None + , BZip2 + , GZip + , XZ + , Zstd + # Special args for `NEWLINE_STYLE` named argument since 3.18 + , UNIX + , DOS + , WIN32 + , LF + , CRLF ] - name: find_file @@ -2018,6 +2102,7 @@ scripting-commands: , PATHS , PATH_SUFFIXES , DOC + , REQUIRED # Since 3.18 , NO_DEFAULT_PATH , NO_PACKAGE_ROOT_PATH , NO_CMAKE_PATH @@ -2037,6 +2122,7 @@ scripting-commands: , PATHS , PATH_SUFFIXES , DOC + , REQUIRED # Since 3.18 , NO_DEFAULT_PATH , NO_PACKAGE_ROOT_PATH , NO_CMAKE_PATH @@ -2091,8 +2177,10 @@ scripting-commands: , ITEMS , ZIP_LISTS # Since 3.17 ] + start-region: foreach - name: function + start-region: function - name: get_cmake_property property-args: [global-properties] @@ -2126,7 +2214,23 @@ scripting-commands: ] - name: get_property - named-args: [GLOBAL, DIRECTORY, TARGET, SOURCE, INSTALL, TEST, CACHE, VARIABLE, PROPERTY, SET, DEFINED, BRIEF_DOCS, FULL_DOCS] + named-args: [ + GLOBAL + , DIRECTORY + , TARGET + , SOURCE + , TARGET_DIRECTORY # `SOURCE` sub-option since 3.18 + , DIRECTORY # `SOURCE` sub-option since 3.18 + , INSTALL + , TEST + , CACHE + , VARIABLE + , PROPERTY + , SET + , DEFINED + , BRIEF_DOCS + , FULL_DOCS + ] property-args: &get-property [ global-properties , directory-properties @@ -2140,6 +2244,7 @@ scripting-commands: name: if named-args: *if nested-parentheses?: true + start-region: if - name: include named-args: [OPTIONAL, RESULT_VARIABLE, NO_POLICY_SCOPE] @@ -2191,9 +2296,18 @@ scripting-commands: , POP_BACK ] # Since 3.13 - special-args: [STRING, FILE_BASENAME, SENSITIVE, INSENSITIVE, ASCENDING, DESCENDING] + special-args: [ + STRING + , FILE_BASENAME + , SENSITIVE + , INSENSITIVE + , ASCENDING + , DESCENDING + , NATURAL # Since 3.18 + ] - name: macro + start-region: macro - name: mark_as_advanced named-args: [CLEAR, FORCE] @@ -2238,7 +2352,22 @@ scripting-commands: property-args: *get-property - name: set_property - named-args: [GLOBAL, DIRECTORY, TARGET, DIRECTORY, SOURCE, INSTALL, TEST, CACHE, VARIABLE, APPEND, APPEND_STRING, PROPERTY] + named-args: [ + GLOBAL + , DIRECTORY + , TARGET + , DIRECTORY + , SOURCE + , TARGET_DIRECTORY # `SOURCE` sub-option since 3.18 + , DIRECTORY # `SOURCE` sub-option since 3.18 + , INSTALL + , TEST + , CACHE + , VARIABLE + , APPEND + , APPEND_STRING + , PROPERTY + ] property-args: *get-property - name: set @@ -2284,6 +2413,7 @@ scripting-commands: , SHA3_384 , SHA3_512 , ASCII + , HEX # Since 3.18 , CONFIGURE , "@ONLY" , ESCAPE_QUOTES @@ -2309,6 +2439,7 @@ scripting-commands: name: while named-args: *if nested-parentheses?: true + start-region: while project-commands: - @@ -2417,6 +2548,11 @@ project-commands: name: fltk_wrap_ui - name: get_source_file_property + named-args: [ + # Sice 3.18 + TARGET_DIRECTORY + , DIRECTORY + ] property-args: &get_source_file_property [source-properties] - name: get_target_property @@ -2536,7 +2672,11 @@ project-commands: name: remove_definitions - name: set_source_files_properties - named-args: [PROPERTIES] + named-args: [ + PROPERTIES + , TARGET_DIRECTORY # Since 3.18 + , DIRECTORY # Since 3.18 + ] property-args: *get_source_file_property - name: set_target_properties @@ -2766,6 +2906,7 @@ ctest-commands: , PARALLEL_LEVEL , TEST_LOAD , SCHEDULE_RANDOM + , STOP_ON_FAILURE # Since 3.18 , STOP_TIME , RETURN_VALUE , CAPTURE_CMAKE_ERROR diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py index c092d27f8f..0dd04a44be 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-cmake-syntax.py @@ -3,7 +3,7 @@ # # Generate Kate syntax file for CMake # -# Copyright (c) 2017-2019 Alex Turbov <i.zaufi@gmail.com> +# SPDX-FileCopyrightText: 2017-2019 Alex Turbov <i.zaufi@gmail.com> # # To install prerequisites: # @@ -33,7 +33,7 @@ _PROPERTY_KEYS = [ , 'install-properties' ] _KW_RE_LIST = ['kw', 're'] -_VAR_KIND_LIST = ['variables', 'environment-variables'] +_VAR_KIND_LIST = ['variables', 'deprecated-or-internal-variables', 'environment-variables'] def try_transform_placeholder_string_to_regex(name): @@ -54,6 +54,9 @@ def try_transform_placeholder_string_to_regex(name): if 'CMAKE_POLICY_WARNING_CMP' in m: return '\\bCMAKE_POLICY_WARNING_CMP[0-9]{4}\\b' + if 'ARGV' in m: + return '\\bARGV[0-9]+\\b' + return '\\b{}\\b'.format('&id_re;'.join(list(m))) if 1 < len(m) else name @@ -101,6 +104,12 @@ def transform_command(cmd): if 'nulary?' in cmd and cmd['nulary?'] and not can_be_nulary: raise RuntimeError('Command `{}` w/ args declared nulary!?'.format(cmd['name'])) + if 'start-region' in cmd: + cmd['start_region'] = cmd['start-region'] + + if 'end-region' in cmd: + cmd['end_region'] = cmd['end-region'] + return cmd @@ -159,8 +168,10 @@ def cli(input_yaml, template): # Fix node names to be accessible from Jinja template data['generator_expressions'] = data['generator-expressions'] + data['deprecated_or_internal_variables'] = data['deprecated-or-internal-variables'] data['environment_variables'] = data['environment-variables'] del data['generator-expressions'] + del data['deprecated-or-internal-variables'] del data['environment-variables'] env = jinja2.Environment( diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl index f034bcada7..04c9fcdb36 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl @@ -14,7 +14,7 @@ # Generated languages need a language named 'PHP/PHP', which shall take care of PHP hl itself # and which will be called every time something like <?php is encountred. # -# Author: Jan Villat <jan.villat@net2000.ch> +# SPDX-FileCopyrightText: Jan Villat <jan.villat@net2000.ch> # License: LGPL my $file = ""; diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-classes.sh b/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-classes.sh index f2735c88a5..fcfddd1a9d 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-classes.sh +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-classes.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012-2013 by Alex Turbov +# SPDX-FileCopyrightText: 2012-2013 Alex Turbov # # Grab a documented (officially) class list from Qt project web site: # http://qt-project.org/doc/qt-${version}/classes.html diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-macros.sh b/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-macros.sh index db2a32d7a3..c6275e52cb 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-macros.sh +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/get-Qt-macros.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2011-2012 by Alex Turbov +# SPDX-FileCopyrightText: 2011-2012 Alex Turbov # # Simplest (and stupid) way to get #defines from a header file(s) # diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/qmake-gen.py b/src/libs/3rdparty/syntax-highlighting/data/generators/qmake-gen.py index 3b20361708..a16d5fd5d4 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/qmake-gen.py +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/qmake-gen.py @@ -1,19 +1,8 @@ #!/usr/bin/env python -# Copyright (C) 2016 Kevin Funk <kfunk@kde.org> +# SPDX-FileCopyrightText: 2016 Kevin Funk <kfunk@kde.org> # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Library General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -# License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: LGPL-2.0-or-later # This script will print XML-like code you can put into the qmake.xml # syntax definition file diff --git a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd index 9a03ef2b78..5fdbbb07df 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd +++ b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2001 Joseph Wenninger <jowenn@kde.org> - modified (c) 2002 Anders Lund <anders@alweb.dk> - modified (c) 2003 Simon Huerlimann <simon.huerlimann@access.unizh.ch> - modified (c) 2005 Dominik Haumann <dhdev@gmx.de> - modified (c) 2008 Wilbert Berendsen <info@wilbertberendsen.nl> + SPDX-FileCopyrightText: 2001 Joseph Wenninger <jowenn@kde.org> + SPDX-FileCopyrightText: 2002 Anders Lund <anders@alweb.dk> + SPDX-FileCopyrightText: 2003 Simon Huerlimann <simon.huerlimann@access.unizh.ch> + SPDX-FileCopyrightText: 2005 Dominik Haumann <dhdev@gmx.de> + SPDX-FileCopyrightText: 2008 Wilbert Berendsen <info@wilbertberendsen.nl> This file describes the XML format used for syntax highlight descriptions for the Kate text editor (http://kate.kde.org), which is part of the KDE @@ -115,6 +115,15 @@ </xs:restriction> </xs:simpleType> <!-- + Char type + A sequence of exactly 1 character + --> + <xs:simpleType name="char"> + <xs:restriction base="xs:string"> + <xs:length value="1"/> + </xs:restriction> + </xs:simpleType> + <!-- Language specification name: The name of this syntax description. Used in the Highlightning Mode menu section: The logical group to which this syntax description belongs. Used for sub menus @@ -330,7 +339,6 @@ <xs:element ref="Float"/> <xs:element ref="HlCOct"/> <xs:element ref="HlCHex"/> - <xs:element ref="HlCFloat"/> <xs:element ref="Int"/> <xs:element ref="DetectChar"/> <xs:element ref="Detect2Chars"/> @@ -433,15 +441,6 @@ </xs:complexType> </xs:element> <!-- - Detect a C-style floating point number - commonAttributes: Common attributes - --> - <xs:element name="HlCFloat"> - <xs:complexType> - <xs:attributeGroup ref="commonAttributes"/> - </xs:complexType> - </xs:element> - <!-- Detect C-style character commonAttributes: Common attributes @@ -471,7 +470,7 @@ <xs:element name="DetectChar"> <xs:complexType> <xs:attributeGroup ref="commonAttributes"/> - <xs:attribute name="char" use="required"/> + <xs:attribute name="char" type="char" use="required"/> <xs:attribute name="dynamic" type="xs:boolean"/> </xs:complexType> </xs:element> @@ -484,8 +483,8 @@ <xs:element name="Detect2Chars"> <xs:complexType> <xs:attributeGroup ref="commonAttributes"/> - <xs:attribute name="char" use="required"/> - <xs:attribute name="char1" use="required"/> + <xs:attribute name="char" type="char" use="required"/> + <xs:attribute name="char1" type="char" use="required"/> </xs:complexType> </xs:element> <!-- @@ -561,7 +560,7 @@ <xs:element name="LineContinue"> <xs:complexType> <xs:attributeGroup ref="commonAttributes"/> - <xs:attribute name="char"/> + <xs:attribute name="char" type="char"/> </xs:complexType> </xs:element> <!-- @@ -585,8 +584,8 @@ <xs:element name="RangeDetect"> <xs:complexType> <xs:attributeGroup ref="commonAttributes"/> - <xs:attribute name="char" use="required"/> - <xs:attribute name="char1" use="required"/> + <xs:attribute name="char" type="char" use="required"/> + <xs:attribute name="char1" type="char" use="required"/> </xs:complexType> </xs:element> <!-- @@ -675,7 +674,7 @@ <xs:element name="encoding"> <xs:complexType> <xs:attribute name="string" use="required"/> - <xs:attribute name="char"/> + <xs:attribute name="char" type="char"/> <xs:attribute name="ignored" type="xs:boolean"/> </xs:complexType> </xs:element> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml index fc33e98e0e..6f3b3dc862 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml @@ -4,35 +4,20 @@ <!ENTITY id_re "[_A-Za-z][\-_0-9A-Za-z]*"> ]> <!-- - This file is part of KDE's kate project. + This file is part of KDE's kate project. - Copyright 2004 Alexander Neundorf (neundorf@kde.org) - Copyright 2005 Dominik Haumann (dhdev@gmx.de) - Copyright 2007,2008,2013,2014 Matthew Woehlke (mw_triad@users.sourceforge.net) - Copyright 2013-2015,2017-2020 Alex Turbov (i.zaufi@gmail.com) + SPDX-FileCopyrightText: 2004 Alexander Neundorf <neundorf@kde.org> + SPDX-FileCopyrightText: 2005 Dominik Haumann <dhdev@gmx.de> + SPDX-FileCopyrightText: 2007, 2008, 2013, 2014 Matthew Woehlke <mw_triad@users.sourceforge.net> + SPDX-FileCopyrightText: 2013-2015, 2017-2020 Alex Turbov <i.zaufi@gmail.com> - ********************************************************************** - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - ********************************************************************** + SPDX-License-Identifier: LGPL-2.0-or-later --> <language name="CMake" - version="24" - kateversion="2.4" + version="25" + kateversion="5.0" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" style="CMake" @@ -2852,9 +2837,7 @@ <WordDetect String="ctest_test" insensitive="true" attribute="Command" context="ctest_test_ctx" /> <WordDetect String="ctest_update" insensitive="true" attribute="Command" context="ctest_update_ctx" /> <WordDetect String="ctest_upload" insensitive="true" attribute="Command" context="ctest_upload_ctx" /> - <RegExpr attribute="Region Marker" context="RST Documentation" String="^#\[(=*)\[\.rst:" column="0" /> - <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" /> - <DetectChar attribute="Comment" context="Comment" char="#" /> + <DetectChar attribute="Comment" context="Match Comments and Docs" char="#" lookAhead="true" /> <DetectIdentifier attribute="User Function/Macro" context="User Function" /> <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" /> <!-- Include keywords matching for language autocompleter work --> @@ -4134,11 +4117,13 @@ <context attribute="Normal Text" lineEndContext="#stay" name="User Function Args"> <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="(" /> <Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=")" /> - <RegExpr attribute="Escapes" context="#stay" String="\\["$n\\]" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1=""" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="$" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="n" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="\" /> <DetectChar attribute="Strings" context="String" char=""" /> - <RegExpr attribute="Strings" context="Bracketed String" String="\[(=*)\[" /> - <RegExpr attribute="Comment" context="Bracketed Comment" String="#\[(=*)\[" /> - <DetectChar attribute="Comment" context="Comment" char="#" /> + <RegExpr attribute="Strings" context="Bracketed String" String="\[(=*)\[" beginRegion="BracketedString" /> + <DetectChar attribute="Comment" context="Match Comments" char="#" lookAhead="true" /> <IncludeRules context="Detect Builtin Variables" /> <IncludeRules context="Detect Variable Substitutions" /> <IncludeRules context="Detect Special Values" /> @@ -4147,42 +4132,62 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Special Values"> - <RegExpr attribute="True Special Arg" context="#stay" String="\b(TRUE|ON)\b" /> - <RegExpr attribute="False Special Arg" context="#stay" String="\b(FALSE|OFF|(&id_re;-)?NOTFOUND)\b" /> + <WordDetect attribute="True Special Arg" context="#stay" String="TRUE" /> + <WordDetect attribute="True Special Arg" context="#stay" String="ON" /> + <WordDetect attribute="False Special Arg" context="#stay" String="FALSE" /> + <WordDetect attribute="False Special Arg" context="#stay" String="OFF" /> + <RegExpr attribute="False Special Arg" context="#stay" String="\b(?:&id_re;-)?NOTFOUND\b" /> <RegExpr attribute="Special Args" context="#stay" String="\bCMP[0-9][0-9][0-9]\b" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Aliased Targets"> - <RegExpr attribute="Aliased Targets" context="#stay" String="\b&id_re;::&id_re;(::&id_re;)*\b" /> + <RegExpr attribute="Aliased Targets" context="#stay" String="\b&id_re;::&id_re;(?:\:\:&id_re;)*\b" /> + </context> + + <context attribute="Comment" lineEndContext="#pop" name="Match Comments"> + <RegExpr attribute="Comment" context="#pop!Bracketed Comment" String="#\[(=*)\[" beginRegion="BracketedComment" /> + <DetectChar attribute="Comment" context="#pop!Comment" char="#" /> + </context> + + <context attribute="Comment" lineEndContext="#pop" name="Match Comments and Docs"> + <RegExpr attribute="Region Marker" context="#pop!RST Documentation" String="^#\[(=*)\[\.rst:" column="0" beginRegion="RSTDocumentation" /> + <IncludeRules context="Match Comments" /> </context> <context attribute="Comment" lineEndContext="#pop" name="Comment"> <LineContinue attribute="Comment" context="#pop" /> + <DetectSpaces /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> <context attribute="Comment" lineEndContext="#stay" name="RST Documentation" dynamic="true"> - <RegExpr attribute="Region Marker" context="#pop" String="^#?\]%1\]" dynamic="true" column="0" /> + <RegExpr attribute="Region Marker" context="#pop" String="^#?\]%1\]" dynamic="true" column="0" endRegion="RSTDocumentation" /> <IncludeRules context="##reStructuredText" /> </context> <context attribute="Comment" lineEndContext="#stay" name="Bracketed Comment" dynamic="true"> <LineContinue attribute="Comment" context="#stay" /> - <RegExpr attribute="Comment" context="#pop" String=".*\]%1\]" dynamic="true" /> + <DetectSpaces /> + <StringDetect attribute="Comment" context="#pop" String="]%1]" dynamic="true" endRegion="BracketedComment" /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> <context attribute="Strings" lineEndContext="#stay" name="String"> <RegExpr attribute="Strings" context="#pop" String=""(?=[ );]|$)" /> - <RegExpr attribute="Escapes" context="#stay" String="\\["$nrt\\]" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1=""" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="$" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="n" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="r" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="t" /> + <Detect2Chars attribute="Escapes" context="#stay" char="\" char1="\" /> <IncludeRules context="Detect Variable Substitutions" /> <IncludeRules context="Detect Generator Expressions" /> </context> <context attribute="Strings" lineEndContext="#stay" name="Bracketed String" dynamic="true"> - <RegExpr attribute="Strings" context="#pop" String="\]%1\]" dynamic="true" /> + <StringDetect attribute="Strings" context="#pop" String="]%1]" dynamic="true" endRegion="BracketedString" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Generator Expressions"> @@ -4211,10 +4216,10 @@ <itemData name="True Special Arg" defStyleNum="dsOthers" color="#30a030" selColor="#30a030" spellChecking="false" /> <itemData name="False Special Arg" defStyleNum="dsOthers" color="#e05050" selColor="#e05050" spellChecking="false" /> <itemData name="Strings" defStyleNum="dsString" spellChecking="true" /> - <itemData name="Escapes" defStyleNum="dsChar" spellChecking="false" /> + <itemData name="Escapes" defStyleNum="dsSpecialChar" spellChecking="false" /> <itemData name="Builtin Variable" defStyleNum="dsDecVal" color="#c09050" selColor="#c09050" spellChecking="false" /> - <itemData name="CMake Internal Variable" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" /> - <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" /> + <itemData name="CMake Internal Variable" defStyleNum="dsVariable" spellChecking="false" /> + <itemData name="Internal Name" defStyleNum="dsVariable" spellChecking="false" /> <itemData name="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" /> <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" /> <itemData name="Cache Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> @@ -4230,11 +4235,12 @@ <general> <comments> - <comment name="singleLine" start="#" /> + <comment name="singleLine" start="#" position="afterwhitespace" /> + <comment name="multiLine" start="#[[" end="]]" region="BracketedComment"/> </comments> <keywords casesensitive="1" /> </general> </language> -<!-- kate: indent-width 2; tab-width 2; --> +<!-- kate: replace-tabs on; indent-width 2; tab-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml index 228bb45b85..3a2aa3dc91 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml @@ -38,7 +38,7 @@ Changelog: --> -<language name="CSS" version="9" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> +<language name="CSS" version="10" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> <!-- https://www.w3.org/Style/CSS/current-work --> <highlighting> @@ -1585,6 +1585,7 @@ Changelog: <DetectSpaces /> <Detect2Chars attribute="Comment" context="#pop#pop" char="*" char1="/" endRegion="comment" /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> @@ -1731,8 +1732,9 @@ Changelog: <general> <keywords casesensitive="0" weakDeliminator="-%@" /> <comments> - <comment name="multiLine" start="/*" end="*/" /> + <comment name="multiLine" start="/*" end="*/" region="comment" /> </comments> </general> </language> +<!-- kate: replace-tabs on; tab-width 4; indent-width 4; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml index a434f0f263..6f3172570c 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/doxygen.xml @@ -6,7 +6,7 @@ <!ENTITY ml_word ".*?(?=&wordsep;|\*/)"> ]> <language name="Doxygen" - version="7" + version="9" kateversion="5.0" section="Markup" extensions="*.dox;*.doxygen" @@ -354,7 +354,7 @@ <DetectChar attribute="Types" context="#pop#pop" char=""" /> </context> - <context name="ML_FindNextLine" attribute="Comment" lineEndContext="#pop" fallthroughContext="#pop"> + <context name="ML_FindNextLine" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectSpaces /> <Detect2Chars attribute="Comment" context="#pop!ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> <Detect2Chars attribute="Comment" context="ML_VerbatimPrefix" char="*" char1="*" lookAhead="true" /> @@ -382,16 +382,16 @@ <context name="ML_Formula" attribute="Formulas" lineEndContext="ML_FindNextLine"> <Detect2Chars attribute="Comment" context="ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> - <WordDetect attribute="Tags" context="#pop" String="\f]" endRegion="VerbatimBlock" /> - <WordDetect attribute="Tags" context="#pop" String="@f]" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="\f]" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="@f]" endRegion="VerbatimBlock" /> <!-- TODO: How to force LaTeX math context here?? --> <!-- <IncludeRules context="##LaTeX" /> --> </context> <context name="ML_FormulaShort" attribute="Formulas" lineEndContext="ML_FindNextLine"> <Detect2Chars attribute="Comment" context="ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> - <WordDetect attribute="Tags" context="#pop" String="\f$" endRegion="VerbatimBlock" /> - <WordDetect attribute="Tags" context="#pop" String="@f$" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="\f$" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="@f$" endRegion="VerbatimBlock" /> <!-- TODO: How to force LaTeX math context here?? --> <!-- <IncludeRules context="##LaTeX" /> --> </context> @@ -401,7 +401,7 @@ <Detect2Chars attribute="Comment" context="ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> </context> - <context name="ML_FormulaEnvStart" attribute="Formulas" lineEndContext="ML_FindNextLine" fallthroughContext="#pop!ML_FormulaEnvFormula"> + <context name="ML_FormulaEnvStart" attribute="Formulas" lineEndContext="ML_FindNextLine" fallthrough="true" fallthroughContext="#pop!ML_FormulaEnvFormula"> <DetectSpaces attribute="Comment" /> <DetectChar attribute="Tags" context="#pop!ML_FormulaEnvFormula" char="{" /> <Detect2Chars attribute="Comment" context="ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> @@ -409,8 +409,8 @@ <context name="ML_FormulaEnvFormula" attribute="Formulas" lineEndContext="ML_FindNextLine"> <Detect2Chars attribute="Comment" context="ML_End_BlockComment" char="*" char1="/" endRegion="VerbatimBlock" lookAhead="1"/> - <WordDetect attribute="Tags" context="#pop" String="\f}" endRegion="VerbatimBlock" /> - <WordDetect attribute="Tags" context="#pop" String="@f}" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="\f}" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="@f}" endRegion="VerbatimBlock" /> <!-- TODO: How to force LaTeX math context here?? --> <!-- <IncludeRules context="##LaTeX" /> --> </context> @@ -514,7 +514,7 @@ <DetectChar attribute="Types" context="#pop#pop" char=""" /> </context> - <context name="SL_FindNextLine" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop#pop#pop"> + <context name="SL_FindNextLine" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop#pop"> <DetectSpaces /> <StringDetect attribute="Comment" context="#pop" String="///" /> <StringDetect attribute="Comment" context="#pop" String="//!" /> @@ -532,8 +532,8 @@ </context> <context name="SL_Formula" attribute="Formulas" lineEndContext="SL_FindNextLine"> - <WordDetect attribute="Tags" context="#pop" String="\f]" endRegion="VerbatimBlock" /> - <WordDetect attribute="Tags" context="#pop" String="@f]" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="\f]" endRegion="VerbatimBlock" /> + <StringDetect attribute="Tags" context="#pop" String="@f]" endRegion="VerbatimBlock" /> <!-- TODO: How to force LaTeX math context here?? --> <!-- <IncludeRules context="##LaTeX" /> --> </context> @@ -549,7 +549,7 @@ <DetectChar attribute="Tags" context="#pop!SL_FormulaEnvStart" char="}" /> </context> - <context name="SL_FormulaEnvStart" attribute="Formulas" lineEndContext="SL_FindNextLine" fallthroughContext="#pop!SL_FormulaEnvFormula"> + <context name="SL_FormulaEnvStart" attribute="Formulas" lineEndContext="SL_FindNextLine" fallthrough="true" fallthroughContext="#pop!SL_FormulaEnvFormula"> <DetectSpaces attribute="Comment" /> <DetectChar attribute="Tags" context="#pop!SL_FormulaEnvFormula" char="{" /> </context> @@ -594,7 +594,7 @@ <DetectChar attribute="Comment" context="#pop" char="@" /> </context> - <context name="LanguageId" attribute="Word" lineEndContext="#pop" fallthroughContext="#pop"> + <context name="LanguageId" attribute="Word" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectIdentifier /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/dtd.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/dtd.xml index 5c39c1b597..be6bed734e 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/dtd.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/dtd.xml @@ -3,7 +3,7 @@ <!ENTITY nmtoken "[\-\w\d\.:_]+"> <!ENTITY entref "(#[0-9]+|#[xX][0-9A-Fa-f]+|&nmtoken;);"> ]> -<language name="DTD" version="2" kateversion="3.4" section="Markup" extensions="*.dtd" mimetype="application/xml-dtd" author="Andriy Lesyuk (s-andy@in.if.ua)" license="LGPL"> +<language name="DTD" version="3" kateversion="3.4" section="Markup" extensions="*.dtd" mimetype="application/xml-dtd" author="Andriy Lesyuk (s-andy@in.if.ua)" license="LGPL"> <highlighting> <list name="Category"> @@ -46,6 +46,7 @@ <DetectSpaces /> <StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> @@ -101,10 +102,9 @@ <general> <comments> - <comment name="multiLine" start="<!--" end="-->" /> + <comment name="multiLine" start="<!--" end="-->" region="comment" /> </comments> </general> </language> -<!-- kate: indent-width 2; indent-mode normal; tab-indents on; --> - +<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml index ecbd46624c..2a9a3bc4f4 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml @@ -5,7 +5,7 @@ <!ENTITY attributeName "[A-Za-z_:*#\(\[][\)\]\w.:_-]*"> <!ENTITY entref "&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> ]> -<language name="HTML" version="11" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> +<language name="HTML" version="12" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> <highlighting> <contexts> @@ -91,9 +91,10 @@ <context name="Comment" attribute="Comment" lineEndContext="#stay"> <DetectSpaces/> + <StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier/> - <StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> <RegExpr attribute="Error" context="#stay" String="-(?:-(?!->))+" /> </context> @@ -193,6 +194,7 @@ <context name="JS comment close" attribute="Comment" lineEndContext="#pop"> <RegExpr attribute="Element" context="El Close 3" String="</script\b" insensitive="true" endRegion="script" /> + <DetectSpaces /> <IncludeRules context="##Alerts" /> </context> @@ -314,3 +316,4 @@ </comments> </general> </language> +<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml index ce300fff47..0a6730977f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/ini.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd"> -<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="5" kateversion="2.4" author="Jan Janssen (medhefgo@web.de)" license="LGPL"> +<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="6" kateversion="2.4" author="Jan Janssen (medhefgo@web.de)" license="LGPL"> <highlighting> <list name="keywords"> @@ -49,6 +49,7 @@ <context name="Comment" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> </contexts> @@ -69,10 +70,10 @@ <general> <comments> - <comment name="singleLine" start="#" /> <comment name="singleLine" start=";" /> </comments> <keywords casesensitive="0" /> </general> </language> +<!-- kate: replace-tabs on; indent-width 1; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml index 938b25a0f3..273e899f73 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/java.xml @@ -4,7 +4,7 @@ <!ENTITY int "[0-9]([0-9_]*[0-9])?"> <!ENTITY hex "[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?"> ]> -<language name="Java" version="6" kateversion="5.0" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)"> +<language name="Java" version="7" kateversion="5.0" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)"> <highlighting> <list name="java15"> <item>ACTIVE</item> @@ -3826,11 +3826,15 @@ <RegExpr attribute="Imports" context="#pop" String="\s*.*;" /> </context> <context attribute="Comment" lineEndContext="#pop" name="Commentar 1"> + <DetectSpaces /> <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> </context> <context attribute="Comment" lineEndContext="#stay" name="Commentar 2"> <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/> + <DetectSpaces /> <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> </context> </contexts> <itemDatas> @@ -3858,8 +3862,9 @@ <general> <comments> <comment name="singleLine" start="//"/> - <comment name="multiLine" start="/*" end="*/"/> + <comment name="multiLine" start="/*" end="*/" region="Comment"/> </comments> <keywords casesensitive="1"/> </general> </language> +<!-- kate: replace-tabs off; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml index e9f80a534e..a7ab85e0bb 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml @@ -12,7 +12,7 @@ ** http://tools.ietf.org/html/rfc4627 *************************************************************************** --> -<language name="JSON" section="Markup" version="4" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.geojson;*.gltf" mimetype="application/json" author="Sebastian Pipping (sebastian@pipping.org)" license="GPL"> +<language name="JSON" section="Markup" version="5" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.geojson;*.gltf;*.theme" mimetype="application/json" author="Sebastian Pipping (sebastian@pipping.org)" license="GPL"> <highlighting> <list name="Constants"> <item>null</item> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml index db158d532f..7df18db5df 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/makefile.xml @@ -9,8 +9,10 @@ improve comments handling --> <!-- v4 by Alex Richardson <arichardson.kde@gmail.com> added bmake support --> +<!-- v10 by Peter J. Mello <admin@petermello.net> + Add recognition of POSIX 2013 '::=' operator for variable assignment --> <language name="Makefile" section="Other" - version="9" kateversion="3.4" + version="10" kateversion="3.4" extensions="GNUmakefile;Makefile;makefile;GNUmakefile.*;Makefile.*;makefile.*;*.mk" mimetype="text/x-makefile" priority="11" author="Per Wigren (wigren@home.se)" license=""> @@ -177,7 +179,7 @@ <keyword attribute="Keyword" context="#stay" String="keywords"/> <keyword attribute="Keyword" context="bmake_other_stmts" String="bmake_other_stmts" firstNonSpace="true"/> - <RegExpr attribute="Variable" context="assign" String="[^\s+:?+]*\s*(?=:=|=|\+=|\?=)"/> + <RegExpr attribute="Variable" context="assign" String="[^\s+:?+]*\s*(?=::=|:=|=|\+=|\?=)"/> <keyword attribute="SpecialTarget" context="bmake_special_target" String="bmake_special_targets" firstNonSpace="true"/> <RegExpr attribute="SpecialTarget" context="prereq" String="\.PATH\.[^:]*:" firstNonSpace="true"/> <keyword attribute="Keyword" context="bmake_include" String="bmake_include_stmt" firstNonSpace="true"/> @@ -512,4 +514,4 @@ <keywords casesensitive="1" weakDeliminator = ".-"/> </general> </language> -<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> +<!-- kate: syntax XML; space-indent on; indent-width 2; replace-tabs on; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml index b39c136acc..43b49f3388 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/modelines.xml @@ -8,7 +8,7 @@ Copyright (c) 2012-2014 by Alex Turbov (i.zaufi@gmail.com) --> <language name="Modelines" - version="5" + version="6" kateversion="5.0" section="Other" extensions="" @@ -127,10 +127,9 @@ </list> <contexts> - <context name="Normal" attribute="Comment" lineEndContext="#pop"> - <DetectSpaces /> + <context name="Normal" attribute="Comment" lineEndContext="#stay"> <keyword String="ModelineStartKeyword" context="Modeline" attribute="Keyword" /> - <RegExpr String="kate-(?:mimetype|wildcard)\(.*\):" 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"> @@ -139,7 +138,6 @@ <keyword String="Integrals" context="Integrals" attribute="Variable" /> <keyword String="Strings" context="Strings" attribute="Variable" /> <keyword String="RemoveSpaces" context="RemoveSpaces" attribute="Variable" /> - <LineContinue context="#pop" /> </context> <context name="Booleans" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> @@ -147,28 +145,24 @@ <keyword String="True" attribute="Option ON" context="#stay" /> <keyword String="False" attribute="Option OFF" context="#stay" /> <DetectChar char="&end;" context="#pop" attribute="Variable" /> - <LineContinue context="#pop" /> </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" /> - <LineContinue context="#pop" /> </context> <context name="Strings" attribute="String" lineEndContext="#pop"> <DetectSpaces /> <RegExpr String="[^&end;&space;]" context="#stay" /> <DetectChar char="&end;" context="#pop" attribute="Variable" /> - <LineContinue context="#pop" /> </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" /> - <LineContinue context="#pop" /> </context> <context name="RemoveSpacesEnd" attribute="Comment" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <DetectChar char="&end;" context="#pop" attribute="Variable" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml index 964e31b67a..1b5ca943be 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml @@ -39,7 +39,7 @@ Enhance tr/// and y/// support. --> -<language name="Perl" version="11" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2"> +<language name="Perl" version="13" 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> @@ -534,7 +534,7 @@ <DetectChar attribute="Pattern" context="subst_curlybrace_pattern_recursive" char="{" /> </context> <context name="subst_curlybrace_middle" attribute="Normal Text" lineEndContext="#stay" > - <RegExpr attribute="Comment" context="#stay" String="#.*$" /> + <DetectChar attribute="Comment" context="comment" char="#" /> <DetectChar attribute="Operator" context="subst_curlybrace_replace" char="{" beginRegion="Replacement" /> </context> <context name="subst_curlybrace_replace" attribute="String (interpolated)" lineEndContext="#stay"> @@ -552,8 +552,12 @@ <IncludeRules context="subst_curlybrace_pattern" /> </context> + <context name="subst_maybe_comment" attribute="Pattern" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <DetectChar attribute="Comment" context="#pop!comment" char="#" /> + </context> + <context name="subst_paren_pattern" attribute="Pattern" lineEndContext="#stay"> - <RegExpr attribute="Comment" context="#stay" String="\s+#.*$" /> + <DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> <DetectChar attribute="Operator" context="subst_paren_replace" char=")" endRegion="Pattern" /> <!-- Round brackets of RegExp pattern inside --> <DetectChar attribute="Pattern Internal Operator" context="subst_paren_pattern_internal_recursive" char="(" /> @@ -570,7 +574,7 @@ </context> <context name="subst_bracket_pattern" attribute="Pattern" lineEndContext="#stay"> - <RegExpr attribute="Comment" context="#stay" String="\s+#.*$" /> + <DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> <IncludeRules context="regex_pattern_internal_ip" /> <DetectChar attribute="Operator" context="subst_bracket_replace" char="]" endRegion="Pattern" /> </context> @@ -592,7 +596,7 @@ </context> <context name="subst_sq_pattern" attribute="Pattern" lineEndContext="#stay"> - <RegExpr attribute="Comment" context="#stay" String="\s+#.*$" /> + <DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> <IncludeRules context="regex_pattern_internal" /> <DetectChar attribute="Operator" context="subst_sq_replace" char="'" endRegion="Pattern" beginRegion="Pattern" /> </context> @@ -658,7 +662,7 @@ <!-- rules internal stuff wrt regex patterns --> <context name="regex_pattern_internal_rules_1" attribute="Pattern" lineEndContext="#stay"> - <RegExpr attribute="Comment" context="#stay" String="#.*$" firstNonSpace="true" /> + <DetectChar attribute="Comment" context="comment" char="#" firstNonSpace="true" /> <RegExpr attribute="Special Variable" context="#stay" String="\\c[^\s\\]" /> <RegExpr attribute="Special Variable" context="#stay" String="\\g(\{(\w+|\-\d+)\}|\d+)" /> <RegExpr attribute="Special Variable" context="#stay" String="\\k(\{\w+\}|<\w+>|'\w+')" /> @@ -838,30 +842,33 @@ <DetectSpaces /> <DetectIdentifier /> <RegExpr attribute="Pod" context="#stay" String="\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s*.*" column="0" beginRegion="POD" endRegion="POD"/> - <RegExpr attribute="Pod" context="#pop" String="\=cut.*$" column="0" endRegion="POD"/> + <StringDetect attribute="Pod" context="Pod" String="=cut" column="0" endRegion="POD"/> </context> <context name="comment" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> + <context name="Pod" attribute="Pod" lineEndContext="#pop#pop"/> + </contexts> <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal" /> <itemData name="Keyword" defStyleNum="dsKeyword" /> <itemData name="Pragma" defStyleNum="dsKeyword" /> <itemData name="Function" defStyleNum="dsFunction" /> - <itemData name="Operator" defStyleNum="dsKeyword" color="#008000"/> + <itemData name="Operator" defStyleNum="dsOthers" bold="1" /> <!-- #008000 --> <itemData name="Data Type" defStyleNum="dsDataType" /> - <itemData name="Special Variable" defStyleNum="dsDataType" color="#C00000" selColor="#C00000" bold="0" italic="0" /> + <itemData name="Special Variable" defStyleNum="dsWarning" bold="0" italic="0" /> <!-- #C00000 --> <itemData name="Decimal" defStyleNum="dsDecVal" /> <itemData name="Octal" defStyleNum="dsBaseN" /> <itemData name="Hex" defStyleNum="dsBaseN" /> <itemData name="Bin" defStyleNum="dsBaseN" /> <itemData name="Float" defStyleNum="dsFloat" /> - <itemData name="String" defStyleNum="dsString" color="#FF6C6C" selColor="#FF6C6C" bold="0" italic="0" /> + <itemData name="String" defStyleNum="dsSpecialString" /> <!-- #FF6C6C --> <itemData name="String (interpolated)" defStyleNum="dsString" /> <itemData name="String Special Character" defStyleNum="dsChar" /> <itemData name="Pattern" defStyleNum="dsOthers" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml deleted file mode 100644 index 71ea0a80e8..0000000000 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml +++ /dev/null @@ -1,1785 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE language SYSTEM "language.dtd" -[ - <!-- - identifier: - Alphabetic characters include characters with the Unicode General Category value Letter (L), and the underscore _. - Alphanumeric characters additionally include characters with the Unicode General Category value Number, Decimal Digit (Nd). - --> - <!-- Large values --> - <!ENTITY rangealphabetic "_A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\x{2c1}\x{2C6}-\x{2D1}\x{2E0}-\x{2EE}\x{370}-\x{588}\x{5d0}-\x{17dc}\x{1820}-\x{1aa7}\x{1b05}-\x{2139}\x{2c00}-\x{31ff}\x{3400}\x{4db5}\x{4db5}\x{4e00}-\x{ac00}\x{d7a3}-\x{d7fb}\x{f900}-\x{FD3D}\x{FF64}\x{100fa}\x{10000}-\x{100fa}\x{10280}-\x{20000}\x{2a6d6}-\x{2fa1d}"> - <!ENTITY rangenumeric "0-9"> - <!ENTITY alphabetic "[&rangealphabetic;]"> - <!ENTITY numeric "[&rangenumeric;]"> - <!ENTITY alnum "[&rangealphabetic;&rangenumeric;]"> - <!ENTITY ident "(?:&alphabetic;(?:&alnum;+|[-']&alphabetic;)*)"> - - <!ENTITY prefixdollarvarname "(?:[&rangealphabetic;0-9/!]|\(\))"> - <!ENTITY dollarvarname "(?:&ident;|[0-9]+|[/!]|\(\))"> - <!ENTITY twigils "*?!.<^:=~"> - - <!ENTITY podfmt "BCEIKLMNPRTUVXZ"> - <!ENTITY allnopodfmt "(?:[^&podfmt;]+|[&podfmt;](?![<«]))+"> - <!ENTITY allnopodfmt1 "(?:[^&podfmt;<>]+|[&podfmt;](<(?:<*(?=<))|(?![<«])))+"> - <!ENTITY allnopodfmt2 "(?:[^&podfmt;«»]+|[&podfmt;](?![<«]))+"> - <!ENTITY allnopodfmt3 "(?:[^&podfmt;<>]+|[&podfmt;](?![<«])|>(?!>)|<(?!<))+"> - - <!ENTITY quotingform_q "(?:q?(?::?[xsahfcb]|:?ww?|:(?:v|exec|words|quotewords|scalar|array|hash|function|closure|backslash|to|heredoc)|)(?::[xsahfcbv]|ww?|exec|words|quotewords|scalar|array|hash|function|closure|backslash|to|heredoc)*)"> - <!ENTITY quotingform_q_assert "(?:\s+(?=\()|\s*(?=[^()>」\]}a-zA-Z0-9]|$))"> - <!ENTITY quotingconstruct "q"ingform_q;"ingform_q_assert;"> - - <!ENTITY int10 "(?:[0-9]+(?:_[0-9]+)*)"> - <!ENTITY intN "(?:[0-9a-zA-Z]+(?:_[0-9a-zA-Z]+)*)"> - - <!-- <!ENTITY operators "(?:\b(?:X[*~]|Z=|xx=)|\((?:[<>][+=]|[-&+.<>|^]|cont|elem)\)|\+[&+<=>^|]?|~[&<>^|~]?|\.(?::<[^>]+>|\.\.?\^?|[=?^*+.])?|\^(?:fff?\b|\.\.)?\^?|(?:[?…]|f?ff)\^|\[[*+]\]|=(?:==?|=>>?|>|~=)?|<(?:<==|=[=>]?)?|\*\*=?|\?[?|]?|!(?:[=]|eqv\b)?|%%?|&&?|//?|\|\|?|>=?|-[-=]?|::|[−∈∉∋∌∘∩∪≅≠≤≥≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖×÷∖*…])"> --> - <!-- <!ENTITY hyperoperators "(?:[«»]|<<|>>)"> --> - <!ENTITY safesymboloperators "−∈∉∋∌∘∩∪≅≠≤≥≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖×÷∖*…?.+-/=!~&|^%"> - <!ENTITY unsafesymboloperators "<>«»"> - <!ENTITY symboloperators "&safesymboloperators;&unsafesymboloperators;"> - <!ENTITY bracehyperoperator "(?:\[[^\s]+\]|\([^\s]+\))"> - <!ENTITY prefixoperator "R?(?:[XZ]|xx)?"> - <!ENTITY extrasymboloperators "(?:\^fff?\b\^?|\bf?ff\^|\((?:[<>][+=]|[-&+.<>|^]|cont|elem)\))"> - <!ENTITY hyperoperators1 "[«»]&prefixoperator;(?:&&ident;|[&safesymboloperators;<>]+|&bracehyperoperator;)[«»]"> - <!ENTITY hyperoperators2 "(?:<<|>>)&prefixoperator;(?:&&ident;|[&safesymboloperators;«»]+|&bracehyperoperator;)(?:<<|>>)"> - <!ENTITY hyperoperators "&hyperoperators1;|&hyperoperators2;"> - <!ENTITY startstringasoperator "&prefixoperator;<[&symboloperators;]*(?=\s|$)"> - <!ENTITY funcoperator "\[\[\&&ident;\]\]"> - <!ENTITY reductionoperator "\[&prefixoperator;[&symboloperators;]+\]"> - <!ENTITY innerbraceoperator "[&symboloperators;'"]+"> - <!ENTITY operators "&prefixoperator;(?:(?:[&safesymboloperators;>]|&extrasymboloperators;)[&symboloperators;]*|\(&innerbraceoperator;\)|\[&innerbraceoperator;\]|<[&safesymboloperators;'"]+>)"> - - <!-- <!ENTITY regadverb "(?!\()\s*(?::\w+\s*)*(?=[^\w\s])"> --> - <!ENTITY regadverb "(?!\()\s*(?=[^\w\s])"> -]> -<language name="Perl6" version="1" kateversion="5.53" section="Scripts" extensions="*.pl6;*.PL6;*.p6;*.pm6;*.pod6" mimetype="application/x-perl;text/x-perl" priority="5" author="Jonathan Poelen (jonathan.poelen@gmail.com)" license="MIT"> - <highlighting> - - <list name="pod"> - <item>begin</item> - <item>end</item> - <item>finish</item> - <item>for</item> - <include>podtypename</include> - </list> - - <list name="podblocktypename"> - <item>pod</item> - <include>podtypename</include> - </list> - - <list name="podvalue"> - <item>True</item> - <item>False</item> - </list> - - <list name="podtypename"> - <item>head1</item> - <item>head2</item> - <item>head3</item> - <item>head4</item> - <item>head5</item> - <item>head6</item> - <item>item</item> - <item>item1</item> - <item>item2</item> - <item>item3</item> - <item>item4</item> - <item>item5</item> - <item>item6</item> - <item>para</item> - <item>code</item> - <item>defn</item> - <item>comment</item> - <item>table</item> - <item>input</item> - <item>output</item> - </list> - - <list name="quoting"> - <item>exec</item> - <item>words</item> - <item>quotewords</item> - <item>scalar</item> - <item>array</item> - <item>hash</item> - <item>function</item> - <item>closure</item> - <item>backslash</item> - <item>heredoc</item> - <item>val</item> - </list> - - <list name="declareRoutine"> - <item>macro</item> - <item>sub</item> - <item>submethod</item> - <item>method</item> - <item>multi</item> - <item>proto</item> - <item>only</item> - <item>category</item> - </list> - - <list name="regexKeyword"> - <item>rule</item> - <item>token</item> - <item>regex</item> - </list> - - <list name="value"> - <include>podvalue</include> - <item>self</item> - </list> - - <list name="varStorage"> - <item>let</item> - <item>my</item> - <item>our</item> - <item>state</item> - <item>temp</item> - <item>has</item> - <item>constant</item> - </list> - - <list name="controlFlow"> - <!-- conditional --> - <item>if</item> - <item>else</item> - <item>elsif</item> - <item>unless</item> - <!-- repeat --> - <item>for</item> - <item>loop</item> - <item>repeat</item> - <item>while</item> - <item>until</item> - <item>gather</item> - <item>given</item> - <!-- control flow --> - <item>take</item> - <item>do</item> - <item>when</item> - <item>next</item> - <item>last</item> - <item>redo</item> - <item>return</item> - <item>contend</item> - <item>maybe</item> - <item>defer</item> - <item>default</item> - <item>exit</item> - <item>make</item> - <item>continue</item> - <item>break</item> - <item>goto</item> - <item>leave</item> - <item>async</item> - <item>lift</item> - <!-- exception --> - <item>die</item> - <item>fail</item> - <item>try</item> - <item>warn</item> - </list> - - <list name="keyword"> - <!-- include --> - <item>no</item> - <item>use</item> - <item>require</item> - <!-- typeConstraint --> - <item>is</item> - <item>as</item> - <item>but</item> - <item>trusts</item> - <item>of</item> - <item>returns</item> - <item>handles</item> - <item>where</item> - <item>augment</item> - <item>supersede</item> - <!-- module --> - <item>module</item> - <item>class</item> - <item>role</item> - <item>package</item> - <item>enum</item> - <item>grammar</item> - <item>slang</item> - <item>subset</item> - <!-- closure trait --> - <item>BEGIN</item> - <item>CHECK</item> - <item>INIT</item> - <item>START</item> - <item>FIRST</item> - <item>ENTER</item> - <item>LEAVE</item> - <item>KEEP</item> - <item>UNDO</item> - <item>NEXT</item> - <item>LAST</item> - <item>PRE</item> - <item>POST</item> - <item>END</item> - <item>CATCH</item> - <item>CONTROL</item> - <item>TEMP</item> - </list> - - <list name="property"> - <item>prec</item> - <item>irs</item> - <item>ofs</item> - <item>ors</item> - <item>export</item> - <item>deep</item> - <item>binary</item> - <item>unary</item> - <item>reparsed</item> - <item>rw</item> - <item>parsed</item> - <item>cached</item> - <item>readonly</item> - <item>defequiv</item> - <item>will</item> - <item>ref</item> - <item>copy</item> - <item>inline</item> - <item>tighter</item> - <item>looser</item> - <item>equiv</item> - <item>assoc</item> - <item>required</item> - </list> - - <list name="isProperty"> - <include>property</include> - <item>signature</item> - <item>context</item> - <item>also</item> - <item>shape</item> - </list> - - <list name="Number"> - <item>NaN</item> - <item>Inf</item> - </list> - - <list name="type"> - <item>Object</item> - <item>Any</item> - <item>Junction</item> - <item>Whatever</item> - <item>Capture</item> - <item>Match</item> - <item>Signature</item> - <item>Proxy</item> - <item>Matcher</item> - <item>Package</item> - <item>Module</item> - <item>Class</item> - <item>Grammar</item> - <item>Scalar</item> - <item>Array</item> - <item>Hash</item> - <item>KeyHash</item> - <item>KeySet</item> - <item>KeyBag</item> - <item>Pair</item> - <item>List</item> - <item>Seq</item> - <item>Range</item> - <item>Set</item> - <item>Bag</item> - <item>Mapping</item> - <item>Void</item> - <item>Undef</item> - <item>Failure</item> - <item>Exception</item> - <item>Code</item> - <item>Block</item> - <item>Routine</item> - <item>Sub</item> - <item>Macro</item> - <item>Method</item> - <item>Submethod</item> - <item>Regex</item> - <item>Str</item> - <item>Blob</item> - <item>Char</item> - <item>Byte</item> - <item>Codepoint</item> - <item>Grapheme</item> - <item>StrPos</item> - <item>StrLen</item> - <item>Version</item> - <item>Num</item> - <item>Complex</item> - <item>num</item> - <item>complex</item> - <item>Bit</item> - <item>bit</item> - <item>bool</item> - <item>True</item> - <item>False</item> - <item>Increasing</item> - <item>Decreasing</item> - <item>Ordered</item> - <item>Callable</item> - <item>AnyChar</item> - <item>Positional</item> - <item>Associative</item> - <item>Ordering</item> - <item>KeyExtractor</item> - <item>Comparator</item> - <item>OrderingPair</item> - <item>IO</item> - <item>KitchenSink</item> - <item>Role</item> - <item>Int</item> - <item>int</item> - <item>int1</item> - <item>int2</item> - <item>int4</item> - <item>int8</item> - <item>int16</item> - <item>int32</item> - <item>int64</item> - <item>Rat</item> - <item>rat</item> - <item>rat1</item> - <item>rat2</item> - <item>rat4</item> - <item>rat8</item> - <item>rat16</item> - <item>rat32</item> - <item>rat64</item> - <item>Buf</item> - <item>buf</item> - <item>buf1</item> - <item>buf2</item> - <item>buf4</item> - <item>buf8</item> - <item>buf16</item> - <item>buf32</item> - <item>buf64</item> - <item>UInt</item> - <item>uint</item> - <item>uint1</item> - <item>uint2</item> - <item>uint4</item> - <item>uint8</item> - <item>uint16</item> - <item>uint32</item> - <item>uint64</item> - <item>Abstraction</item> - <item>utf8</item> - <item>utf16</item> - <item>utf32</item> - </list> - - <list name="operator"> - <item>X</item> - <item>gcd</item> - <item>ge</item> - <item>gt</item> - <item>lcm</item> - <item>le</item> - <item>leg</item> - <item>let</item> - <item>lt</item> - <item>map</item> - <item>max</item> - <item>min</item> - <item>minmax</item> - <item>mod</item> - <item>ne</item> - <item>not</item> - <item>notandthen</item> - <item>o</item> - <item>or</item> - <item>orelse</item> - <item>print</item> - <item>push</item> - <item>say</item> - <item>so</item> - <item>substr</item> - <item>temp</item> - <item>unicmp</item> - <item>x</item> - <item>xor</item> - <item>xx</item> - <item>Xeqv</item> - <item>Z</item> - <item>and</item> - <item>andthen</item> - <item>any</item> - <item>but</item> - <item>cmp</item> - <item>coll</item> - <item>die</item> - <item>div</item> - <item>does</item> - <item>eq</item> - <item>eqv</item> - <item>ff</item> - <item>fff</item> - </list> - - <list name="unicodeGeneralCategories"> - <item>L</item> <item>Letter</item> - <item>LC</item> <item>Cased_Letter</item> - <item>Lu</item> <item>Uppercase_Letter</item> - <item>Ll</item> <item>Lowercase_Letter</item> - <item>Lt</item> <item>Titlecase_Letter</item> - <item>Lm</item> <item>Modifier_Letter</item> - <item>Lo</item> <item>Other_Letter</item> - <item>M</item> <item>Mark</item> - <item>Mn</item> <item>Nonspacing_Mark</item> - <item>Mc</item> <item>Spacing_Mark</item> - <item>Me</item> <item>Enclosing_Mark</item> - <item>N</item> <item>Number</item> - <item>Nd</item> <item>Decimal_Number</item> <item>digit</item> - <item>Nl</item> <item>Letter_Number</item> - <item>No</item> <item>Other_Number</item> - <item>P</item> <item>Punctuation</item> <item>punct</item> - <item>Pc</item> <item>Connector_Punctuation</item> - <item>Pd</item> <item>Dash_Punctuation</item> - <item>Ps</item> <item>Open_Punctuation</item> - <item>Pe</item> <item>Close_Punctuation</item> - <item>Pi</item> <item>Initial_Punctuation</item> - <item>Pf</item> <item>Final_Punctuation</item> - <item>Po</item> <item>Other_Punctuation</item> - <item>S</item> <item>Symbol</item> - <item>Sm</item> <item>Math_Symbol</item> - <item>Sc</item> <item>Currency_Symbol</item> - <item>Sk</item> <item>Modifier_Symbol</item> - <item>So</item> <item>Other_Symbol</item> - <item>Z</item> <item>Separator</item> - <item>Zs</item> <item>Space_Separator</item> - <item>Zl</item> <item>Line_Separator</item> - <item>Zp</item> <item>Paragraph_Separator</item> - <item>C</item> <item>Other</item> - <item>Cc</item> <item>Control</item> <item>cntrl</item> - <item>Cf</item> <item>Format</item> - <item>Cs</item> <item>Surrogate</item> - <item>Co</item> <item>Private_Use</item> - <item>Cn</item> <item>Unassigned</item> - </list> - - <list name="assertion"> - <item>before</item> - <item>after</item> - </list> - - <contexts> - - <context name="Shebang" attribute="Comment" lineEndContext="#pop!base" fallthrough="1" fallthroughContext="#pop!base"> - <RegExpr attribute="Keyword" context="#pop!base" String="^#!\/.*" column="0"/> - </context> - - <context name="base" attribute="Normal Text" lineEndContext="#stay"> - <DetectSpaces/> - <DetectChar attribute="Comment" context="StartComment" char="#"/> - <!-- <DetectChar attribute="Unspace" context="#stay" char="\"/> --> - <DetectChar attribute="String Delimiter" context="qq_RawString" char="""/> - <DetectChar attribute="String Delimiter" context="q_RawString" char="'"/> - <DetectChar char="{" context="Interpolation" attribute="Operator" beginRegion="block"/> - <RegExpr String="(?:s|tr|TR)®adverb;" context="RegexSubstitution" attribute="Operator"/> - <RegExpr String="(?:rx|m)®adverb;" context="Regex" attribute="Operator"/> - <IncludeRules context="find_Variable"/> - <DetectChar attribute="Pod" context="StartPod" char="=" firstNonSpace="1"/> - <RegExpr String="»\.|<<\.|&hyperoperators;|&startstringasoperator;|&funcoperator;|&reductionoperator;|&operators;" context="MaybeRegex" attribute="Operator"/> - <DetectChar char="(" context="SubExpression(" attribute="Operator" beginRegion="block"/> - <DetectChar char="[" context="SubExpression[" attribute="Operator" beginRegion="block"/> - <AnyChar String=",;" context="#stay" attribute="Separator Symbol"/> - <DetectChar attribute="String Delimiter" context="qq_String«" char="«"/> - <Detect2Chars attribute="String Delimiter" context="qq_String<<" char="<" char1="<"/> - <DetectChar attribute="String Delimiter" context="q_String<" char="<"/> - <DetectChar attribute="String Delimiter" context="Q_String「" char="「"/> - <DetectChar attribute="Operator" context="Q_String" char="Q" lookAhead="1"/> - <DetectChar char=":" context="MaybeAttribute" attribute="Operator"/> - <AnyChar String="0123456789." context="Number" lookAhead="1"/> - <RegExpr attribute="Operator" context="q_QuotingForm" String="q(?="ingform_q;"ingform_q_assert;)"/> - <keyword String="operator" context="#stay" attribute="Operator"/> - <keyword String="varStorage" context="#stay" attribute="Variable Storage"/> - <keyword String="type" context="#stay" attribute="Data Type"/> - <keyword String="controlFlow" context="#stay" attribute="Control Flow"/> - <WordDetect String="is" context="Is" attribute="Keyword"/> - <keyword String="keyword" context="#stay" attribute="Keyword"/> - <keyword String="declareRoutine" context="#stay" attribute="Declare Routine"/> - <keyword String="property" context="#stay" attribute="Property"/> - <keyword String="regexKeyword" context="RegexKeyword" attribute="Keyword"/> - <keyword String="value" context="#stay" attribute="Keyword Value"/> - <keyword String="Number" context="#stay" attribute="Float"/> - <RegExpr String="[A-Z](?:[a-z]+[a-zA-Z0-9]*)+" context="#stay" attribute="Data Type"/> - <RegExpr String="&ident;" context="#stay" attribute="Normal Text"/> - </context> - - <context name="Is" attribute="Normal Text" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <DetectSpaces/> - <keyword String="isProperty" context="#pop" attribute="Property"/> - </context> - - <context name="Interpolation" attribute="Normal Text" lineEndContext="#stay"> - <DetectChar char="}" context="#pop" attribute="Operator" endRegion="block"/> - <IncludeRules context="base"/> - </context> - - <context name="SubExpression(" attribute="Normal Text" lineEndContext="#stay"> - <IncludeRules context="base"/> - <DetectChar char=")" context="#pop" attribute="Operator" endRegion="block"/> - </context> - - <context name="SubExpression[" attribute="Normal Text" lineEndContext="#stay"> - <IncludeRules context="base"/> - <DetectChar char="]" context="#pop" attribute="Operator" endRegion="block"/> - </context> - - <context name="find_Variable" attribute="Normal Text" lineEndContext="#stay"> - <RegExpr String="[%&](?=[?*]&alphabetic;)|(?:\$[&twigils;]|::\?)(?=&alphabetic;)" context="Twigil" attribute="Variable"/> - <RegExpr String="[$@]\(\)|[%@]?\$/|\$!|\$[0-9]+|[\\@%&$]&ident;" context="#stay" attribute="Variable"/> - </context> - - <context name="MaybeRegex" attribute="Normal Text" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop"> - <DetectSpaces/> - <DetectChar char="/" context="#pop!Regex" attribute="Operator" lookAhead="1"/> - </context> - - <context name="Twigil" attribute="Variable" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <AnyChar String="&twigils;" context="#stay" attribute="Twigil"/> - <RegExpr String="&ident;" context="#pop" attribute="Variable"/> - </context> - - <context name="RegexKeyword" attribute="Normal Text" lineEndContext="#pop"> - <DetectChar char="{" context="#pop!Pattern{" attribute="Operator" beginRegion="regex"/> - </context> - - <!-- Regex --> - - <context name="Regex" attribute="Pattern" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop"> - <IncludeRules context="find_RegexClosure"/> - <RegExpr String="([^\w\s])" context="Pattern" attribute="Operator" beginRegion="regex"/> - </context> - - <context name="find_RegexClosure" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char=":" context="RegexModifier" attribute="Pattern Modifier"/> - <DetectChar char="{" context="Pattern{" attribute="Operator" beginRegion="regex"/> - <DetectChar char="(" context="Pattern(" attribute="Operator" beginRegion="regex"/> - <DetectChar char="[" context="Pattern[" attribute="Operator" beginRegion="regex"/> - <DetectChar char="<" context="Pattern<" attribute="Operator" beginRegion="regex"/> - <DetectSpaces/> - </context> - - <context name="RegexModifier" attribute="Pattern Modifier" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <StringDetect String="P5" context="RegexPerl5" attribute="Pattern Modifier"/> - <StringDetect String="Perl5" context="RegexPerl5" attribute="Pattern Modifier"/> - <DetectIdentifier context="#pop" attribute="Pattern Modifier"/> - </context> - - <context name="RegexPerl5" attribute="Pattern Modifier" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop!IsRegexPerl5"> - <DetectSpaces/> - </context> - - <context name="IsRegexPerl5" attribute="Pattern" lineEndContext="#stay"> - <IncludeRules context="find_pattern##Perl"/> - </context> - - <context name="Pattern{" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char="}" context="#pop#pop" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="Pattern[" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char="]" context="#pop#pop" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="Pattern(" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char=")" context="#pop#pop" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="Pattern<" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char=">" context="#pop#pop" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="Pattern" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char="1" dynamic="1" context="#pop#pop" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="find_Pattern" attribute="Pattern" lineEndContext="#stay"> - <DetectChar attribute="Operator" context="SubPattern" char="("/> - <DetectChar char="\" context="PatternMetaChar" attribute="Pattern Character Class"/> - <DetectChar attribute="String Delimiter" context="qq_RawString" char="""/> - <DetectChar attribute="String Delimiter" context="q_RawString" char="'"/> - <DetectChar attribute="Pattern Modifier" context="PatternModifier" char=":" lookAhead="1"/> - <DetectChar char="{" context="Interpolation" attribute="Operator" beginRegion="block"/> - <Detect2Chars attribute="Operator" context="RecursivePattern" char="<" char1="("/> - <Detect2Chars attribute="Operator" context="PatternAssertion" char="<" char1="?"/> - <Detect2Chars attribute="Operator" context="PatternAssertion" char="<" char1="!"/> - <Detect2Chars attribute="Operator" context="#stay" char="<" char1="<"/> - <Detect2Chars attribute="Operator" context="#stay" char=">" char1=">"/> - <DetectChar attribute="Pattern Meta Character" context="RegexClass" char="<"/> - <AnyChar attribute="Pattern Quantifier" context="#stay" String="?*+%"/> - <Detect2Chars attribute="Pattern Quantifier" context="#stay" char="." char1="."/> - <AnyChar attribute="Operator" context="#stay" String="[]«»~"/> - <DetectChar attribute="Pattern Special Character" context="#stay" char="."/> - <Detect2Chars attribute="Variable" context="PatternVariable" char="$" char1="<"/> - <AnyChar attribute="Pattern Control Flow" context="#stay" String="&|^$"/> - <DetectChar attribute="Comment" context="StartComment" char="#"/> - <IncludeRules context="find_Variable"/> - <RegExpr String="[&rangealphabetic;&rangenumeric;\s]+" context="#stay" attribute="Pattern"/> - </context> - - <context name="SubPattern" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char=")" context="#pop" attribute="Operator"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="RecursivePattern" attribute="Variable" lineEndContext="#stay"> - <Detect2Chars attribute="Operator" context="#pop" char=")" char1=">"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="PatternModifier" attribute="Pattern Modifier" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <RegExpr context="#pop" attribute="Pattern Modifier" String=":\w+"/> - <DetectChar attribute="Pattern Control Flow" context="#pop" char=":"/> - </context> - - <context name="PatternVariable" attribute="Variable" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <RegExpr String="&ident;>?" context="#pop" attribute="Variable"/> - </context> - - <context name="PatternAssertion" attribute="Normal Text" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!RegexClass"> - <DetectChar attribute="Operator" context="#pop" char=">"/> - <DetectChar attribute="Operator" context="PatternAssertionCond" char="{"/> - <keyword attribute="Keyword" String="assertion" context="SubPatternAssertion"/> - </context> - <context name="SubPatternAssertion" attribute="Pattern" lineEndContext="#stay"> - <DetectChar char=">" context="#pop#pop" attribute="Operator"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="PatternAssertionCond" attribute="Normal Text" lineEndContext="#stay"> - <Detect2Chars attribute="Operator" context="#pop#pop" char="}" char1=">"/> - <IncludeRules context="base"/> - </context> - - <context name="PatternMetaChar" attribute="Pattern Meta Character" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop!CharError"> - <AnyChar attribute="Pattern Character Class" context="#pop" String="nthvsdwNTHVSDW"/> - <RegExpr String="[^&rangealphabetic;&rangenumeric;]" context="#pop" attribute="Pattern Meta Character"/> - </context> - - - <!-- Pattern Character Classes --> - - <context name="RegexClass" attribute="Pattern Meta Character" lineEndContext="#stay"> - <DetectSpaces/> - <AnyChar attribute="Operator" context="#stay" String="-!+()"/> - <DetectChar attribute="Pattern Meta Character" context="RegexClassRange" char="["/> - <DetectChar attribute="Pattern Unicode Property" context="RegexClassName" char=":"/> - <DetectChar attribute="Pattern Meta Character" context="#pop" char=">"/> - <DetectChar attribute="String Delimiter" context="q_RawString" char="'"/> - <DetectChar attribute="String Delimiter" context="qq_RawString" char="""/> - <DetectChar attribute="String Delimiter" context="Q_String「" char="「"/> - <DetectChar attribute="String Delimiter" context="q_String<" char="<"/> - <DetectChar attribute="String Delimiter" context="qq_String«" char="«"/> - <RegExpr attribute="String" context="#stay" String="[^-!+()?:<>'"「«]+"/> - </context> - - <context name="RegexClassName" attribute="Pattern Unicode Property" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop"> - <RegExpr String="\w+" context="#pop" attribute="Pattern Unicode Property"/> - <!-- auto-completion only --> - <keyword attribute="Pattern Unicode Property" context="#pop" String="unicodeGeneralCategories"/> - </context> - - <context name="RegexClassRange" attribute="Pattern Character" lineEndContext="#stay"> - <DetectSpaces/> - <DetectChar char="\" context="RegexClassRangeMetaChar" attribute="Pattern Character Class"/> - <Detect2Chars char="." char1="." context="#stay" attribute="Pattern Quantifier"/> - <DetectChar attribute="Pattern Meta Character" context="#pop" char="]"/> - </context> - - <context name="RegexClassRangeMetaChar" attribute="Pattern Meta Character" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop"> - <DetectSpaces/> - <IncludeRules context="find_SpecialChar"/> - <IncludeRules context="PatternMetaChar"/> - </context> - - - <!-- Regex Substitution --> - - <context name="RegexSubstitution" attribute="Operator" lineEndContext="#stay"> - <IncludeRules context="find_RegexClosure"/> - <RegExpr String="([^\w\s])" context="RegexSubstitutionPattern" attribute="Operator" beginRegion="regex"/> - </context> - - <context name="RegexSubstitutionPattern" attribute="Pattern" lineEndContext="#stay"> - <RegExpr String="(%1)" dynamic="1" context="RegexSubstitutionString" attribute="Operator" endRegion="regex"/> - <IncludeRules context="find_Pattern"/> - </context> - - <context name="RegexSubstitutionString" attribute="String" lineEndContext="#stay"> - <DetectChar char="1" dynamic="1" context="#pop#pop#pop" attribute="Operator"/> - </context> - - - <!-- Number --> - - <context name="Number" attribute="Decimal" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!CharErrorIfNoSep"> - <RegExpr String="&int10;(?:\.&int10;(?:[eE][+-]?&int10;)?|[eE][+-]?&int10;)i?|\.&int10;(?:[eE][+-]?&int10;)?i?" context="CheckNumberError" attribute="Float"/> - <Detect2Chars char="0" char1="x" context="HexNumber" attribute="Hex"/> - <Detect2Chars char="0" char1="o" context="OctalNumber" attribute="Octal"/> - <RegExpr String="&int10;i?" context="CheckNumberError" attribute="Decimal"/> - <DetectChar char="." context="#pop" attribute="Operator"/> - </context> - - <context name="HexNumber" attribute="Hex" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop!CharErrorIfNoSep"> - <RegExpr String="[a-fA-F0-9]+(?:_[a-fA-F0-9]+)*i?" context="#pop!CheckNumberError" attribute="Hex"/> - </context> - - <context name="OctalNumber" attribute="Octal" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop!CharErrorIfNoSep"> - <RegExpr String="[0-7]+(?:_[0-7]+)*i?" context="#pop!CheckNumberError" attribute="Octal"/> - </context> - - <context name="BaseNumber" attribute="Decimal" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop!CharErrorIfNoSep"> - <DetectChar char=">" context="#pop#pop#pop" attribute="Error"/> - <RegExpr String="&intN;\.&intN;|\.&intN;" context="#pop#pop!BaseNumberClose" attribute="Float"/> - <RegExpr String="&intN;" context="#pop#pop!BaseNumberClose" attribute="Decimal"/> - </context> - <context name="BaseNumberClose" attribute="Decimal" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop!CharErrorIfNoSep"> - <DetectChar char=">" context="#pop#pop" attribute="Operator"/> - <IncludeRules context="CheckNumberError"/> - </context> - - <context name="CheckNumberError" attribute="Octal" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <RegExpr String="&alnum;+" context="#pop#pop" attribute="Error"/> - </context> - - - <!-- Attribute or Key --> - - <context name="MaybeAttribute" attribute="Normal Text" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <Int context="MaybeAttribute2" attribute="Decimal"/> - <DetectChar char="!" context="#pop" attribute="Operator"/> - <RegExpr String="&ident;" context="#pop" attribute="Attribute"/> - </context> - - <context name="MaybeAttribute2" attribute="Decimal" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <DetectChar char="<" context="BaseNumber" attribute="Operator"/> - </context> - - - <!-- Pod --> - - <context name="StartPod" attribute="Pod Typename" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> - <WordDetect String="begin" context="PodBegin" attribute="Pod Block"/> - <WordDetect String="for" context="PodFor" attribute="Pod Typename"/> - <keyword String="pod" context="PodTypenameValue" attribute="Pod Typename"/> - <RegExpr String="[_A-Z][-_A-Z0-9]*\b" context="PodTypenameValue" attribute="Pod Typename"/> - <RegExpr String="&ident;" context="PodTypenameValue" attribute="Pod Unknown"/> - </context> - - <context name="PodTypenameValue" attribute="Pod Typename Value" lineEndContext="PodTypenameValueNextLine" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Typename Value" context="#stay" String="&allnopodfmt;"/> - </context> - - <context name="PodTypenameValueNextLine" attribute="Pod Typename Value" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop"> - <DetectSpaces attribute="Normal Text" context="PodTypenameValueOrEmpty"/> - <DetectChar attribute="Pod" context="#pop#pop#pop" char="=" lookAhead="true"/> - </context> - - <context name="PodTypenameValueOrEmpty" attribute="Pod Typename Value" lineEndContext="#pop#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <DetectChar attribute="Pod" context="#pop#pop#pop#pop" char="=" lookAhead="true"/> - </context> - - - <!-- Pod formatting --> - - <context name="PodFormat" attribute="Pod Typename Value" lineEndContext="#stay"> - <Detect2Chars char="B" char1="<" attribute="Pod Bold" context="#pop!PodFormatB"/> - <Detect2Chars char="B" char1="«" attribute="Pod Bold" context="#pop!PodFormatB2"/> - <Detect2Chars char="I" char1="<" attribute="Pod Italic" context="#pop!PodFormatI"/> - <Detect2Chars char="I" char1="«" attribute="Pod Italic" context="#pop!PodFormatI2"/> - <Detect2Chars char="L" char1="<" attribute="Pod Link" context="#pop!PodFormatL"/> - <Detect2Chars char="L" char1="«" attribute="Pod Link" context="#pop!PodFormatL2"/> - <Detect2Chars char="N" char1="<" attribute="Pod Note" context="#pop!PodFormatN"/> - <Detect2Chars char="N" char1="«" attribute="Pod Note" context="#pop!PodFormatN2"/> - <Detect2Chars char="P" char1="<" attribute="Pod Link" context="#pop!PodFormatL"/> - <Detect2Chars char="P" char1="«" attribute="Pod Link" context="#pop!PodFormatL2"/> - <Detect2Chars char="Z" char1="<" attribute="Pod Comment" context="#pop!PodFormatZ"/> - <Detect2Chars char="Z" char1="«" attribute="Pod Comment" context="#pop!PodFormatZ2"/> - <Detect2Chars char="U" char1="<" attribute="Pod Underline" context="#pop!PodFormatU"/> - <Detect2Chars char="U" char1="«" attribute="Pod Underline" context="#pop!PodFormatU2"/> - <Detect2Chars char="C" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatVT"/> - <Detect2Chars char="C" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatVT2"/> - <Detect2Chars char="E" char1="<" attribute="Pod Unicode" context="#pop!PodFormatE"/> - <Detect2Chars char="E" char1="«" attribute="Pod Unicode" context="#pop!PodFormatE2"/> - <Detect2Chars char="K" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatVT"/> - <Detect2Chars char="K" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatVT2"/> - <Detect2Chars char="R" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatVT"/> - <Detect2Chars char="R" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatVT2"/> - <Detect2Chars char="T" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatVT"/> - <Detect2Chars char="T" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatVT2"/> - <Detect2Chars char="V" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatV"/> - <Detect2Chars char="V" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatV2"/> - <Detect2Chars char="X" char1="<" attribute="Pod Indexed Terms" context="#pop!PodFormatX"/> - <Detect2Chars char="X" char1="«" attribute="Pod Indexed Terms" context="#pop!PodFormatX2"/> - <Detect2Chars char="M" char1="<" attribute="Pod Verbatim" context="#pop!PodFormatVT"/> - <Detect2Chars char="M" char1="«" attribute="Pod Verbatim" context="#pop!PodFormatVT2"/> - </context> - - <context name="PodFormatB" attribute="Pod Bold" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatB1"> - <DetectChar char="<" attribute="Pod Bold" context="#pop!PodFormatB3"/> - </context> - <context name="PodFormatB1" attribute="Pod Bold" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Bold" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Bold" context="PodFormatB1"/> - <DetectChar char=">" attribute="Pod Bold" context="#pop"/> - </context> - <context name="PodFormatB2" attribute="Pod Bold" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Bold" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Bold" context="PodFormatB2"/> - <DetectChar char="»" attribute="Pod Bold" context="#pop"/> - </context> - <context name="PodFormatB3" attribute="Pod Bold" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Bold" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Bold" context="PodFormatB3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Bold" context="#pop"/> - </context> - - <context name="PodFormatE" attribute="Pod Unicode" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatE1"> - <DetectChar char="<" attribute="Pod Unicode" context="#pop!PodFormatE3"/> - </context> - <context name="PodFormatE1" attribute="Pod Unicode" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Unicode" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Unicode" context="PodFormatE1"/> - <DetectChar char=">" attribute="Pod Unicode" context="#pop"/> - </context> - <context name="PodFormatE2" attribute="Pod Unicode" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Unicode" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Unicode" context="PodFormatE2"/> - <DetectChar char="»" attribute="Pod Unicode" context="#pop"/> - </context> - <context name="PodFormatE3" attribute="Pod Unicode" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Unicode" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Unicode" context="PodFormatE3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Unicode" context="#pop"/> - </context> - - <context name="PodFormatI" attribute="Pod Italic" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatI1"> - <DetectChar char="<" attribute="Pod Italic" context="#pop!PodFormatI3"/> - </context> - <context name="PodFormatI1" attribute="Pod Italic" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Italic" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Italic" context="PodFormatI1"/> - <DetectChar char=">" attribute="Pod Italic" context="#pop"/> - </context> - <context name="PodFormatI2" attribute="Pod Italic" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Italic" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Italic" context="PodFormatI2"/> - <DetectChar char="»" attribute="Pod Italic" context="#pop"/> - </context> - <context name="PodFormatI3" attribute="Pod Italic" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Italic" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Italic" context="PodFormatI3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Italic" context="#pop"/> - </context> - - <context name="PodFormatL" attribute="Pod Link" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatL1"> - <DetectChar char="<" attribute="Pod Link" context="#pop!PodFormatL3"/> - </context> - <context name="PodFormatL1" attribute="Pod Link" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;<>|]+|[&podfmt;](?![<«]))+"/> - <DetectChar char="|" attribute="Pod Operator" context="#stay"/> - <DetectChar char=">" attribute="Pod Link" context="#pop"/> - </context> - <context name="PodFormatL2" attribute="Pod Link" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;«»|]+|[&podfmt;](?![<«]))+"/> - <DetectChar char="|" attribute="Pod Operator" context="#stay"/> - <DetectChar char="»" attribute="Pod Link" context="#pop"/> - </context> - <context name="PodFormatL3" attribute="Pod Link" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;<>|]+|[&podfmt;](?![<«])|>(?!>)|<(?!<))+"/> - <DetectChar char="|" attribute="Pod Operator" context="#stay"/> - <Detect2Chars char=">" char1=">" attribute="Pod Link" context="#pop"/> - </context> - - <context name="PodFormatN" attribute="Pod Note" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatN1"> - <DetectChar char="<" attribute="Pod Note" context="#pop!PodFormatN3"/> - </context> - <context name="PodFormatN1" attribute="Pod Note" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Note" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Note" context="PodFormatN1"/> - <DetectChar char=">" attribute="Pod Note" context="#pop"/> - </context> - <context name="PodFormatN2" attribute="Pod Note" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Note" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Note" context="PodFormatN2"/> - <DetectChar char="»" attribute="Pod Note" context="#pop"/> - </context> - <context name="PodFormatN3" attribute="Pod Note" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Note" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Note" context="PodFormatN3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Note" context="#pop"/> - </context> - - <context name="PodFormatU" attribute="Pod Underline" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatU1"> - <DetectChar char="<" attribute="Pod Underline" context="#pop!PodFormatU3"/> - </context> - <context name="PodFormatU1" attribute="Pod Underline" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Underline" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Underline" context="PodFormatU1"/> - <DetectChar char=">" attribute="Pod Underline" context="#pop"/> - </context> - <context name="PodFormatU2" attribute="Pod Underline" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Underline" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Underline" context="PodFormatU2"/> - <DetectChar char="»" attribute="Pod Underline" context="#pop"/> - </context> - <context name="PodFormatU3" attribute="Pod Underline" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Underline" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Underline" context="PodFormatU3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Underline" context="#pop"/> - </context> - - <context name="PodFormatV" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatV1"> - <DetectChar char="<" attribute="Pod Verbatim" context="#pop!PodFormatV3"/> - </context> - <context name="PodFormatV1" attribute="Pod Verbatim" lineEndContext="#stay"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Verbatim" context="PodFormatV1"/> - <DetectChar char=">" attribute="Pod Verbatim" context="#pop"/> - </context> - <context name="PodFormatV2" attribute="Pod Verbatim" lineEndContext="#stay"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Verbatim" context="PodFormatV2"/> - <DetectChar char="»" attribute="Pod Verbatim" context="#pop"/> - </context> - <context name="PodFormatV3" attribute="Pod Verbatim" lineEndContext="#stay"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Verbatim" context="PodFormatV3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Verbatim" context="#pop"/> - </context> - - <context name="PodFormatVT" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatVT1"> - <DetectChar char="<" attribute="Pod Verbatim" context="#pop!PodFormatVT3"/> - </context> - <context name="PodFormatVT1" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Verbatim" context="PodFormatVT1"/> - <DetectChar char=">" attribute="Pod Verbatim" context="#pop"/> - </context> - <context name="PodFormatVT2" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Verbatim" context="PodFormatVT2"/> - <DetectChar char="»" attribute="Pod Verbatim" context="#pop"/> - </context> - <context name="PodFormatVT3" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Verbatim" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Verbatim" context="PodFormatVT3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Verbatim" context="#pop"/> - </context> - - <context name="PodFormatZ" attribute="Pod Comment" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatZ1"> - <DetectChar char="<" attribute="Pod Comment" context="#pop!PodFormatZ3"/> - </context> - <context name="PodFormatZ1" attribute="Pod Comment" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Comment" context="#stay" String="&allnopodfmt1;"/> - <DetectChar char="<" attribute="Pod Comment" context="PodFormatZ1"/> - <DetectChar char=">" attribute="Pod Comment" context="#pop"/> - </context> - <context name="PodFormatZ2" attribute="Pod Comment" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Comment" context="#stay" String="&allnopodfmt2;"/> - <DetectChar char="«" attribute="Pod Comment" context="PodFormatZ2"/> - <DetectChar char="»" attribute="Pod Comment" context="#pop"/> - </context> - <context name="PodFormatZ3" attribute="Pod Comment" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Comment" context="#stay" String="&allnopodfmt3;"/> - <Detect2Chars char="<" char1="<" attribute="Pod Comment" context="PodFormatZ3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Comment" context="#pop"/> - </context> - - <context name="PodFormatX" attribute="Pod Indexed Terms" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!PodFormatX1"> - <DetectChar char="<" attribute="Pod Indexed Terms" context="#pop!PodFormatX3"/> - </context> - <context name="PodFormatX1" attribute="Pod Indexed Terms" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;<>|;,]+|[&podfmt;](?![<«]))+"/> - <AnyChar String="|;," attribute="Pod Operator" context="#stay"/> - <DetectChar char=">" attribute="Pod Indexed Terms" context="#pop"/> - </context> - <context name="PodFormatX2" attribute="Pod Indexed Terms" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;«»|;,]+|[&podfmt;](?![<«]))+"/> - <AnyChar String="|;," attribute="Pod Operator" context="#stay"/> - <DetectChar char="«" attribute="Pod Indexed Terms" context="PodFormatX2"/> - <DetectChar char="»" attribute="Pod Indexed Terms" context="#pop"/> - </context> - <context name="PodFormatX3" attribute="Pod Indexed Terms" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodFormat"> - <RegExpr attribute="Pod Link" context="#stay" String="(?:[^&podfmt;<>|;,]+|[&podfmt;](?![<«])|>(?!>)|<(?!<))+"/> - <AnyChar String="|;," attribute="Pod Operator" context="#stay"/> - <Detect2Chars char="<" char1="<" attribute="Pod Indexed Terms" context="PodFormatX3"/> - <Detect2Chars char=">" char1=">" attribute="Pod Indexed Terms" context="#pop"/> - </context> - - <!-- Pod =begin --> - - <context name="PodBegin" attribute="Pod Typename Value" lineEndContext="#pop#pop!Error"> - <DetectSpaces attribute="Normal Text"/> - <WordDetect String="code" context="PodBeginCode" attribute="Pod Typename Value" beginRegion="pod"/> - <WordDetect String="comment" context="PodBeginComment" attribute="Pod Typename Value" beginRegion="pod"/> - <RegExpr String="(&ident;)" context="PodBeginTypename" attribute="Pod Typename Value" beginRegion="pod"/> - <!-- auto-completion only --> - <keyword String="podblocktypename" context="#stay" attribute="Pod Typename Value"/> - </context> - - <context name="PodBeginCode" attribute="Error" lineEndContext="PodInnerCode"> - <DetectSpaces attribute="Normal Text"/> - <DetectChar char=":" context="PodBlockConfigKey" attribute="Pod Operator"/> - <DetectChar char="=" context="PodEndCode" attribute="Pod" firstNonSpace="1"/> - </context> - - <context name="PodInnerCode" attribute="Pod Verbatim" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodCode"> - <RegExpr String="^\s*=end\s+code\s*$" context="#pop" attribute="Pod" column="0" lookAhead="1"/> - </context> - <context name="PodCode" attribute="Pod Verbatim" lineEndContext="#pop"/> - - <context name="PodEndCode" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop"> - <StringDetect String="end" context="PodEndCodeName" attribute="Pod Block" endRegion="pod"/> - </context> - <context name="PodEndCodeName" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop#pop!Error"> - <DetectSpaces attribute="Normal Text"/> - <StringDetect String="code" context="#pop#pop#pop#pop!Error" attribute="Pod Typename Value"/> - </context> - - - <context name="PodBeginComment" attribute="Error" lineEndContext="PodInnerComment"> - <DetectSpaces attribute="Normal Text"/> - <DetectChar char="=" context="PodEndComment" attribute="Pod" firstNonSpace="1"/> - </context> - - <context name="PodInnerComment" attribute="Comment" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodComment"> - <RegExpr String="^\s*=end\s+comment\s*$" context="#pop" attribute="Pod" column="0" lookAhead="1"/> - </context> - <context name="PodComment" attribute="Comment" lineEndContext="#pop"/> - - <context name="PodEndComment" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop"> - <StringDetect String="end" context="PodEndCommentName" attribute="Pod Block" endRegion="pod"/> - </context> - <context name="PodEndCommentName" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop#pop!Error"> - <DetectSpaces attribute="Normal Text"/> - <StringDetect String="comment" context="#pop#pop#pop#pop!Error" attribute="Pod Typename Value"/> - </context> - - - <context name="PodBeginTypename" attribute="Error" lineEndContext="PodInnerBlock"> - <RegExpr String="^\s*=end\s+%1\b" dynamic="1" context="PodEnd" attribute="Pod" column="0" lookAhead="1"/> - <DetectSpaces attribute="Normal Text"/> - <DetectChar char=":" context="PodBlockConfigKey" attribute="Pod Operator"/> - <DetectChar char="=" context="PodEndError" attribute="Pod" firstNonSpace="1"/> - </context> - - <context name="PodInnerBlock" attribute="Pod Paragraph" lineEndContext="#stay" fallthrough="1" fallthroughContext="PodInnerBlockFormat"> - <RegExpr String="^\s*=end\b" context="#pop" attribute="Pod" column="0" lookAhead="1"/> - <DetectSpaces/> - <DetectChar char="=" context="StartPod" attribute="Pod" firstNonSpace="1"/> - <RegExpr attribute="Pod Paragraph" context="#stay" String="&allnopodfmt;"/> - </context> - - <context name="PodInnerBlockFormat" attribute="Pod Paragraph" lineEndContext="#stay"> - <IncludeRules context="PodFormat"/> - </context> - - <context name="PodEnd" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop"> - <DetectSpaces attribute="Normal Text"/> - <DetectChar char="=" context="#stay" attribute="Pod"/> - <StringDetect String="end" context="PodEndName" attribute="Pod Block" endRegion="pod"/> - </context> - <context name="PodEndName" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop#pop"> - <DetectSpaces attribute="Normal Text"/> - <RegExpr String="&ident;" context="#pop#pop#pop#pop!Error" attribute="Pod Typename Value"/> - </context> - - <context name="PodEndError" attribute="Pod Paragraph" lineEndContext="#pop#pop#pop"> - <StringDetect String="end" attribute="Pod Block" context="#pop#pop#pop!Error" endRegion="pod"/> - </context> - - <!-- Pod configuration for =begin --> - - <context name="PodBlockConfigError" attribute="Error" lineEndContext="#pop#pop!PodInnerBlock"/> - - <context name="PodBlockConfigKey" attribute="Pod Key" lineEndContext="#pop!PodInnerBlock" fallthrough="1" fallthroughContext="PodBlockConfigError"> - <DetectChar char="!" context="#pop!PodBlockConfigKeyName" attribute="Pod Operator"/> - <Int context="PodBlockConfigKeyIntName" attribute="Decimal"/> - <DetectIdentifier context="PodBlockConfigParam" attribute="Pod Key"/> - </context> - - <context name="PodBlockConfigKeyName" attribute="Pod Key" lineEndContext="#pop!PodTypenameValue" fallthrough="1" fallthroughContext="PodBlockConfigError"> - <DetectIdentifier context="PodBlockConfigParam" attribute="Pod Key"/> - </context> - - <context name="PodBlockConfigKeyIntName" attribute="Pod Key" lineEndContext="#pop#pop!PodBlockConfigError" fallthrough="1" fallthroughContext="#pop!PodBlockConfigError"> - <DetectIdentifier context="#pop#pop" attribute="Pod Key"/> - </context> - - <context name="PodBlockConfigParam" attribute="Pod Key" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop"> - <AnyChar String="<" context="PodParamSequence" attribute="Pod Operator"/> - <DetectChar char="{" context="PodParamHash" attribute="Pod Operator"/> - <AnyChar String="([" context="PodParamList" attribute="Pod Operator"/> - </context> - - - <!-- Pod =for --> - - <context name="PodFor" attribute="Pod Typename" lineEndContext="#pop#pop!Error" fallthrough="1" fallthroughContext="#pop#pop!Error"> - <DetectSpaces attribute="Normal Text"/> - <keyword String="podtypename" context="#pop!PodConfig" attribute="Pod Typename"/> - </context> - - <!-- Pod configuration for =for --> - - <context name="PodConfigError" attribute="Error" lineEndContext="#pop#pop!PodTypenameValue"/> - - <context name="PodConfig" attribute="Normal Text" lineEndContext="#pop!PodTypenameValue" fallthrough="1" fallthroughContext="PodConfigError"> - <DetectSpaces/> - <DetectChar char=":" context="PodConfigKey" attribute="Pod Operator"/> - </context> - - <context name="PodConfigKey" attribute="Pod Key" lineEndContext="#pop#pop!PodTypenameValue" fallthrough="1" fallthroughContext="#pop!PodConfigError"> - <DetectChar char="!" context="#pop!PodConfigKeyName" attribute="Pod Operator"/> - <Int context="PodConfigKeyIntName" attribute="Decimal"/> - <DetectIdentifier context="PodConfigParam" attribute="Pod Key"/> - </context> - - <context name="PodConfigKeyName" attribute="Pod Key" lineEndContext="#pop#pop!PodTypenameValue" fallthrough="1" fallthroughContext="#pop!PodConfigError"> - <DetectIdentifier context="PodConfigParam" attribute="Pod Key"/> - </context> - - <context name="PodConfigKeyIntName" attribute="Pod Key" lineEndContext="#pop#pop#pop!PodConfigError" fallthrough="1" fallthroughContext="#pop#pop!PodConfigError"> - <DetectIdentifier context="#pop#pop" attribute="Pod Key"/> - </context> - - <context name="PodConfigParam" attribute="Pod Key" lineEndContext="#pop#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <AnyChar String="<" context="PodParamSequence" attribute="Pod Operator"/> - <DetectChar char="{" context="PodParamHash" attribute="Pod Operator"/> - <AnyChar String="([" context="PodParamList" attribute="Pod Operator"/> - </context> - - <context name="PodParamSequence" attribute="Pod Config" lineEndContext="#stay"> - <DetectSpaces/> - <keyword String="podvalue" context="#stay" attribute="Data Type"/> - <DetectIdentifier/> - <AnyChar String="0123456789." context="Number" lookAhead="1"/> - <DetectChar char=">" context="#pop#pop#pop" attribute="Pod Operator"/> - <DetectChar char="'" context="PodSQString" attribute="String"/> - <DetectChar char=""" context="PodQString" attribute="String"/> - </context> - - <context name="PodParamHash" attribute="Pod Config" lineEndContext="#stay"> - <DetectSpaces/> - <Detect2Chars char="=" char1=">" context="#stay" attribute="Pod Operator"/> - <DetectChar char="," context="#stay" attribute="Pod Operator"/> - <keyword String="podvalue" context="#stay" attribute="Data Type"/> - <DetectIdentifier/> - <DetectChar char="'" context="PodSQString" attribute="String"/> - <DetectChar char=""" context="PodQString" attribute="String"/> - <AnyChar String="0123456789." context="Number" lookAhead="1"/> - <DetectChar char="}" context="#pop#pop#pop" attribute="Pod Operator"/> - </context> - - <context name="PodParamList" attribute="Pod Config" lineEndContext="#stay"> - <DetectSpaces/> - <DetectChar char="," context="#stay" attribute="Pod Operator"/> - <keyword String="podvalue" context="#stay" attribute="Data Type"/> - <DetectIdentifier/> - <DetectChar char="'" context="PodSQString" attribute="String"/> - <DetectChar char=""" context="PodQString" attribute="String"/> - <AnyChar String="0123456789." context="Number" lookAhead="1"/> - <AnyChar String="])" context="#pop#pop#pop" attribute="Pod Operator"/> - </context> - - - <!-- Pod String --> - - <context name="PodSQString" attribute="String" lineEndContext="#stay"> - <Detect2Chars char="\" char1="'" context="#stay" attribute="String Special Character"/> - <DetectChar char="'" context="#pop" attribute="String Delimiter"/> - <RegExpr String="(?:[^\\']*|\\[^']|\\$)*" context="#stay" attribute="String"/> - </context> - - <context name="PodQString" attribute="String" lineEndContext="#stay"> - <DetectChar char=""" context="#pop" attribute="String Delimiter"/> - <DetectChar char="\" context="SpecialChar" attribute="String Special Character"/> - <RegExpr String="(?:[^"\\]*|\\$)*" context="#stay" attribute="String"/> - </context> - - <context name="find_SpecialChar" attribute="String Special Character" lineEndContext="#stay"> - <Detect2Chars char="c" char1="[" context="UnicodeCodepoint" attribute="String Special Character"/> - <DetectChar char="c" context="UnicodeCodepointDecimal" attribute="String Special Character"/> - <DetectChar char="x" context="HexaString" attribute="String Special Character"/> - <DetectChar char="o" context="OctalString" attribute="String Special Character"/> - </context> - - <context name="SpecialChar" attribute="String Special Character" lineEndContext="#pop"> - <IncludeRules context="find_SpecialChar"/> - <RegExpr String="." context="#pop" attribute="String"/> - </context> - - <context name="UnicodeCodepoint" attribute="String Special Character" lineEndContext="#stay"> - <DetectSpaces/> - <DetectIdentifier/> - <DetectChar char="]" context="#pop#pop" attribute="String Special Character"/> - <DetectChar char="," context="#stay" attribute="Separator Symbol"/> - </context> - - <context name="UnicodeCodepointDecimal" attribute="String Special Character" lineEndContext="#pop#pop"> - <!-- 0 to 1114111 --> - <RegExpr String="0*(?:1(?:0\d{5}|1(?:O\d{4}|(?:1[0-3]\d{3}|4(?:0\d\d|1(?:0\d|1[01]))))))|\d{1,6}|0+" context="UnicodeCodepointDecimalCheck" attribute="String Special Character"/> - <RegExpr String="[^"]" context="#pop" attribute="Error"/> - </context> - <context name="UnicodeCodepointDecimalCheck" attribute="Error" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop"> - <AnyChar String="0123456789" context="#pop#pop#pop" attribute="Error"/> - </context> - - <context name="HexaString" attribute="String Special Character" lineEndContext="#pop#pop"> - <DetectChar char="[" context="HexaStringBracket" attribute="String Special Character"/> - <!-- 0 to 0x10FFFF --> - <RegExpr String="0*(?:10[0-9a-fA-F]{4}|[0-9a-fA-F]{1,5})|0+" context="HexaStringCheck" attribute="String Special Character"/> - <RegExpr String="[^"]" context="#pop#pop" attribute="Error"/> - </context> - <context name="HexaStringCheck" attribute="Error" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop"> - <AnyChar String="0123456789abcdefABCDEF" context="#pop#pop#pop" attribute="Error"/> - </context> - <context name="HexaStringBracket" attribute="String Special Character" lineEndContext="#stay"> - <DetectSpaces/> - <DetectChar char="]" context="#pop#pop#pop" attribute="Error"/> - <!-- 0 to 0x10FFFF --> - <RegExpr String="0*(?:10[0-9a-fA-F]{4}|[0-9a-fA-F]{1,5})|0+" context="HexaStringBracketCheck" attribute="String Special Character"/> - </context> - <context name="HexaStringBracketCheck" attribute="String Special Character" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop#pop#pop"> - <DetectChar char="]" context="#pop#pop#pop#pop" attribute="String Special Character"/> - <DetectChar char="," context="#pop" attribute="Separator Symbol"/> - <RegExpr String="[^]"]" context="#stay" attribute="Error"/> - </context> - - <context name="OctalString" attribute="String Special Character" lineEndContext="#pop#pop"> - <DetectChar char="[" context="OctalStringBracket" attribute="String Special Character"/> - <!-- 0 to 0o4177777 --> - <RegExpr String="0*(?:[0-3][0-7]{6}|4[01]|[0-7])[0-7]{0,5}|0+" context="OctalStringCheck" attribute="String Special Character"/> - <RegExpr String="[^"]" context="#stay" attribute="Error"/> - </context> - <context name="OctalStringCheck" attribute="Error" lineEndContext="#pop#pop#pop" fallthrough="1" fallthroughContext="#pop#pop#pop"> - <AnyChar String="01234567" context="#pop#pop#pop" attribute="Error"/> - </context> - <context name="OctalStringBracket" attribute="String Special Character" lineEndContext="#stay"> - <DetectChar char="]" context="#pop#pop#pop" attribute="Error"/> - <!-- 0 to 0o4177777 --> - <RegExpr String="0*(?:[0-3][0-7]{6}|4[01]|[0-7])[0-7]{0,5}|0+" context="OctalStringBracketCheck" attribute="String Special Character"/> - </context> - <context name="OctalStringBracketCheck" attribute="String Special Character" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop#pop#pop"> - <DetectChar char="]" context="#pop#pop#pop#pop" attribute="String Special Character"/> - <DetectChar char="," context="#pop" attribute="Separator Symbol"/> - <RegExpr String="[^]"]" context="#stay" attribute="Error"/> - </context> - - - <!-- Q String --> - - <context name="Q_String" attribute="String" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop"> - <RegExpr String="Q\s+(?=['(])|Q\s*(?=[^()>」\]}'a-zA-Z0-9])" context="Q_StringOpen" attribute="String"/> - <RegExpr String="Q\s*$" context="Q_String2" attribute="String"/> - </context> - - <context name="Q_String2" attribute="String" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!Q_StringOpen"> - <DetectSpaces/> - </context> - - <context name="Q_StringOpen" attribute="String" lineEndContext="#stay"> - <DetectChar char=":" context="#pop#pop!Q_StringModifier" attribute="Operator"/> - <DetectChar char="(" context="#pop#pop!Q_String(" attribute="String Delimiter"/> - <DetectChar char="[" context="#pop#pop!Q_String[" attribute="String Delimiter"/> - <DetectChar char="{" context="#pop#pop!Q_String{" attribute="String Delimiter"/> - <DetectChar char="「" context="#pop#pop!Q_String「" attribute="String Delimiter"/> - <DetectChar char="<" context="#pop#pop!Q_String<" attribute="String Delimiter"/> - <RegExpr String="(.)" context="#pop#pop!Q_StringAny" attribute="String Delimiter"/> - </context> - - <context name="Q_String(" attribute="String" lineEndContext="#stay"> - <DetectChar char=")" context="#pop" attribute="String Delimiter"/> - <DetectChar char="(" context="Q_String(" attribute="String Delimiter"/> - <RegExpr String="[^()]*" context="#stay" attribute="String"/> - </context> - - <context name="Q_String[" attribute="String" lineEndContext="#stay"> - <DetectChar char="]" context="#pop" attribute="String Delimiter"/> - <DetectChar char="[" context="Q_String[" attribute="String Delimiter"/> - <RegExpr String="[^\[\]]*" context="#stay" attribute="String"/> - </context> - - <context name="Q_String{" attribute="String" lineEndContext="#stay"> - <DetectChar char="}" context="#pop" attribute="String Delimiter"/> - <DetectChar char="{" context="Q_String{" attribute="String Delimiter"/> - <RegExpr String="[^{}]*" context="#stay" attribute="String"/> - </context> - - <context name="Q_String「" attribute="String" lineEndContext="#stay"> - <DetectChar char="」" context="#pop" attribute="String Delimiter"/> - <DetectChar char="「" context="Q_String「" attribute="String Delimiter"/> - <RegExpr String="[^「」]*" context="#stay" attribute="String"/> - </context> - - <context name="Q_String<" attribute="String" lineEndContext="#stay"> - <DetectChar char=">" context="#pop" attribute="String Delimiter"/> - <DetectChar char="<" context="Q_String<" attribute="String Delimiter"/> - <RegExpr String="[^<>]*" context="#stay" attribute="String"/> - </context> - - <context name="Q_StringAny" attribute="String" lineEndContext="#stay"> - <DetectChar char="1" dynamic="1" context="#pop" attribute="String Delimiter"/> - <RegExpr String="[^%1]*" dynamic="1" context="#stay" attribute="String"/> - </context> - - <context name="q_Q_StringModifier" attribute="Operator" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop!q_String"> - <DetectChar char=":" context="#pop#pop!q_QuotingForm2" attribute="Operator"/> - </context> - - <context name="qq_Q_StringModifier" attribute="Operator" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop!qq_String"> - <DetectChar char=":" context="#pop!qq_QuotingForm" attribute="Operator"/> - </context> - - <context name="Q_StringModifier" attribute="Operator" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop!q_QuotingForm2"> - <DetectChar char="q" context="#pop!q_QuotingForm" attribute="Operator"/> - <DetectChar char="'" context="q_Q_StringModifier" attribute="Operator"/> - <DetectChar char=""" context="qq_Q_StringModifier" attribute="Operator"/> - </context> - - <context name="q_QuotingForm" attribute="Operator" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop!q_QuotingForm2"> - <DetectChar char="q" context="#pop!qq_QuotingForm" attribute="Operator"/> - <DetectChar char=":" context="#pop!q_QuotingForm2" attribute="Operator"/> - </context> - <context name="q_QuotingForm2" attribute="Operator" lineEndContext="#pop" fallthrough="1" fallthroughContext="q_String"> - <AnyChar String="wvx:sahfb" context="#stay" attribute="Operator"/> - <!-- :closure as qq --> - <DetectChar char="c" context="#pop!qq_QuotingForm" attribute="Operator"/> - <Detect2Chars char="t" char1="o" context="q_Heredoc" attribute="Operator"/> - <WordDetect String="heredoc" context="q_Heredoc" attribute="Operator"/> - <keyword String="quoting" context="#stay" attribute="Operator"/> - </context> - - <context name="qq_QuotingForm" attribute="Operator" lineEndContext="#pop" fallthrough="1" fallthroughContext="qq_String"> - <AnyChar String="wvx:sahfcb" context="#stay" attribute="Operator"/> - <Detect2Chars char="t" char1="o" context="qq_Heredoc" attribute="Operator"/> - <WordDetect String="heredoc" context="qq_Heredoc" attribute="Operator"/> - <keyword String="quoting" context="#stay" attribute="Operator"/> - </context> - - - <!-- q and qq Heredoc --> - - <context name="q_Heredoc" attribute="String" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <RegExpr String="/([^/]+)/" context="q_HeredocTerminator" attribute="String Delimiter"/> - </context> - <context name="q_HeredocTerminator" attribute="String" lineEndContext="#stay"> - <DetectSpaces/> - <StringDetect String="%1" dynamic="1" context="#pop#pop#pop" attribute="String Delimiter" firstNonSpace="1"/> - <RegExpr String="(?:[^\\]*|\\(?![\\%1]|"ingconstruct;|$))*" dynamic="1" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="qq_Heredoc" attribute="String" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <RegExpr String="/([^/]+)/" context="qq_HeredocTerminator" attribute="String Delimiter"/> - </context> - <context name="qq_HeredocTerminator" attribute="String" lineEndContext="#stay"> - <DetectSpaces/> - <StringDetect String="%1" dynamic="1" context="#pop#pop#pop" attribute="String Delimiter" firstNonSpace="1"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^\\${@&]*" context="#stay" attribute="String"/> - </context> - - - <!-- q String --> - - <context name="q_String" attribute="String" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop"> - <DetectSpaces/> - <DetectChar char="(" context="#pop#pop!q_String(" attribute="String Delimiter"/> - <DetectChar char="[" context="#pop#pop!q_String[" attribute="String Delimiter"/> - <DetectChar char="{" context="#pop#pop!q_String{" attribute="String Delimiter"/> - <DetectChar char="<" context="#pop#pop!q_String<" attribute="String Delimiter"/> - <RegExpr String="([^a-zA-Z0-9])" context="#pop#pop!q_StringAny" attribute="String Delimiter"/> - </context> - - <context name="q_String(" attribute="String" lineEndContext="#stay"> - <DetectChar char=")" context="#pop" attribute="String Delimiter"/> - <DetectChar char="(" context="q_String(" attribute="String Delimiter"/> - <Detect2Chars char="\" char1="(" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1=")" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="\" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^()\\]*|\\(?![()\\]|"ingconstruct;|$))*" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="q_String[" attribute="String" lineEndContext="#stay"> - <DetectChar char="]" context="#pop" attribute="String Delimiter"/> - <DetectChar char="[" context="q_String[" attribute="String Delimiter"/> - <Detect2Chars char="\" char1="[" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="]" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="\" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^\[\]\\]*|\\(?![\[\]\\]|"ingconstruct;|$))*" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="q_String{" attribute="String" lineEndContext="#stay"> - <DetectChar char="}" context="#pop" attribute="String Delimiter"/> - <DetectChar char="{" context="q_String{" attribute="String Delimiter"/> - <Detect2Chars char="\" char1="{" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="}" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="\" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^{}\\]*|\\(?![{}\\]|"ingconstruct;|$))*" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="q_String<" attribute="String" lineEndContext="#stay"> - <DetectChar char=">" context="#pop" attribute="String Delimiter"/> - <DetectChar char="<" context="q_String<" attribute="String Delimiter"/> - <Detect2Chars char="\" char1="<" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1=">" context="#stay" attribute="String Special Character"/> - <Detect2Chars char="\" char1="\" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^<>\\]*|\\(?![<>\\]|"ingconstruct;|$))*" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="q_StringAny" attribute="String" lineEndContext="#stay"> - <DetectChar char="1" dynamic="1" context="#pop" attribute="String Delimiter"/> - <StringDetect String="\%1" dynamic="1" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^\\%1]*|\\(?![\\%1]|"ingconstruct;|$))*" dynamic="1" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <context name="q_RawString" attribute="String" lineEndContext="#stay"> - <DetectChar char="'" context="#pop" attribute="String Delimiter"/> - <Detect2Chars char="\" char1="'" context="#stay" attribute="String Special Character"/> - <RegExpr String="(?:[^\\']*|\\(?![\\']|"ingconstruct;|$))*" context="#stay" attribute="String"/> - <Detect2Chars char="\" char1="q" context="q_QuotingForm" attribute="Operator"/> - </context> - - <!-- qq String --> - - <context name="qq_String" attribute="String" lineEndContext="#stay" fallthrough="1" fallthroughContext="#pop#pop"> - <DetectSpaces/> - <DetectChar char="(" context="#pop#pop!qq_String(" attribute="String Delimiter"/> - <DetectChar char="[" context="#pop#pop!qq_String[" attribute="String Delimiter"/> - <DetectChar char="{" context="#pop#pop!qq_String{" attribute="String Delimiter"/> - <DetectChar char="<" context="#pop#pop!qq_String<" attribute="String Delimiter"/> - <RegExpr String="([^a-zA-Z0-9])" context="#pop#pop!qq_StringAny" attribute="String Delimiter"/> - </context> - - <context name="qq_String(" attribute="String" lineEndContext="#stay"> - <DetectChar char=")" context="#pop" attribute="String Delimiter"/> - <DetectChar char="(" context="qq_String(" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^()\\${@&]*" context="#stay" attribute="String"/> - </context> - - <context name="qq_String[" attribute="String" lineEndContext="#stay"> - <DetectChar char="]" context="#pop" attribute="String Delimiter"/> - <DetectChar char="[" context="qq_String[" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^\[\]\\${@&]*" context="#stay" attribute="String"/> - </context> - - <context name="qq_String{" attribute="String" lineEndContext="#stay"> - <DetectChar char="}" context="#pop" attribute="String Delimiter"/> - <DetectChar char="{" context="qq_String{" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^{}\\$@&]*" context="#stay" attribute="String"/> - </context> - - <context name="qq_String<" attribute="String" lineEndContext="#stay"> - <DetectChar char=">" context="#pop" attribute="String Delimiter"/> - <DetectChar char="<" context="qq_String<" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^<>\\${@&]*" context="#stay" attribute="String"/> - </context> - - <context name="qq_String«" attribute="String" lineEndContext="#stay"> - <DetectChar char="»" context="#pop" attribute="String Delimiter"/> - <DetectChar char="«" context="qq_String«" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^«»\\${@&]*" context="#stay" attribute="String"/> - </context> - - <context name="qq_String<<" attribute="String" lineEndContext="#stay"> - <Detect2Chars char=">" char1=">" context="#pop" attribute="String Delimiter"/> - <Detect2Chars char="<" char1="<" context="qq_String<<" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="([^<>\\${@&]*|<(?!<)|>(?!>))" context="#stay" attribute="String"/> - </context> - - <context name="qq_StringAny" attribute="String" lineEndContext="#stay"> - <DetectChar char="1" dynamic="1" context="#pop" attribute="String Delimiter"/> - <StringDetect String="\%1" dynamic="1" context="#stay" attribute="String Special Character"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^%1\\${@&]*" dynamic="1" context="#stay" attribute="String"/> - </context> - - <context name="qq_RawString" attribute="String" lineEndContext="#stay"> - <DetectChar char=""" context="#pop" attribute="String Delimiter"/> - <IncludeRules context="find_qq_StringCommon"/> - <RegExpr String="[^\\"${@&]*" context="#stay" attribute="String"/> - </context> - - <context name="find_qq_StringCommon" attribute="String" lineEndContext="#stay"> - <DetectChar char="\" context="qq_StringEscape" attribute="Operator" lookAhead="1"/> - <DetectChar char="{" context="qq_Interpolation" attribute="String (interpolated)"/> - <DetectChar char="$" context="qq_StringMaybeVar$" attribute="String" lookAhead="1"/> - <AnyChar String="@%" context="qq_StringMaybeVar" attribute="String" lookAhead="1"/> - <DetectChar char="&" context="qq_StringSigil" attribute="String" lookAhead="1"/> - </context> - - <context name="qq_StringEscape" attribute="String Special Character" lineEndContext="#pop"> - <Detect2Chars char="\" char1="q" context="#pop!q_QuotingForm" attribute="Operator"/> - <Detect2Chars char="\" char1="x" context="HexaString" attribute="String Special Character"/> - <StringDetect String="\c[" context="UnicodeCodepoint" attribute="String Special Character"/> - <Detect2Chars char="\" char1="c" context="UnicodeCodepointDecimal" attribute="String Special Character"/> - <Detect2Chars char="\" char1="o" context="OctalString" attribute="String Special Character"/> - <RegExpr String="\\.?" context="#pop" attribute="String Special Character"/> - </context> - - <context name="qq_Interpolation" attribute="String (interpolated)" lineEndContext="#stay"> - <DetectChar char="}" context="#pop" attribute="String (interpolated)"/> - <IncludeRules context="base"/> - </context> - - <context name="qq_StringSigil" attribute="Function" lineEndContext="#stay"> - <RegExpr String="&&ident;\(" context="#pop!FunctionParameters" attribute="Function"/> - <DetectChar char="&" context="#pop" attribute="String"/> - </context> - - <context name="qq_StringMaybeVar$" attribute="String" lineEndContext="#stay"> - <RegExpr String="\$(?=[&twigils;]?&prefixdollarvarname;)" context="qq_InterpolationVar" attribute="Variable"/> - <DetectChar char="$" context="#pop" attribute="String"/> - </context> - - <context name="qq_StringMaybeVar" attribute="String" lineEndContext="#stay"> - <RegExpr String="@\(\)|[%@]\$/|[@%]&ident;" context="qq_Interpolation1" attribute="Variable"/> - <AnyChar String="@%" context="#pop" attribute="String"/> - </context> - - <context name="qq_InterpolationVar" attribute="String" lineEndContext="#stay"> - <AnyChar String="&twigils;" context="#stay" attribute="Twigil"/> - <RegExpr String="&dollarvarname;" context="#pop!qq_Interpolation1" attribute="Variable"/> - </context> - - <context name="qq_Interpolation1" attribute="String" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> - <DetectChar char="[" context="qq_InterpolationIndex" attribute="Function"/> - <DetectChar char="." context="qq_InterpolationFunction" attribute="Function" lookAhead="1"/> - </context> - - <context name="qq_InterpolationIndex" attribute="String" lineEndContext="#stay"> - <DetectChar char="]" context="#pop#pop#pop" attribute="Function"/> - <IncludeRules context="base"/> - </context> - - <context name="qq_InterpolationFunction" attribute="String" lineEndContext="#stay"> - <RegExpr String="(?:\.&ident;)*\.&ident;\(" context="#pop#pop#pop!FunctionParameters" attribute="Function"/> - <DetectChar char="." context="#pop#pop#pop" attribute="String"/> - </context> - - <context name="FunctionParameters" attribute="String" lineEndContext="#stay"> - <DetectChar char=")" context="#pop" attribute="Function"/> - <DetectChar char="(" context="FunctionParameters" attribute="Function"/> - <IncludeRules context="base"/> - </context> - - - <!-- Comment --> - - <context name="StartComment" attribute="Comment" lineEndContext="#pop" fallthrough="1" fallthroughContext="SingleLineComment"> - <DetectChar attribute="Comment" context="MultilineComment" char="`"/> - <AnyChar attribute="Pod Operator" context="MultilineComment" String="=|"/> - </context> - - <context name="MultilineComment" attribute="Comment" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop!SingleLineComment"> - <!-- TODO a new rule is needed to find the corresponding closures --> - <StringDetect attribute="Comment" context="#pop#pop!MultilineComment(((" String="(((" beginRegion="comment"/> - <StringDetect attribute="Comment" context="#pop#pop!MultilineComment[[[" String="[[[" beginRegion="comment"/> - <StringDetect attribute="Comment" context="#pop#pop!MultilineComment{{{" String="{{{" beginRegion="comment"/> - <StringDetect attribute="Comment" context="#pop#pop!MultilineComment«««" String="«««" beginRegion="comment"/> - <StringDetect attribute="Comment" context="#pop#pop!MultilineComment<<<" String="<<<" beginRegion="comment"/> - <Detect2Chars attribute="Comment" context="#pop#pop!MultilineComment((" char="(" char1="(" beginRegion="comment"/> - <Detect2Chars attribute="Comment" context="#pop#pop!MultilineComment[[" char="[" char1="[" beginRegion="comment"/> - <Detect2Chars attribute="Comment" context="#pop#pop!MultilineComment{{" char="{" char1="{" beginRegion="comment"/> - <Detect2Chars attribute="Comment" context="#pop#pop!MultilineComment««" char="«" char1="«" beginRegion="comment"/> - <Detect2Chars attribute="Comment" context="#pop#pop!MultilineComment<<" char="<" char1="<" beginRegion="comment"/> - <DetectChar attribute="Comment" context="#pop#pop!MultilineComment(" char="(" beginRegion="comment"/> - <DetectChar attribute="Comment" context="#pop#pop!MultilineComment[" char="[" beginRegion="comment"/> - <DetectChar attribute="Comment" context="#pop#pop!MultilineComment{" char="{" beginRegion="comment"/> - <DetectChar attribute="Comment" context="#pop#pop!MultilineComment«" char="«" beginRegion="comment"/> - <DetectChar attribute="Comment" context="#pop#pop!MultilineComment<" char="<" beginRegion="comment"/> - <!-- etc --> - </context> - - <context name="MultilineComment(((" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <StringDetect String=")))" attribute="Comment" context="#pop" endRegion="comment"/> - <StringDetect String="(((" attribute="Comment" context="MultilineComment(((" beginRegion="comment"/> - </context> - <context name="MultilineComment[[[" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <StringDetect String="]]]" attribute="Comment" context="#pop" endRegion="comment"/> - <StringDetect String="[[[" attribute="Comment" context="MultilineComment[[[" beginRegion="comment"/> - </context> - <context name="MultilineComment{{{" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <StringDetect String="}}}" attribute="Comment" context="#pop" endRegion="comment"/> - <StringDetect String="{{{" attribute="Comment" context="MultilineComment{{{" beginRegion="comment"/> - </context> - <context name="MultilineComment«««" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <StringDetect String="»»»" attribute="Comment" context="#pop" endRegion="comment"/> - <StringDetect String="«««" attribute="Comment" context="MultilineComment«««" beginRegion="comment"/> - </context> - <context name="MultilineComment<<<" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <StringDetect String=">>>" attribute="Comment" context="#pop" endRegion="comment"/> - <StringDetect String="<<<" attribute="Comment" context="MultilineComment<<<" beginRegion="comment"/> - </context> - - <context name="MultilineComment((" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <Detect2Chars char=")" char1=")" attribute="Comment" context="#pop" endRegion="comment"/> - <Detect2Chars char="(" char1="(" attribute="Comment" context="MultilineComment((" beginRegion="comment"/> - </context> - <context name="MultilineComment[[" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <Detect2Chars char="]" char1="]" attribute="Comment" context="#pop" endRegion="comment"/> - <Detect2Chars char="[" char1="[" attribute="Comment" context="MultilineComment[[" beginRegion="comment"/> - </context> - <context name="MultilineComment{{" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <Detect2Chars char="}" char1="}" attribute="Comment" context="#pop" endRegion="comment"/> - <Detect2Chars char="{" char1="{" attribute="Comment" context="MultilineComment{{" beginRegion="comment"/> - </context> - <context name="MultilineComment««" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <Detect2Chars char="»" char1="»" attribute="Comment" context="#pop" endRegion="comment"/> - <Detect2Chars char="«" char1="«" attribute="Comment" context="MultilineComment««" beginRegion="comment"/> - </context> - <context name="MultilineComment<<" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <Detect2Chars char=">" char1=">" attribute="Comment" context="#pop" endRegion="comment"/> - <Detect2Chars char="<" char1="<" attribute="Comment" context="MultilineComment<<" beginRegion="comment"/> - </context> - - <context name="MultilineComment(" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <DetectChar char=")" attribute="Comment" context="#pop" endRegion="comment"/> - <DetectChar char="(" attribute="Comment" context="MultilineComment(" beginRegion="comment"/> - </context> - <context name="MultilineComment[" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <DetectChar char="]" attribute="Comment" context="#pop" endRegion="comment"/> - <DetectChar char="[" attribute="Comment" context="MultilineComment[" beginRegion="comment"/> - </context> - <context name="MultilineComment{" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <DetectChar char="}" attribute="Comment" context="#pop" endRegion="comment"/> - <DetectChar char="{" attribute="Comment" context="MultilineComment{" beginRegion="comment"/> - </context> - <context name="MultilineComment«" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <DetectChar char="»" attribute="Comment" context="#pop" endRegion="comment"/> - <DetectChar char="«" attribute="Comment" context="MultilineComment«" beginRegion="comment"/> - </context> - <context name="MultilineComment<" attribute="Comment" lineEndContext="#stay"> - <IncludeRules context="SingleLineComment"/> - <DetectChar char=">" attribute="Comment" context="#pop" endRegion="comment"/> - <DetectChar char="<" attribute="Comment" context="MultilineComment<" beginRegion="comment"/> - </context> - - <context name="SingleLineComment" attribute="Comment" lineEndContext="#pop#pop"> - <DetectSpaces/> - <IncludeRules context="##Alerts"/> - <DetectIdentifier/> - </context> - - - <!-- Error --> - - <context name="Error" attribute="Error" lineEndContext="#pop"/> - - <context name="CharErrorIfNoSep" attribute="Error" lineEndContext="#pop"> - <RegExpr String="[^;)]" context="#pop" attribute="Error"/> - </context> - - <context name="CharError" attribute="Error" lineEndContext="#pop"> - <RegExpr String="." context="#pop" attribute="Error"/> - </context> - - </contexts> - - <itemDatas> - <itemData name="Normal Text" defStyleNum="dsNormal"/> - <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/> - <itemData name="Keyword Value" defStyleNum="dsKeyword" spellChecking="false"/> - <itemData name="Variable" defStyleNum="dsVariable" spellChecking="false"/> - <itemData name="Twigil" defStyleNum="dsAttribute" spellChecking="false"/> - <itemData name="Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/> - <itemData name="Variable Storage" defStyleNum="dsKeyword" spellChecking="false" bold="1"/> - <itemData name="Property" defStyleNum="dsBuiltIn" spellChecking="false" italic="1"/> - <itemData name="Declare Routine" defStyleNum="dsBuiltIn" spellChecking="false"/> - <itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/> - <itemData name="Operator" defStyleNum="dsKeyword" spellChecking="false"/> - <itemData name="Separator Symbol" defStyleNum="dsNormal" spellChecking="false"/> - <itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/> - <itemData name="Attribute" defStyleNum="dsAttribute" spellChecking="false"/> - <itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/> - <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> - <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> - <itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> - <itemData name="String" defStyleNum="dsString"/> - <itemData name="String Delimiter" defStyleNum="dsChar" spellChecking="false"/> - <itemData name="String (interpolated)" defStyleNum="dsString"/> - <itemData name="String Special Character" defStyleNum="dsChar"/> - <itemData name="Pattern" defStyleNum="dsOthers" spellChecking="false"/> - <itemData name="Pattern Meta Character" defStyleNum="dsChar" spellChecking="false"/> - <itemData name="Pattern Character Class" defStyleNum="dsBaseN" spellChecking="false"/> - <itemData name="Pattern Unicode Property" defStyleNum="dsBaseN" spellChecking="false"/> - <itemData name="Pattern Character" defStyleNum="dsChar" spellChecking="false"/> - <itemData name="Pattern Modifier" defStyleNum="dsKeyword" spellChecking="false"/> - <itemData name="Pattern Quantifier" defStyleNum="dsControlFlow" spellChecking="false"/> - <itemData name="Pattern Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/> - <itemData name="Pattern Special Character" defStyleNum="dsBuiltIn" spellChecking="false"/> - <itemData name="Comment" defStyleNum="dsComment"/> - <itemData name="Error" defStyleNum="dsError" spellChecking="false"/> - <itemData name="Pod" defStyleNum="dsDocumentation" spellChecking="false"/> - <itemData name="Pod Paragraph" defStyleNum="dsDocumentation"/> - <itemData name="Pod Block" defStyleNum="dsRegionMarker" spellChecking="false"/> - <itemData name="Pod Typename" defStyleNum="dsAnnotation" spellChecking="false"/> - <itemData name="Pod Typename Value" defStyleNum="dsCommentVar" spellChecking="false"/> - <itemData name="Pod Unknown" defStyleNum="dsError" spellChecking="false"/> - <itemData name="Pod Operator" defStyleNum="dsOperator" spellChecking="false"/> - <itemData name="Pod Key" defStyleNum="dsAttribute" spellChecking="false"/> - <itemData name="Pod Config" defStyleNum="dsCommentVar" spellChecking="false"/> - <itemData name="Pod Bold" defStyleNum="dsDocumentation" bold="1"/> - <itemData name="Pod Italic" defStyleNum="dsDocumentation" italic="1"/> - <itemData name="Pod Underline" defStyleNum="dsDocumentation" underline="1"/> - <itemData name="Pod Link" defStyleNum="dsOthers" underline="1"/> - <itemData name="Pod Note" defStyleNum="dsInformation"/> - <itemData name="Pod Comment" defStyleNum="dsComment"/> - <itemData name="Pod Verbatim" defStyleNum="dsInformation" spellChecking="false"/> - <itemData name="Pod Unicode" defStyleNum="dsChar" spellChecking="false"/> - <itemData name="Pod Indexed Terms" defStyleNum="dsOthers" spellChecking="false"/> - </itemDatas> - </highlighting> - <general> - <comments> - <comment name="singleLine" start="#"/> - </comments> - <keywords casesensitive="1" weakDeliminator="-'"/> - </general> -</language> -<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml index 03acb0f5a9..29ec21e286 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/powershell.xml @@ -1,7 +1,7 @@ <!DOCTYPE language SYSTEM "language.dtd"> <language name="PowerShell" - version="6" + version="7" kateversion="5.0" extensions="*.ps1;*.ps1m;*.ps1d" section="Scripts" @@ -880,7 +880,6 @@ <IncludeRules context="Cmdlet" /> <DetectChar attribute="String" context="String" char="""/> <Detect2Chars attribute="HereString" context="HereStringer" char="@" char1=""" beginRegion="StringRegion"/> - <IncludeRules context="##Doxygen" /> <DetectChar attribute="Comment" context="Commentar 1" char="#"/> <Detect2Chars attribute="Comment" context="Commentar 2" char="<" char1="#" beginRegion="CommentRegion"/> <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="block1"/> @@ -907,9 +906,16 @@ <context attribute="Normal Text" lineEndContext="#pop" name="Member" fallthrough="true" fallthroughContext="#pop"> <RegExpr attribute="Function" context="#pop" String="\b[_\w][_\w\d]*(?=[\s]*)" /> </context> - <context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/> + <context attribute="Comment" lineEndContext="#pop" name="Commentar 1"> + <DetectSpaces /> + <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> + </context> <context attribute="Comment" lineEndContext="#stay" name="Commentar 2"> + <DetectSpaces /> <Detect2Chars attribute="Comment" context="#pop" char="#" char1=">" endRegion="CommentRegion"/> + <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> </context> <context attribute="Cmdlets" lineEndContext="#stay" name="Cmdlet"> <keyword attribute="Function" context="#stay" String="cmdlets"/> @@ -938,3 +944,4 @@ <keywords casesensitive="0" weakDeliminator=":-"/> </general> </language> +<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml index 2c0c24bf00..2cdde881c9 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/python.xml @@ -19,7 +19,7 @@ <!-- v2.07 add support for %prog and co, see bug 142832 --> <!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords --> <!-- v2.29 recognize escape sequenzes correctly --> -<language name="Python" version="11" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> +<language name="Python" version="12" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> <highlighting> <list name="import"> <item>import</item> @@ -447,6 +447,7 @@ <!-- Comments --> <context name="Hash comment" attribute="Comment" lineEndContext="#pop"> + <DetectSpaces /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/qdocconf.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/qdocconf.xml index 0efd6edc3f..4504016d0a 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/qdocconf.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/qdocconf.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd"> <language name="QDoc Configuration" - version="1" + version="2" kateversion="5.0" section="Configuration" extensions="*.qdocconf" @@ -84,7 +84,7 @@ <contexts> <context name="key-context" attribute="Normal Text" lineEndContext="#stay"> - <DetectChar char="#" context="comment-context" column="0"/> + <DetectChar char="#" attribute="Comment" context="comment-context" column="0"/> <keyword attribute="Keyword" String="key-names"/> <keyword attribute="Function" String="function-names"/> <DetectChar char="=" context="value-context"/> @@ -112,7 +112,9 @@ </context> <context name="comment-context" attribute="Comment" lineEndContext="#pop"> + <DetectSpaces /> <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> </context> </contexts> @@ -134,3 +136,4 @@ <keywords casesensitive="1" weakDeliminator="-/"/> </general> </language> +<!-- kate: replace-tabs on; tab-width 4; indent-width 4; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml index a451e1442f..a6d44b4246 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml @@ -31,7 +31,7 @@ <!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". --> <language name="Ruby" section="Scripts" - version="10" kateversion="3.3" + version="12" kateversion="3.3" extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec;Vagrantfile" mimetype="application/x-ruby" style="ruby" indenter="ruby" @@ -389,6 +389,7 @@ <context name="Embedded documentation" attribute="Blockcomment" lineEndContext="#stay"> <RegExpr attribute="Comment" String="^=end(?:\s.*|$)" context="#pop" endRegion="comment block" column="0"/> + <DetectSpaces /> <IncludeRules context="##Alerts" /> </context> @@ -431,7 +432,9 @@ </context> <context name="General Comment" attribute="Comment" lineEndContext="#pop"> + <DetectSpaces /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> </context> <!-- HEREDOC support @@ -878,9 +881,9 @@ <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal"/> - <itemData name="Keyword" defStyleNum="dsKeyword"/> + <itemData name="Keyword" defStyleNum="dsControlFlow"/> <itemData name="Attribute Definition" defStyleNum="dsOthers"/> - <itemData name="Access Control" defStyleNum="dsKeyword" color="#0000FF"/> + <itemData name="Access Control" defStyleNum="dsAttribute" bold="1"/> <!-- #0000FF --> <itemData name="Definition" defStyleNum="dsKeyword"/> <itemData name="Pseudo variable" defStyleNum="dsDecVal"/> @@ -891,24 +894,24 @@ <itemData name="Hex" defStyleNum="dsBaseN"/> <itemData name="Bin" defStyleNum="dsBaseN"/> - <itemData name="Symbol" defStyleNum="dsString" color="#D40000"/> + <itemData name="Symbol" defStyleNum="dsWarning" bold="0" underline="0"/> <!-- #D40000 --> <itemData name="String" defStyleNum="dsString"/> - <itemData name="Raw String" defStyleNum="dsString" color="#DD4A4A" selColor="#DD4A4A"/> - <itemData name="Command" defStyleNum="dsString" color="#AA3000"/> - <itemData name="Message" defStyleNum="dsNormal" color="#4000A7"/> <!-- #4A00C0 --> - <itemData name="Regular Expression" defStyleNum="dsOthers" color="#4A5704"/> - <itemData name="Substitution" defStyleNum="dsOthers"/> + <itemData name="Raw String" defStyleNum="dsVerbatimString" /> <!-- #DD4A4A --> + <itemData name="Command" defStyleNum="dsInformation"/> <!-- #AA3000 --> + <itemData name="Message" defStyleNum="dsAttribute" bold="0"/> <!-- #4000A7 --> + <itemData name="Regular Expression" defStyleNum="dsSpecialString"/> <!-- #4A5704 --> + <itemData name="Substitution" defStyleNum="dsSpecialChar"/> <itemData name="Data" defStyleNum="dsNormal"/> <!-- short for 'general delimited input' --> <itemData name="GDL input" defStyleNum="dsOthers" /> - <itemData name="Default globals" defStyleNum="dsDataType" color="#C00000" bold="1"/> - <itemData name="Global Variable" defStyleNum="dsDataType" color="#C00000"/> - <itemData name="Global Constant" defStyleNum="dsDataType" color="#bb1188" bold="1"/> + <itemData name="Default globals" defStyleNum="dsVariable" bold="1"/> <!-- #C00000 --> + <itemData name="Global Variable" defStyleNum="dsVariable"/> <!-- #C00000 --> + <itemData name="Global Constant" defStyleNum="dsConstant" bold="1"/> <!-- #bb1188 --> <itemData name="Constant" defStyleNum="dsDataType"/> - <itemData name="Constant Value" defStyleNum="dsDataType" color="#bb1188"/> - <itemData name="Kernel methods" defStyleNum="dsNormal" color="#000080" selColor="#ffffff"/> <!-- #CC0E86 --> - <itemData name="Module mixin methods" defStyleNum="dsNormal" color="#000080" selColor="#ffffff"/> <!-- #CC0E86 --> + <itemData name="Constant Value" defStyleNum="dsConstant" bold="0"/> <!-- #bb1188 --> + <itemData name="Kernel methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> + <itemData name="Module mixin methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> <itemData name="Member" defStyleNum="dsNormal"/> <itemData name="Instance Variable" defStyleNum="dsOthers"/> <itemData name="Class Variable" defStyleNum="dsOthers"/> @@ -916,15 +919,15 @@ <itemData name="Comment" defStyleNum="dsComment"/> <itemData name="Blockcomment" defStyleNum="dsComment"/> - <itemData name="Here Document" defStyleNum="dsOthers"/> + <itemData name="Here Document" defStyleNum="dsDocumentation"/> - <itemData name="Delimiter" defStyleNum="dsNormal" color="#FF9FEC"/> - <itemData name="Operator" defStyleNum="dsNormal" color="#FF9FEC"/> + <itemData name="Delimiter" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> + <itemData name="Operator" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> </itemDatas> </highlighting> <general> <comments> - <comment name="singleLine" start="#"/> + <comment name="singleLine" start="#" position="afterwhitespace"/> </comments> <keywords casesensitive="1" weakDeliminator="!?"/> </general> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/valgrind-suppression.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/valgrind-suppression.xml index 7fe3dd474e..d30fc77582 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/valgrind-suppression.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/valgrind-suppression.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd"> -<language name="Valgrind Suppression" section="Other" extensions="*.supp;" mimetype="" version="2" kateversion="2.4" author="Milian Wolff (mail@milianw.de)" license="LGPL"> +<language name="Valgrind Suppression" section="Other" extensions="*.supp;" mimetype="" version="3" kateversion="2.4" author="Milian Wolff (mail@milianw.de)" license="LGPL"> <highlighting> <contexts> <context name="File" attribute="Normal Text" lineEndContext="#stay"> @@ -26,6 +26,7 @@ <context name="Comment" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <IncludeRules context="##Alerts" /> + <IncludeRules context="##Modelines" /> <DetectIdentifier /> </context> </contexts> @@ -49,3 +50,4 @@ </general> </language> +<!-- kate: replace-tabs on; indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml index ddfc4e705f..bb88366c86 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/xml.xml @@ -147,3 +147,4 @@ </comments> </general> </language> +<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml index ecb1a0d6a2..996d36df62 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/yacc.xml @@ -32,7 +32,7 @@ This code is released under the LGPL as part of kdelibs/kate. ======================================================================== --> -<language name="Yacc/Bison" version="6" kateversion="5.0" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL"> +<language name="Yacc/Bison" version="7" kateversion="5.0" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL"> <highlighting> <contexts> @@ -199,11 +199,13 @@ This code is released under the LGPL as part of kdelibs/kate. <Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" /> </context> <context name="CommentStar" attribute="Comment" lineEndContext="#stay"> + <DetectSpaces /> <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="comment" /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> <context name="CommentSlash" attribute="Comment" lineEndContext="#pop"> + <DetectSpaces /> <IncludeRules context="##Alerts" /> <IncludeRules context="##Modelines" /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme new file mode 100644 index 0000000000..9c84e5af5d --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-dark.theme @@ -0,0 +1,180 @@ +{ + "_comments": [ + "Last update: Sep 21, 2020 (revision 2)", + "This file has been converted from: https://github.com/dempfi/ayu", + "Also see: https://github.com/ayu-theme" + ], + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Ike Ku", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "ayu Dark", + "revision": 2 + }, + "editor-colors": { + "BackgroundColor": "#0a0e14", + "BracketMatching": "#1e232d", + "CodeFolding": "#121a23", + "CurrentLine": "#00010a", + "CurrentLineNumber": "#414857", + "IconBorder": "#0e1218", + "IndentationLine": "#252b35", + "LineNumbers": "#323844", + "MarkBookmark": "#59c2ff", + "MarkBreakpointActive": "#f07178", + "MarkBreakpointDisabled": "#ffee99", + "MarkBreakpointReached": "#e6b673", + "MarkError": "#ff3333", + "MarkExecution": "#95e6cb", + "MarkWarning": "#c2d94c", + "ModifiedLines": "#6994bf", + "ReplaceHighlight": "#705728", + "SavedLines": "#91b362", + "SearchHighlight": "#414857", + "Separator": "#151a1e", + "SpellChecking": "#d96c75", + "TabMarker": "#1d222b", + "TemplateBackground": "#030810", + "TemplateFocusedPlaceholder": "#3c4250", + "TemplatePlaceholder": "#2b303a", + "TemplateReadOnlyPlaceholder": "#0d1016", + "TextSelection": "#273747", + "WordWrapMarker": "#1e222b" + }, + "text-styles": { + "Alert": { + "background-color": "#2a0f15", + "bold": true, + "selected-text-color": "#ff3333", + "text-color": "#ff3333" + }, + "Annotation": { + "selected-text-color": "#e6b673", + "text-color": "#e6b673" + }, + "Attribute": { + "selected-text-color": "#59c2ff", + "text-color": "#59c2ff" + }, + "BaseN": { + "selected-text-color": "#e6b450", + "text-color": "#e6b450" + }, + "BuiltIn": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "Char": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "Comment": { + "italic": true, + "selected-text-color": "#626a73", + "text-color": "#626a73" + }, + "CommentVar": { + "selected-text-color": "#ffee99", + "text-color": "#ffee99" + }, + "Constant": { + "selected-text-color": "#ffee99", + "text-color": "#ffee99" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#ff8f40", + "text-color": "#ff8f40" + }, + "DataType": { + "selected-text-color": "#ff8f40", + "text-color": "#ff8f40" + }, + "DecVal": { + "selected-text-color": "#e6b450", + "text-color": "#e6b450" + }, + "Documentation": { + "selected-text-color": "#626a73", + "text-color": "#626a73" + }, + "Error": { + "selected-text-color": "#ff3333", + "text-color": "#ff3333", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#59c2ff", + "text-color": "#59c2ff" + }, + "Float": { + "selected-text-color": "#e6b450", + "text-color": "#e6b450" + }, + "Function": { + "selected-text-color": "#ffb454", + "text-color": "#ffb454" + }, + "Import": { + "selected-text-color": "#c2d94c", + "text-color": "#c2d94c" + }, + "Information": { + "selected-text-color": "#e6b450", + "text-color": "#e6b450" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#ff8f40", + "text-color": "#ff8f40" + }, + "Normal": { + "selected-text-color": "#b3b1ad", + "text-color": "#b3b1ad" + }, + "Operator": { + "selected-text-color": "#f29668", + "text-color": "#f29668" + }, + "Others": { + "selected-text-color": "#39bae6", + "text-color": "#39bae6" + }, + "Preprocessor": { + "selected-text-color": "#f07178", + "text-color": "#f07178" + }, + "RegionMarker": { + "background-color": "#173649", + "selected-text-color": "#59c2ff", + "text-color": "#59c2ff" + }, + "SpecialChar": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "SpecialString": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "String": { + "selected-text-color": "#c2d94c", + "text-color": "#c2d94c" + }, + "Variable": { + "selected-text-color": "#39bae6", + "text-color": "#39bae6" + }, + "VerbatimString": { + "selected-text-color": "#c2d94c", + "text-color": "#c2d94c" + }, + "Warning": { + "selected-text-color": "#f07178", + "text-color": "#f07178" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme new file mode 100644 index 0000000000..c93e414457 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-light.theme @@ -0,0 +1,180 @@ +{ + "_comments": [ + "Last update: Sep 21, 2020 (revision 2)", + "This file has been converted from: https://github.com/dempfi/ayu", + "Also see: https://github.com/ayu-theme" + ], + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Ike Ku", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "ayu Light", + "revision": 2 + }, + "editor-colors": { + "BackgroundColor": "#fafafa", + "BracketMatching": "#d9dbdd", + "CodeFolding": "#ffe6dc", + "CurrentLine": "#eff0f2", + "CurrentLineNumber": "#767676", + "IconBorder": "#f3f3f3", + "IndentationLine": "#dcdee1", + "LineNumbers": "#9f9f9f", + "MarkBookmark": "#399ee6", + "MarkBreakpointActive": "#f07171", + "MarkBreakpointDisabled": "#a37acc", + "MarkBreakpointReached": "#e6ba7e", + "MarkError": "#f51818", + "MarkExecution": "#4cbf99", + "MarkWarning": "#86b300", + "ModifiedLines": "#709ecc", + "ReplaceHighlight": "#b0d4e4", + "SavedLines": "#99bf4d", + "SearchHighlight": "#fdd1bc", + "Separator": "#e0dfdf", + "SpellChecking": "#f27983", + "TabMarker": "#dcdee1", + "TemplateBackground": "#f7f7f7", + "TemplateFocusedPlaceholder": "#bec1c6", + "TemplatePlaceholder": "#dddfe1", + "TemplateReadOnlyPlaceholder": "#ffffff", + "TextSelection": "#d1e4f4", + "WordWrapMarker": "#e9eaeb" + }, + "text-styles": { + "Alert": { + "background-color": "#faefef", + "bold": true, + "selected-text-color": "#f51818", + "text-color": "#f51818" + }, + "Annotation": { + "selected-text-color": "#e6ba7e", + "text-color": "#e6ba7e" + }, + "Attribute": { + "selected-text-color": "#399ee6", + "text-color": "#399ee6" + }, + "BaseN": { + "selected-text-color": "#ff9940", + "text-color": "#ff9940" + }, + "BuiltIn": { + "selected-text-color": "#4cbf99", + "text-color": "#4cbf99" + }, + "Char": { + "selected-text-color": "#4cbf99", + "text-color": "#4cbf99" + }, + "Comment": { + "italic": true, + "selected-text-color": "#607880", + "text-color": "#607880" + }, + "CommentVar": { + "selected-text-color": "#a37acc", + "text-color": "#a37acc" + }, + "Constant": { + "selected-text-color": "#a37acc", + "text-color": "#a37acc" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#fa8d3e", + "text-color": "#fa8d3e" + }, + "DataType": { + "selected-text-color": "#fa8d3e", + "text-color": "#fa8d3e" + }, + "DecVal": { + "selected-text-color": "#ff9940", + "text-color": "#ff9940" + }, + "Documentation": { + "selected-text-color": "#607880", + "text-color": "#607880" + }, + "Error": { + "selected-text-color": "#f51818", + "text-color": "#f51818", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#399ee6", + "text-color": "#399ee6" + }, + "Float": { + "selected-text-color": "#ff9940", + "text-color": "#ff9940" + }, + "Function": { + "selected-text-color": "#f2ae49", + "text-color": "#f2ae49" + }, + "Import": { + "selected-text-color": "#86b300", + "text-color": "#86b300" + }, + "Information": { + "selected-text-color": "#ff9940", + "text-color": "#ff9940" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#fa8d3e", + "text-color": "#fa8d3e" + }, + "Normal": { + "selected-text-color": "#575f66", + "text-color": "#575f66" + }, + "Operator": { + "selected-text-color": "#ed9366", + "text-color": "#ed9366" + }, + "Others": { + "selected-text-color": "#55b4d4", + "text-color": "#55b4d4" + }, + "Preprocessor": { + "selected-text-color": "#f07171", + "text-color": "#f07171" + }, + "RegionMarker": { + "background-color": "#ddecf3", + "selected-text-color": "#399ee6", + "text-color": "#399ee6" + }, + "SpecialChar": { + "selected-text-color": "#4cbf99", + "text-color": "#4cbf99" + }, + "SpecialString": { + "selected-text-color": "#4cbf99", + "text-color": "#4cbf99" + }, + "String": { + "selected-text-color": "#86b300", + "text-color": "#86b300" + }, + "Variable": { + "selected-text-color": "#55b4d4", + "text-color": "#55b4d4" + }, + "VerbatimString": { + "selected-text-color": "#86b300", + "text-color": "#86b300" + }, + "Warning": { + "selected-text-color": "#f07171", + "text-color": "#f07171" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme new file mode 100644 index 0000000000..cd9ff7488e --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/ayu-mirage.theme @@ -0,0 +1,180 @@ +{ + "_comments": [ + "Last update: Sep 21, 2020 (revision 2)", + "This file has been converted from: https://github.com/dempfi/ayu", + "Also see: https://github.com/ayu-theme" + ], + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Ike Ku", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "ayu Mirage", + "revision": 2 + }, + "editor-colors": { + "BackgroundColor": "#1f2430", + "BracketMatching": "#383e4c", + "CodeFolding": "#252c3e", + "CurrentLine": "#191e2a", + "CurrentLineNumber": "#606979", + "IconBorder": "#222733", + "IndentationLine": "#383f4c", + "LineNumbers": "#444b59", + "MarkBookmark": "#73d0ff", + "MarkBreakpointActive": "#f28779", + "MarkBreakpointDisabled": "#d4bfff", + "MarkBreakpointReached": "#ffe6b3", + "MarkError": "#ff3333", + "MarkExecution": "#95e6cb", + "MarkWarning": "#bae67e", + "ModifiedLines": "#77a8d9", + "ReplaceHighlight": "#7f553b", + "SavedLines": "#a6cc70", + "SearchHighlight": "#606979", + "Separator": "#2c313d", + "SpellChecking": "#f27983", + "TabMarker": "#303642", + "TemplateBackground": "#1d222e", + "TemplateFocusedPlaceholder": "#596171", + "TemplatePlaceholder": "#434957", + "TemplateReadOnlyPlaceholder": "#232834", + "TextSelection": "#33415e", + "WordWrapMarker": "#303642" + }, + "text-styles": { + "Alert": { + "background-color": "#332430", + "bold": true, + "selected-text-color": "#ff3333", + "text-color": "#ff3333" + }, + "Annotation": { + "selected-text-color": "#ffe6b3", + "text-color": "#ffe6b3" + }, + "Attribute": { + "selected-text-color": "#73d0ff", + "text-color": "#73d0ff" + }, + "BaseN": { + "selected-text-color": "#ffcc66", + "text-color": "#ffcc66" + }, + "BuiltIn": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "Char": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "Comment": { + "italic": true, + "selected-text-color": "#5c6773", + "text-color": "#5c6773" + }, + "CommentVar": { + "selected-text-color": "#d4bfff", + "text-color": "#d4bfff" + }, + "Constant": { + "selected-text-color": "#d4bfff", + "text-color": "#d4bfff" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#ffa759", + "text-color": "#ffa759" + }, + "DataType": { + "selected-text-color": "#ffa759", + "text-color": "#ffa759" + }, + "DecVal": { + "selected-text-color": "#ffcc66", + "text-color": "#ffcc66" + }, + "Documentation": { + "selected-text-color": "#5c6773", + "text-color": "#5c6773" + }, + "Error": { + "selected-text-color": "#ff3333", + "text-color": "#ff3333", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#73d0ff", + "text-color": "#73d0ff" + }, + "Float": { + "selected-text-color": "#ffcc66", + "text-color": "#ffcc66" + }, + "Function": { + "selected-text-color": "#ffd580", + "text-color": "#ffd580" + }, + "Import": { + "selected-text-color": "#bae67e", + "text-color": "#bae67e" + }, + "Information": { + "selected-text-color": "#ffcc66", + "text-color": "#ffcc66" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#ffa759", + "text-color": "#ffa759" + }, + "Normal": { + "selected-text-color": "#cbccc6", + "text-color": "#cbccc6" + }, + "Operator": { + "selected-text-color": "#f29e74", + "text-color": "#f29e74" + }, + "Others": { + "selected-text-color": "#5ccfe6", + "text-color": "#5ccfe6" + }, + "Preprocessor": { + "selected-text-color": "#f28779", + "text-color": "#f28779" + }, + "RegionMarker": { + "background-color": "#2a4254", + "selected-text-color": "#73d0ff", + "text-color": "#73d0ff" + }, + "SpecialChar": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "SpecialString": { + "selected-text-color": "#95e6cb", + "text-color": "#95e6cb" + }, + "String": { + "selected-text-color": "#bae67e", + "text-color": "#bae67e" + }, + "Variable": { + "selected-text-color": "#5ccfe6", + "text-color": "#5ccfe6" + }, + "VerbatimString": { + "selected-text-color": "#bae67e", + "text-color": "#bae67e" + }, + "Warning": { + "selected-text-color": "#f28779", + "text-color": "#f28779" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme index 8147948eeb..93f8fa9cac 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-dark.theme @@ -1,5 +1,10 @@ { "metadata" : { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>", + "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" + ], + "license": "SPDX-License-Identifier: MIT", "revision" : 2, "name" : "Breeze Dark" }, @@ -142,33 +147,33 @@ } }, "editor-colors": { - "background-color" : "#232629", - "code-folding" : "#224e65", - "bracket-matching" : "#8e44ad", - "current-line" : "#2A2E32", - "icon-border" : "#31363b", - "indentation-line" : "#3a3f44", - "line-numbers" : "#7a7c7d", - "current-line-number" : "#a5a6a8", - "mark-bookmark" : "#0404bf", - "mark-breakpoint-active" : "#8b0607", - "mark-breakpoint-reached" : "#6d6e07", - "mark-breakpoint-disabled" : "#820683", - "mark-execution" : "#4d4e50", - "mark-warning" : "#f67400", - "mark-error" : "#da4453", - "modified-lines" : "#c04900", - "replace-highlight" : "#808021", - "saved-lines" : "#1c8042", - "search-highlight" : "#218058", - "selection" : "#2d5c76", - "separator" : "#7a7c7d", - "spell-checking" : "#c0392b", - "tab-marker" : "#4d4d4d", - "template-background" : "#31363b", - "template-placeholder" : "#123723", - "template-focused-placeholder" : "#123723", - "template-read-only-placeholder" : "#4d1f24", - "word-wrap-marker" : "#3a3f44" + "BackgroundColor" : "#232629", + "CodeFolding" : "#224e65", + "BracketMatching" : "#8e44ad", + "CurrentLine" : "#2A2E32", + "IconBorder" : "#31363b", + "IndentationLine" : "#3a3f44", + "LineNumbers" : "#7a7c7d", + "CurrentLineNumber" : "#a5a6a8", + "MarkBookmark" : "#0404bf", + "MarkBreakpointActive" : "#8b0607", + "MarkBreakpointReached" : "#6d6e07", + "MarkBreakpointDisabled" : "#820683", + "MarkExecution" : "#4d4e50", + "MarkWarning" : "#f67400", + "MarkError" : "#da4453", + "ModifiedLines" : "#c04900", + "ReplaceHighlight" : "#808021", + "SavedLines" : "#1c8042", + "SearchHighlight" : "#218058", + "TextSelection" : "#2d5c76", + "Separator" : "#7a7c7d", + "SpellChecking" : "#c0392b", + "TabMarker" : "#4d4d4d", + "TemplateBackground" : "#31363b", + "TemplatePlaceholder" : "#123723", + "TemplateFocusedPlaceholder" : "#123723", + "TemplateReadOnlyPlaceholder" : "#4d1f24", + "WordWrapMarker" : "#3a3f44" } } diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme new file mode 100644 index 0000000000..0a27e2d354 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/breeze-light.theme @@ -0,0 +1,179 @@ +{ + "metadata" : { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>", + "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" + ], + "license": "SPDX-License-Identifier: MIT", + "revision" : 4, + "name" : "Breeze Light" + }, + "text-styles": { + "Normal" : { + "text-color" : "#1f1c1b", + "selected-text-color" : "#ffffff", + "bold" : false, + "italic" : false, + "underline" : false, + "strike-through" : false + }, + "Keyword" : { + "text-color" : "#1f1c1b", + "selected-text-color" : "#ffffff", + "bold" : true + }, + "Function" : { + "text-color" : "#644a9b", + "selected-text-color" : "#452886" + }, + "Variable" : { + "text-color" : "#0057ae", + "selected-text-color" : "#00316e" + }, + "ControlFlow" : { + "text-color" : "#1f1c1b", + "selected-text-color" : "#ffffff", + "bold" : true + }, + "Operator" : { + "text-color" : "#1f1c1b", + "selected-text-color" : "#ffffff" + }, + "BuiltIn" : { + "text-color" : "#644a9b", + "selected-text-color" : "#452886", + "bold" : true + }, + "Extension" : { + "text-color" : "#0095ff", + "selected-text-color" : "#ffffff", + "bold" : true + }, + "Preprocessor" : { + "text-color" : "#006e28", + "selected-text-color" : "#006e28" + }, + "Attribute" : { + "text-color" : "#0057ae", + "selected-text-color" : "#00316e" + }, + "Char" : { + "text-color" : "#924c9d", + "selected-text-color" : "#6c2477" + }, + "SpecialChar" : { + "text-color" : "#3daee9", + "selected-text-color" : "#fcfcfc" + }, + "String" : { + "text-color" : "#bf0303", + "selected-text-color" : "#9c0e0e" + }, + "VerbatimString" : { + "text-color" : "#bf0303", + "selected-text-color" : "#9c0e0e" + }, + "SpecialString" : { + "text-color" : "#ff5500", + "selected-text-color" : "#ff5500" + }, + "Import" : { + "text-color" : "#ff5500", + "selected-text-color" : "#ff5500" + }, + "DataType" : { + "text-color" : "#0057ae", + "selected-text-color" : "#00316e" + }, + "DecVal" : { + "text-color" : "#b08000", + "selected-text-color" : "#805c00" + }, + "BaseN" : { + "text-color" : "#b08000", + "selected-text-color" : "#805c00" + }, + "Float" : { + "text-color" : "#b08000", + "selected-text-color" : "#805c00" + }, + "Constant" : { + "text-color" : "#aa5500", + "selected-text-color" : "#5e2f00" + }, + "Comment" : { + "text-color" : "#898887", + "selected-text-color" : "#5e5d5d" + }, + "Documentation" : { + "text-color" : "#607880", + "selected-text-color" : "#46585e" + }, + "Annotation" : { + "text-color" : "#ca60ca", + "selected-text-color" : "#a44ea4" + }, + "CommentVar" : { + "text-color" : "#0095ff", + "selected-text-color" : "#ffffff" + }, + "RegionMarker" : { + "text-color" : "#0057ae", + "selected-text-color" : "#00316e", + "background-color" : "#e0e9f8" + }, + "Information" : { + "text-color" : "#b08000", + "selected-text-color" : "#805c00" + }, + "Warning" : { + "text-color" : "#bf0303", + "selected-text-color" : "#9c0e0e" + }, + "Alert" : { + "text-color" : "#bf0303", + "selected-text-color" : "#9c0e0e", + "background-color" : "#f7e6e6", + "bold" : true + }, + "Error" : { + "text-color" : "#bf0303", + "selected-text-color" : "#9c0e0e", + "underline" : true + }, + "Others" : { + "text-color" : "#006e28", + "selected-text-color" : "#006e28" + } + }, + "editor-colors": { + "BackgroundColor" : "#ffffff", + "CodeFolding" : "#94caef", + "BracketMatching" : "#ffff00", + "CurrentLine" : "#f8f7f6", + "IconBorder" : "#f0f0f0", + "IndentationLine" : "#d2d2d2", + "LineNumbers" : "#a0a0a0", + "CurrentLineNumber" : "#1e1e1e", + "MarkBookmark" : "#0000ff", + "MarkBreakpointActive" : "#ff0000", + "MarkBreakpointReached" : "#ffff00", + "MarkBreakpointDisabled" : "#ff00ff", + "MarkExecution" : "#a0a0a4", + "MarkWarning" : "#00ff00", + "MarkError" : "#ff0000", + "ModifiedLines" : "#fdbc4b", + "ReplaceHighlight" : "#00ff00", + "SavedLines" : "#2ecc71", + "SearchHighlight" : "#ffff00", + "TextSelection" : "#94caef", + "Separator" : "#a0a0a0", + "SpellChecking" : "#bf0303", + "TabMarker" : "#d2d2d2", + "TemplateBackground" : "#d6d2d0", + "TemplatePlaceholder" : "#baf8ce", + "TemplateFocusedPlaceholder" : "#76da98", + "TemplateReadOnlyPlaceholder" : "#f6e6e6", + "WordWrapMarker" : "#ededed" + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme new file mode 100644 index 0000000000..82786160b8 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/dracula.theme @@ -0,0 +1,173 @@ +{ + "editor-colors": { + "BackgroundColor": "#282a36", + "BracketMatching": "#55007f", + "CodeFolding": "#8be9fd", + "CurrentLine": "#282a36", + "CurrentLineNumber": "#f8f8f2", + "IconBorder": "#282a36", + "IndentationLine": "#6272a4", + "LineNumbers": "#909194", + "MarkBookmark": "#8be9fd", + "MarkBreakpointActive": "#ff5555", + "MarkBreakpointDisabled": "#bd93f9", + "MarkBreakpointReached": "#f1fa8c", + "MarkError": "#ff5555", + "MarkExecution": "#44475a", + "MarkWarning": "#ffb86c", + "ModifiedLines": "#ff79c6", + "ReplaceHighlight": "#50fa7b", + "SavedLines": "#50fa7b", + "SearchHighlight": "#b39800", + "Separator": "#909194", + "SpellChecking": "#ff5555", + "TabMarker": "#6272a4", + "TemplateBackground": "#282a36", + "TemplateFocusedPlaceholder": "#282a36", + "TemplatePlaceholder": "#282a36", + "TemplateReadOnlyPlaceholder": "#44475a", + "TextSelection": "#44475a", + "WordWrapMarker": "#282a36" + }, + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Dracula Theme", + "SPDX-FileCopyrightText: 2020 Christoph Cullmann <cullmann@kde.org>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "Dracula", + "revision": 1 + }, + "text-styles": { + "Alert": { + "bold": true, + "selected-text-color": "#ff5555", + "text-color": "#ff5555" + }, + "Annotation": { + "selected-text-color": "#ff79c6", + "text-color": "#ff79c6" + }, + "Attribute": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "BaseN": { + "selected-text-color": "#ffb86c", + "text-color": "#ffb86c" + }, + "BuiltIn": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "Char": { + "selected-text-color": "#ff79c6", + "text-color": "#ff79c6" + }, + "Comment": { + "selected-text-color": "#6272a4", + "text-color": "#6272a4" + }, + "CommentVar": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "Constant": { + "bold": true, + "selected-text-color": "#bd93f9", + "text-color": "#bd93f9" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#ffb86c", + "text-color": "#ffb86c" + }, + "DataType": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "DecVal": { + "selected-text-color": "#ffb86c", + "text-color": "#ffb86c" + }, + "Documentation": { + "selected-text-color": "#ffb86c", + "text-color": "#ffb86c" + }, + "Error": { + "selected-text-color": "#ff5555", + "text-color": "#ff5555", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#0095ff", + "text-color": "#0095ff" + }, + "Float": { + "selected-text-color": "#ffb86c", + "text-color": "#ffb86c" + }, + "Function": { + "selected-text-color": "#50fa7b", + "text-color": "#50fa7b" + }, + "Import": { + "selected-text-color": "#ff79c6", + "text-color": "#ff79c6" + }, + "Information": { + "selected-text-color": "#f67400", + "text-color": "#f67400" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#ff79c6", + "text-color": "#ff79c6" + }, + "Normal": { + "selected-text-color": "#f8f8f2", + "text-color": "#f8f8f2" + }, + "Operator": { + "selected-text-color": "#f8f8f2", + "text-color": "#f8f8f2" + }, + "Others": { + "selected-text-color": "#50fa7b", + "text-color": "#50fa7b" + }, + "Preprocessor": { + "selected-text-color": "#50fa7b", + "text-color": "#50fa7b" + }, + "RegionMarker": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "SpecialChar": { + "selected-text-color": "#ff79c6", + "text-color": "#ff79c6" + }, + "SpecialString": { + "selected-text-color": "#f1fa8c", + "text-color": "#f1fa8c" + }, + "String": { + "selected-text-color": "#f1fa8c", + "text-color": "#f1fa8c" + }, + "Variable": { + "selected-text-color": "#8be9fd", + "text-color": "#8be9fd" + }, + "VerbatimString": { + "selected-text-color": "#f1fa8c", + "text-color": "#f1fa8c" + }, + "Warning": { + "selected-text-color": "#ff5555", + "text-color": "#ff5555" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme new file mode 100644 index 0000000000..66c6c9afb7 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-dark.theme @@ -0,0 +1,185 @@ +{ + "_comments": [ + "Last update: Sep 17, 2020 (revision 2)", + "This file has been converted from: https://github.com/morhetz/gruvbox" + ], + "metadata" : { + "copyright": [ + "SPDX-FileCopyrightText: 2017 Pavel Pertsev <morhetz@gmail.com>", + "SPDX-FileCopyrightText: 2020 Frederik Banning <laubblaeser@live.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name" : "gruvbox Dark", + "revision" : 2 + }, + "text-styles": { + "Normal" : { + "text-color" : "#ebdbb2", + "selected-text-color" : "#ebdbb2", + "bold" : false, + "italic" : false, + "underline" : false, + "strike-through" : false + }, + "Keyword" : { + "text-color" : "#ebdbb2", + "selected-text-color" : "#ebdbb2", + "bold" : true + }, + "Function" : { + "text-color" : "#689d6a", + "selected-text-color" : "#8ec07c" + }, + "Variable" : { + "text-color" : "#458588", + "selected-text-color" : "#83a598" + }, + "ControlFlow" : { + "text-color" : "#cc241d", + "selected-text-color" : "#fb4934", + "bold" : true + }, + "Operator" : { + "text-color" : "#ebdbb2", + "selected-text-color" : "#ebdbb2" + }, + "BuiltIn" : { + "text-color" : "#d65d0e", + "selected-text-color" : "#fe8019" + }, + "Extension" : { + "text-color" : "#689d6a", + "selected-text-color" : "#8ec07c", + "bold" : true + }, + "Preprocessor" : { + "text-color" : "#d65d0e", + "selected-text-color" : "#fe8019" + }, + "Attribute" : { + "text-color" : "#d79921", + "selected-text-color" : "#fabd2f" + }, + "Char" : { + "text-color" : "#b16286", + "selected-text-color" : "#d3869b" + }, + "SpecialChar" : { + "text-color" : "#b16286", + "selected-text-color" : "#d3869b" + }, + "String" : { + "text-color" : "#98971a", + "selected-text-color" : "#b8bb26" + }, + "VerbatimString" : { + "text-color" : "#98971a", + "selected-text-color" : "#b8bb26" + }, + "SpecialString" : { + "text-color" : "#98971a", + "selected-text-color" : "#b8bb26" + }, + "Import" : { + "text-color" : "#689d6a", + "selected-text-color" : "#8ec07c" + }, + "DataType" : { + "text-color" : "#d79921", + "selected-text-color" : "#fabd2f" + }, + "DecVal" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "BaseN" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "Float" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "Constant" : { + "text-color" : "#b16286", + "selected-text-color" : "#d3869b", + "bold" : true + }, + "Comment" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984" + }, + "Documentation" : { + "text-color" : "#98971a", + "selected-text-color" : "#b8bb26" + }, + "Annotation" : { + "text-color" : "#98971a", + "selected-text-color" : "#b8bb26" + }, + "CommentVar" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984" + }, + "RegionMarker" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984", + "background-color" : "#1d2021" + }, + "Information" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#83a598" + }, + "Warning" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#fabd2f" + }, + "Alert" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#cc241d", + "bold" : true + }, + "Error" : { + "text-color" : "#cc241d", + "selected-text-color" : "#fb4934", + "underline" : true + }, + "Others" : { + "text-color" : "#689d6a", + "selected-text-color" : "#8ec07c" + } + }, + "editor-colors": { + "BackgroundColor" : "#282828", + "CodeFolding" : "#1d2021", + "BracketMatching" : "#a89984", + "CurrentLine" : "#32302f", + "IconBorder" : "#282828", + "IndentationLine" : "#504945", + "LineNumbers" : "#ebdbb2", + "CurrentLineNumber" : "#ebdbb2", + "MarkBookmark" : "#458588", + "MarkBreakpointActive" : "#cc241d", + "MarkBreakpointReached" : "#98971a", + "MarkBreakpointDisabled" : "#b16286", + "MarkExecution" : "#ebdbb2", + "MarkWarning" : "#d65d0e", + "MarkError" : "#cc241d", + "ModifiedLines" : "#fe8019", + "ReplaceHighlight" : "#b8bb26", + "SavedLines" : "#689d6a", + "SearchHighlight" : "#8ec07c", + "TextSelection" : "#504945", + "Separator" : "#504945", + "SpellChecking" : "#cc241d", + "TabMarker" : "#504945", + "TemplateBackground" : "#282828", + "TemplatePlaceholder" : "#98971a", + "TemplateFocusedPlaceholder" : "#b8bb26", + "TemplateReadOnlyPlaceholder" : "#fb4934", + "WordWrapMarker" : "#a89984" + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme new file mode 100644 index 0000000000..6038c70e94 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/gruvbox-light.theme @@ -0,0 +1,185 @@ +{ + "_comments": [ + "Last update: Sep 17, 2020 (revision 2)", + "This file has been converted from: https://github.com/morhetz/gruvbox" + ], + "metadata" : { + "copyright": [ + "SPDX-FileCopyrightText: 2017 Pavel Pertsev <morhetz@gmail.com>", + "SPDX-FileCopyrightText: 2020 Frederik Banning <laubblaeser@live.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name" : "gruvbox Light", + "revision" : 2 + }, + "text-styles": { + "Normal" : { + "text-color" : "#3c3836", + "selected-text-color" : "#3c3836", + "bold" : false, + "italic" : false, + "underline" : false, + "strike-through" : false + }, + "Keyword" : { + "text-color" : "#3c3836", + "selected-text-color" : "#3c3836", + "bold" : true + }, + "Function" : { + "text-color" : "#689d6a", + "selected-text-color" : "#427b58" + }, + "Variable" : { + "text-color" : "#458588", + "selected-text-color" : "#076678" + }, + "ControlFlow" : { + "text-color" : "#cc241d", + "selected-text-color" : "#9d0006", + "bold" : true + }, + "Operator" : { + "text-color" : "#3c3836", + "selected-text-color" : "#3c3836" + }, + "BuiltIn" : { + "text-color" : "#d65d0e", + "selected-text-color" : "#af3a03" + }, + "Extension" : { + "text-color" : "#689d6a", + "selected-text-color" : "#427b58", + "bold" : true + }, + "Preprocessor" : { + "text-color" : "#d65d0e", + "selected-text-color" : "#af3a03" + }, + "Attribute" : { + "text-color" : "#d79921", + "selected-text-color" : "#b57614" + }, + "Char" : { + "text-color" : "#b16286", + "selected-text-color" : "#8f3f71" + }, + "SpecialChar" : { + "text-color" : "#b16286", + "selected-text-color" : "#8f3f71" + }, + "String" : { + "text-color" : "#98971a", + "selected-text-color" : "#79740e" + }, + "VerbatimString" : { + "text-color" : "#98971a", + "selected-text-color" : "#79740e" + }, + "SpecialString" : { + "text-color" : "#98971a", + "selected-text-color" : "#79740e" + }, + "Import" : { + "text-color" : "#689d6a", + "selected-text-color" : "#427b58" + }, + "DataType" : { + "text-color" : "#d79921", + "selected-text-color" : "#b57614" + }, + "DecVal" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "BaseN" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "Float" : { + "text-color" : "#f67400", + "selected-text-color" : "#f67400" + }, + "Constant" : { + "text-color" : "#b16286", + "selected-text-color" : "#8f3f71", + "bold" : true + }, + "Comment" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984" + }, + "Documentation" : { + "text-color" : "#98971a", + "selected-text-color" : "#79740e" + }, + "Annotation" : { + "text-color" : "#98971a", + "selected-text-color" : "#79740e" + }, + "CommentVar" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984" + }, + "RegionMarker" : { + "text-color" : "#928374", + "selected-text-color" : "#a89984", + "background-color" : "#f9f5d7" + }, + "Information" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#83a598" + }, + "Warning" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#fabd2f" + }, + "Alert" : { + "text-color" : "#282828", + "selected-text-color" : "#282828", + "background-color" : "#cc241d", + "bold" : true + }, + "Error" : { + "text-color" : "#cc241d", + "selected-text-color" : "#9d0006", + "underline" : true + }, + "Others" : { + "text-color" : "#689d6a", + "selected-text-color" : "#427b58" + } + }, + "editor-colors": { + "BackgroundColor" : "#fbf1c7", + "CodeFolding" : "#f9f5d7", + "BracketMatching" : "#a89984", + "CurrentLine" : "#f2e5bc", + "IconBorder" : "#fbf1c7", + "IndentationLine" : "#d5c4a1", + "LineNumbers" : "#3c3836", + "CurrentLineNumber" : "#3c3836", + "MarkBookmark" : "#458588", + "MarkBreakpointActive" : "#cc241d", + "MarkBreakpointReached" : "#98971a", + "MarkBreakpointDisabled" : "#b16286", + "MarkExecution" : "#3c3836", + "MarkWarning" : "#d65d0e", + "MarkError" : "#cc241d", + "ModifiedLines" : "#af3a03", + "ReplaceHighlight" : "#79740e", + "SavedLines" : "#689d6a", + "SearchHighlight" : "#427b58", + "TextSelection" : "#d5c4a1", + "Separator" : "#d5c4a1", + "SpellChecking" : "#cc241d", + "TabMarker" : "#d5c4a1", + "TemplateBackground" : "#fbf1c7", + "TemplatePlaceholder" : "#98971a", + "TemplateFocusedPlaceholder" : "#79740e", + "TemplateReadOnlyPlaceholder" : "#9d0006", + "WordWrapMarker" : "#a89984" + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme new file mode 100644 index 0000000000..6ad4d82e43 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/nord.theme @@ -0,0 +1,181 @@ +{ + "_comments": [ + "Last update: Sep 21, 2020 (revision 2)", + "This theme has been adapted from: https://www.nordtheme.com" + ], + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2016 Arctic Ice Studio <development@arcticicestudio.com>", + "SPDX-FileCopyrightText: 2016 Sven Greb <development@svengreb.de>", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "Nord", + "revision": 2 + }, + "editor-colors": { + "BackgroundColor": "#2e3440", + "BracketMatching": "#4c566a", + "CodeFolding": "#434c5e", + "CurrentLine": "#3b4252", + "CurrentLineNumber": "#616e88", + "IconBorder": "#2e3440", + "IndentationLine": "#434c5e", + "LineNumbers": "#4c566a", + "MarkBookmark": "#55749a", + "MarkBreakpointActive": "#79aab9", + "MarkBreakpointDisabled": "#b48ead", + "MarkBreakpointReached": "#91a97e", + "MarkError": "#a95862", + "MarkExecution": "#4c566a", + "MarkWarning": "#d0b47d", + "ModifiedLines": "#ebcb8b", + "ReplaceHighlight": "#8e6057", + "SavedLines": "#a3be8c", + "SearchHighlight": "#5f8491", + "Separator": "#3b4252", + "SpellChecking": "#bf616a", + "TabMarker": "#3e4656", + "TemplateBackground": "#3b4252", + "TemplateFocusedPlaceholder": "#81a1c1", + "TemplatePlaceholder": "#5e81ac", + "TemplateReadOnlyPlaceholder": "#4c566a", + "TextSelection": "#4c566a", + "WordWrapMarker": "#3f4859" + }, + "text-styles": { + "Alert": { + "background-color": "#3b4252", + "bold": true, + "selected-text-color": "#bf616a", + "text-color": "#bf616a" + }, + "Annotation": { + "selected-text-color": "#d08770", + "text-color": "#d08770" + }, + "Attribute": { + "selected-text-color": "#8fbcbb", + "text-color": "#8fbcbb" + }, + "BaseN": { + "selected-text-color": "#b48ead", + "text-color": "#b48ead" + }, + "BuiltIn": { + "italic": true, + "selected-text-color": "#88c0d0", + "text-color": "#88c0d0" + }, + "Char": { + "selected-text-color": "#ebcb8b", + "text-color": "#ebcb8b" + }, + "Comment": { + "selected-text-color": "#616e88", + "text-color": "#616e88" + }, + "CommentVar": { + "selected-text-color": "#e5e9f0", + "text-color": "#e5e9f0" + }, + "Constant": { + "bold": true, + "selected-text-color": "#eceff4", + "text-color": "#eceff4" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#81a1c1", + "text-color": "#81a1c1" + }, + "DataType": { + "selected-text-color": "#81a1c1", + "text-color": "#81a1c1" + }, + "DecVal": { + "selected-text-color": "#b48ead", + "text-color": "#b48ead" + }, + "Documentation": { + "selected-text-color": "#5e81ac", + "text-color": "#5e81ac" + }, + "Error": { + "selected-text-color": "#bf616a", + "text-color": "#bf616a", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#8fbcbb", + "text-color": "#8fbcbb" + }, + "Float": { + "selected-text-color": "#b48ead", + "text-color": "#b48ead" + }, + "Function": { + "selected-text-color": "#88c0d0", + "text-color": "#88c0d0" + }, + "Import": { + "selected-text-color": "#a3be8c", + "text-color": "#a3be8c" + }, + "Information": { + "selected-text-color": "#ebcb8b", + "text-color": "#ebcb8b" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#81a1c1", + "text-color": "#81a1c1" + }, + "Normal": { + "selected-text-color": "#d8dee9", + "text-color": "#d8dee9" + }, + "Operator": { + "selected-text-color": "#81a1c1", + "text-color": "#81a1c1" + }, + "Others": { + "selected-text-color": "#8fbcbb", + "text-color": "#8fbcbb" + }, + "Preprocessor": { + "selected-text-color": "#5e81ac", + "text-color": "#5e81ac" + }, + "RegionMarker": { + "background-color": "#3b4252", + "selected-text-color": "#88c0d0", + "text-color": "#88c0d0" + }, + "SpecialChar": { + "selected-text-color": "#ebcb8b", + "text-color": "#ebcb8b" + }, + "SpecialString": { + "selected-text-color": "#d08770", + "text-color": "#d08770" + }, + "String": { + "selected-text-color": "#a3be8c", + "text-color": "#a3be8c" + }, + "Variable": { + "selected-text-color": "#5e81ac", + "text-color": "#5e81ac" + }, + "VerbatimString": { + "selected-text-color": "#a3be8c", + "text-color": "#a3be8c" + }, + "Warning": { + "selected-text-color": "#bf616a", + "text-color": "#bf616a" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme index a6048ed01a..26d779582d 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/printing.theme @@ -1,6 +1,11 @@ { "metadata" : { - "revision" : 3, + "copyright": [ + "SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>", + "SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>" + ], + "license": "SPDX-License-Identifier: MIT", + "revision" : 4, "name" : "Printing" }, "text-styles": { @@ -141,33 +146,33 @@ } }, "editor-colors": { - "background-color" : "#ffffff", - "code-folding" : "#94caef", - "bracket-matching" : "#edf9ff", - "current-line" : "#f8f7f6", - "icon-border" : "#d6d2d0", - "indentation-line" : "#d2d2d2", - "line-numbers" : "#221f1e", - "current-line-number" : "#221f1e", - "mark-bookmark" : "#0000ff", - "mark-breakpoint-active" : "#ff0000", - "mark-breakpoint-reached" : "#ffff00", - "mark-breakpoint-disabled" : "#ff00ff", - "mark-execution" : "#a0a0a4", - "mark-warning" : "#00ff00", - "mark-error" : "#ff0000", - "modified-lines" : "#f6e6e6", - "replace-highlight" : "#00ff00", - "saved-lines" : "#baf8ce", - "search-highlight" : "#ffff00", - "selection" : "#94caef", - "separator" : "#898887", - "spell-checking" : "#bf0303", - "tab-marker" : "#d2d2d2", - "template-background" : "#d6d2d0", - "template-placeholder" : "#baf8ce", - "template-focused-placeholder" : "#76da98", - "template-read-only-placeholder" : "#f6e6e6", - "word-wrap-marker" : "#ededed" + "BackgroundColor" : "#ffffff", + "CodeFolding" : "#94caef", + "BracketMatching" : "#edf9ff", + "CurrentLine" : "#f8f7f6", + "IconBorder" : "#d6d2d0", + "IndentationLine" : "#d2d2d2", + "LineNumbers" : "#221f1e", + "CurrentLineNumber" : "#221f1e", + "MarkBookmark" : "#0000ff", + "MarkBreakpointActive" : "#ff0000", + "MarkBreakpointReached" : "#ffff00", + "MarkBreakpointDisabled" : "#ff00ff", + "MarkExecution" : "#a0a0a4", + "MarkWarning" : "#00ff00", + "MarkError" : "#ff0000", + "ModifiedLines" : "#f6e6e6", + "ReplaceHighlight" : "#00ff00", + "SavedLines" : "#baf8ce", + "SearchHighlight" : "#ffff00", + "TextSelection" : "#94caef", + "Separator" : "#221f1e", + "SpellChecking" : "#bf0303", + "TabMarker" : "#d2d2d2", + "TemplateBackground" : "#d6d2d0", + "TemplatePlaceholder" : "#baf8ce", + "TemplateFocusedPlaceholder" : "#76da98", + "TemplateReadOnlyPlaceholder" : "#f6e6e6", + "WordWrapMarker" : "#ededed" } } diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/radical.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/radical.theme new file mode 100644 index 0000000000..ec0eb8ca9f --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/radical.theme @@ -0,0 +1,182 @@ +{ + "_comments": [ + "Last update: Sep 23, 2020 (revision 2)", + "This file has been converted from: https://github.com/dhedgecock/radical-vscode" + ], + "metadata": { + "copyright": [ + "SPDX-FileCopyrightText: 2018 Dan Hedgecock", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "name": "Radical", + "revision": 2 + }, + "editor-colors": { + "BackgroundColor": "#141322", + "BracketMatching": "#4f2e93", + "CodeFolding": "#1e1836", + "CurrentLine": "#231630", + "CurrentLineNumber": "#d0fff4", + "IconBorder": "#141322", + "IndentationLine": "#353541", + "LineNumbers": "#415e6c", + "MarkBookmark": "#391ab5", + "MarkBreakpointActive": "#fa61b8", + "MarkBreakpointDisabled": "#83fee8", + "MarkBreakpointReached": "#fffc7e", + "MarkError": "#fc0065", + "MarkExecution": "#c8ff00", + "MarkWarning": "#ffd000", + "ModifiedLines": "#a3ff57", + "ReplaceHighlight": "#ffb000", + "SavedLines": "#ffb000", + "SearchHighlight": "#642581", + "Separator": "#252531", + "SpellChecking": "#ff1767", + "TabMarker": "#2e2e3a", + "TemplateBackground": "#1c1a30", + "TemplateFocusedPlaceholder": "#ff428e", + "TemplatePlaceholder": "#242560", + "TemplateReadOnlyPlaceholder": "#1a1b46", + "TextSelection": "#4f2e93", + "WordWrapMarker": "#100f1a" + }, + "text-styles": { + "Alert": { + "background-color": "#2f183b", + "bold": true, + "selected-text-color": "#ff427b", + "text-color": "#ff427b" + }, + "Annotation": { + "selected-text-color": "#fda8bc", + "text-color": "#fda8bc" + }, + "Attribute": { + "selected-text-color": "#5af5f0", + "text-color": "#5af5f0" + }, + "BaseN": { + "selected-text-color": "#f834bb", + "text-color": "#f834bb" + }, + "BuiltIn": { + "selected-text-color": "#999ee1", + "text-color": "#999ee1" + }, + "Char": { + "selected-text-color": "#dff959", + "text-color": "#dff959" + }, + "Comment": { + "italic": true, + "selected-text-color": "#45898c", + "text-color": "#45898c" + }, + "CommentVar": { + "selected-text-color": "#a8c0c2", + "text-color": "#a8c0c2" + }, + "Constant": { + "bold": true, + "selected-text-color": "#fa61b8", + "text-color": "#fa61b8" + }, + "ControlFlow": { + "bold": true, + "selected-text-color": "#d5358f", + "text-color": "#d5358f" + }, + "DataType": { + "selected-text-color": "#ff85a1", + "text-color": "#ff85a1" + }, + "DecVal": { + "selected-text-color": "#fa61b8", + "text-color": "#fa61b8" + }, + "Documentation": { + "selected-text-color": "#75b7bb", + "text-color": "#75b7bb" + }, + "Error": { + "bold": true, + "italic": true, + "selected-text-color": "#ff427b", + "text-color": "#ff427b", + "underline": true + }, + "Extension": { + "bold": true, + "selected-text-color": "#a8ffdb", + "text-color": "#a8ffdb" + }, + "Float": { + "selected-text-color": "#f834bb", + "text-color": "#f834bb" + }, + "Function": { + "selected-text-color": "#a9fef7", + "text-color": "#a9fef7" + }, + "Import": { + "selected-text-color": "#a9fef7", + "text-color": "#a9fef7" + }, + "Information": { + "selected-text-color": "#ffd000", + "text-color": "#ffd000" + }, + "Keyword": { + "bold": true, + "selected-text-color": "#d5358f", + "text-color": "#d5358f" + }, + "Normal": { + "selected-text-color": "#7c9c9e", + "text-color": "#7c9c9e" + }, + "Operator": { + "selected-text-color": "#d5358f", + "text-color": "#d5358f" + }, + "Others": { + "selected-text-color": "#5effbd", + "text-color": "#5effbd" + }, + "Preprocessor": { + "selected-text-color": "#d5358f", + "text-color": "#d5358f" + }, + "RegionMarker": { + "background-color": "#242560", + "selected-text-color": "#baf7fc", + "text-color": "#baf7fc" + }, + "SpecialChar": { + "selected-text-color": "#c3f920", + "text-color": "#c3f920" + }, + "SpecialString": { + "selected-text-color": "#ff96aa", + "text-color": "#ff96aa" + }, + "String": { + "selected-text-color": "#a9fef7", + "text-color": "#a9fef7" + }, + "Variable": { + "selected-text-color": "#c7e3ee", + "text-color": "#c7e3ee" + }, + "VerbatimString": { + "selected-text-color": "#a8ffdb", + "text-color": "#a8ffdb" + }, + "Warning": { + "selected-text-color": "#ff427b", + "text-color": "#ff427b" + } + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme index 42a6eacbe8..035e1db9c0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-dark.theme @@ -1,6 +1,15 @@ { + "_comments": [ + "This theme has been adapted from: https://ethanschoonover.com/solarized/" + ], "metadata" : { - "revision" : 1, + "copyright": [ + "SPDX-FileCopyrightText: 2011 Ethan Schoonover", + "SPDX-FileCopyrightText: 2012 Dominik Haumann <dhaumann@kde.org>", + "SPDX-FileCopyrightText: 2018 Andrew Crouthamel <andrew.crouthamel@kdemail.net>" + ], + "license": "SPDX-License-Identifier: MIT", + "revision" : 2, "name" : "Solarized Dark" }, "text-styles": { @@ -143,33 +152,33 @@ } }, "editor-colors": { - "background-color" : "#002b36", - "code-folding" : "#6c71c4", - "bracket-matching" : "#073642", - "current-line" : "#073642", - "icon-border" : "#073642", - "indentation-line" : "#073642", - "line-numbers" : "#586e75", - "current-line-number" : "#586e75", - "mark-bookmark" : "#268bd2", - "mark-breakpoint-active" : "#dc322f", - "mark-breakpoint-reached" : "#b58900", - "mark-breakpoint-disabled" : "#d33682", - "mark-execution" : "#586e75", - "mark-warning" : "#cb4b16", - "mark-error" : "#dc322f", - "modified-lines" : "#cb4b16", - "replace-highlight" : "#859900", - "saved-lines" : "#2aa198", - "search-highlight" : "#b58900", - "selection" : "#eee8d5", - "separator" : "#586e75", - "spell-checking" : "#dc322f", - "tab-marker" : "#586e75", - "template-background" : "#073642", - "template-placeholder" : "#073642", - "template-focused-placeholder" : "#073642", - "template-read-only-placeholder" : "#073642", - "word-wrap-marker" : "#586e75" + "BackgroundColor" : "#002b36", + "CodeFolding" : "#6c71c4", + "BracketMatching" : "#073642", + "CurrentLine" : "#073642", + "IconBorder" : "#073642", + "IndentationLine" : "#073642", + "LineNumbers" : "#586e75", + "CurrentLineNumber" : "#586e75", + "MarkBookmark" : "#268bd2", + "MarkBreakpointActive" : "#dc322f", + "MarkBreakpointReached" : "#b58900", + "MarkBreakpointDisabled" : "#d33682", + "MarkExecution" : "#586e75", + "MarkWarning" : "#cb4b16", + "MarkError" : "#dc322f", + "ModifiedLines" : "#cb4b16", + "ReplaceHighlight" : "#859900", + "SavedLines" : "#2aa198", + "SearchHighlight" : "#b58900", + "TextSelection" : "#eee8d5", + "Separator" : "#002b36", + "SpellChecking" : "#dc322f", + "TabMarker" : "#586e75", + "TemplateBackground" : "#073642", + "TemplatePlaceholder" : "#073642", + "TemplateFocusedPlaceholder" : "#073642", + "TemplateReadOnlyPlaceholder" : "#073642", + "WordWrapMarker" : "#586e75" } } diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme index 473f98add3..8cab40db48 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/solarized-light.theme @@ -1,6 +1,15 @@ { + "_comments": [ + "This theme has been adapted from: https://ethanschoonover.com/solarized/" + ], "metadata" : { - "revision" : 1, + "copyright": [ + "SPDX-FileCopyrightText: 2011 Ethan Schoonover", + "SPDX-FileCopyrightText: 2012 Dominik Haumann <dhaumann@kde.org>", + "SPDX-FileCopyrightText: 2018 Andrew Crouthamel <andrew.crouthamel@kdemail.net>" + ], + "license": "SPDX-License-Identifier: MIT", + "revision" : 2, "name" : "Solarized Light" }, "text-styles": { @@ -143,33 +152,33 @@ } }, "editor-colors": { - "background-color" : "#fdf6e3", - "code-folding" : "#6c71c4", - "bracket-matching" : "#eee8d5", - "current-line" : "#eee8d5", - "icon-border" : "#eee8d5", - "indentation-line" : "#eee8d5", - "line-numbers" : "#93a1a1", - "current-line-number" : "#93a1a1", - "mark-bookmark" : "#268bd2", - "mark-breakpoint-active" : "#dc322f", - "mark-breakpoint-reached" : "#b58900", - "mark-breakpoint-disabled" : "#d33682", - "mark-execution" : "#93a1a1", - "mark-warning" : "#cb4b16", - "mark-error" : "#dc322f", - "modified-lines" : "#cb4b16", - "replace-highlight" : "#859900", - "saved-lines" : "#2aa198", - "search-highlight" : "#b58900", - "selection" : "#073642", - "separator" : "#93a1a1", - "spell-checking" : "#dc322f", - "tab-marker" : "#93a1a1", - "template-background" : "#eee8d5", - "template-placeholder" : "#eee8d5", - "template-focused-placeholder" : "#eee8d5", - "template-read-only-placeholder" : "#eee8d5", - "word-wrap-marker" : "#93a1a1" + "BackgroundColor" : "#fdf6e3", + "CodeFolding" : "#6c71c4", + "BracketMatching" : "#eee8d5", + "CurrentLine" : "#eee8d5", + "IconBorder" : "#eee8d5", + "IndentationLine" : "#eee8d5", + "LineNumbers" : "#93a1a1", + "CurrentLineNumber" : "#93a1a1", + "MarkBookmark" : "#268bd2", + "MarkBreakpointActive" : "#dc322f", + "MarkBreakpointReached" : "#b58900", + "MarkBreakpointDisabled" : "#d33682", + "MarkExecution" : "#93a1a1", + "MarkWarning" : "#cb4b16", + "MarkError" : "#dc322f", + "ModifiedLines" : "#cb4b16", + "ReplaceHighlight" : "#859900", + "SavedLines" : "#2aa198", + "SearchHighlight" : "#b58900", + "TextSelection" : "#073642", + "Separator" : "#fdf6e3", + "SpellChecking" : "#dc322f", + "TabMarker" : "#93a1a1", + "TemplateBackground" : "#eee8d5", + "TemplatePlaceholder" : "#eee8d5", + "TemplateFocusedPlaceholder" : "#eee8d5", + "TemplateReadOnlyPlaceholder" : "#eee8d5", + "WordWrapMarker" : "#93a1a1" } } diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc b/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc index 46af4213b5..0a6f24385a 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/theme-data.qrc @@ -1,10 +1,19 @@ <!DOCTYPE RCC> <RCC version="1.0"> <qresource prefix="/org.kde.syntax-highlighting/themes"> - <file alias="default.theme">default.theme</file> - <file alias="breeze-dark.theme">breeze-dark.theme</file> - <file alias="printing.theme">printing.theme</file> - <file alias="solarized-dark.theme">solarized-dark.theme</file> - <file alias="solarized-light.theme">solarized-light.theme</file> + <file>breeze-dark.theme</file> + <file>breeze-light.theme</file> + <file>ayu-dark.theme</file> + <file>ayu-light.theme</file> + <file>ayu-mirage.theme</file> + <file>dracula.theme</file> + <file>gruvbox-dark.theme</file> + <file>gruvbox-light.theme</file> + <file>nord.theme</file> + <file>printing.theme</file> + <file>radical.theme</file> + <file>solarized-dark.theme</file> + <file>solarized-light.theme</file> + <file>vim-dark.theme</file> </qresource> </RCC> diff --git a/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme b/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme new file mode 100644 index 0000000000..1a2c7785ac --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/themes/vim-dark.theme @@ -0,0 +1,180 @@ +{ + "metadata" : { + "copyright": [ + "SPDX-FileCopyrightText: 2012 Dominik Haumann <dhaumann@kde.org>", + "SPDX-FileCopyrightText: 2020 Nibaldo González <nibgonz@gmail.com>" + ], + "license": "SPDX-License-Identifier: MIT", + "revision" : 3, + "name" : "Vim Dark" + }, + "text-styles": { + "Normal" : { + "text-color" : "#b2b2b2", + "selected-text-color" : "#b2b2b2", + "bold" : false, + "italic" : false, + "underline" : false, + "strike-through" : false + }, + "Keyword" : { + "text-color" : "#5fd7ff", + "selected-text-color" : "#e0ffff", + "bold" : true + }, + "Function" : { + "text-color" : "#cd00cd", + "selected-text-color" : "#cd00cd" + }, + "Variable" : { + "text-color" : "#06989a", + "selected-text-color" : "#06989a" + }, + "ControlFlow" : { + "text-color" : "#ffff54", + "selected-text-color" : "#ffff54", + "bold" : true + }, + "Operator" : { + "text-color" : "#b2b2b2", + "selected-text-color" : "#b2b2b2" + }, + "BuiltIn" : { + "text-color" : "#87ffaf", + "selected-text-color" : "#87ffaf", + "bold" : true + }, + "Extension" : { + "text-color" : "#0095ff", + "selected-text-color" : "#0095ff", + "bold" : true + }, + "Preprocessor" : { + "text-color" : "#87ffaf", + "selected-text-color" : "#87ffaf" + }, + "Attribute" : { + "text-color" : "#ffffaf", + "selected-text-color" : "#ffffaf" + }, + "Char" : { + "text-color" : "#ff5454", + "selected-text-color" : "#ff5454" + }, + "SpecialChar" : { + "text-color" : "#0095ff", + "selected-text-color" : "#0095ff" + }, + "String" : { + "text-color" : "#ff54ff", + "selected-text-color" : "#ff54ff" + }, + "VerbatimString" : { + "text-color" : "#ff54ff", + "selected-text-color" : "#ff54ff" + }, + "SpecialString" : { + "text-color" : "#ff5500", + "selected-text-color" : "#ff5500" + }, + "Import" : { + "text-color" : "#ff54ff", + "selected-text-color" : "#ff54ff" + }, + "DataType" : { + "text-color" : "#ffff54", + "selected-text-color" : "#ffff54" + }, + "DecVal" : { + "text-color" : "#ff8b8b", + "selected-text-color" : "#ff8b8b" + }, + "BaseN" : { + "text-color" : "#ff8b8b", + "selected-text-color" : "#ff8b8b" + }, + "Float" : { + "text-color" : "#ff8b8b", + "selected-text-color" : "#ff8b8b" + }, + "Constant" : { + "text-color" : "#af7f00", + "selected-text-color" : "#af7f00", + "bold" : true + }, + "Comment" : { + "text-color" : "#54ffff", + "selected-text-color" : "#54ffff" + }, + "Documentation" : { + "text-color" : "#e0ffff", + "selected-text-color" : "#e0ffff" + }, + "Annotation" : { + "text-color" : "#ff00ff", + "selected-text-color" : "#ff00ff" + }, + "CommentVar" : { + "text-color" : "#0095ff", + "selected-text-color" : "#0095ff" + }, + "RegionMarker" : { + "text-color" : "#0095ff", + "selected-text-color" : "#0095ff", + "background-color" : "#22226d" + }, + "Information" : { + "text-color" : "#ffaa00", + "selected-text-color" : "#ffaa00" + }, + "Warning" : { + "text-color" : "#ff0000", + "selected-text-color" : "#ed1515" + }, + "Alert" : { + "text-color" : "#ff0000", + "selected-text-color" : "#bf0303", + "background-color" : "#3f0000", + "bold" : true + }, + "Error" : { + "text-color" : "#ff5500", + "selected-text-color" : "#ff5500", + "underline" : true + }, + "Others" : { + "text-color" : "#54ff54", + "selected-text-color" : "#54ff54" + } + }, + "editor-colors": { + "BackgroundColor" : "#000000", + "CodeFolding" : "#002b26", + "BracketMatching" : "#4400aa", + "CurrentLine" : "#17003b", + "IconBorder" : "#000000", + "IndentationLine" : "#2a00d2", + "LineNumbers" : "#005d7a", + "CurrentLineNumber" : "#005d7a", + "MarkBookmark" : "#0000ff", + "MarkBreakpointActive" : "#ff0000", + "MarkBreakpointReached" : "#ffff00", + "MarkBreakpointDisabled" : "#ff00ff", + "MarkExecution" : "#a0a0a4", + "MarkWarning" : "#00ff00", + "MarkError" : "#ff0000", + "ModifiedLines" : "#54ff54", + "ReplaceHighlight" : "#54ff54", + "SavedLines" : "#5454ff", + "SearchHighlight" : "#ffff00", + "TextSelection" : "#232323", + "Separator" : "#003344", + "SpellChecking" : "#ff0000", + "TabMarker" : "#414141", + "TemplateBackground" : "#cccccc", + "TemplatePlaceholder" : "#ccffcc", + "TemplateFocusedPlaceholder" : "#66ff66", + "TemplateReadOnlyPlaceholder" : "#ffcccc", + "WordWrapMarker" : "#262626" + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp index 82207c0099..a178c1ba27 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "ksyntaxhighlighting_version.h" @@ -26,6 +9,7 @@ #include <definition.h> #include <definitiondownloader.h> #include <htmlhighlighter.h> +#include <ansihighlighter.h> #include <repository.h> #include <theme.h> @@ -37,6 +21,25 @@ using namespace KSyntaxHighlighting; +template<class Highlighter, class ...Ts> +static void applyHighlighter(Highlighter &highlighter, QCommandLineParser &parser, bool fromFileName, const QString &inFileName, const QCommandLineOption &stdinOption, const QCommandLineOption &outputName, const Ts &...highlightParams) +{ + if (parser.isSet(outputName)) + highlighter.setOutputFile(parser.value(outputName)); + else + highlighter.setOutputFile(stdout); + + if (fromFileName) { + highlighter.highlightFile(inFileName, highlightParams...); + } else if (parser.isSet(stdinOption)) { + QFile inFile; + inFile.open(stdin, QIODevice::ReadOnly); + highlighter.highlightData(&inFile, highlightParams...); + } else { + parser.showHelp(1); + } +} + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -45,6 +48,8 @@ int main(int argc, char **argv) QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setApplicationVersion(QStringLiteral(SyntaxHighlighting_VERSION_STRING)); + Repository repo; + QCommandLineParser parser; parser.setApplicationDescription(app.translate("SyntaxHighlightingCLI", "Command line syntax highlighter using Kate syntax definitions.")); parser.addHelpOption(); @@ -69,9 +74,24 @@ int main(int argc, char **argv) parser.addOption(syntaxName); QCommandLineOption themeName( - QStringList() << QStringLiteral("t") << QStringLiteral("theme"), app.translate("SyntaxHighlightingCLI", "Color theme to use for highlighting."), app.translate("SyntaxHighlightingCLI", "theme"), QStringLiteral("Default")); + QStringList() << QStringLiteral("t") << QStringLiteral("theme"), app.translate("SyntaxHighlightingCLI", "Color theme to use for highlighting."), app.translate("SyntaxHighlightingCLI", "theme"), repo.defaultTheme(Repository::LightTheme).name()); 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."), + 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 values are format, region and context."), + app.translate("SyntaxHighlightingCLI", "type")); + parser.addOption(traceOption); + + QCommandLineOption noAnsiEditorBg(QStringList() << QStringLiteral("b") << QStringLiteral("no-ansi-background"), + app.translate("SyntaxHighlightingCLI", "Disable ANSI background for the default color.")); + parser.addOption(noAnsiEditorBg); + QCommandLineOption titleOption(QStringList() << QStringLiteral("T") << QStringLiteral("title"), app.translate("SyntaxHighlightingCLI", "Set HTML page's title\n(default: the filename or \"Kate Syntax Highlighter\" if reading from stdin)."), app.translate("SyntaxHighlightingCLI", "title")); @@ -82,7 +102,6 @@ int main(int argc, char **argv) parser.process(app); - Repository repo; if (parser.isSet(listDefs)) { for (const auto &def : repo.definitions()) { std::cout << qPrintable(def.name()) << std::endl; @@ -113,41 +132,70 @@ int main(int argc, char **argv) Definition def; if (parser.isSet(syntaxName)) { - def = repo.definitionForName(parser.value(syntaxName)); - if (!def.isValid()) + const QString syntax = parser.value(syntaxName); + def = repo.definitionForName(syntax); + if (!def.isValid()) { /* see if it's a mimetype instead */ - def = repo.definitionForMimeType(parser.value(syntaxName)); + def = repo.definitionForMimeType(syntax); + if (!def.isValid()) { + /* see if it's a extension instead */ + def = repo.definitionForFileName(QLatin1String("f.")+syntax); + if (!def.isValid()) + /* see if it's a filename instead */ + def = repo.definitionForFileName(syntax); + } + } } else if (fromFileName) { def = repo.definitionForFileName(inFileName); } else { parser.showHelp(1); } - QString title; - if (parser.isSet(titleOption)) - title = parser.value(titleOption); - if (!def.isValid()) { std::cerr << "Unknown syntax." << std::endl; return 1; } - HtmlHighlighter highlighter; - highlighter.setDefinition(def); - if (parser.isSet(outputName)) - highlighter.setOutputFile(parser.value(outputName)); - else - highlighter.setOutputFile(stdout); - highlighter.setTheme(repo.theme(parser.value(themeName))); + QString outputFormat = parser.value(outputFormatOption); + if (0 == outputFormat.compare(QLatin1String("html"), Qt::CaseInsensitive)) { + QString title; + if (parser.isSet(titleOption)) + title = parser.value(titleOption); - if (fromFileName) { - highlighter.highlightFile(inFileName, title); - } else if (parser.isSet(stdinOption)) { - QFile inFile; - inFile.open(stdin, QIODevice::ReadOnly); - highlighter.highlightData(&inFile, title); + HtmlHighlighter highlighter; + highlighter.setDefinition(def); + highlighter.setTheme(repo.theme(parser.value(themeName))); + applyHighlighter(highlighter, parser, fromFileName, inFileName, stdinOption, outputName, title); } else { - parser.showHelp(1); + auto AnsiFormat = AnsiHighlighter::AnsiFormat::TrueColor; + if (0 == outputFormat.compare(QLatin1String("ansi256Colors"), Qt::CaseInsensitive)) { + AnsiFormat = AnsiHighlighter::AnsiFormat::XTerm256Color; + } else if (0 != outputFormat.compare(QLatin1String("ansi"), Qt::CaseInsensitive)) { + std::cerr << "Unknown output format." << std::endl; + return 2; + } + + auto debugOptions = AnsiHighlighter::TraceOptions(); + if (parser.isSet(traceOption)) { + const auto options = parser.values(traceOption); + for (auto const& option : options) { + if (option == QStringLiteral("format")) { + debugOptions |= AnsiHighlighter::TraceOption::Format; + } else if (option == QStringLiteral("region")) { + debugOptions |= AnsiHighlighter::TraceOption::Region; + } else if (option == QStringLiteral("context")) { + debugOptions |= AnsiHighlighter::TraceOption::Context; + } else { + std::cerr << "Unknown trace name." << std::endl; + return 2; + } + } + } + + AnsiHighlighter highlighter; + highlighter.setDefinition(def); + highlighter.setTheme(repo.theme(parser.value(themeName))); + applyHighlighter(highlighter, parser, fromFileName, inFileName, stdinOption, outputName, AnsiFormat, !parser.isSet(noAnsiEditorBg), debugOptions); } return 0; diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp index aeb4c2db55..b5d04934e6 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2014 Christoph Cullmann <cullmann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2014 Christoph Cullmann <cullmann@kde.org> + + SPDX-License-Identifier: MIT */ #include <QCoreApplication> @@ -35,6 +18,10 @@ #include <QXmlSchemaValidator> #endif +#include "../lib/xml_p.h" + +using KSyntaxHighlighting::Xml::attrToBool; + namespace { QStringList readListing(const QString &fileName) @@ -138,7 +125,7 @@ bool checkRegularExpression(const QString &hlFilename, QXmlStreamReader &xml) } // dynamic == true and no place holder? - if (xml.name() == QLatin1String("RegExpr") && xml.attributes().value(QStringLiteral("dynamic")) == QStringLiteral("true")) { + if (xml.name() == QLatin1String("RegExpr") && attrToBool(xml.attributes().value(QStringLiteral("dynamic")))) { static const QRegularExpression placeHolder(QStringLiteral("%\\d+")); if (!string.contains(placeHolder)) { qWarning() << hlFilename << "line" << xml.lineNumber() << "broken regex:" << string << "problem: dynamic=true but no %\\d+ placeholder"; @@ -197,7 +184,7 @@ bool checkLookAhead(const QString &hlFilename, QXmlStreamReader &xml) { if (xml.attributes().hasAttribute(QStringLiteral("lookAhead"))) { auto lookAhead = xml.attributes().value(QStringLiteral("lookAhead")); - if (lookAhead == QStringLiteral("true")) { + if (attrToBool(lookAhead)) { auto context = xml.attributes().value(QStringLiteral("context")); if (context == QStringLiteral("#stay")) { qWarning() << hlFilename << "line" << xml.lineNumber() << "Infinite loop: lookAhead with context #stay"; @@ -368,9 +355,18 @@ public: language.existingContextNames.insert(name); } - if (xml.attributes().value(QLatin1String("fallthroughContext")).toString() == QLatin1String("#stay")) { - qWarning() << hlFilename << "possible infinite loop due to fallthroughContext=\"#stay\" in context " << name; - m_success = false; + auto fallthroughContext = xml.attributes().value(QLatin1String("fallthroughContext")); + if (!fallthroughContext.isEmpty()) { + if (fallthroughContext == QLatin1String("#stay")) { + qWarning() << hlFilename << "possible infinite loop due to fallthroughContext=\"#stay\" in context " << name; + m_success = false; + } + + auto fallthrough = xml.attributes().value(QLatin1String("fallthrough")); + if (fallthrough.isEmpty() && language.version < Version{5, 62}) { + qWarning() << hlFilename << "fallthroughContext attribute without fallthrough attribute is only valid with kateversion >= 5.62 in context " << name; + m_success = false; + } } processContext(hlName, xml.attributes().value(QLatin1String("lineEndContext")).toString()); @@ -692,8 +688,7 @@ int main(int argc, char *argv[]) hl[QStringLiteral("priority")] = xml.attributes().value(QLatin1String("priority")).toInt(); // add boolean one - const QString hidden = xml.attributes().value(QLatin1String("hidden")).toString(); - hl[QStringLiteral("hidden")] = (hidden == QLatin1String("true") || hidden == QLatin1String("1")); + hl[QStringLiteral("hidden")] = attrToBool(xml.attributes().value(QLatin1String("hidden"))); // remember hl hls[QFileInfo(hlFile).fileName()] = hl; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt index d208d48f5c..97aeee3dbc 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt @@ -8,6 +8,7 @@ set(syntax_highlighting_srcs foldingregion.cpp format.cpp htmlhighlighter.cpp + ansihighlighter.cpp keywordlist.cpp rule.cpp definition.cpp @@ -17,6 +18,7 @@ set(syntax_highlighting_srcs theme.cpp wildcardmatcher.cpp themedata.cpp + worddelimiters.cpp ${syntax_highlighting_QM_LOADER} ) ecm_qt_declare_logging_category(syntax_highlighting_srcs diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp index fc5c627812..5eefc3a48d 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "abstracthighlighter.h" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h index 575a723527..5e85873ce0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h index f1492df786..11332fdcfd 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/abstracthighlighter_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTER_P_H @@ -27,6 +10,10 @@ #include "definition.h" #include "theme.h" +QT_BEGIN_NAMESPACE +class QStringList; +QT_END_NAMESPACE + namespace KSyntaxHighlighting { class ContextSwitch; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp new file mode 100644 index 0000000000..abe5e8d2be --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.cpp @@ -0,0 +1,1291 @@ +/* + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT +*/ + +#include "ansihighlighter.h" +#include "definition.h" +#include "format.h" +#include "ksyntaxhighlighting_logging.h" +#include "state.h" +#include "theme.h" +#include "state_p.h" +#include "context_p.h" +#include "definition_p.h" + +#include <QFile> +#include <QFileInfo> +#include <QTextStream> +#include <QColor> +#include <QMap> +#include <QtMath> + +#include <vector> +#include <cmath> + +using namespace KSyntaxHighlighting; + +namespace +{ + struct CieLab + { + double l; + double a; + double b; + }; + + // xterm color reference + // constexpr Rgb888 xterm256Colors[] { + // {0x00, 0x00, 0x00}, {0x80, 0x00, 0x00}, {0x00, 0x80, 0x00}, {0x80, 0x80, 0x00}, + // {0x00, 0x00, 0x80}, {0x80, 0x00, 0x80}, {0x00, 0x80, 0x80}, {0xc0, 0xc0, 0xc0}, + // {0x80, 0x80, 0x80}, {0xff, 0x00, 0x00}, {0x00, 0xff, 0x00}, {0xff, 0xff, 0x00}, + // {0x00, 0x00, 0xff}, {0xff, 0x00, 0xff}, {0x00, 0xff, 0xff}, {0xff, 0xff, 0xff}, + // {0x00, 0x00, 0x00}, {0x00, 0x00, 0x5f}, {0x00, 0x00, 0x87}, {0x00, 0x00, 0xaf}, + // {0x00, 0x00, 0xd7}, {0x00, 0x00, 0xff}, {0x00, 0x5f, 0x00}, {0x00, 0x5f, 0x5f}, + // {0x00, 0x5f, 0x87}, {0x00, 0x5f, 0xaf}, {0x00, 0x5f, 0xd7}, {0x00, 0x5f, 0xff}, + // {0x00, 0x87, 0x00}, {0x00, 0x87, 0x5f}, {0x00, 0x87, 0x87}, {0x00, 0x87, 0xaf}, + // {0x00, 0x87, 0xd7}, {0x00, 0x87, 0xff}, {0x00, 0xaf, 0x00}, {0x00, 0xaf, 0x5f}, + // {0x00, 0xaf, 0x87}, {0x00, 0xaf, 0xaf}, {0x00, 0xaf, 0xd7}, {0x00, 0xaf, 0xff}, + // {0x00, 0xd7, 0x00}, {0x00, 0xd7, 0x5f}, {0x00, 0xd7, 0x87}, {0x00, 0xd7, 0xaf}, + // {0x00, 0xd7, 0xd7}, {0x00, 0xd7, 0xff}, {0x00, 0xff, 0x00}, {0x00, 0xff, 0x5f}, + // {0x00, 0xff, 0x87}, {0x00, 0xff, 0xaf}, {0x00, 0xff, 0xd7}, {0x00, 0xff, 0xff}, + // {0x5f, 0x00, 0x00}, {0x5f, 0x00, 0x5f}, {0x5f, 0x00, 0x87}, {0x5f, 0x00, 0xaf}, + // {0x5f, 0x00, 0xd7}, {0x5f, 0x00, 0xff}, {0x5f, 0x5f, 0x00}, {0x5f, 0x5f, 0x5f}, + // {0x5f, 0x5f, 0x87}, {0x5f, 0x5f, 0xaf}, {0x5f, 0x5f, 0xd7}, {0x5f, 0x5f, 0xff}, + // {0x5f, 0x87, 0x00}, {0x5f, 0x87, 0x5f}, {0x5f, 0x87, 0x87}, {0x5f, 0x87, 0xaf}, + // {0x5f, 0x87, 0xd7}, {0x5f, 0x87, 0xff}, {0x5f, 0xaf, 0x00}, {0x5f, 0xaf, 0x5f}, + // {0x5f, 0xaf, 0x87}, {0x5f, 0xaf, 0xaf}, {0x5f, 0xaf, 0xd7}, {0x5f, 0xaf, 0xff}, + // {0x5f, 0xd7, 0x00}, {0x5f, 0xd7, 0x5f}, {0x5f, 0xd7, 0x87}, {0x5f, 0xd7, 0xaf}, + // {0x5f, 0xd7, 0xd7}, {0x5f, 0xd7, 0xff}, {0x5f, 0xff, 0x00}, {0x5f, 0xff, 0x5f}, + // {0x5f, 0xff, 0x87}, {0x5f, 0xff, 0xaf}, {0x5f, 0xff, 0xd7}, {0x5f, 0xff, 0xff}, + // {0x87, 0x00, 0x00}, {0x87, 0x00, 0x5f}, {0x87, 0x00, 0x87}, {0x87, 0x00, 0xaf}, + // {0x87, 0x00, 0xd7}, {0x87, 0x00, 0xff}, {0x87, 0x5f, 0x00}, {0x87, 0x5f, 0x5f}, + // {0x87, 0x5f, 0x87}, {0x87, 0x5f, 0xaf}, {0x87, 0x5f, 0xd7}, {0x87, 0x5f, 0xff}, + // {0x87, 0x87, 0x00}, {0x87, 0x87, 0x5f}, {0x87, 0x87, 0x87}, {0x87, 0x87, 0xaf}, + // {0x87, 0x87, 0xd7}, {0x87, 0x87, 0xff}, {0x87, 0xaf, 0x00}, {0x87, 0xaf, 0x5f}, + // {0x87, 0xaf, 0x87}, {0x87, 0xaf, 0xaf}, {0x87, 0xaf, 0xd7}, {0x87, 0xaf, 0xff}, + // {0x87, 0xd7, 0x00}, {0x87, 0xd7, 0x5f}, {0x87, 0xd7, 0x87}, {0x87, 0xd7, 0xaf}, + // {0x87, 0xd7, 0xd7}, {0x87, 0xd7, 0xff}, {0x87, 0xff, 0x00}, {0x87, 0xff, 0x5f}, + // {0x87, 0xff, 0x87}, {0x87, 0xff, 0xaf}, {0x87, 0xff, 0xd7}, {0x87, 0xff, 0xff}, + // {0xaf, 0x00, 0x00}, {0xaf, 0x00, 0x5f}, {0xaf, 0x00, 0x87}, {0xaf, 0x00, 0xaf}, + // {0xaf, 0x00, 0xd7}, {0xaf, 0x00, 0xff}, {0xaf, 0x5f, 0x00}, {0xaf, 0x5f, 0x5f}, + // {0xaf, 0x5f, 0x87}, {0xaf, 0x5f, 0xaf}, {0xaf, 0x5f, 0xd7}, {0xaf, 0x5f, 0xff}, + // {0xaf, 0x87, 0x00}, {0xaf, 0x87, 0x5f}, {0xaf, 0x87, 0x87}, {0xaf, 0x87, 0xaf}, + // {0xaf, 0x87, 0xd7}, {0xaf, 0x87, 0xff}, {0xaf, 0xaf, 0x00}, {0xaf, 0xaf, 0x5f}, + // {0xaf, 0xaf, 0x87}, {0xaf, 0xaf, 0xaf}, {0xaf, 0xaf, 0xd7}, {0xaf, 0xaf, 0xff}, + // {0xaf, 0xd7, 0x00}, {0xaf, 0xd7, 0x5f}, {0xaf, 0xd7, 0x87}, {0xaf, 0xd7, 0xaf}, + // {0xaf, 0xd7, 0xd7}, {0xaf, 0xd7, 0xff}, {0xaf, 0xff, 0x00}, {0xaf, 0xff, 0x5f}, + // {0xaf, 0xff, 0x87}, {0xaf, 0xff, 0xaf}, {0xaf, 0xff, 0xd7}, {0xaf, 0xff, 0xff}, + // {0xd7, 0x00, 0x00}, {0xd7, 0x00, 0x5f}, {0xd7, 0x00, 0x87}, {0xd7, 0x00, 0xaf}, + // {0xd7, 0x00, 0xd7}, {0xd7, 0x00, 0xff}, {0xd7, 0x5f, 0x00}, {0xd7, 0x5f, 0x5f}, + // {0xd7, 0x5f, 0x87}, {0xd7, 0x5f, 0xaf}, {0xd7, 0x5f, 0xd7}, {0xd7, 0x5f, 0xff}, + // {0xd7, 0x87, 0x00}, {0xd7, 0x87, 0x5f}, {0xd7, 0x87, 0x87}, {0xd7, 0x87, 0xaf}, + // {0xd7, 0x87, 0xd7}, {0xd7, 0x87, 0xff}, {0xd7, 0xaf, 0x00}, {0xd7, 0xaf, 0x5f}, + // {0xd7, 0xaf, 0x87}, {0xd7, 0xaf, 0xaf}, {0xd7, 0xaf, 0xd7}, {0xd7, 0xaf, 0xff}, + // {0xd7, 0xd7, 0x00}, {0xd7, 0xd7, 0x5f}, {0xd7, 0xd7, 0x87}, {0xd7, 0xd7, 0xaf}, + // {0xd7, 0xd7, 0xd7}, {0xd7, 0xd7, 0xff}, {0xd7, 0xff, 0x00}, {0xd7, 0xff, 0x5f}, + // {0xd7, 0xff, 0x87}, {0xd7, 0xff, 0xaf}, {0xd7, 0xff, 0xd7}, {0xd7, 0xff, 0xff}, + // {0xff, 0x00, 0x00}, {0xff, 0x00, 0x5f}, {0xff, 0x00, 0x87}, {0xff, 0x00, 0xaf}, + // {0xff, 0x00, 0xd7}, {0xff, 0x00, 0xff}, {0xff, 0x5f, 0x00}, {0xff, 0x5f, 0x5f}, + // {0xff, 0x5f, 0x87}, {0xff, 0x5f, 0xaf}, {0xff, 0x5f, 0xd7}, {0xff, 0x5f, 0xff}, + // {0xff, 0x87, 0x00}, {0xff, 0x87, 0x5f}, {0xff, 0x87, 0x87}, {0xff, 0x87, 0xaf}, + // {0xff, 0x87, 0xd7}, {0xff, 0x87, 0xff}, {0xff, 0xaf, 0x00}, {0xff, 0xaf, 0x5f}, + // {0xff, 0xaf, 0x87}, {0xff, 0xaf, 0xaf}, {0xff, 0xaf, 0xd7}, {0xff, 0xaf, 0xff}, + // {0xff, 0xd7, 0x00}, {0xff, 0xd7, 0x5f}, {0xff, 0xd7, 0x87}, {0xff, 0xd7, 0xaf}, + // {0xff, 0xd7, 0xd7}, {0xff, 0xd7, 0xff}, {0xff, 0xff, 0x00}, {0xff, 0xff, 0x5f}, + // {0xff, 0xff, 0x87}, {0xff, 0xff, 0xaf}, {0xff, 0xff, 0xd7}, {0xff, 0xff, 0xff}, + // {0x08, 0x08, 0x08}, {0x12, 0x12, 0x12}, {0x1c, 0x1c, 0x1c}, {0x26, 0x26, 0x26}, + // {0x30, 0x30, 0x30}, {0x3a, 0x3a, 0x3a}, {0x44, 0x44, 0x44}, {0x4e, 0x4e, 0x4e}, + // {0x58, 0x58, 0x58}, {0x62, 0x62, 0x62}, {0x6c, 0x6c, 0x6c}, {0x76, 0x76, 0x76}, + // {0x80, 0x80, 0x80}, {0x8a, 0x8a, 0x8a}, {0x94, 0x94, 0x94}, {0x9e, 0x9e, 0x9e}, + // {0xa8, 0xa8, 0xa8}, {0xb2, 0xb2, 0xb2}, {0xbc, 0xbc, 0xbc}, {0xc6, 0xc6, 0xc6}, + // {0xd0, 0xd0, 0xd0}, {0xda, 0xda, 0xda}, {0xe4, 0xe4, 0xe4}, {0xee, 0xee, 0xee}, + // }; + + // xterm color represented in CIELAB (D65) + // see rgbToLab() + constexpr CieLab xterm240Labs[] { + // ignore the first 16 colors as they are unpredictable (user configurable) + // { 0.000000, 0.000000, 0.000000}, + // { 25.535531, 48.045128, 38.057321}, + // { 46.227431, -51.698496, 49.896846}, + // { 51.868943, -12.929464, 56.674579}, + // { 12.971967, 47.502281, -64.702162}, + // { 29.784667, 58.927896, -36.487077}, + // { 48.254093, -28.846304, -8.476886}, + // { 77.704367, -0.000013, 0.000005}, + // { 53.585016, -0.000010, 0.000004}, + // { 53.240794, 80.092460, 67.203197}, + // { 87.734722, -86.182716, 83.179321}, + // { 97.139267, -21.553748, 94.477975}, + // { 32.297011, 79.187520, -107.860162}, + // { 60.324212, 98.234312, -60.824892}, + // { 91.113220, -48.087528, -14.131186}, + // { 100.000004, -0.000017, 0.000007}, + // 240 colors mode + { 0.000000, 0.000000, 0.000000}, + { 7.460661, 38.391030, -52.344094}, + { 14.108800, 49.366227, -67.241015}, + { 20.416780, 59.708756, -81.328423}, + { 26.461219, 69.619186, -94.827275}, + { 32.297011, 79.187520, -107.860162}, + { 34.362921, -41.841471, 40.383330}, + { 36.003172, -23.346362, -6.860652}, + { 37.721074, -8.280292, -28.838129}, + { 40.044712, 8.050351, -49.077929}, + { 42.896244, 24.232072, -67.665859}, + { 46.179103, 39.611555, -84.835619}, + { 48.669178, -53.727096, 51.854752}, + { 49.680825, -41.468213, 12.871276}, + { 50.775364, -29.978206, -8.809511}, + { 52.309747, -16.087685, -29.668380}, + { 54.271652, -0.984531, -49.346593}, + { 56.628677, 14.436593, -67.825764}, + { 62.217771, -64.983255, 62.718643}, + { 62.913963, -56.274791, 30.552786}, + { 63.677487, -47.533738, 9.989760}, + { 64.765216, -36.258826, -10.655158}, + { 66.184274, -23.179986, -30.659176}, + { 67.928678, -9.021871, -49.792238}, + { 75.200318, -75.769144, 73.128652}, + { 75.714081, -69.238116, 46.415771}, + { 76.281325, -62.437099, 27.358874}, + { 77.096125, -53.317791, 7.414754}, + { 78.170587, -42.277048, -12.423696}, + { 79.508487, -29.803889, -31.743841}, + { 87.734722, -86.182716, 83.179321}, + { 88.132543, -81.079314, 60.784276}, + { 88.573418, -75.649889, 43.369240}, + { 89.209664, -68.192330, 24.408752}, + { 90.053903, -58.903863, 5.054882}, + { 91.113220, -48.087528, -14.131186}, + { 17.616214, 38.884668, 27.208161}, + { 21.055194, 47.692487, -29.530317}, + { 24.265489, 55.109279, -50.109929}, + { 28.188460, 63.497258, -68.189398}, + { 32.565034, 72.278448, -84.495140}, + { 37.209055, 81.157734, -99.539334}, + { 38.928802, -10.464285, 45.868796}, + { 40.317682, -0.000008, 0.000003}, + { 41.792415, 9.716881, -22.184768}, + { 43.816568, 21.358548, -42.829511}, + { 46.341283, 33.910621, -61.915173}, + { 49.295490, 46.651030, -79.609352}, + { 51.565360, -31.106941, 55.362293}, + { 52.493892, -22.366057, 17.186391}, + { 53.502318, -13.755714, -4.459620}, + { 54.922246, -2.860324, -25.412901}, + { 56.747662, 9.522785, -45.263794}, + { 58.953975, 22.669708, -63.961919}, + { 64.235031, -48.203292, 65.170137}, + { 64.897084, -41.171043, 33.487406}, + { 65.624132, -33.963343, 13.012989}, + { 66.661569, -24.464553, -7.626328}, + { 68.017831, -13.189300, -27.680081}, + { 69.689139, -0.708182, -46.900093}, + { 76.698001, -62.880681, 74.951857}, + { 77.195429, -57.221495, 48.537298}, + { 77.744943, -51.270878, 29.570908}, + { 78.534816, -43.206116, 9.664419}, + { 79.577356, -33.321295, -10.175418}, + { 80.876952, -22.010117, -29.524777}, + { 88.898351, -75.968373, 84.597226}, + { 89.287443, -71.354717, 62.392493}, + { 89.718758, -66.422134, 45.055576}, + { 90.341414, -59.608536, 26.140485}, + { 91.167986, -51.063898, 6.804468}, + { 92.205709, -41.038767, -12.384583}, + { 27.165347, 49.930374, 40.136706}, + { 29.358410, 55.725044, -15.903001}, + { 31.581214, 61.240172, -37.918796}, + { 34.491549, 68.043425, -57.611837}, + { 37.945003, 75.652936, -75.432962}, + { 41.798486, 83.706896, -91.791834}, + { 43.266004, 9.134592, 50.930049}, + { 44.465039, 16.311047, 6.512751}, + { 45.750668, 23.372978, -15.766712}, + { 47.534439, 32.300943, -36.702982}, + { 49.787278, 42.444465, -56.184495}, + { 52.457917, 53.224022, -74.320646}, + { 54.532058, -13.436804, 58.898437}, + { 55.385516, -6.768114, 21.580884}, + { 56.315467, -0.000010, 0.000004}, + { 57.630008, 8.825705, -21.021347}, + { 59.328134, 19.179536, -41.022229}, + { 61.391858, 30.508200, -59.920728}, + { 66.374922, -33.335627, 67.745825}, + { 67.003415, -27.527170, 36.582861}, + { 67.694487, -21.482419, 16.212526}, + { 68.682127, -13.384693, -4.410654}, + { 69.975892, -3.594073, -24.507224}, + { 71.574010, 7.447858, -43.809975}, + { 78.315904, -50.585277, 76.909139}, + { 78.796543, -45.651434, 50.818542}, + { 79.327805, -40.421790, 31.953767}, + { 80.091978, -33.269832, 12.092110}, + { 81.101528, -24.409844, -7.745063}, + { 82.361425, -14.154994, -27.121909}, + { 90.168532, -65.770182, 86.138290}, + { 90.548420, -61.599052, 64.141611}, + { 90.969646, -57.119911, 46.891522}, + { 91.577948, -50.900805, 28.027875}, + { 92.385840, -43.052445, 8.713289}, + { 93.400696, -33.779293, -10.477090}, + { 36.208754, 60.391097, 50.573778}, + { 37.739975, 64.495259, -2.438323}, + { 39.353431, 68.650313, -25.128730}, + { 41.549773, 74.070366, -45.863018}, + { 44.264011, 80.458448, -64.848646}, + { 47.410429, 87.520359, -82.356598}, + { 48.637025, 27.330267, 57.029239}, + { 49.649655, 32.345900, 14.536338}, + { 50.745209, 37.483199, -7.743369}, + { 52.280931, 44.249599, -28.930913}, + { 54.244425, 52.280310, -48.806029}, + { 56.603189, 61.178271, -67.411894}, + { 58.455996, 5.073270, 63.495100}, + { 59.223239, 10.069966, 27.347971}, + { 60.062286, 15.267320, 5.894811}, + { 61.253487, 22.225763, -15.176012}, + { 62.800706, 30.633519, -35.336720}, + { 64.692889, 40.111206, -54.465103}, + { 69.308960, -16.251898, 71.238024}, + { 69.895406, -11.599340, 40.796840}, + { 70.541246, -6.687200, 20.584981}, + { 71.466005, -0.000013, 0.000005}, + { 72.680407, 8.238495, -20.139565}, + { 74.184959, 17.716313, -39.540668}, + { 80.579920, -35.513903, 79.627400}, + { 81.038448, -31.346986, 53.992269}, + { 81.545637, -26.892900, 35.276028}, + { 82.275842, -20.742163, 15.484099}, + { 83.241675, -13.032556, -4.342368}, + { 84.448794, -3.993322, -23.750841}, + { 91.967824, -52.701251, 88.309654}, + { 92.335220, -49.036719, 66.608006}, + { 92.742744, -45.081868, 49.483561}, + { 93.331530, -39.558175, 30.696050}, + { 94.113989, -32.535991, 11.415203}, + { 95.097663, -24.169464, -7.773705}, + { 44.874337, 70.414781, 59.082945}, + { 46.012582, 73.488282, 10.528988}, + { 47.236695, 76.706186, -12.348562}, + { 48.940884, 81.051413, -33.681818}, + { 51.101856, 86.364529, -53.475339}, + { 53.674597, 92.446330, -71.879038}, + { 54.695304, 43.548940, 63.726908}, + { 55.544895, 47.195327, 23.494868}, + { 56.470786, 51.029166, 1.345906}, + { 57.779848, 56.225393, -20.000213}, + { 59.471313, 62.597129, -40.204567}, + { 61.527524, 69.897355, -59.241373}, + { 63.159654, 22.859865, 68.897396}, + { 63.839588, 26.634208, 34.185583}, + { 64.585756, 30.632858, 12.941230}, + { 65.649581, 36.098152, -8.134153}, + { 67.038832, 42.864229, -28.433915}, + { 68.748596, 50.691293, -47.788927}, + { 72.964214, 1.430076, 75.529188}, + { 73.503895, 5.119471, 45.996429}, + { 74.099224, 9.062101, 26.005435}, + { 74.953413, 14.504783, 5.492273}, + { 76.078172, 21.324042, -14.677149}, + { 77.476211, 29.315742, -34.177868}, + { 83.468499, -18.949380, 83.062075}, + { 83.900955, -15.492587, 58.010021}, + { 84.379703, -11.768724, 39.493278}, + { 85.069678, -6.579078, 19.801555}, + { 85.983569, -0.000015, 0.000006}, + { 87.127728, 7.813055, -19.437771}, + { 94.298345, -37.668200, 91.102418}, + { 94.650453, -34.512373, 69.782914}, + { 95.041192, -31.089517, 52.825519}, + { 95.606040, -26.280220, 34.142079}, + { 96.357251, -20.119939, 14.910613}, + { 97.302528, -12.715984, -4.270744}, + { 53.240794, 80.092460, 67.203197}, + { 54.125781, 82.492192, 22.910970}, + { 55.088767, 85.054618, 0.168144}, + { 56.447798, 88.591017, -21.450672}, + { 58.199846, 93.025112, -41.765998}, + { 60.324212, 98.234312, -60.824892}, + { 61.177753, 58.007184, 70.725237}, + { 61.892577, 60.769076, 32.940064}, + { 62.675958, 63.722867, 11.059157}, + { 63.790979, 67.805180, -10.333124}, + { 65.243976, 72.929281, -30.773134}, + { 67.027700, 78.950491, -50.165199}, + { 68.456202, 39.347025, 74.858462}, + { 69.054426, 42.256401, 41.778310}, + { 69.712953, 45.379691, 20.832601}, + { 70.655381, 49.714784, -0.184657}, + { 71.892132, 55.183573, -20.579895}, + { 73.423104, 61.643523, -40.132156}, + { 77.236080, 18.715563, 80.467683}, + { 77.727829, 21.651859, 52.000981}, + { 78.271171, 24.819797, 32.297655}, + { 79.052359, 29.242703, 11.899654}, + { 80.083760, 34.862654, -8.273975}, + { 81.369962, 41.554730, -27.861347}, + { 86.930570, -1.923749, 87.132036}, + { 87.334594, 0.925621, 62.778902}, + { 87.782260, 4.015632, 44.514668}, + { 88.428154, 8.356443, 24.958589}, + { 89.284922, 13.915222, 5.202570}, + { 90.359536, 20.594187, -14.254942}, + { 97.139267, -21.553748, 94.477975}, + { 97.473993, -18.866927, 73.623332}, + { 97.845623, -15.939407, 56.875584}, + { 98.383182, -11.803189, 38.326889}, + { 99.098697, -6.467219, 19.163906}, + { 100.000004, -0.000017, 0.000007}, + { 2.193399, -0.000001, 0.000000}, + { 5.463889, -0.000002, 0.000001}, + { 10.268185, -0.000004, 0.000002}, + { 15.159721, -0.000004, 0.000002}, + { 19.865535, -0.000005, 0.000002}, + { 24.421321, -0.000006, 0.000002}, + { 28.851904, -0.000006, 0.000003}, + { 33.175474, -0.000007, 0.000003}, + { 37.405892, -0.000008, 0.000003}, + { 41.554045, -0.000008, 0.000003}, + { 45.628691, -0.000009, 0.000004}, + { 49.637017, -0.000009, 0.000004}, + { 53.585016, -0.000010, 0.000004}, + { 57.477759, -0.000011, 0.000004}, + { 61.319585, -0.000011, 0.000004}, + { 65.114248, -0.000012, 0.000005}, + { 68.865021, -0.000012, 0.000005}, + { 72.574786, -0.000013, 0.000005}, + { 76.246094, -0.000013, 0.000005}, + { 79.881220, -0.000014, 0.000006}, + { 83.482203, -0.000014, 0.000006}, + { 87.050883, -0.000015, 0.000006}, + { 90.588923, -0.000015, 0.000006}, + { 94.097838, -0.000016, 0.000006}, + }; + + // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + constexpr double sRGB_D65[] { + 0.4124564, 0.3575761, 0.1804375, + 0.2126729, 0.7151522, 0.0721750, + 0.0193339, 0.1191920, 0.9503041, + }; + + // http://www.brucelindbloom.com/index.html?WorkingSpaceInfo.html + constexpr double illuminant_D65[] { + 0.95047, 1.00000, 1.08883, + }; + + // convert a sRGB (D65) color to CIELAB (D65) + CieLab rgbToLab(QRgb rgb) + { + // Perform the inverse gamma companding for a sRGB color + // http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html + auto inverseGammaCompanding = [](int c){ + if (c <= 10) + return c / (255.0 * 12.92); + else + return std::pow((c / 255.0 + 0.055) / 1.055, 2.4); + }; + + const double r = inverseGammaCompanding(qRed(rgb)); + const double g = inverseGammaCompanding(qGreen(rgb)); + const double b = inverseGammaCompanding(qBlue(rgb)); + + const double x = (r * sRGB_D65[0] + g * sRGB_D65[1] + b * sRGB_D65[2]); + const double y = (r * sRGB_D65[3] + g * sRGB_D65[4] + b * sRGB_D65[5]); + const double z = (r * sRGB_D65[6] + g * sRGB_D65[7] + b * sRGB_D65[8]); + + // http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html + auto f = [](double t) { + if (t > 216.0 / 24389.0) + return std::cbrt(t); + else + return t * (24389.0 / (27.0 * 116.0)) + 4.0 / 29.0; + }; + + const double f_x = f(x / illuminant_D65[0]); + const double f_y = f(y / illuminant_D65[1]); + const double f_z = f(z / illuminant_D65[2]); + + return CieLab{ + 116.0 * f_y - 16.0, + 500.0 * (f_x - f_y), + 200.0 * (f_y - f_z), + }; + } + + + constexpr double epsilon = 1e-15; + + inline double sinDegree(double x) { return std::sin(x * M_PI / 180.0); } + + inline double cosDegree(double x) { return std::cos(x * M_PI / 180.0); } + + inline double pow2(double x) { return x * x; } + + inline double computeHPrime(double a_prime, double b) + { + if (std::abs(a_prime) < epsilon && std::abs(b) < epsilon) + return 0.0; + + const double value = std::atan2(b, a_prime) * 180.0 / M_PI; + return (value < 0.0) ? value + 360.0 : value; + } + + inline double computeDeltaHPrime(double C1_prime, double C2_prime, double h1_prime, double h2_prime) + { + if (C1_prime * C2_prime < epsilon) + return 0.0; + + const double diff = h2_prime - h1_prime; + + if (std::abs(diff) <= 180.0) + return diff; + else if (diff > 180.0) + return diff - 360.0; + else + return diff + 360.0; + } + + inline double computeHPrimeBar(double C1_prime, double C2_prime, double h1_prime, double h2_prime) + { + const double sum = h1_prime + h2_prime; + + if (C1_prime * C2_prime < epsilon) + return sum; + + const double dist = std::abs(h1_prime - h2_prime); + + if (dist <= 180.0) + return 0.5 * sum; + else if (sum < 360.0) + return 0.5 * (sum + 360.0); + else + return 0.5 * (sum - 360.0); + } + + /// Calculate the perceptual color difference based on CIEDE2000. + /// https://en.wikipedia.org/wiki/Color_difference#CIEDE2000 + /// \return The color difference of the two colors. + double calculate_CIEDE2000(const CieLab& color1, const CieLab& color2) + { + const double L1 = color1.l; + const double a1 = color1.a; + const double b1 = color1.b; + const double L2 = color2.l; + const double a2 = color2.a; + const double b2 = color2.b; + + const double _25_pow_7 = /*std::pow(25.0, 7.0) = */6103515625.0; + + const double C1_ab = std::sqrt(a1 * a1 + b1 * b1); + const double C2_ab = std::sqrt(a2 * a2 + b2 * b2); + const double C_ab_bar = 0.5 * (C1_ab + C2_ab); + const double c_ab_bar_pow_7 = std::pow(C_ab_bar, 7.0); + const double G = 0.5 * (1.0 - std::sqrt(c_ab_bar_pow_7 / (c_ab_bar_pow_7 + _25_pow_7))); + const double a1_prime = (1.0 + G) * a1; + const double a2_prime = (1.0 + G) * a2; + const double C1_prime = std::sqrt(a1_prime * a1_prime + b1 * b1); + const double C2_prime = std::sqrt(a2_prime * a2_prime + b2 * b2); + const double h1_prime = computeHPrime(a1_prime, b1); + const double h2_prime = computeHPrime(a2_prime, b2); + + const double deltaL_prime = L2 - L1; + const double deltaC_prime = C2_prime - C1_prime; + const double deltah_prime = computeDeltaHPrime(C1_prime, C2_prime, h1_prime, h2_prime); + const double deltaH_prime = 2.0 * std::sqrt(C1_prime * C2_prime) * sinDegree(0.5 * deltah_prime); + + const double L_primeBar = 0.5 * (L1 + L2); + const double C_primeBar = 0.5 * (C1_prime + C2_prime); + const double h_primeBar = computeHPrimeBar(C1_prime, C2_prime, h1_prime, h2_prime); + + const double T = 1.0 + - 0.17 * cosDegree(h_primeBar - 30.0) + + 0.24 * cosDegree(2.0 * h_primeBar) + + 0.32 * cosDegree(3.0 * h_primeBar + 6.0) + - 0.20 * cosDegree(4.0 * h_primeBar - 63.0); + + const double C_primeBar_pow7 = std::pow(C_primeBar, 7.0); + const double R_C = 2.0 * std::sqrt(C_primeBar_pow7 / (C_primeBar_pow7 + _25_pow_7)); + const double S_L = 1.0 + (0.015 * pow2(L_primeBar - 50.0)) + / std::sqrt(20.0 + pow2(L_primeBar - 50.0)); + const double S_C = 1.0 + 0.045 * C_primeBar; + const double S_H = 1.0 + 0.015 * C_primeBar * T; + const double R_T = -R_C * sinDegree(60.0 * std::exp(-pow2((h_primeBar - 275) / 25.0))); + + constexpr double kL = 1.0; + constexpr double kC = 1.0; + constexpr double kH = 1.0; + + const double deltaL = deltaL_prime / (kL * S_L); + const double deltaC = deltaC_prime / (kC * S_C); + const double deltaH = deltaH_prime / (kH * S_H); + + return /*std::sqrt*/( deltaL * deltaL + + deltaC * deltaC + + deltaH * deltaH + + R_T * deltaC * deltaH); + } + + struct AnsiBuffer + { + using ColorCache = QMap<QRgb, int>; + + void append(char c) + { + Q_ASSERT(remaining() >= 1); + m_data[m_size] = c; + ++m_size; + } + + void append(QLatin1String str) + { + Q_ASSERT(remaining() >= str.size()); + memcpy(m_data + m_size, str.data(), str.size()); + m_size += str.size(); + } + + void appendForeground(QRgb rgb, bool is256Colors, ColorCache& colorCache) + { + append(QLatin1String("38;")); + append(rgb, is256Colors, colorCache); + } + + void appendBackground(QRgb rgb, bool is256Colors, ColorCache& colorCache) + { + append(QLatin1String("48;")); + append(rgb, is256Colors, colorCache); + } + + void append(QRgb rgb, bool is256Colors, ColorCache& colorCache) + { + auto appendUInt8 = [&](int x){ + Q_ASSERT(x <= 255 && x >= 0); + if (x > 99) { + if (x >= 200) { + append('2'); + x -= 200; + } + else { + append('1'); + x -= 100; + } + } else if (x < 10) { + append(char('0' + x)); + return ; + } + + constexpr char const* tb2digits = + "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" + "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" + "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" + "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" + "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" + "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" + "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" + "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" + "80" "81" "82" "83" "84" "85" "86" "87" "88" "89" + "90" "91" "92" "93" "94" "95" "96" "97" "98" "99" + ; + auto* p = tb2digits + x * 2; + append(p[0]); + append(p[1]); + }; + + if (is256Colors) { + double dist = 1e24; + int idx = 0; + auto it = colorCache.find(rgb); + if (it == colorCache.end()) { + const auto lab = rgbToLab(rgb); + // find the nearest xterm color + for (CieLab const& xtermLab : xterm240Labs) { + auto dist2 = calculate_CIEDE2000(lab, xtermLab); + if (dist2 < dist) { + dist = dist2; + idx = &xtermLab - xterm240Labs; + } + } + // add 16 to convert 240 colors mode to 256 colors mode + idx += 16; + colorCache.insert(rgb, idx); + } + else { + idx = it.value(); + } + + append('5'); + append(';'); + appendUInt8(idx); + } else { + append('2'); + append(';'); + appendUInt8(qRed(rgb)); + append(';'); + appendUInt8(qGreen(rgb)); + append(';'); + appendUInt8(qBlue(rgb)); + } + append(';'); + } + + // Replace last character with 'm'. Last character must be ';' + void setFinalStyle() + { + Q_ASSERT(m_data[m_size-1] == ';'); + m_data[m_size-1] = 'm'; + } + + void clear() + { + m_size = 0; + } + + QLatin1String latin1() const + { + return QLatin1String(m_data, m_size); + } + + private: + char m_data[128]; + int m_size = 0; + + int remaining() const noexcept + { + return 128 - m_size; + } + }; + + void fillString(QString &s, int n, const QString &fill) + { + if (n > 0) { + for (; n > fill.size(); n -= fill.size()) { + s += fill; + } + s += fill.left(n); + } + } + + struct GraphLine + { + QString graphLine; + QString labelLine; + int graphLineLength = 0; + int labelLineLength = 0; + int nextLabelOffset = 0; + + template<class String> + void pushLabel(int offset, String const& s, int charCounter) + { + Q_ASSERT(offset >= labelLineLength); + const int n = offset - labelLineLength; + labelLineLength += charCounter + n; + fillLine(labelLine, n); + labelLine += s; + nextLabelOffset = labelLineLength; + } + + template<class String> + void pushGraph(int offset, String const& s, int charCounter) + { + Q_ASSERT(offset >= graphLineLength); + const int n = offset - graphLineLength; + graphLineLength += charCounter + n; + fillLine(graphLine, n); + const int ps1 = graphLine.size(); + graphLine += s; + if (offset >= labelLineLength) { + const int n2 = offset - labelLineLength; + labelLineLength += n2 + 1; + fillLine(labelLine, n2); + labelLine += graphLine.rightRef(graphLine.size() - ps1); + } + } + + private: + static void fillLine(QString& s, int n) + { + Q_ASSERT(n >= 0); + fillString(s, n, QStringLiteral( + " " + " " + " " + )); + } + }; + + /** + * Returns the first free line at a given position or create a new one + */ + GraphLine& lineAtOffset(std::vector<GraphLine> &graphLines, int offset) + { + const auto last = graphLines.end(); + auto p = std::find_if(graphLines.begin(), last, [=](GraphLine const& line) { + return line.nextLabelOffset < offset; + }); + if (p == last) { + graphLines.emplace_back(); + return graphLines.back(); + } + return *p; + } + + // disable bold, italic and underline on | + const QLatin1String graphSymbol("\x1b[21;23;24m|"); + // reverse video + const QLatin1String nameStyle("\x1b[7m"); + + /** + * ANSI Highlighter dedicated to traces + */ + class DebugSyntaxHighlighter : public KSyntaxHighlighting::AbstractHighlighter + { + public: + using TraceOption = KSyntaxHighlighting::AnsiHighlighter::TraceOption; + using TraceOptions = KSyntaxHighlighting::AnsiHighlighter::TraceOptions; + + void setDefinition(const KSyntaxHighlighting::Definition & def) override + { + AbstractHighlighter::setDefinition(def); + m_defData = DefinitionData::get(def); + m_contextCapture.setDefinition(def); + } + + void highlightData(QTextStream &in, QTextStream &out, QLatin1String infoStyle, QLatin1String editorBackground, const std::vector<QPair<QString, QString>> &ansiStyles, TraceOptions traceOptions) + { + initRegionStyles(ansiStyles); + + m_hasFormatTrace = traceOptions.testFlag(TraceOption::Format); + m_hasRegionTrace = traceOptions.testFlag(TraceOption::Region); + const bool hasContextTrace = traceOptions.testFlag(TraceOption::Context); + const bool hasFormatOrContextTrace = m_hasFormatTrace || hasContextTrace; + + const bool hasSeparator = hasFormatOrContextTrace && m_hasRegionTrace; + const QString resetBgColor = (editorBackground.isEmpty() ? QStringLiteral("\x1b[0m") : editorBackground); + + bool firstLine = true; + State state; + while (!in.atEnd()) { + const QString currentLine = in.readLine(); + auto oldState = state; + state = highlightLine(currentLine, state); + + if (hasSeparator) { + if (!firstLine) + out << QStringLiteral("\x1b[0m────────────────────────────────────────────────────\x1b[K\n"); + firstLine = false; + } + + if (!m_regions.empty()) { + printRegions(out, infoStyle, currentLine.size()); + out << resetBgColor; + } + + for (const auto &fragment : m_highlightedFragments) { + auto const& ansiStyle = ansiStyles[fragment.formatId]; + out << ansiStyle.first << currentLine.midRef(fragment.offset, fragment.length) << ansiStyle.second; + } + + out << QStringLiteral("\x1b[K\n"); + + if (hasFormatOrContextTrace && !m_highlightedFragments.empty()) { + if (hasContextTrace) + appendContextNames(oldState, currentLine); + + printFormats(out, infoStyle, ansiStyles); + out << resetBgColor; + } + + m_highlightedFragments.clear(); + } + } + + void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) override + { + m_highlightedFragments.push_back({m_hasFormatTrace ? format.name() : QString(), offset, length, format.id()}); + } + + void applyFolding(int offset, int /*length*/, FoldingRegion region) override + { + if (!m_hasRegionTrace) return; + + const auto id = region.id(); + + if (region.type() == FoldingRegion::Begin) { + m_regions.push_back(Region{m_regionDepth, offset, -1, id, Region::State::Open}); + ++m_regionDepth; + } else { + // find open region + auto it = m_regions.rbegin(); + auto eit = m_regions.rend(); + for (int depth = 0; it != eit; ++it) { + if (it->regionId == id && it->bindIndex < 0) { + if (it->state == Region::State::Close) + ++depth; + else if (--depth < 0) + break; + } + } + + if (it != eit) { + it->bindIndex = int(m_regions.size()); + int bindIndex = int(&*it - m_regions.data()); + m_regions.push_back(Region{it->depth, offset, bindIndex, id, Region::State::Close}); + } else { + m_regions.push_back(Region{-1, offset, -1, id, Region::State::Close}); + } + + m_regionDepth = std::max(m_regionDepth-1, 0); + } + } + + using KSyntaxHighlighting::AbstractHighlighter::highlightLine; + + private: + /** + * Initializes with colors of \p ansiStyle without duplicate. + */ + void initRegionStyles(const std::vector<QPair<QString, QString>> &ansiStyles) + { + m_regionStyles.resize(ansiStyles.size()); + for (std::size_t i = 0; i < m_regionStyles.size(); ++i) + m_regionStyles[i] = ansiStyles[i].first; + + std::sort(m_regionStyles.begin(), m_regionStyles.end()); + m_regionStyles.erase(std::unique(m_regionStyles.begin(), m_regionStyles.end()), m_regionStyles.end()); + } + + /** + * Append the context name in front of the format name. + */ + void appendContextNames(State &state, const QString ¤tLine) + { + auto newState = state; + for (auto &fragment : m_highlightedFragments) { + QString contextName = extractContextName(StateData::get(newState)); + + 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); + newState = m_contextCapture.highlightLine(lineFragment, state); + + // Deduced context does not start at the position of the format. + // This can happen because of lookAhead/fallthrought attribute, + // assertion in regex, etc. + if (m_contextCapture.offset != fragment.offset && m_contextCapture.length != fragment.length) { + contextName.insert(0, QLatin1Char('~')); + } + fragment.name.insert(0, contextName); + } + } + + /** + * \return Current context name with definition name if different + * from the current definition name + */ + QString extractContextName(StateData *stateData) const + { + // first state is empty + if (stateData->isEmpty()) { + return QStringLiteral("[???]"); + } + + const auto context = stateData->topContext(); + const auto defData = DefinitionData::get(context->definition()); + const auto contextName = (defData != m_defData) + ? QString(QLatin1Char('<') % defData->name % QLatin1Char('>')) + : QString(); + return QString(contextName % QLatin1Char('[') % context->name() % QLatin1Char(']')); + } + + void printFormats(QTextStream &out, QLatin1String regionStyle, const std::vector<QPair<QString, QString>> &ansiStyles) + { + // init graph + m_formatGraph.clear(); + for (auto const& fragment : m_highlightedFragments) { + GraphLine& line = lineAtOffset(m_formatGraph, fragment.offset); + auto const& style = ansiStyles[fragment.formatId].first; + line.pushLabel(fragment.offset, style % nameStyle % fragment.name % regionStyle, fragment.name.size()); + + for (GraphLine* pline = m_formatGraph.data(); pline <= &line; ++pline) { + pline->pushGraph(fragment.offset, style % graphSymbol % regionStyle, 1); + } + } + + // display graph + out << regionStyle; + auto first = m_formatGraph.begin(); + auto last = m_formatGraph.end(); + --last; + for (; first != last; ++first) { + out << first->graphLine << "\x1b[K\n" << first->labelLine << "\x1b[K\n"; + } + out << first->graphLine << "\x1b[K\n" << first->labelLine << "\x1b[K\x1b[0m\n"; + } + + void printRegions(QTextStream &out, QLatin1String regionStyle, int lineLength) + { + const QString continuationLine = QStringLiteral( + "------------------------------" + "------------------------------" + "------------------------------"); + + bool hasContinuation = false; + + m_regionGraph.clear(); + QString label; + QString numStr; + + // init graph + for (Region& region : m_regions) { + if (region.state == Region::State::Continuation) { + hasContinuation = true; + continue; + } + + auto pushGraphs = [&](int offset, const GraphLine *endline, const QStringView &style){ + for (GraphLine* pline = m_regionGraph.data(); pline <= endline; ++pline) { + // a label can hide a graph + if (pline->graphLineLength <= offset) { + pline->pushGraph(offset, style % graphSymbol % regionStyle, 1); + } + } + }; + + QChar openChar; + QChar closeChar; + int lpad = 0; + int rpad = 0; + + int offsetLabel = region.offset; + + numStr.setNum(region.regionId); + + if (region.state == Region::State::Open) { + openChar = QLatin1Char('('); + if (region.bindIndex == -1) { + rpad = lineLength - region.offset - numStr.size(); + } else { + rpad = m_regions[region.bindIndex].offset - region.offset - 2; + closeChar = QLatin1Char(')'); + } + // close without open + } else if (region.bindIndex == -1) { + closeChar = QLatin1Char('>'); + // label already present, we only display the graph + } else if (m_regions[region.bindIndex].state == Region::State::Open) { + const auto &openRegion = m_regions[region.bindIndex]; + // here offset is a graph index + const GraphLine &line = m_regionGraph[openRegion.offset]; + const auto &style = m_regionStyles[openRegion.depth % m_regionStyles.size()]; + pushGraphs(region.offset, &line, style); + continue; + } else { + closeChar = QLatin1Char(')'); + lpad = region.offset - numStr.size(); + offsetLabel = 0; + } + + const QStringView openS(&openChar, openChar.unicode() ? 1 : 0); + const QStringView closeS(&closeChar, closeChar.unicode() ? 1 : 0); + + label.clear(); + fillString(label, lpad, continuationLine); + label += numStr; + fillString(label, rpad, continuationLine); + + GraphLine &line = lineAtOffset(m_regionGraph, offsetLabel); + const auto &style = m_regionStyles[region.depth % m_regionStyles.size()]; + line.pushLabel(offsetLabel, style % nameStyle % openS % label % closeS % regionStyle, label.size() + openS.size() + closeS.size()); + pushGraphs(region.offset, &line, style); + + // transforms offset into graph index when region is on 1 line + if (region.state == Region::State::Open && region.bindIndex != -1) { + region.offset = &line - m_regionGraph.data(); + } + } + + out << regionStyle; + + // display regions which are neither closed nor open + if (hasContinuation) { + label.clear(); + fillString(label, lineLength ? lineLength : 5, continuationLine); + for (const auto ®ion : m_regions) { + if (region.state == Region::State::Continuation && region.bindIndex == -1) { + const auto &style = m_regionStyles[region.depth % m_regionStyles.size()]; + out << style << nameStyle << label << regionStyle << "\x1b[K\n"; + } + } + } + + // display graph + if (!m_regionGraph.empty()) { + auto first = m_regionGraph.rbegin(); + auto last = m_regionGraph.rend(); + --last; + for (; first != last; ++first) { + out << first->labelLine << "\x1b[K\n" << first->graphLine << "\x1b[K\n"; + } + out << first->labelLine << "\x1b[K\n" << first->graphLine << "\x1b[K\x1b[0m\n"; + } + + // keep regions that are not closed + m_regions.erase(std::remove_if(m_regions.begin(), m_regions.end(), [](Region const& region){ + return region.bindIndex != -1 || region.state == Region::State::Close; + }), m_regions.end()); + // all remaining regions become Continuation + for (auto& region : m_regions) { + region.offset = 0; + region.state = Region::State::Continuation; + } + } + + struct HighlightFragment + { + QString name; + int offset; + int length; + quint16 formatId; + }; + + struct ContextCaptureHighlighter : KSyntaxHighlighting::AbstractHighlighter + { + int offset; + int length; + int offsetNext; + int lengthNext; + + void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &/*format*/) override + { + offset = offsetNext; + length = lengthNext; + offsetNext = offset; + lengthNext = length; + } + + using KSyntaxHighlighting::AbstractHighlighter::highlightLine; + }; + + struct Region + { + enum class State : int8_t + { + Open, + Close, + Continuation, + }; + + int depth; + int offset; + int bindIndex; + quint16 regionId; + State state; + }; + + bool m_hasFormatTrace; + bool m_hasRegionTrace; + + std::vector<HighlightFragment> m_highlightedFragments; + std::vector<GraphLine> m_formatGraph; + ContextCaptureHighlighter m_contextCapture; + DefinitionData* m_defData; + + int m_regionDepth = 0; + std::vector<Region> m_regions; + std::vector<GraphLine> m_regionGraph; + std::vector<QStringView> m_regionStyles; + }; +} // anonymous namespace + +class KSyntaxHighlighting::AnsiHighlighterPrivate +{ +public: + QTextStream out; + QFile file; + QString currentLine; + // pairs of startColor / resetColor + std::vector<QPair<QString, QString>> ansiStyles; +}; + +AnsiHighlighter::AnsiHighlighter() + : d(new AnsiHighlighterPrivate()) +{ +} + +AnsiHighlighter::~AnsiHighlighter() = default; + +void AnsiHighlighter::setOutputFile(const QString &fileName) +{ + if (d->file.isOpen()) { + d->file.close(); + } + d->file.setFileName(fileName); + if (!d->file.open(QFile::WriteOnly | QFile::Truncate)) { + qCWarning(Log) << "Failed to open output file" << fileName << ":" << d->file.errorString(); + return; + } + d->out.setDevice(&d->file); + d->out.setCodec("UTF-8"); +} + +void AnsiHighlighter::setOutputFile(FILE *fileHandle) +{ + d->file.open(fileHandle, QIODevice::WriteOnly); + d->out.setDevice(&d->file); + d->out.setCodec("UTF-8"); +} + +void AnsiHighlighter::highlightFile(const QString &fileName, AnsiFormat format, bool useEditorBackground, TraceOptions traceOptions) +{ + QFileInfo fi(fileName); + QFile f(fileName); + if (!f.open(QFile::ReadOnly)) { + qCWarning(Log) << "Failed to open input file" << fileName << ":" << f.errorString(); + return; + } + + highlightData(&f, format, useEditorBackground, traceOptions); +} + +void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useEditorBackground, TraceOptions traceOptions) +{ + if (!d->out.device()) { + qCWarning(Log) << "No output stream defined!"; + return; + } + + const auto is256Colors = (format == AnsiFormat::XTerm256Color); + const auto theme = this->theme(); + const auto definition = this->definition(); + + auto definitions = definition.includedDefinitions(); + definitions.append(definition); + + AnsiBuffer::ColorCache colorCache; + + AnsiBuffer foregroundColorBuffer; + AnsiBuffer backgroundColorBuffer; + QLatin1String foregroundDefaultColor; + QLatin1String backgroundDefaultColor; + + // 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); + } + + // initialize ansiStyles + for (auto&& definition : qAsConst(definitions)) { + const auto formats = definition.formats(); + for (auto&& format : formats) { + const auto id = format.id(); + if (id >= d->ansiStyles.size()) { + // better than id + 1 to avoid successive allocations + d->ansiStyles.resize(std::max(std::size_t(id*2), std::size_t(32))); + } + + AnsiBuffer buffer; + + buffer.append(QLatin1String("\x1b[")); + + const bool hasFg = format.hasTextColor(theme); + const bool hasBg = format.hasBackgroundColor(theme); + 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); + else + buffer.append(foregroundDefaultColor); + if (hasBg) buffer.appendBackground(format.backgroundColor(theme).rgb(), is256Colors, colorCache); + if (hasBold) buffer.append(QLatin1String("1;")); + if (hasItalic) buffer.append(QLatin1String("3;")); + if (hasUnderline) buffer.append(QLatin1String("4;")); + if (hasStrikeThrough) buffer.append(QLatin1String("9;")); + + // if there is ANSI style + if (buffer.latin1().size() > 2) { + buffer.setFinalStyle(); + d->ansiStyles[id].first = buffer.latin1(); + + if (useEditorBackground) { + buffer.clear(); + const bool hasEffect = hasBold || hasItalic || hasUnderline || hasStrikeThrough; + if (hasBg) { + buffer.append(hasEffect ? QLatin1String("\x1b[0;") : QLatin1String("\x1b[")); + buffer.append(backgroundDefaultColor); + buffer.setFinalStyle(); + d->ansiStyles[id].second = buffer.latin1(); + } else if (hasEffect) { + buffer.append(QLatin1String("\x1b[")); + if (hasBold) buffer.append(QLatin1String("21;")); + if (hasItalic) buffer.append(QLatin1String("23;")); + if (hasUnderline) buffer.append(QLatin1String("24;")); + if (hasStrikeThrough) buffer.append(QLatin1String("29;")); + buffer.setFinalStyle(); + d->ansiStyles[id].second = buffer.latin1(); + } + } else { + d->ansiStyles[id].second = QStringLiteral("\x1b[0m"); + } + } + } + } + + if (useEditorBackground) { + backgroundColorBuffer.setFinalStyle(); + backgroundDefaultColor = backgroundColorBuffer.latin1(); + d->out << backgroundDefaultColor; + } + + QTextStream in(dev); + in.setCodec("UTF-8"); + + if (!traceOptions) { + State state; + while (!in.atEnd()) { + d->currentLine = in.readLine(); + state = highlightLine(d->currentLine, state); + + if (useEditorBackground) + d->out << QStringLiteral("\x1b[K\n"); + else + d->out << QLatin1Char('\n'); + } + } else { + AnsiBuffer buffer; + buffer.append(QLatin1String("\x1b[0;")); + buffer.appendBackground(theme.editorColor(useEditorBackground ? Theme::TemplateBackground : Theme::BackgroundColor), is256Colors, colorCache); + buffer.setFinalStyle(); + DebugSyntaxHighlighter debugHighlighter; + debugHighlighter.setDefinition(definition); + debugHighlighter.highlightData(in, d->out, buffer.latin1(), backgroundDefaultColor, d->ansiStyles, traceOptions); + } + + if (useEditorBackground) { + d->out << QStringLiteral("\x1b[0m"); + } + + d->out.setDevice(nullptr); + d->file.close(); + d->ansiStyles.clear(); +} + +void AnsiHighlighter::applyFormat(int offset, int length, const Format &format) +{ + auto const& ansiStyle = d->ansiStyles[format.id()]; + d->out << ansiStyle.first << d->currentLine.midRef(offset, length) << ansiStyle.second; +} diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.h new file mode 100644 index 0000000000..6593799234 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/ansihighlighter.h @@ -0,0 +1,60 @@ +/* + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT +*/ + +#ifndef KSYNTAXHIGHLIGHTING_ANSIHIGHLIGHTER_H +#define KSYNTAXHIGHLIGHTING_ANSIHIGHLIGHTER_H + +#include "abstracthighlighter.h" +#include "ksyntaxhighlighting_export.h" + +#include <QIODevice> +#include <QString> +#include <QFlags> + +#include <memory> + +namespace KSyntaxHighlighting +{ +class AnsiHighlighterPrivate; + +class KSYNTAXHIGHLIGHTING_EXPORT AnsiHighlighter final : public AbstractHighlighter +{ +public: + enum class AnsiFormat + { + TrueColor, + XTerm256Color, + }; + + enum class TraceOption + { + NoOptions, + Format = 1 << 0, + Region = 1 << 1, + Context = 1 << 2, + }; + Q_DECLARE_FLAGS(TraceOptions, TraceOption) + + AnsiHighlighter(); + ~AnsiHighlighter() override; + + void highlightFile(const QString &fileName, AnsiFormat format = AnsiFormat::TrueColor, bool useEditorBackground = true, TraceOptions traceOptions = TraceOptions()); + void highlightData(QIODevice *device, AnsiFormat format = AnsiFormat::TrueColor, bool useEditorBackground = true, TraceOptions traceOptions = TraceOptions()); + + void setOutputFile(const QString &fileName); + void setOutputFile(FILE *fileHandle); + +protected: + void applyFormat(int offset, int length, const Format &format) override; + +private: + std::unique_ptr<AnsiHighlighterPrivate> d; +}; +} + +Q_DECLARE_OPERATORS_FOR_FLAGS(KSyntaxHighlighting::AnsiHighlighter::TraceOptions) + +#endif // KSYNTAXHIGHLIGHTING_ANSIHIGHLIGHTER_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp index 2327cfe584..4d83da3d05 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "context_p.h" @@ -57,13 +41,13 @@ void Context::load(QXmlStreamReader &reader) Q_ASSERT(reader.name() == QLatin1String("context")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - m_name = reader.attributes().value(QStringLiteral("name")).toString(); - m_attribute = reader.attributes().value(QStringLiteral("attribute")).toString(); - m_lineEndContext.parse(reader.attributes().value(QStringLiteral("lineEndContext"))); - m_lineEmptyContext.parse(reader.attributes().value(QStringLiteral("lineEmptyContext"))); - m_fallthroughContext.parse(reader.attributes().value(QStringLiteral("fallthroughContext"))); + m_name = reader.attributes().value(QLatin1String("name")).toString(); + m_attribute = reader.attributes().value(QLatin1String("attribute")).toString(); + m_lineEndContext.parse(reader.attributes().value(QLatin1String("lineEndContext"))); + m_lineEmptyContext.parse(reader.attributes().value(QLatin1String("lineEmptyContext"))); + m_fallthroughContext.parse(reader.attributes().value(QLatin1String("fallthroughContext"))); m_fallthrough = !m_fallthroughContext.isStay(); - m_noIndentationBasedFolding = Xml::attrToBool(reader.attributes().value(QStringLiteral("noIndentationBasedFolding"))); + m_noIndentationBasedFolding = Xml::attrToBool(reader.attributes().value(QLatin1String("noIndentationBasedFolding"))); reader.readNext(); while (!reader.atEnd()) { @@ -73,7 +57,7 @@ void Context::load(QXmlStreamReader &reader) if (rule) { rule->setDefinition(m_def.definition()); if (rule->load(reader)) - m_rules.push_back(rule); + m_rules.push_back(std::move(rule)); } else { reader.skipCurrentElement(); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h index 5d23ee2400..6263045537 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_CONTEXT_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp index 8d353b9174..14c50396d8 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #include "contextswitch_p.h" @@ -44,7 +27,7 @@ Context *ContextSwitch::context() const return m_context; } -void ContextSwitch::parse(const QStringView &contextInstr) +void ContextSwitch::parse(const QStringRef &contextInstr) { if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) return; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h index 46579fcb61..c84948d9f7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/contextswitch_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H @@ -42,7 +25,7 @@ public: int popCount() const; Context *context() const; - void parse(const QStringView &contextInstr); + void parse(const QStringRef &contextInstr); void resolve(const Definition &def); private: diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp index c0fa860dc9..fd1debe0f2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp @@ -1,26 +1,10 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2018 Dominik Haumann <dhaumann@kde.org> - Copyright (C) 2018 Christoph Cullmann <cullmann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2018 Dominik Haumann <dhaumann@kde.org> + SPDX-FileCopyrightText: 2018 Christoph Cullmann <cullmann@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "definition.h" @@ -36,6 +20,7 @@ #include "repository_p.h" #include "rule_p.h" #include "xml_p.h" +#include "worddelimiters_p.h" #include <QCborMap> #include <QCoreApplication> @@ -50,7 +35,7 @@ using namespace KSyntaxHighlighting; DefinitionData::DefinitionData() - : wordDelimiters(QStringLiteral("\t !%&()*+,-./:;<=>?[\\]^{|}~")) // must be sorted! + : wordDelimiters() , wordWrapDelimiters(wordDelimiters) { } @@ -76,8 +61,8 @@ Definition::Definition(const Definition &other) d->q = *this; } -Definition::Definition(const std::shared_ptr<DefinitionData> &dd) - : d(dd) +Definition::Definition(std::shared_ptr<DefinitionData> &&dd) + : d(std::move(dd)) { } @@ -179,13 +164,13 @@ QString Definition::license() const bool Definition::isWordDelimiter(QChar c) const { d->load(); - return d->isWordDelimiter(c); + return d->wordDelimiters.contains(c); } bool Definition::isWordWrapDelimiter(QChar c) const { d->load(); - return std::binary_search(d->wordWrapDelimiters.constBegin(), d->wordWrapDelimiters.constEnd(), c); + return d->wordWrapDelimiters.contains(c); } bool Definition::foldingEnabled() const @@ -346,11 +331,6 @@ KeywordList *DefinitionData::keywordList(const QString &wantedName) return (it == keywordLists.end()) ? nullptr : &it.value(); } -bool DefinitionData::isWordDelimiter(QChar c) const -{ - return std::binary_search(wordDelimiters.constBegin(), wordDelimiters.constEnd(), c); -} - Format DefinitionData::formatByName(const QString &wantedName) const { const auto it = formats.constFind(wantedName); @@ -407,7 +387,6 @@ bool DefinitionData::load(OnlyKeywords onlyKeywords) context->resolveAttributeFormat(); } - Q_ASSERT(std::is_sorted(wordDelimiters.constBegin(), wordDelimiters.constEnd())); return true; } @@ -427,7 +406,7 @@ void DefinitionData::clear() license.clear(); mimetypes.clear(); extensions.clear(); - wordDelimiters = QStringLiteral("\t !%&()*+,-./:;<=>?[\\]^{|}~"); // must be sorted! + wordDelimiters = WordDelimiters(); wordWrapDelimiters = wordDelimiters; caseSensitive = Qt::CaseSensitive; version = 0.0f; @@ -470,10 +449,18 @@ bool DefinitionData::loadMetaData(const QString &file, const QCborMap &obj) fileName = file; const auto exts = obj.value(QLatin1String("extensions")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + for (const auto &ext : exts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif extensions.push_back(ext); const auto mts = obj.value(QLatin1String("mimetype")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + for (const auto &mt : mts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif mimetypes.push_back(mt); return true; @@ -484,27 +471,35 @@ bool DefinitionData::loadLanguage(QXmlStreamReader &reader) Q_ASSERT(reader.name() == QLatin1String("language")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - if (!checkKateVersion(reader.attributes().value(QStringLiteral("kateversion")))) + if (!checkKateVersion(reader.attributes().value(QLatin1String("kateversion")))) return false; - name = reader.attributes().value(QStringLiteral("name")).toString(); - section = reader.attributes().value(QStringLiteral("section")).toString(); + name = reader.attributes().value(QLatin1String("name")).toString(); + section = reader.attributes().value(QLatin1String("section")).toString(); // toFloat instead of toInt for backward compatibility with old Kate files - version = reader.attributes().value(QStringLiteral("version")).toFloat(); - priority = reader.attributes().value(QStringLiteral("priority")).toInt(); - hidden = Xml::attrToBool(reader.attributes().value(QStringLiteral("hidden"))); - style = reader.attributes().value(QStringLiteral("style")).toString(); - indenter = reader.attributes().value(QStringLiteral("indenter")).toString(); - author = reader.attributes().value(QStringLiteral("author")).toString(); - license = reader.attributes().value(QStringLiteral("license")).toString(); - const auto exts = reader.attributes().value(QStringLiteral("extensions")).toString(); + version = reader.attributes().value(QLatin1String("version")).toFloat(); + priority = reader.attributes().value(QLatin1String("priority")).toInt(); + hidden = Xml::attrToBool(reader.attributes().value(QLatin1String("hidden"))); + style = reader.attributes().value(QLatin1String("style")).toString(); + indenter = reader.attributes().value(QLatin1String("indenter")).toString(); + author = reader.attributes().value(QLatin1String("author")).toString(); + license = reader.attributes().value(QLatin1String("license")).toString(); + const auto exts = reader.attributes().value(QLatin1String("extensions")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + for (const auto &ext : exts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else for (const auto &ext : exts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif extensions.push_back(ext); - const auto mts = reader.attributes().value(QStringLiteral("mimetype")).toString(); + const auto mts = reader.attributes().value(QLatin1String("mimetype")).toString(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + for (const auto &mt : mts.split(QLatin1Char(';'), QString::SkipEmptyParts)) +#else for (const auto &mt : mts.split(QLatin1Char(';'), Qt::SkipEmptyParts)) +#endif mimetypes.push_back(mt); - if (reader.attributes().hasAttribute(QStringLiteral("casesensitive"))) - caseSensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; + if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) + caseSensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; return true; } @@ -631,25 +626,26 @@ void DefinitionData::loadGeneral(QXmlStreamReader &reader) ++elementRefCounter; if (reader.name() == QLatin1String("keywords")) { - if (reader.attributes().hasAttribute(QStringLiteral("casesensitive"))) - caseSensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; - - // adapt sorted wordDelimiters - wordDelimiters += reader.attributes().value(QStringLiteral("additionalDeliminator")); - std::sort(wordDelimiters.begin(), wordDelimiters.end()); - auto it = std::unique(wordDelimiters.begin(), wordDelimiters.end()); - wordDelimiters.truncate(std::distance(wordDelimiters.begin(), it)); - for (const auto c : reader.attributes().value(QLatin1String("weakDeliminator"))) + if (reader.attributes().hasAttribute(QLatin1String("casesensitive"))) + caseSensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("casesensitive"))) ? Qt::CaseSensitive : Qt::CaseInsensitive; + + // adapt wordDelimiters + for (QChar c : reader.attributes().value(QLatin1String("additionalDeliminator"))) + wordDelimiters.append(c); + for (QChar c : reader.attributes().value(QLatin1String("weakDeliminator"))) wordDelimiters.remove(c); - // adaptWordWrapDelimiters, and sort - wordWrapDelimiters = reader.attributes().value(QStringLiteral("wordWrapDeliminator")).toString(); - std::sort(wordWrapDelimiters.begin(), wordWrapDelimiters.end()); - if (wordWrapDelimiters.isEmpty()) + // adapt WordWrapDelimiters + QStringRef wordWrapDeliminatorAttr = reader.attributes().value(QLatin1String("wordWrapDeliminator")); + if (wordWrapDeliminatorAttr.isEmpty()) wordWrapDelimiters = wordDelimiters; + else { + for (QChar c : wordWrapDeliminatorAttr) + wordWrapDelimiters.append(c); + } } else if (reader.name() == QLatin1String("folding")) { - if (reader.attributes().hasAttribute(QStringLiteral("indentationsensitive"))) - indentationBasedFolding = Xml::attrToBool(reader.attributes().value(QStringLiteral("indentationsensitive"))); + if (reader.attributes().hasAttribute(QLatin1String("indentationsensitive"))) + indentationBasedFolding = Xml::attrToBool(reader.attributes().value(QLatin1String("indentationsensitive"))); } else if (reader.name() == QLatin1String("emptyLines")) { loadFoldingIgnoreList(reader); } else if (reader.name() == QLatin1String("comments")) { @@ -688,14 +684,14 @@ void DefinitionData::loadComments(QXmlStreamReader &reader) case QXmlStreamReader::StartElement: ++elementRefCounter; if (reader.name() == QLatin1String("comment")) { - const bool isSingleLine = reader.attributes().value(QStringLiteral("name")) == QStringLiteral("singleLine"); + const bool isSingleLine = reader.attributes().value(QLatin1String("name")) == QLatin1String("singleLine"); if (isSingleLine) { - singleLineCommentMarker = reader.attributes().value(QStringLiteral("start")).toString(); - const bool afterWhiteSpace = reader.attributes().value(QStringLiteral("position")).toString() == QStringLiteral("afterwhitespace"); + singleLineCommentMarker = reader.attributes().value(QLatin1String("start")).toString(); + const bool afterWhiteSpace = reader.attributes().value(QLatin1String("position")).toString() == QLatin1String("afterwhitespace"); singleLineCommentPosition = afterWhiteSpace ? CommentPosition::AfterWhitespace : CommentPosition::StartOfLine; } else { - multiLineCommentStartMarker = reader.attributes().value(QStringLiteral("start")).toString(); - multiLineCommentEndMarker = reader.attributes().value(QStringLiteral("end")).toString(); + multiLineCommentStartMarker = reader.attributes().value(QLatin1String("start")).toString(); + multiLineCommentEndMarker = reader.attributes().value(QLatin1String("end")).toString(); } } reader.readNext(); @@ -727,7 +723,7 @@ void DefinitionData::loadFoldingIgnoreList(QXmlStreamReader &reader) case QXmlStreamReader::StartElement: ++elementRefCounter; if (reader.name() == QLatin1String("emptyLine")) { - foldingIgnoreList << reader.attributes().value(QStringLiteral("regexpr")).toString(); + foldingIgnoreList << reader.attributes().value(QLatin1String("regexpr")).toString(); } reader.readNext(); break; @@ -758,9 +754,9 @@ void DefinitionData::loadSpellchecking(QXmlStreamReader &reader) case QXmlStreamReader::StartElement: ++elementRefCounter; if (reader.name() == QLatin1String("encoding")) { - const auto charRef = reader.attributes().value(QStringLiteral("char")); + const auto charRef = reader.attributes().value(QLatin1String("char")); if (!charRef.isEmpty()) { - const auto str = reader.attributes().value(QStringLiteral("string")).toString(); + const auto str = reader.attributes().value(QLatin1String("string")).toString(); characterEncodings.push_back({charRef[0], str}); } } @@ -779,15 +775,15 @@ void DefinitionData::loadSpellchecking(QXmlStreamReader &reader) } } -bool DefinitionData::checkKateVersion(const QStringView &verStr) +bool DefinitionData::checkKateVersion(const QStringRef &verStr) { const auto idx = verStr.indexOf(QLatin1Char('.')); if (idx <= 0) { qCWarning(Log) << "Skipping" << fileName << "due to having no valid kateversion attribute:" << verStr; return false; } - const auto major = verStr.left(idx).toString().toInt(); - const auto minor = verStr.mid(idx + 1).toString().toInt(); + const auto major = verStr.left(idx).toInt(); + const auto minor = verStr.mid(idx + 1).toInt(); if (major > SyntaxHighlighting_VERSION_MAJOR || (major == SyntaxHighlighting_VERSION_MAJOR && minor > SyntaxHighlighting_VERSION_MINOR)) { qCWarning(Log) << "Skipping" << fileName << "due to being too new, version:" << verStr; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h index 3219bf03b9..0cc2df70d0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_H @@ -33,6 +17,8 @@ QT_BEGIN_NAMESPACE class QChar; class QString; +class QStringList; +template<typename T> class QVector; QT_END_NAMESPACE namespace KSyntaxHighlighting @@ -401,7 +387,7 @@ public: private: friend class DefinitionData; friend class DefinitionRef; - explicit Definition(const std::shared_ptr<DefinitionData> &dd); + explicit Definition(std::shared_ptr<DefinitionData> &&dd); std::shared_ptr<DefinitionData> d; }; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h index 9e707908ba..c334e31ac0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_P_H @@ -26,6 +10,7 @@ #include "definition.h" #include "definitionref_p.h" +#include "worddelimiters_p.h" #include <QHash> #include <QString> @@ -68,12 +53,11 @@ public: void loadComments(QXmlStreamReader &reader); void loadFoldingIgnoreList(QXmlStreamReader &reader); void loadSpellchecking(QXmlStreamReader &reader); - bool checkKateVersion(const QStringView &verStr); + bool checkKateVersion(const QStringRef &verStr); void resolveIncludeKeywords(); KeywordList *keywordList(const QString &name); - bool isWordDelimiter(QChar c) const; Context *initialContext() const; Context *contextByName(const QString &name) const; @@ -88,8 +72,8 @@ public: QHash<QString, KeywordList> keywordLists; QVector<Context *> contexts; QHash<QString, Format> formats; - QString wordDelimiters; - QString wordWrapDelimiters; + WordDelimiters wordDelimiters; + WordDelimiters wordWrapDelimiters; bool keywordIsLoaded = false; bool hasFoldingRegions = false; bool indentationBasedFolding = false; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp index b76e215778..9ec6e366b0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "definitiondownloader.h" @@ -180,8 +163,7 @@ void DefinitionDownloader::start() { const QString url = QLatin1String("https://www.kate-editor.org/syntax/update-") + QString::number(SyntaxHighlighting_VERSION_MAJOR) + QLatin1Char('.') + QString::number(SyntaxHighlighting_VERSION_MINOR) + QLatin1String(".xml"); auto req = QNetworkRequest(QUrl(url)); - req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, - QNetworkRequest::NoLessSafeRedirectPolicy); + req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); auto reply = d->nam->get(req); QObject::connect(reply, &QNetworkReply::finished, this, [=]() { d->definitionListDownloadFinished(reply); }); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h index a1300d57e6..db0c6ee68a 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_DEFINITIONDOWNLOADER_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h index 0e072db415..25a1a749e4 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitionref_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_DEFINITIONREF_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp index 72a410cb2a..3bca63eecd 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "foldingregion.h" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h index ea26aba9b2..ca4cacafb2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/foldingregion.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_FOLDINGREGION_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp index adc78e2e63..b48f0e7d5c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "format.h" @@ -35,7 +19,7 @@ using namespace KSyntaxHighlighting; -static Theme::TextStyle stringToDefaultFormat(const QStringView &str) +static Theme::TextStyle stringToDefaultFormat(const QStringRef &str) { if (!str.startsWith(QLatin1String("ds"))) return Theme::Normal; @@ -113,14 +97,14 @@ Theme::TextStyle Format::textStyle() const bool Format::isDefaultTextStyle(const Theme &theme) const { - return (!hasTextColor(theme)) && (!hasBackgroundColor(theme)) && (selectedTextColor(theme) == theme.selectedTextColor(Theme::Normal)) && (selectedBackgroundColor(theme) == theme.selectedBackgroundColor(Theme::Normal)) && + // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! + return (!hasTextColor(theme)) && (!hasBackgroundColor(theme)) && (selectedTextColor(theme) == theme.selectedTextColor(Theme::Normal)) && (selectedBackgroundColor(theme) == QColor::fromRgba(theme.selectedBackgroundColor(Theme::Normal))) && (isBold(theme) == theme.isBold(Theme::Normal)) && (isItalic(theme) == theme.isItalic(Theme::Normal)) && (isUnderline(theme) == theme.isUnderline(Theme::Normal)) && (isStrikeThrough(theme) == theme.isStrikeThrough(Theme::Normal)); } bool Format::hasTextColor(const Theme &theme) const { - const auto overrideStyle = d->styleOverride(theme); - return textColor(theme) != theme.textColor(Theme::Normal) && (d->style.textColor || theme.textColor(d->defaultStyle) || overrideStyle.textColor); + return textColor(theme) != theme.textColor(Theme::Normal) && (d->style.textColor || theme.textColor(d->defaultStyle) || d->styleOverride(theme).textColor); } QColor Format::textColor(const Theme &theme) const @@ -141,8 +125,8 @@ QColor Format::selectedTextColor(const Theme &theme) const bool Format::hasBackgroundColor(const Theme &theme) const { - const auto overrideStyle = d->styleOverride(theme); - return backgroundColor(theme) != theme.backgroundColor(Theme::Normal) && (d->style.backgroundColor || theme.backgroundColor(d->defaultStyle) || overrideStyle.backgroundColor); + // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! + return backgroundColor(theme) != QColor::fromRgba(theme.backgroundColor(Theme::Normal)) && (d->style.backgroundColor || theme.backgroundColor(d->defaultStyle) || d->styleOverride(theme).backgroundColor); } QColor Format::backgroundColor(const Theme &theme) const @@ -150,7 +134,9 @@ QColor Format::backgroundColor(const Theme &theme) const const auto overrideStyle = d->styleOverride(theme); if (overrideStyle.backgroundColor) return overrideStyle.backgroundColor; - return d->style.backgroundColor ? d->style.backgroundColor : theme.backgroundColor(d->defaultStyle); + + // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! + return d->style.backgroundColor ? d->style.backgroundColor : QColor::fromRgba(theme.backgroundColor(d->defaultStyle)); } QColor Format::selectedBackgroundColor(const Theme &theme) const @@ -158,7 +144,9 @@ QColor Format::selectedBackgroundColor(const Theme &theme) const const auto overrideStyle = d->styleOverride(theme); if (overrideStyle.selectedBackgroundColor) return overrideStyle.selectedBackgroundColor; - return d->style.selectedBackgroundColor ? d->style.selectedBackgroundColor : theme.selectedBackgroundColor(d->defaultStyle); + + // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black! + return d->style.selectedBackgroundColor ? d->style.selectedBackgroundColor : QColor::fromRgba(theme.selectedBackgroundColor(d->defaultStyle)); } bool Format::isBold(const Theme &theme) const @@ -240,54 +228,54 @@ bool Format::hasSelectedBackgroundColorOverride() const void FormatPrivate::load(QXmlStreamReader &reader) { - name = reader.attributes().value(QStringLiteral("name")).toString(); - defaultStyle = stringToDefaultFormat(reader.attributes().value(QStringLiteral("defStyleNum"))); + name = reader.attributes().value(QLatin1String("name")).toString(); + defaultStyle = stringToDefaultFormat(reader.attributes().value(QLatin1String("defStyleNum"))); - QStringView attribute = reader.attributes().value(QStringLiteral("color")); + QStringRef attribute = reader.attributes().value(QLatin1String("color")); if (!attribute.isEmpty()) { style.textColor = QColor(attribute.toString()).rgba(); } - attribute = reader.attributes().value(QStringLiteral("selColor")); + attribute = reader.attributes().value(QLatin1String("selColor")); if (!attribute.isEmpty()) { style.selectedTextColor = QColor(attribute.toString()).rgba(); } - attribute = reader.attributes().value(QStringLiteral("backgroundColor")); + attribute = reader.attributes().value(QLatin1String("backgroundColor")); if (!attribute.isEmpty()) { style.backgroundColor = QColor(attribute.toString()).rgba(); } - attribute = reader.attributes().value(QStringLiteral("selBackgroundColor")); + attribute = reader.attributes().value(QLatin1String("selBackgroundColor")); if (!attribute.isEmpty()) { style.selectedBackgroundColor = QColor(attribute.toString()).rgba(); } - attribute = reader.attributes().value(QStringLiteral("italic")); + attribute = reader.attributes().value(QLatin1String("italic")); if (!attribute.isEmpty()) { style.hasItalic = true; style.italic = Xml::attrToBool(attribute); } - attribute = reader.attributes().value(QStringLiteral("bold")); + attribute = reader.attributes().value(QLatin1String("bold")); if (!attribute.isEmpty()) { style.hasBold = true; style.bold = Xml::attrToBool(attribute); } - attribute = reader.attributes().value(QStringLiteral("underline")); + attribute = reader.attributes().value(QLatin1String("underline")); if (!attribute.isEmpty()) { style.hasUnderline = true; style.underline = Xml::attrToBool(attribute); } - attribute = reader.attributes().value(QStringLiteral("strikeOut")); + attribute = reader.attributes().value(QLatin1String("strikeOut")); if (!attribute.isEmpty()) { style.hasStrikeThrough = true; style.strikeThrough = Xml::attrToBool(attribute); } - attribute = reader.attributes().value(QStringLiteral("spellChecking")); + attribute = reader.attributes().value(QLatin1String("spellChecking")); if (!attribute.isEmpty()) { spellCheck = Xml::attrToBool(attribute); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h index 25491809ae..496a54e42c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_FORMAT_H @@ -37,7 +21,6 @@ QT_END_NAMESPACE namespace KSyntaxHighlighting { -class DefinitionRef; class FormatPrivate; /** Describes the format to be used for a specific text fragment. diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h index 91a4f1e912..e578d23e14 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_FORMAT_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp index 3acade7f9d..7594d33d23 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp @@ -1,25 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2018 Christoph Cullmann <cullmann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2018 Christoph Cullmann <cullmann@kde.org> + + SPDX-License-Identifier: MIT */ #include "htmlhighlighter.h" @@ -61,21 +44,13 @@ void HtmlHighlighter::setOutputFile(const QString &fileName) return; } d->out.reset(new QTextStream(d->file.get())); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - d->out->setEncoding(QStringConverter::Utf8); -#else d->out->setCodec("UTF-8"); -#endif } void HtmlHighlighter::setOutputFile(FILE *fileHandle) { d->out.reset(new QTextStream(fileHandle, QIODevice::WriteOnly)); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - d->out->setEncoding(QStringConverter::Utf8); -#else d->out->setCodec("UTF-8"); -#endif } void HtmlHighlighter::highlightFile(const QString &fileName, const QString &title) @@ -111,18 +86,15 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title) *d->out << "<html><head>\n"; *d->out << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n"; *d->out << "<title>" << htmlTitle << "</title>\n"; - *d->out << "<meta name=\"generator\" content=\"KF5::SyntaxHighlighting (" << definition().name() << ")\"/>\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:" << QColor(theme().editorColor(Theme::BackgroundColor)).name(); if (theme().textColor(Theme::Normal)) - *d->out << " style=\"color:" << QColor(theme().textColor(Theme::Normal)).name() << "\""; - *d->out << "><pre>\n"; + *d->out << ";color:" << QColor(theme().textColor(Theme::Normal)).name(); + *d->out << "\"><pre>\n"; QTextStream in(dev); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - in.setEncoding(QStringConverter::Utf8); -#else in.setCodec("UTF-8"); -#endif while (!in.atEnd()) { d->currentLine = in.readLine(); state = highlightLine(d->currentLine, state); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h index 7479ee2b63..8754057345 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_HTMLHIGHLIGHTER_H @@ -32,11 +15,6 @@ #include <memory> -QT_BEGIN_NAMESPACE -class QFile; -class QTextStream; -QT_END_NAMESPACE - namespace KSyntaxHighlighting { class HtmlHighlighterPrivate; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp index d82408d801..8a335c4cc4 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "definition_p.h" @@ -32,7 +16,7 @@ using namespace KSyntaxHighlighting; -bool KeywordList::contains(const QStringView &str, Qt::CaseSensitivity caseSensitive) const +bool KeywordList::contains(const QStringRef &str, Qt::CaseSensitivity caseSensitive) const { /** * get right vector to search in @@ -42,12 +26,7 @@ bool KeywordList::contains(const QStringView &str, Qt::CaseSensitivity caseSensi /** * search with right predicate */ - return std::binary_search(vectorToSearch.begin(), - vectorToSearch.end(), - str, - [caseSensitive](const QStringView &a, const QStringView &b) { - return a.compare(b, caseSensitive) < 0; - }); + return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), QStringView(str), [caseSensitive](const QStringView &a, const QStringView &b) { return a.compare(b, caseSensitive) < 0; }); } void KeywordList::load(QXmlStreamReader &reader) @@ -55,7 +34,7 @@ void KeywordList::load(QXmlStreamReader &reader) Q_ASSERT(reader.name() == QLatin1String("list")); Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - m_name = reader.attributes().value(QStringLiteral("name")).toString(); + m_name = reader.attributes().value(QLatin1String("name")).toString(); while (!reader.atEnd()) { switch (reader.tokenType()) { @@ -105,17 +84,13 @@ void KeywordList::initLookupForCaseSensitivity(Qt::CaseSensitivity caseSensitive */ vectorToSort.reserve(m_keywords.size()); for (const auto &keyword : qAsConst(m_keywords)) { - vectorToSort.emplace_back(keyword); + vectorToSort.push_back(keyword); } /** * sort with right predicate */ - std::sort(vectorToSort.begin(), - vectorToSort.end(), - [caseSensitive](const QStringView &a, const QStringView &b) { - return a.compare(b, caseSensitive) < 0; - }); + std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive](const QStringView &a, const QStringView &b) { return a.compare(b, caseSensitive) < 0; }); } void KeywordList::resolveIncludeKeywords(DefinitionData &def) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h index de39a8731b..bf067cc3cf 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h @@ -1,30 +1,15 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H #define KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H #include <QString> +#include <QStringView> #include <QStringList> #include <vector> @@ -68,10 +53,13 @@ public: } /** Checks if @p str is a keyword in this list. */ - bool contains(const QStringView &str) const { return contains(str, m_caseSensitive); } + bool contains(const QStringRef &str) const + { + return contains(str, m_caseSensitive); + } /** Checks if @p str is a keyword in this list, overriding the global case-sensitivity setting. */ - bool contains(const QStringView &str, Qt::CaseSensitivity caseSensitive) const; + bool contains(const QStringRef &str, Qt::CaseSensitivity caseSensitive) const; void load(QXmlStreamReader &reader); void setCaseSensitivity(Qt::CaseSensitivity caseSensitive); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h index c79801dd3d..1e0f7c6102 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/matchresult_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_MATCHRESULT_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp index c45dfa7d3c..2252bc67d2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "repository.h" @@ -92,8 +75,9 @@ QVector<Definition> Repository::definitionsForFileName(const QString &fileName) QFileInfo fi(fileName); const auto name = fi.fileName(); + // use d->m_defs, sorted map by highlighting name, to be deterministic and independent of translations QVector<Definition> candidates; - for (const Definition &def : qAsConst(d->m_sortedDefs)) { + for (const Definition &def : qAsConst(d->m_defs)) { for (const auto &pattern : def.extensions()) { if (WildcardMatcher::exactMatch(name, pattern)) { candidates.push_back(def); @@ -113,8 +97,9 @@ Definition Repository::definitionForMimeType(const QString &mimeType) const QVector<Definition> Repository::definitionsForMimeType(const QString &mimeType) const { + // use d->m_defs, sorted map by highlighting name, to be deterministic and independent of translations QVector<Definition> candidates; - for (const Definition &def : qAsConst(d->m_sortedDefs)) { + for (const Definition &def : qAsConst(d->m_defs)) { for (const auto &matchType : def.mimeTypes()) { if (mimeType == matchType) { candidates.push_back(def); @@ -152,7 +137,7 @@ Theme Repository::defaultTheme(Repository::DefaultTheme t) { if (t == DarkTheme) return theme(QLatin1String("Breeze Dark")); - return theme(QLatin1String("Default")); + return theme(QLatin1String("Breeze Light")); } void RepositoryPrivate::load(Repository *repo) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h index 555dbe983e..d24aa92703 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_REPOSITORY_H @@ -28,10 +11,10 @@ #include <memory> #include <qglobal.h> -#include <qvector.h> QT_BEGIN_NAMESPACE class QString; +template<typename T> class QVector; QT_END_NAMESPACE /** diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h index 81cba47942..447cfae699 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_REPOSITORY_P_H @@ -58,7 +41,10 @@ public: QVector<QString> m_customSearchPaths; - QHash<QString, Definition> m_defs; + // sorted map to have deterministic iteration order for e.g. definitionsForFileName + QMap<QString, Definition> m_defs; + + // this vector is sorted by translated sections/names QVector<Definition> m_sortedDefs; QVector<Theme> m_themes; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp index ad74146954..c5cf1919a7 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp @@ -1,25 +1,9 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2018 Christoph Cullmann <cullmann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2018 Christoph Cullmann <cullmann@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "context_p.h" @@ -27,21 +11,29 @@ #include "ksyntaxhighlighting_logging.h" #include "rule_p.h" #include "xml_p.h" +#include "worddelimiters_p.h" #include <QString> #include <QXmlStreamReader> using namespace KSyntaxHighlighting; +// QChar::isDigit() match any digit in unicode (romain numeral, etc) +static bool isDigit(QChar c) +{ + return (c <= QLatin1Char('9') && QLatin1Char('0') <= c); +} + static bool isOctalChar(QChar c) { - return c.isNumber() && c != QLatin1Char('9') && c != QLatin1Char('8'); + return (c <= QLatin1Char('7') && QLatin1Char('0') <= c); } static bool isHexChar(QChar c) { - return c.isNumber() || c == QLatin1Char('a') || c == QLatin1Char('A') || c == QLatin1Char('b') || c == QLatin1Char('B') || c == QLatin1Char('c') || c == QLatin1Char('C') || c == QLatin1Char('d') || c == QLatin1Char('D') || - c == QLatin1Char('e') || c == QLatin1Char('E') || c == QLatin1Char('f') || c == QLatin1Char('F'); + return isDigit(c) + || (c <= QLatin1Char('f') && QLatin1Char('a') <= c) + || (c <= QLatin1Char('F') && QLatin1Char('A') <= c); } static int matchEscapedChar(const QString &text, int offset) @@ -50,30 +42,31 @@ static int matchEscapedChar(const QString &text, int offset) return offset; const auto c = text.at(offset + 1); - static const auto controlChars = QStringLiteral("abefnrtv\"'?\\"); - if (controlChars.contains(c)) + switch (c.unicode()) { + // control chars + case 'a': case 'b': case 'e': case 'f': + case 'n': case 'r': case 't': case 'v': + case '"': case '\'': case '?': case '\\': return offset + 2; // hex encoded character - if (c == QLatin1Char('x')) { - auto newOffset = offset + 2; - for (int i = 0; i < 2 && newOffset + i < text.size(); ++i, ++newOffset) { - if (!isHexChar(text.at(newOffset))) - break; + case 'x': + if (offset + 2 < text.size() && isHexChar(text.at(offset + 2))) { + if (offset + 3 < text.size() && isHexChar(text.at(offset + 3))) + return offset + 4; + return offset + 3; } - if (newOffset == offset + 2) - return offset; - return newOffset; - } + return offset; // octal encoding, simple \0 is OK, too, unlike simple \x above - if (isOctalChar(c)) { - auto newOffset = offset + 2; - for (int i = 0; i < 2 && newOffset + i < text.size(); ++i, ++newOffset) { - if (!isOctalChar(text.at(newOffset))) - break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + if (offset + 2 < text.size() && isOctalChar(text.at(offset + 2))) { + if (offset + 3 < text.size() && isOctalChar(text.at(offset + 3))) + return offset + 4; + return offset + 3; } - return newOffset; + return offset + 2; } return offset; @@ -102,13 +95,13 @@ bool Rule::load(QXmlStreamReader &reader) { Q_ASSERT(reader.tokenType() == QXmlStreamReader::StartElement); - m_attribute = reader.attributes().value(QStringLiteral("attribute")).toString(); + m_attribute = reader.attributes().value(QLatin1String("attribute")).toString(); if (reader.name() != QLatin1String("IncludeRules")) // IncludeRules uses this with a different semantic - m_context.parse(reader.attributes().value(QStringLiteral("context"))); - m_firstNonSpace = Xml::attrToBool(reader.attributes().value(QStringLiteral("firstNonSpace"))); - m_lookAhead = Xml::attrToBool(reader.attributes().value(QStringLiteral("lookAhead"))); + m_context.parse(reader.attributes().value(QLatin1String("context"))); + m_firstNonSpace = Xml::attrToBool(reader.attributes().value(QLatin1String("firstNonSpace"))); + m_lookAhead = Xml::attrToBool(reader.attributes().value(QLatin1String("lookAhead"))); bool colOk = false; - m_column = reader.attributes().value(QStringLiteral("column")).toInt(&colOk); + m_column = reader.attributes().value(QLatin1String("column")).toInt(&colOk); if (!colOk) m_column = -1; @@ -131,10 +124,12 @@ bool Rule::load(QXmlStreamReader &reader) void Rule::resolveContext() { - m_context.resolve(m_def.definition()); + auto const& def = m_def.definition(); + + m_context.resolve(def); // cache for DefinitionData::wordDelimiters, is accessed VERY often - m_wordDelimiter = DefinitionData::get(m_def.definition())->wordDelimiters; + m_wordDelimiters = &DefinitionData::get(def)->wordDelimiters; } void Rule::resolveAttributeFormat(Context *lookupContext) @@ -156,60 +151,57 @@ bool Rule::doLoad(QXmlStreamReader &reader) return true; } -Rule::Ptr Rule::create(const QStringView &name) +Rule::Ptr Rule::create(const QStringRef &name) { - Rule *rule = nullptr; if (name == QLatin1String("AnyChar")) - rule = new AnyChar; - else if (name == QLatin1String("DetectChar")) - rule = new DetectChar; - else if (name == QLatin1String("Detect2Chars")) - rule = new Detect2Char; - else if (name == QLatin1String("DetectIdentifier")) - rule = new DetectIdentifier; - else if (name == QLatin1String("DetectSpaces")) - rule = new DetectSpaces; - else if (name == QLatin1String("Float")) - rule = new Float; - else if (name == QLatin1String("Int")) - rule = new Int; - else if (name == QLatin1String("HlCChar")) - rule = new HlCChar; - else if (name == QLatin1String("HlCHex")) - rule = new HlCHex; - else if (name == QLatin1String("HlCOct")) - rule = new HlCOct; - else if (name == QLatin1String("HlCStringChar")) - rule = new HlCStringChar; - else if (name == QLatin1String("IncludeRules")) - rule = new IncludeRules; - else if (name == QLatin1String("keyword")) - rule = new KeywordListRule; - else if (name == QLatin1String("LineContinue")) - rule = new LineContinue; - else if (name == QLatin1String("RangeDetect")) - rule = new RangeDetect; - else if (name == QLatin1String("RegExpr")) - rule = new RegExpr; - else if (name == QLatin1String("StringDetect")) - rule = new StringDetect; - else if (name == QLatin1String("WordDetect")) - rule = new WordDetect; - else - qCWarning(Log) << "Unknown rule type:" << name; - - return Ptr(rule); + return std::make_shared<AnyChar>(); + if (name == QLatin1String("DetectChar")) + return std::make_shared<DetectChar>(); + if (name == QLatin1String("Detect2Chars")) + return std::make_shared<Detect2Char>(); + if (name == QLatin1String("DetectIdentifier")) + return std::make_shared<DetectIdentifier>(); + if (name == QLatin1String("DetectSpaces")) + return std::make_shared<DetectSpaces>(); + if (name == QLatin1String("Float")) + return std::make_shared<Float>(); + if (name == QLatin1String("Int")) + return std::make_shared<Int>(); + if (name == QLatin1String("HlCChar")) + return std::make_shared<HlCChar>(); + if (name == QLatin1String("HlCHex")) + return std::make_shared<HlCHex>(); + if (name == QLatin1String("HlCOct")) + return std::make_shared<HlCOct>(); + if (name == QLatin1String("HlCStringChar")) + return std::make_shared<HlCStringChar>(); + if (name == QLatin1String("IncludeRules")) + return std::make_shared<IncludeRules>(); + if (name == QLatin1String("keyword")) + return std::make_shared<KeywordListRule>(); + if (name == QLatin1String("LineContinue")) + return std::make_shared<LineContinue>(); + if (name == QLatin1String("RangeDetect")) + return std::make_shared<RangeDetect>(); + if (name == QLatin1String("RegExpr")) + return std::make_shared<RegExpr>(); + if (name == QLatin1String("StringDetect")) + return std::make_shared<StringDetect>(); + if (name == QLatin1String("WordDetect")) + return std::make_shared<WordDetect>(); + + qCWarning(Log) << "Unknown rule type:" << name; + return Ptr(nullptr); } bool Rule::isWordDelimiter(QChar c) const { - // perf tells contains is MUCH faster than binary search here, very short array - return m_wordDelimiter.contains(c); + return m_wordDelimiters->contains(c); } bool AnyChar::doLoad(QXmlStreamReader &reader) { - m_chars = reader.attributes().value(QStringLiteral("String")).toString(); + m_chars = reader.attributes().value(QLatin1String("String")).toString(); if (m_chars.size() == 1) qCDebug(Log) << "AnyChar rule with just one char: use DetectChar instead."; return !m_chars.isEmpty(); @@ -224,11 +216,11 @@ MatchResult AnyChar::doMatch(const QString &text, int offset, const QStringList bool DetectChar::doLoad(QXmlStreamReader &reader) { - const auto s = reader.attributes().value(QStringLiteral("char")); + const auto s = reader.attributes().value(QLatin1String("char")); if (s.isEmpty()) return false; m_char = s.at(0); - m_dynamic = Xml::attrToBool(reader.attributes().value(QStringLiteral("dynamic"))); + m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); if (m_dynamic) { m_captureIndex = m_char.digitValue(); } @@ -252,8 +244,8 @@ MatchResult DetectChar::doMatch(const QString &text, int offset, const QStringLi bool Detect2Char::doLoad(QXmlStreamReader &reader) { - const auto s1 = reader.attributes().value(QStringLiteral("char")); - const auto s2 = reader.attributes().value(QStringLiteral("char1")); + const auto s1 = reader.attributes().value(QLatin1String("char")); + const auto s2 = reader.attributes().value(QLatin1String("char1")); if (s1.isEmpty() || s2.isEmpty()) return false; m_char1 = s1.at(0); @@ -297,14 +289,14 @@ MatchResult Float::doMatch(const QString &text, int offset, const QStringList &) return offset; auto newOffset = offset; - while (newOffset < text.size() && text.at(newOffset).isDigit()) + while (newOffset < text.size() && isDigit(text.at(newOffset))) ++newOffset; if (newOffset >= text.size() || text.at(newOffset) != QLatin1Char('.')) return offset; ++newOffset; - while (newOffset < text.size() && text.at(newOffset).isDigit()) + while (newOffset < text.size() && isDigit(text.at(newOffset))) ++newOffset; if (newOffset == offset + 1) // we only found a decimal point @@ -318,7 +310,7 @@ MatchResult Float::doMatch(const QString &text, int offset, const QStringList &) if (expOffset < text.size() && (text.at(expOffset) == QLatin1Char('+') || text.at(expOffset) == QLatin1Char('-'))) ++expOffset; bool foundExpDigit = false; - while (expOffset < text.size() && text.at(expOffset).isDigit()) { + while (expOffset < text.size() && isDigit(text.at(expOffset))) { ++expOffset; foundExpDigit = true; } @@ -422,7 +414,7 @@ bool IncludeRules::doLoad(QXmlStreamReader &reader) #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) const auto split = s.split(QLatin1String("##"), QString::KeepEmptyParts); #else - const auto split = s.split(QString::fromLatin1("##"), Qt::KeepEmptyParts); + const auto split = s.split(QLatin1String("##"), Qt::KeepEmptyParts); #endif if (split.isEmpty()) return false; @@ -446,7 +438,7 @@ MatchResult Int::doMatch(const QString &text, int offset, const QStringList &) c if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) return offset; - while (offset < text.size() && text.at(offset).isDigit()) + while (offset < text.size() && isDigit(text.at(offset))) ++offset; return offset; } @@ -486,11 +478,10 @@ MatchResult KeywordListRule::doMatch(const QString &text, int offset, const QStr return offset; if (m_hasCaseSensitivityOverride) { - if (m_keywordList->contains(QStringView(text).mid(offset, newOffset - offset), - m_caseSensitivityOverride)) + if (m_keywordList->contains(text.midRef(offset, newOffset - offset), m_caseSensitivityOverride)) return newOffset; } else { - if (m_keywordList->contains(QStringView(text).mid(offset, newOffset - offset))) + if (m_keywordList->contains(text.midRef(offset, newOffset - offset))) return newOffset; } @@ -500,7 +491,7 @@ MatchResult KeywordListRule::doMatch(const QString &text, int offset, const QStr bool LineContinue::doLoad(QXmlStreamReader &reader) { - const auto s = reader.attributes().value(QStringLiteral("char")); + const auto s = reader.attributes().value(QLatin1String("char")); if (s.isEmpty()) m_char = QLatin1Char('\\'); else @@ -517,8 +508,8 @@ MatchResult LineContinue::doMatch(const QString &text, int offset, const QString bool RangeDetect::doLoad(QXmlStreamReader &reader) { - const auto s1 = reader.attributes().value(QStringLiteral("char")); - const auto s2 = reader.attributes().value(QStringLiteral("char1")); + const auto s1 = reader.attributes().value(QLatin1String("char")); + const auto s2 = reader.attributes().value(QLatin1String("char1")); if (s1.isEmpty() || s2.isEmpty()) return false; m_begin = s1.at(0); @@ -544,14 +535,14 @@ MatchResult RangeDetect::doMatch(const QString &text, int offset, const QStringL bool RegExpr::doLoad(QXmlStreamReader &reader) { - m_regexp.setPattern(reader.attributes().value(QStringLiteral("String")).toString()); + m_regexp.setPattern(reader.attributes().value(QLatin1String("String")).toString()); - const auto isMinimal = Xml::attrToBool(reader.attributes().value(QStringLiteral("minimal"))); - const auto isCaseInsensitive = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))); + const auto isMinimal = Xml::attrToBool(reader.attributes().value(QLatin1String("minimal"))); + const auto isCaseInsensitive = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))); m_regexp.setPatternOptions((isMinimal ? QRegularExpression::InvertedGreedinessOption : QRegularExpression::NoPatternOption) | (isCaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption)); // optimize the pattern for the non-dynamic case, we use them OFTEN - m_dynamic = Xml::attrToBool(reader.attributes().value(QStringLiteral("dynamic"))); + m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); if (!m_dynamic) { m_regexp.optimize(); } @@ -601,9 +592,9 @@ MatchResult RegExpr::doMatch(const QString &text, int offset, const QStringList bool StringDetect::doLoad(QXmlStreamReader &reader) { - m_string = reader.attributes().value(QStringLiteral("String")).toString(); - m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; - m_dynamic = Xml::attrToBool(reader.attributes().value(QStringLiteral("dynamic"))); + m_string = reader.attributes().value(QLatin1String("String")).toString(); + m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; + m_dynamic = Xml::attrToBool(reader.attributes().value(QLatin1String("dynamic"))); return !m_string.isEmpty(); } @@ -614,16 +605,15 @@ MatchResult StringDetect::doMatch(const QString &text, int offset, const QString */ const auto &pattern = m_dynamic ? replaceCaptures(m_string, captures, false) : m_string; - if (offset + pattern.size() <= text.size() - && QStringView(text).mid(offset, pattern.size()).compare(pattern, m_caseSensitivity) == 0) + if (text.midRef(offset, pattern.size()).compare(pattern, m_caseSensitivity) == 0) return offset + pattern.size(); return offset; } bool WordDetect::doLoad(QXmlStreamReader &reader) { - m_word = reader.attributes().value(QStringLiteral("String")).toString(); - m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QStringLiteral("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; + m_word = reader.attributes().value(QLatin1String("String")).toString(); + m_caseSensitivity = Xml::attrToBool(reader.attributes().value(QLatin1String("insensitive"))) ? Qt::CaseInsensitive : Qt::CaseSensitive; return !m_word.isEmpty(); } @@ -639,7 +629,7 @@ MatchResult WordDetect::doMatch(const QString &text, int offset, const QStringLi if (offset > 0 && !isWordDelimiter(text.at(offset - 1)) && !isWordDelimiter(text.at(offset))) return offset; - if (QStringView(text).mid(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) + if (text.midRef(offset, m_word.size()).compare(m_word, m_caseSensitivity) != 0) return offset; if (text.size() == offset + m_word.size() || isWordDelimiter(text.at(offset + m_word.size())) || isWordDelimiter(text.at(offset + m_word.size() - 1))) diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h index 484687bc0a..288f66246e 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h @@ -1,24 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_RULE_P_H @@ -43,6 +27,8 @@ QT_END_NAMESPACE namespace KSyntaxHighlighting { +class WordDelimiters; + class Rule { public: @@ -100,7 +86,7 @@ public: virtual MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const = 0; - static Rule::Ptr create(const QStringView &name); + static Rule::Ptr create(const QStringRef &name); protected: virtual bool doLoad(QXmlStreamReader &reader); @@ -121,7 +107,7 @@ private: bool m_lookAhead = false; // cache for DefinitionData::wordDelimiters, is accessed VERY often - QStringView m_wordDelimiter; + WordDelimiters* m_wordDelimiters = nullptr; protected: bool m_dynamic = false; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp index dfb4d0c24a..ea5bd36e4f 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.cpp @@ -1,25 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2018 Christoph Cullmann <cullmann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2018 Christoph Cullmann <cullmann@kde.org> + + SPDX-License-Identifier: MIT */ #include "state.h" @@ -33,7 +16,12 @@ using namespace KSyntaxHighlighting; StateData *StateData::get(State &state) { - state.d.detach(); + // create state data on demand, to make default state construction cheap + if (!state.d) { + state.d = new StateData(); + } else { + state.d.detach(); + } return state.d.data(); } @@ -68,7 +56,7 @@ bool StateData::pop(int popCount) // keep the initial context alive in any case Q_ASSERT(!isEmpty()); const bool initialContextSurvived = m_contextStack.size() > popCount; - m_contextStack.resize(std::max(1, int(m_contextStack.size()) - popCount)); + m_contextStack.resize(std::max(1, m_contextStack.size() - popCount)); return initialContextSurvived; } @@ -85,7 +73,6 @@ const QStringList &StateData::topCaptures() const } State::State() - : d(new StateData) { } @@ -107,7 +94,7 @@ State &State::operator=(const State &other) bool State::operator==(const State &other) const { // use pointer equal as shortcut for shared states - return (d == other.d) || (d->m_contextStack == other.d->m_contextStack && d->m_defRef == other.d->m_defRef); + return (d == other.d) || (d && other.d && d->m_contextStack == other.d->m_contextStack && d->m_defRef == other.d->m_defRef); } bool State::operator!=(const State &other) const @@ -117,7 +104,7 @@ bool State::operator!=(const State &other) const bool State::indentationBasedFoldingEnabled() const { - if (d->m_contextStack.isEmpty()) + if (!d || d->m_contextStack.isEmpty()) return false; return d->m_contextStack.last().first->indentationBasedFoldingEnabled(); } diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h index ed63274695..726ff32a88 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_STATE_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h index 1156ce981a..80bf8f4b02 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state_p.h @@ -1,25 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2018 Christoph Cullmann <cullmann@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2018 Christoph Cullmann <cullmann@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_STATE_P_H @@ -30,6 +13,10 @@ #include "definitionref_p.h" +QT_BEGIN_NAMESPACE +class QStringList; +QT_END_NAMESPACE + namespace KSyntaxHighlighting { class Context; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp index a6bccffdd4..d0c4ee98ae 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "syntaxhighlighter.h" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h index 7f5dadefeb..a57455d9ba 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_QSYNTAXHIGHLIGHTER_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h index 4b6cef7e98..40c3da86a3 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_TEXTSTYLEDATA_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp index c6f31a5182..beb1e87797 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + + SPDX-License-Identifier: MIT */ #include "theme.h" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h index 3379aec853..076e8d0318 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/theme.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_THEME_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp index 03a5ea8e32..f8283b4456 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp @@ -1,25 +1,9 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2016 Dominik Haumann <dhaumann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #include "ksyntaxhighlighting_logging.h" @@ -120,54 +104,64 @@ bool ThemeData::load(const QString &filePath) m_revision = metadata.value(QLatin1String("revision")).toInt(); // read text styles - static const auto idx = Theme::staticMetaObject.indexOfEnumerator("TextStyle"); - Q_ASSERT(idx >= 0); - const auto metaEnum = Theme::staticMetaObject.enumerator(idx); + static const auto styleIdx = Theme::staticMetaObject.indexOfEnumerator("TextStyle"); + Q_ASSERT(styleIdx >= 0); + const auto metaEnumStyle = Theme::staticMetaObject.enumerator(styleIdx); const QJsonObject textStyles = obj.value(QLatin1String("text-styles")).toObject(); - for (int i = 0; i < metaEnum.keyCount(); ++i) { - Q_ASSERT(i == metaEnum.value(i)); - m_textStyles[i] = readThemeData(textStyles.value(QLatin1String(metaEnum.key(i))).toObject()); + for (int i = 0; i < metaEnumStyle.keyCount(); ++i) { + Q_ASSERT(i == metaEnumStyle.value(i)); + m_textStyles[i] = readThemeData(textStyles.value(QLatin1String(metaEnumStyle.key(i))).toObject()); } - // read editor area colors + // read editor colors + static const auto colorIdx = Theme::staticMetaObject.indexOfEnumerator("EditorColorRole"); + Q_ASSERT(colorIdx >= 0); + const auto metaEnumColor = Theme::staticMetaObject.enumerator(colorIdx); const QJsonObject editorColors = obj.value(QLatin1String("editor-colors")).toObject(); - m_editorColors[Theme::BackgroundColor] = readColor(editorColors.value(QLatin1String("background-color"))); - m_editorColors[Theme::TextSelection] = readColor(editorColors.value(QLatin1String("selection"))); - m_editorColors[Theme::CurrentLine] = readColor(editorColors.value(QLatin1String("current-line"))); - m_editorColors[Theme::SearchHighlight] = readColor(editorColors.value(QLatin1String("search-highlight"))); - m_editorColors[Theme::ReplaceHighlight] = readColor(editorColors.value(QLatin1String("replace-highlight"))); - m_editorColors[Theme::BracketMatching] = readColor(editorColors.value(QLatin1String("bracket-matching"))); - m_editorColors[Theme::TabMarker] = readColor(editorColors.value(QLatin1String("tab-marker"))); - m_editorColors[Theme::SpellChecking] = readColor(editorColors.value(QLatin1String("spell-checking"))); - m_editorColors[Theme::IndentationLine] = readColor(editorColors.value(QLatin1String("indentation-line"))); - m_editorColors[Theme::IconBorder] = readColor(editorColors.value(QLatin1String("icon-border"))); - m_editorColors[Theme::CodeFolding] = readColor(editorColors.value(QLatin1String("code-folding"))); - m_editorColors[Theme::LineNumbers] = readColor(editorColors.value(QLatin1String("line-numbers"))); - m_editorColors[Theme::CurrentLineNumber] = readColor(editorColors.value(QLatin1String("current-line-number"))); - m_editorColors[Theme::WordWrapMarker] = readColor(editorColors.value(QLatin1String("word-wrap-marker"))); - m_editorColors[Theme::ModifiedLines] = readColor(editorColors.value(QLatin1String("modified-lines"))); - m_editorColors[Theme::SavedLines] = readColor(editorColors.value(QLatin1String("saved-lines"))); - m_editorColors[Theme::Separator] = readColor(editorColors.value(QLatin1String("separator"))); - m_editorColors[Theme::MarkBookmark] = readColor(editorColors.value(QLatin1String("mark-bookmark"))); - m_editorColors[Theme::MarkBreakpointActive] = readColor(editorColors.value(QLatin1String("mark-breakpoint-active"))); - m_editorColors[Theme::MarkBreakpointReached] = readColor(editorColors.value(QLatin1String("mark-breakpoint-reached"))); - m_editorColors[Theme::MarkBreakpointDisabled] = readColor(editorColors.value(QLatin1String("mark-breakpoint-disabled"))); - m_editorColors[Theme::MarkExecution] = readColor(editorColors.value(QLatin1String("mark-execution"))); - m_editorColors[Theme::MarkWarning] = readColor(editorColors.value(QLatin1String("mark-warning"))); - m_editorColors[Theme::MarkError] = readColor(editorColors.value(QLatin1String("mark-error"))); - m_editorColors[Theme::TemplateBackground] = readColor(editorColors.value(QLatin1String("template-background"))); - m_editorColors[Theme::TemplatePlaceholder] = readColor(editorColors.value(QLatin1String("template-placeholder"))); - m_editorColors[Theme::TemplateFocusedPlaceholder] = readColor(editorColors.value(QLatin1String("template-focused-placeholder"))); - m_editorColors[Theme::TemplateReadOnlyPlaceholder] = readColor(editorColors.value(QLatin1String("template-read-only-placeholder"))); + for (int i = 0; i < metaEnumColor.keyCount(); ++i) { + Q_ASSERT(i == metaEnumColor.value(i)); + m_editorColors[i] = readColor(editorColors.value(QLatin1String(metaEnumColor.key(i)))); + } + + // if we have no new key around for Theme::BackgroundColor => use old variants to be compatible + if (!editorColors.contains(QLatin1String(metaEnumColor.key(Theme::BackgroundColor)))) { + m_editorColors[Theme::BackgroundColor] = readColor(editorColors.value(QLatin1String("background-color"))); + m_editorColors[Theme::TextSelection] = readColor(editorColors.value(QLatin1String("selection"))); + m_editorColors[Theme::CurrentLine] = readColor(editorColors.value(QLatin1String("current-line"))); + m_editorColors[Theme::SearchHighlight] = readColor(editorColors.value(QLatin1String("search-highlight"))); + m_editorColors[Theme::ReplaceHighlight] = readColor(editorColors.value(QLatin1String("replace-highlight"))); + m_editorColors[Theme::BracketMatching] = readColor(editorColors.value(QLatin1String("bracket-matching"))); + m_editorColors[Theme::TabMarker] = readColor(editorColors.value(QLatin1String("tab-marker"))); + m_editorColors[Theme::SpellChecking] = readColor(editorColors.value(QLatin1String("spell-checking"))); + m_editorColors[Theme::IndentationLine] = readColor(editorColors.value(QLatin1String("indentation-line"))); + m_editorColors[Theme::IconBorder] = readColor(editorColors.value(QLatin1String("icon-border"))); + m_editorColors[Theme::CodeFolding] = readColor(editorColors.value(QLatin1String("code-folding"))); + m_editorColors[Theme::LineNumbers] = readColor(editorColors.value(QLatin1String("line-numbers"))); + m_editorColors[Theme::CurrentLineNumber] = readColor(editorColors.value(QLatin1String("current-line-number"))); + m_editorColors[Theme::WordWrapMarker] = readColor(editorColors.value(QLatin1String("word-wrap-marker"))); + m_editorColors[Theme::ModifiedLines] = readColor(editorColors.value(QLatin1String("modified-lines"))); + m_editorColors[Theme::SavedLines] = readColor(editorColors.value(QLatin1String("saved-lines"))); + m_editorColors[Theme::Separator] = readColor(editorColors.value(QLatin1String("separator"))); + m_editorColors[Theme::MarkBookmark] = readColor(editorColors.value(QLatin1String("mark-bookmark"))); + m_editorColors[Theme::MarkBreakpointActive] = readColor(editorColors.value(QLatin1String("mark-breakpoint-active"))); + m_editorColors[Theme::MarkBreakpointReached] = readColor(editorColors.value(QLatin1String("mark-breakpoint-reached"))); + m_editorColors[Theme::MarkBreakpointDisabled] = readColor(editorColors.value(QLatin1String("mark-breakpoint-disabled"))); + m_editorColors[Theme::MarkExecution] = readColor(editorColors.value(QLatin1String("mark-execution"))); + m_editorColors[Theme::MarkWarning] = readColor(editorColors.value(QLatin1String("mark-warning"))); + m_editorColors[Theme::MarkError] = readColor(editorColors.value(QLatin1String("mark-error"))); + m_editorColors[Theme::TemplateBackground] = readColor(editorColors.value(QLatin1String("template-background"))); + m_editorColors[Theme::TemplatePlaceholder] = readColor(editorColors.value(QLatin1String("template-placeholder"))); + m_editorColors[Theme::TemplateFocusedPlaceholder] = readColor(editorColors.value(QLatin1String("template-focused-placeholder"))); + m_editorColors[Theme::TemplateReadOnlyPlaceholder] = readColor(editorColors.value(QLatin1String("template-read-only-placeholder"))); + } // read per-definition style overrides const auto customStyles = obj.value(QLatin1String("custom-styles")).toObject(); for (auto it = customStyles.begin(); it != customStyles.end(); ++it) { const auto obj = it.value().toObject(); - QHash<QString, TextStyleData> overrideStyle; + auto &overrideStyle = m_textStyleOverrides[it.key()]; for (auto it2 = obj.begin(); it2 != obj.end(); ++it2) overrideStyle.insert(it2.key(), readThemeData(it2.value().toObject())); - m_textStyleOverrides.insert(it.key(), overrideStyle); } return true; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h index 052d297599..7a9772f104 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h @@ -1,25 +1,8 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - Copyright (C) 2016 Dominik Haumann <dhaumann@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_THEMEDATA_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp index 604318200b..82d3e4ea80 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher.cpp @@ -1,24 +1,7 @@ /* - Copyright (C) 2007 Sebastian Pipping <webmaster@hartwork.org> + SPDX-FileCopyrightText: 2007 Sebastian Pipping <webmaster@hartwork.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #include "wildcardmatcher_p.h" diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h index feeca66217..0b92e4c1d6 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/wildcardmatcher_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2007 Sebastian Pipping <webmaster@hartwork.org> + SPDX-FileCopyrightText: 2007 Sebastian Pipping <webmaster@hartwork.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_WILDCARDMATCHER_P_H diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp new file mode 100644 index 0000000000..71cf73ca33 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters.cpp @@ -0,0 +1,43 @@ +/* + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT +*/ + +#include "worddelimiters_p.h" + +using namespace KSyntaxHighlighting; + +WordDelimiters::WordDelimiters() + : asciiDelimiters{} +{ + for(const char *p = "\t !%&()*+,-./:;<=>?[\\]^{|}~"; *p; ++p) + // int(*p) fix -Wchar-subscripts + asciiDelimiters[int(*p)] = true; +} + +bool WordDelimiters::contains(QChar c) const +{ + if (c.unicode() < 128) + return asciiDelimiters[c.unicode()]; + // perf tells contains is MUCH faster than binary search here, very short array + return notAsciiDelimiters.contains(c); +} + +void WordDelimiters::append(QChar c) +{ + if (c.unicode() < 128) { + asciiDelimiters[c.unicode()] = true; + } else { + notAsciiDelimiters.append(c); + } +} + +void WordDelimiters::remove(QChar c) +{ + if (c.unicode() < 128) { + asciiDelimiters[c.unicode()] = false; + } else { + notAsciiDelimiters.remove(c); + } +} diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h new file mode 100644 index 0000000000..51708fc13f --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/worddelimiters_p.h @@ -0,0 +1,56 @@ +/* + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT +*/ + +#ifndef KSYNTAXHIGHLIGHTING_WORDDELIMITERS_P_H +#define KSYNTAXHIGHLIGHTING_WORDDELIMITERS_P_H + +#include <QString> + +namespace KSyntaxHighlighting +{ +/** + * Repesents a list of character that separates 2 words. + * + * Default delimiters are .():!+*,-<=>%&/;?[]^{|}~\, space (' ') and tabulator ('\t'). + * + * @see Rule + * @since 5.74 + */ +class WordDelimiters +{ +public: + WordDelimiters(); + + /** + * Returns @c true if @p c is a word delimiter; otherwise returns @c false. + */ + bool contains(QChar c) const; + + /** + * Appends the character @p c to word delimiter. + */ + void append(QChar c); + + /** + * Removes the character @p c from word delimiters. + */ + void remove(QChar c); + +private: + /** + * An array which represents ascii characters for very fast lookup. + * The character is used as an index and the value @c true indicates a word delimiter. + */ + bool asciiDelimiters[128]; + + /** + * Contains characters that are not ascii and is empty for most syntax definition. + */ + QString notAsciiDelimiters; +}; +} + +#endif diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h index da14a6cc26..65f46a6abc 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/xml_p.h @@ -1,24 +1,7 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_XML_P_H @@ -32,9 +15,9 @@ namespace KSyntaxHighlighting namespace Xml { /** Parse a xs:boolean attribute. */ -inline bool attrToBool(const QStringView &str) +inline bool attrToBool(const QStringRef &str) { - return str == QLatin1String("1") || str.compare(QString("true"), Qt::CaseInsensitive) == 0; + return str == QLatin1String("1") || str.compare(QLatin1String("true"), Qt::CaseInsensitive) == 0; } } diff --git a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro index 38127e1cfe..333af297a8 100644 --- a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro +++ b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.pro @@ -34,6 +34,7 @@ HEADERS += \ src/lib/theme.h \ src/lib/themedata_p.h \ src/lib/wildcardmatcher_p.h \ + src/lib/worddelimiters_p.h \ src/lib/xml_p.h \ SOURCES += \ @@ -53,3 +54,4 @@ SOURCES += \ src/lib/theme.cpp \ src/lib/themedata.cpp \ src/lib/wildcardmatcher.cpp \ + src/lib/worddelimiters.cpp \ |