diff options
author | Eike Ziller <[email protected]> | 2019-11-11 12:58:11 +0100 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2019-11-11 12:58:11 +0100 |
commit | 646c7860cb95fd7e6c36aa640ea1a2f5fde7d59a (patch) | |
tree | 727866c9ea7a22f61978e56212e5fd99726b128d | |
parent | a5044727900b3db78746ae17f72d20da1fd3a8ca (diff) | |
parent | c6115771f9b71e065cb49328bf9d387d327ac996 (diff) |
Merge remote-tracking branch 'origin/4.11'
Conflicts:
src/plugins/genericprojectmanager/genericprojectplugin.cpp
src/plugins/projectexplorer/environmentaspect.cpp
src/plugins/projectexplorer/environmentaspect.h
src/plugins/projectexplorer/environmentaspectwidget.cpp
Change-Id: Id21d62cf14419febd1e06c9b429fcdf4501c0eaf
114 files changed, 4930 insertions, 746 deletions
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 35ba699ee09..27e6cfd7abb 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -38,7 +38,7 @@ if (APPLE) set(_IDE_PLUGIN_PATH "${_IDE_OUTPUT_PATH}/PlugIns") set(_IDE_LIBRARY_BASE_PATH "Frameworks") set(_IDE_LIBRARY_PATH "${_IDE_OUTPUT_PATH}/Frameworks") - set(_IDE_LIBEXEC_PATH "${_IDE_OUTPUT_PATH}/Resources") + set(_IDE_LIBEXEC_PATH "${_IDE_OUTPUT_PATH}/Resources/libexec") set(_IDE_DATA_PATH "${_IDE_OUTPUT_PATH}/Resources") set(_IDE_DOC_PATH "${_IDE_OUTPUT_PATH}/Resources/doc") set(_IDE_BIN_PATH "${_IDE_OUTPUT_PATH}/MacOS") @@ -178,8 +178,12 @@ function(separate_object_libraries libraries REGULAR_LIBS OBJECT_LIBS OBJECT_LIB endfunction(separate_object_libraries) function(set_explicit_moc target_name file) + unset(file_dependencies) + if (file MATCHES "^.*plugin.h$") + set(file_dependencies DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.json") + endif() set_property(SOURCE "${file}" PROPERTY SKIP_AUTOMOC ON) - qt5_wrap_cpp(file_moc "${file}") + qt5_wrap_cpp(file_moc "${file}" ${file_dependencies}) target_sources(${target_name} PRIVATE "${file_moc}") endfunction() diff --git a/dist/installer/mac/ios_qt.conf b/dist/installer/mac/ios_qt.conf index 9e239d6193d..249df1d74cc 100644 --- a/dist/installer/mac/ios_qt.conf +++ b/dist/installer/mac/ios_qt.conf @@ -1,2 +1,2 @@ [Paths] -Plugins = ../../PlugIns +Plugins = ../../../PlugIns diff --git a/dist/installer/mac/libexec_qt.conf b/dist/installer/mac/libexec_qt.conf new file mode 100644 index 00000000000..7004d4bec38 --- /dev/null +++ b/dist/installer/mac/libexec_qt.conf @@ -0,0 +1,5 @@ +[Paths] +Prefix = ../.. +Imports = Imports/qtquick1 +Qml2Imports = Imports/qtquick2 +Plugins = PlugIns diff --git a/dist/installer/mac/qmldesigner_qt.conf b/dist/installer/mac/qmldesigner_qt.conf index c10c195bdd6..8d80be2292f 100644 --- a/dist/installer/mac/qmldesigner_qt.conf +++ b/dist/installer/mac/qmldesigner_qt.conf @@ -1,4 +1,5 @@ [Paths] -Imports = ../../Imports/qtquick1 -Qml2Imports = ../../Imports/qtquick2 -Plugins = ../../PlugIns +Prefix = ../../.. +Imports = Imports/qtquick1 +Qml2Imports = Imports/qtquick2 +Plugins = PlugIns diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index d41a98f5629..3c6c30f8c75 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -48,7 +48,7 @@ Module { ? ide_app_target + ".app/Contents/Resources" : "share/qtcreator" property string ide_libexec_path: qbs.targetOS.contains("macos") - ? ide_data_path : qbs.targetOS.contains("windows") + ? ide_data_path + "/libexec" : qbs.targetOS.contains("windows") ? ide_app_path : "libexec/qtcreator" property string ide_bin_path: qbs.targetOS.contains("macos") diff --git a/qtcreator.pri b/qtcreator.pri index 9a61746ddbe..cc0a0b658cb 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -107,7 +107,7 @@ osx { IDE_LIBRARY_PATH = $$IDE_OUTPUT_PATH/Frameworks IDE_PLUGIN_PATH = $$IDE_OUTPUT_PATH/PlugIns - IDE_LIBEXEC_PATH = $$IDE_OUTPUT_PATH/Resources + IDE_LIBEXEC_PATH = $$IDE_OUTPUT_PATH/Resources/libexec IDE_DATA_PATH = $$IDE_OUTPUT_PATH/Resources IDE_DOC_PATH = $$IDE_DATA_PATH/doc IDE_BIN_PATH = $$IDE_OUTPUT_PATH/MacOS @@ -118,7 +118,7 @@ osx { INSTALL_LIBRARY_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/Frameworks INSTALL_PLUGIN_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/PlugIns - INSTALL_LIBEXEC_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/Resources + INSTALL_LIBEXEC_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/Resources/libexec INSTALL_DATA_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/Resources INSTALL_DOC_PATH = $$INSTALL_DATA_PATH/doc INSTALL_BIN_PATH = $$QTC_PREFIX/$${IDE_APP_TARGET}.app/Contents/MacOS diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index 47c76130024..8844f8502d9 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -30,6 +30,7 @@ app_path="$1" resource_path="$app_path/Contents/Resources" +libexec_path="$app_path/Contents/Resources/libexec" bin_src="$2" translation_src="$3" plugin_src="$4" @@ -76,6 +77,7 @@ if [ -d "$quick1_src" ]; then echo "- Copying Qt Quick 1 imports" mkdir -p "$importsDir" cp -R "$quick1_src"/ "$importsDir"/ + find "$importsDir" -path "*.dylib.dSYM*" -delete fi fi @@ -86,6 +88,7 @@ if [ -d "$quick2_src" ]; then echo "- Copying Qt Quick 2 imports" mkdir -p "$imports2Dir" cp -R "$quick2_src"/ "$imports2Dir"/ + find "$imports2Dir" -path "*.dylib.dSYM*" -delete fi fi @@ -95,16 +98,22 @@ if [ ! -f "$resource_path/qt.conf" ]; then cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$resource_path/qt.conf" || exit 1 fi +# copy libexec tools' qt.conf +if [ ! -f "$libexec_path/qt.conf" ]; then + echo "- Copying libexec/qt.conf" + cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/libexec_qt.conf" "$libexec_path/qt.conf" || exit 1 +fi + # copy ios tools' qt.conf -if [ ! -f "$resource_path/ios/qt.conf" ]; then - echo "- Copying ios/qt.conf" - cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$resource_path/ios/qt.conf" || exit 1 +if [ ! -f "$libexec_path/ios/qt.conf" ]; then + echo "- Copying libexec/ios/qt.conf" + cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$libexec_path/ios/qt.conf" || exit 1 fi # copy qml2puppet's qt.conf -if [ ! -f "$resource_path/qmldesigner/qt.conf" ]; then - echo "- Copying qmldesigner/qt.conf" - cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$resource_path/qmldesigner/qt.conf" || exit 1 +if [ ! -f "$libexec_path/qmldesigner/qt.conf" ]; then + echo "- Copying libexec/qmldesigner/qt.conf" + cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$libexec_path/qmldesigner/qt.conf" || exit 1 fi # copy Qt translations @@ -120,50 +129,40 @@ if [ $LLVM_INSTALL_DIR ]; then echo "- Copying libclang" mkdir -p "$app_path/Contents/Frameworks" || exit 1 # use recursive copy to make it copy symlinks as symlinks - mkdir -p "$resource_path/clang/bin" - mkdir -p "$resource_path/clang/lib" + mkdir -p "$libexec_path/clang/bin" + mkdir -p "$libexec_path/clang/lib" cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang.*dylib "$app_path/Contents/Frameworks/" || exit 1 - cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$resource_path/clang/lib/" || exit 1 + cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$libexec_path/clang/lib/" || exit 1 clangsource="$LLVM_INSTALL_DIR"/bin/clang clanglinktarget="$(readlink "$clangsource")" - cp -Rf "$clangsource" "$resource_path/clang/bin/" || exit 1 + cp -Rf "$clangsource" "$libexec_path/clang/bin/" || exit 1 if [ $clanglinktarget ]; then - cp -Rf "$(dirname "$clangsource")/$clanglinktarget" "$resource_path/clang/bin/$clanglinktarget" || exit 1 + cp -Rf "$(dirname "$clangsource")/$clanglinktarget" "$libexec_path/clang/bin/$clanglinktarget" || exit 1 fi clangdsource="$LLVM_INSTALL_DIR"/bin/clangd - cp -Rf "$clangdsource" "$resource_path/clang/bin/" || exit 1 + cp -Rf "$clangdsource" "$libexec_path/clang/bin/" || exit 1 clangtidysource="$LLVM_INSTALL_DIR"/bin/clang-tidy - cp -Rf "$clangtidysource" "$resource_path/clang/bin/" || exit 1 + cp -Rf "$clangtidysource" "$libexec_path/clang/bin/" || exit 1 clazysource="$LLVM_INSTALL_DIR"/bin/clazy-standalone - cp -Rf "$clazysource" "$resource_path/clang/bin/" || exit 1 + cp -Rf "$clazysource" "$libexec_path/clang/bin/" || exit 1 fi - clangbackendArgument="-executable=$resource_path/clangbackend" - clangpchmanagerArgument="-executable=$resource_path/clangpchmanagerbackend" - clangrefactoringArgument="-executable=$resource_path/clangrefactoringbackend" + clangbackendArgument="-executable=$libexec_path/clangbackend" + clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend" + clangrefactoringArgument="-executable=$libexec_path/clangrefactoringbackend" fi #### macdeployqt if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then - qml2puppetapp="$resource_path/qmldesigner/qml2puppet" + qml2puppetapp="$libexec_path/qmldesigner/qml2puppet" if [ -f "$qml2puppetapp" ]; then qml2puppetArgument="-executable=$qml2puppetapp" fi qbsapp="$app_path/Contents/MacOS/qbs" - - echo "- Running macdeployqt ($bin_src/macdeployqt)" - - "$bin_src/macdeployqt" "$app_path" \ - "-executable=$app_path/Contents/MacOS/qtdiag" \ - "-executable=$resource_path/qtpromaker" \ - "-executable=$resource_path/sdktool" \ - "-executable=$resource_path/ios/iostool" \ - "-executable=$resource_path/buildoutputparser" \ - "-executable=$resource_path/cpaster" \ - "-executable=$resource_path/qbs_processlauncher" \ - "-executable=$qbsapp" \ + if [ -f "$qbsapp" ]; then + qbsArguments=("-executable=$qbsapp" \ "-executable=$qbsapp-config" \ "-executable=$qbsapp-config-ui" \ "-executable=$qbsapp-qmltypes" \ @@ -171,6 +170,19 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then "-executable=$qbsapp-setup-qt" \ "-executable=$qbsapp-setup-toolchains" \ "-executable=$qbsapp-create-project" \ + "-executable=$libexec_path/qbs_processlauncher") + fi + + echo "- Running macdeployqt ($bin_src/macdeployqt)" + + "$bin_src/macdeployqt" "$app_path" \ + "-executable=$app_path/Contents/MacOS/qtdiag" \ + "-executable=$libexec_path/qtpromaker" \ + "-executable=$libexec_path/sdktool" \ + "-executable=$libexec_path/ios/iostool" \ + "-executable=$libexec_path/buildoutputparser" \ + "-executable=$libexec_path/cpaster" \ + "${qbsArguments[@]}" \ "$qml2puppetArgument" \ "$clangbackendArgument" "$clangpchmanagerArgument" "$clangrefactoringArgument" || exit 1 diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/Arrow.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/Arrow.qml index 0176a55dfaf..67ae4c7b295 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/Arrow.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/Arrow.qml @@ -27,104 +27,29 @@ import QtQuick 2.0 import QtQuick3D 1.0 import MouseArea3D 1.0 -Model { +DirectionalDraggable { id: arrow - rotationOrder: Node.XYZr source: "meshes/arrow.mesh" - property View3D view3D - property alias color: material.emissiveColor - property Node targetNode: null - property bool dragging: false - - readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering - - property var _pointerPosPressed - property var _targetStartPos - signal positionCommit() signal positionMove() - materials: DefaultMaterial { - id: material - emissiveColor: "white" - lighting: DefaultMaterial.NoLighting - } - - function handlePressed(mouseArea, pointerPosition) + function localPos(sceneRelativeDistance) { - if (!targetNode) - return; - - var maskedPosition = Qt.vector3d(pointerPosition.x, 0, 0); - _pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition); - var sp = targetNode.scenePosition; - _targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z); - dragging = true; - } - - function posInParent(mouseArea, pointerPosition) - { - var maskedPosition = Qt.vector3d(pointerPosition.x, 0, 0); - var scenePointerPos = mouseArea.mapPositionToScene(maskedPosition); - var sceneRelativeDistance = Qt.vector3d( - scenePointerPos.x - _pointerPosPressed.x, - scenePointerPos.y - _pointerPosPressed.y, - scenePointerPos.z - _pointerPosPressed.z); - var newScenePos = Qt.vector3d( _targetStartPos.x + sceneRelativeDistance.x, _targetStartPos.y + sceneRelativeDistance.y, _targetStartPos.z + sceneRelativeDistance.z); - return targetNode.parent.mapPositionFromScene(newScenePos); } - function handleDragged(mouseArea, pointerPosition) - { - if (!targetNode) - return; - - targetNode.position = posInParent(mouseArea, pointerPosition); - arrow.positionMove(); - } - - function handleReleased(mouseArea, pointerPosition) - { - if (!targetNode) - return; - - targetNode.position = posInParent(mouseArea, pointerPosition); - dragging = false; - arrow.positionCommit(); + onDragged: { + targetNode.position = localPos(sceneRelativeDistance); + positionMove(); } - MouseArea3D { - id: mouseAreaYZ - view3D: arrow.view3D - x: 0 - y: -1.5 - width: 12 - height: 3 - rotation: Qt.vector3d(0, 0, 90) - grabsMouse: targetNode - onPressed: arrow.handlePressed(mouseAreaYZ, pointerPosition) - onDragged: arrow.handleDragged(mouseAreaYZ, pointerPosition) - onReleased: arrow.handleReleased(mouseAreaYZ, pointerPosition) - } - - MouseArea3D { - id: mouseAreaXZ - view3D: arrow.view3D - x: 0 - y: -1.5 - width: 12 - height: 3 - rotation: Qt.vector3d(0, 90, 90) - grabsMouse: targetNode - onPressed: arrow.handlePressed(mouseAreaXZ, pointerPosition) - onDragged: arrow.handleDragged(mouseAreaXZ, pointerPosition) - onReleased: arrow.handleReleased(mouseAreaXZ, pointerPosition) + onReleased: { + targetNode.position = localPos(sceneRelativeDistance); + positionCommit(); } } - diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml index 14e45951ae3..6a2a7b3a763 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml @@ -25,17 +25,27 @@ import QtQuick 2.0 import QtQuick3D 1.0 +import CameraGeometry 1.0 IconGizmo { id: cameraGizmo iconSource: "qrc:///qtquickplugin/mockfiles/images/camera-pick-icon.png" - gizmoModel.source: "#Cube" + gizmoModel.geometry: cameraGeometry + property alias geometryName: cameraGeometry.name // Name must be unique for each geometry + property alias viewPortRect: cameraGeometry.viewPortRect + + CameraGeometry { + id: cameraGeometry + camera: cameraGizmo.targetNode + } + gizmoModel.materials: [ DefaultMaterial { id: defaultMaterial emissiveColor: "blue" lighting: DefaultMaterial.NoLighting + cullingMode: Material.DisableCulling } ] } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml new file mode 100644 index 00000000000..243744210ee --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +Model { + id: rootModel + rotationOrder: Node.XYZr + + property View3D view3D + property alias color: material.emissiveColor + property Node targetNode: null + property bool dragging: false + property bool active: false + + readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering + + property var _pointerPosPressed + property var _targetStartPos + + signal pressed(var mouseArea) + signal dragged(var mouseArea, vector3d sceneRelativeDistance) + signal released(var mouseArea, vector3d sceneRelativeDistance) + + materials: DefaultMaterial { + id: material + emissiveColor: "white" + lighting: DefaultMaterial.NoLighting + } + + function handlePressed(mouseArea, scenePos) + { + if (!targetNode) + return; + + var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); + _pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition); + var sp = targetNode.scenePosition; + _targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z); + dragging = true; + pressed(mouseArea); + } + + function calcRelativeDistance(mouseArea, scenePos) + { + var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); + var scenePointerPos = mouseArea.mapPositionToScene(maskedPosition); + return Qt.vector3d(scenePointerPos.x - _pointerPosPressed.x, + scenePointerPos.y - _pointerPosPressed.y, + scenePointerPos.z - _pointerPosPressed.z); + } + + function handleDragged(mouseArea, scenePos) + { + if (!targetNode) + return; + + dragged(mouseArea, calcRelativeDistance(mouseArea, scenePos)); + } + + function handleReleased(mouseArea, scenePos) + { + if (!targetNode) + return; + + released(mouseArea, calcRelativeDistance(mouseArea, scenePos)); + dragging = false; + } + + MouseArea3D { + id: mouseAreaYZ + view3D: rootModel.view3D + x: 0 + y: -1.5 + width: 12 + height: 3 + rotation: Qt.vector3d(0, 0, 90) + grabsMouse: targetNode + active: rootModel.active + onPressed: rootModel.handlePressed(mouseAreaYZ, scenePos) + onDragged: rootModel.handleDragged(mouseAreaYZ, scenePos) + onReleased: rootModel.handleReleased(mouseAreaYZ, scenePos) + } + + MouseArea3D { + id: mouseAreaXZ + view3D: rootModel.view3D + x: 0 + y: -1.5 + width: 12 + height: 3 + rotation: Qt.vector3d(0, 90, 90) + grabsMouse: targetNode + active: rootModel.active + onPressed: rootModel.handlePressed(mouseAreaXZ, scenePos) + onDragged: rootModel.handleDragged(mouseAreaXZ, scenePos) + onReleased: rootModel.handleReleased(mouseAreaXZ, scenePos) + } +} + diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index e19e75acb8d..e82391f8bce 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -38,7 +38,7 @@ Window { title: "3D" flags: Qt.WindowStaysOnTopHint | Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint - property alias scene: editView.scene + property alias scene: editView.importScene property alias showEditLight: editLightCheckbox.checked property alias usePerspective: usePerspectiveCheckbox.checked @@ -46,10 +46,11 @@ Window { property var lightGizmos: [] property var cameraGizmos: [] + property rect viewPortRect: Qt.rect(0, 0, 1000, 1000) signal objectClicked(var object) - signal commitObjectPosition(var object) - signal moveObjectPosition(var object) + signal commitObjectProperty(var object, var propName) + signal changeObjectProperty(var object, var propName) function selectObject(object) { selectedNode = object; @@ -75,10 +76,14 @@ Window { { var component = Qt.createComponent("CameraGizmo.qml"); if (component.status === Component.Ready) { - var gizmo = component.createObject(overlayScene, - {"view3D": overlayView, "targetNode": obj}); + var geometryName = designStudioNativeCameraControlHelper.generateUniqueName("CameraGeometry"); + var gizmo = component.createObject( + overlayScene, + {"view3D": overlayView, "targetNode": obj, "geometryName": geometryName, + "viewPortRect": viewPortRect}); cameraGizmos[cameraGizmos.length] = gizmo; gizmo.selected.connect(emitObjectClicked); + gizmo.viewPortRect = Qt.binding(function() {return viewPortRect;}); } } @@ -113,11 +118,26 @@ Window { position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition : Qt.vector3d(0, 0, 0) globalOrientation: globalControl.checked - visible: selectedNode + visible: selectedNode && moveToolControl.checked view3D: overlayView - onPositionCommit: viewWindow.commitObjectPosition(selectedNode) - onPositionMove: viewWindow.moveObjectPosition(selectedNode) + onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position") + onPositionMove: viewWindow.changeObjectProperty(selectedNode, "position") + } + + ScaleGizmo { + id: scaleGizmo + scale: autoScale.getScale(Qt.vector3d(5, 5, 5)) + highlightOnHover: true + targetNode: viewWindow.selectedNode + position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition + : Qt.vector3d(0, 0, 0) + globalOrientation: globalControl.checked + visible: selectedNode && scaleToolControl.checked + view3D: overlayView + + onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale") + onScaleChange: viewWindow.changeObjectProperty(selectedNode, "scale") } AutoScaleHelper { @@ -156,10 +176,12 @@ Window { } PointLight { - id: pointLight + id: editLight visible: showEditLight position: usePerspective ? editPerspectiveCamera.position : editOrthoCamera.position + quadraticFade: 0 + linearFade: 0 } PerspectiveCamera { @@ -181,16 +203,16 @@ Window { id: overlayView anchors.fill: parent camera: usePerspective ? overlayPerspectiveCamera : overlayOrthoCamera - scene: overlayScene + importScene: overlayScene } Overlay2D { id: gizmoLabel - targetNode: moveGizmo + targetNode: moveGizmo.visible ? moveGizmo : scaleGizmo targetView: overlayView offsetX: 0 offsetY: 45 - visible: moveGizmo.dragging + visible: targetNode.dragging Rectangle { color: "white" @@ -203,11 +225,18 @@ Window { id: gizmoLabelText text: { var l = Qt.locale(); - selectedNode - ? qsTr("x:") + Number(selectedNode.position.x).toLocaleString(l, 'f', 1) - + qsTr(" y:") + Number(selectedNode.position.y).toLocaleString(l, 'f', 1) - + qsTr(" z:") + Number(selectedNode.position.z).toLocaleString(l, 'f', 1) - : ""; + var targetProperty; + if (viewWindow.selectedNode) { + if (gizmoLabel.targetNode === moveGizmo) + targetProperty = viewWindow.selectedNode.position; + else + targetProperty = viewWindow.selectedNode.scale; + return qsTr("x:") + Number(targetProperty.x).toLocaleString(l, 'f', 1) + + qsTr(" y:") + Number(targetProperty.y).toLocaleString(l, 'f', 1) + + qsTr(" z:") + Number(targetProperty.z).toLocaleString(l, 'f', 1); + } else { + return ""; + } } anchors.centerIn: parent } @@ -252,6 +281,19 @@ Window { text: qsTr("Use Global Orientation") onCheckedChanged: cameraControl.forceActiveFocus() } + Column { + x: 8 + RadioButton { + id: moveToolControl + checked: true + text: qsTr("Move Tool") + } + RadioButton { + id: scaleToolControl + checked: false + text: qsTr("Scale Tool") + } + } } Text { diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml index 56bec4ae0c9..6fbf17367e0 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml @@ -45,7 +45,6 @@ Node { Model { id: gizmoModel - scale: Qt.vector3d(0.05, 0.05, 0.05) visible: iconGizmo.visible } Overlay2D { diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml index d3a5932b392..888b2fce5cd 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml @@ -31,6 +31,7 @@ IconGizmo { iconSource: "qrc:///qtquickplugin/mockfiles/images/light-pick-icon.png" gizmoModel.source: "#Sphere" + gizmoModel.scale: Qt.vector3d(0.10, 0.10, 0.10) gizmoModel.materials: [ DefaultMaterial { id: defaultMaterial diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml index 7ad5a2a0113..b8e6cdafb94 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml @@ -35,7 +35,8 @@ Node { property Node targetNode: null property bool globalOrientation: true readonly property bool dragging: arrowX.dragging || arrowY.dragging || arrowZ.dragging - || centerMouseArea.dragging + || planeX.dragging || planeY.dragging || planeZ.dragging + || centerBall.dragging signal positionCommit() signal positionMove() @@ -45,12 +46,12 @@ Node { Arrow { id: arrowX - objectName: "Arrow X" rotation: Qt.vector3d(0, 0, -90) targetNode: moveGizmo.targetNode color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1)) - : Qt.rgba(1, 0, 0, 1) + : Qt.rgba(1, 0, 0, 1) view3D: moveGizmo.view3D + active: moveGizmo.visible onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -58,12 +59,12 @@ Node { Arrow { id: arrowY - objectName: "Arrow Y" rotation: Qt.vector3d(0, 0, 0) targetNode: moveGizmo.targetNode - color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) - : Qt.rgba(0, 0, 1, 1) + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1)) + : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D + active: moveGizmo.visible onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -71,85 +72,83 @@ Node { Arrow { id: arrowZ - objectName: "Arrow Z" + rotation: Qt.vector3d(90, 0, 0) + targetNode: moveGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) + : Qt.rgba(0, 0, 1, 1) + view3D: moveGizmo.view3D + active: moveGizmo.visible + + onPositionCommit: moveGizmo.positionCommit() + onPositionMove: moveGizmo.positionMove() + } + + PlanarMoveHandle { + id: planeX + + y: 10 + z: 10 + + rotation: Qt.vector3d(0, 90, 0) + targetNode: moveGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1)) + : Qt.rgba(1, 0, 0, 1) + view3D: moveGizmo.view3D + active: moveGizmo.visible + + onPositionCommit: moveGizmo.positionCommit() + onPositionMove: moveGizmo.positionMove() + } + + PlanarMoveHandle { + id: planeY + + x: 10 + z: 10 + rotation: Qt.vector3d(90, 0, 0) targetNode: moveGizmo.targetNode color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1)) - : Qt.rgba(0, 0.6, 0, 1) + : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D + active: moveGizmo.visible onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() } + PlanarMoveHandle { + id: planeZ + + x: 10 + y: 10 + + rotation: Qt.vector3d(0, 0, 0) + targetNode: moveGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) + : Qt.rgba(0, 0, 1, 1) + view3D: moveGizmo.view3D + active: moveGizmo.visible + + onPositionCommit: moveGizmo.positionCommit() + onPositionMove: moveGizmo.positionMove() + } } - Model { + PlanarMoveHandle { id: centerBall source: "#Sphere" - scale: Qt.vector3d(0.024, 0.024, 0.024) - materials: DefaultMaterial { - id: material - emissiveColor: highlightOnHover - && (centerMouseArea.hovering || centerMouseArea.dragging) - ? Qt.lighter(Qt.rgba(0.5, 0.5, 0.5, 1)) - : Qt.rgba(0.5, 0.5, 0.5, 1) - lighting: DefaultMaterial.NoLighting - } + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0.5, 0.5, 0.5, 1)) + : Qt.rgba(0.5, 0.5, 0.5, 1) + rotation: view3D.camera.rotation + priority: 1 + targetNode: moveGizmo.targetNode - MouseArea3D { - id: centerMouseArea - view3D: moveGizmo.view3D - x: -60 - y: -60 - width: 120 - height: 120 - rotation: view3D.camera.rotation - grabsMouse: moveGizmo.targetNode - priority: 1 - - property var _pointerPosPressed - property var _targetStartPos - - function posInParent(pointerPosition) - { - var scenePointerPos = mapPositionToScene(pointerPosition); - var sceneRelativeDistance = Qt.vector3d( - scenePointerPos.x - _pointerPosPressed.x, - scenePointerPos.y - _pointerPosPressed.y, - scenePointerPos.z - _pointerPosPressed.z); - - var newScenePos = Qt.vector3d( - _targetStartPos.x + sceneRelativeDistance.x, - _targetStartPos.y + sceneRelativeDistance.y, - _targetStartPos.z + sceneRelativeDistance.z); - - return moveGizmo.targetNode.parent.mapPositionFromScene(newScenePos); - } - - onPressed: { - if (!moveGizmo.targetNode) - return; - - _pointerPosPressed = mapPositionToScene(pointerPosition); - var sp = moveGizmo.targetNode.scenePosition; - _targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z); - } - onDragged: { - if (!moveGizmo.targetNode) - return; - - moveGizmo.targetNode.position = posInParent(pointerPosition); - moveGizmo.positionMove(); - } - onReleased: { - if (!moveGizmo.targetNode) - return; - - moveGizmo.targetNode.position = posInParent(pointerPosition); - moveGizmo.positionCommit(); - } - } + view3D: moveGizmo.view3D + active: moveGizmo.visible + + onPositionCommit: moveGizmo.positionCommit() + onPositionMove: moveGizmo.positionMove() } } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml new file mode 100644 index 00000000000..7bb1085e65c --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +Model { + id: rootModel + + property View3D view3D + property alias color: gizmoMaterial.emissiveColor + property alias priority: mouseArea.priority + property Node targetNode: null + property bool dragging: false + property bool active: false + + readonly property bool hovering: mouseArea.hovering + + property var _pointerPosPressed + property var _targetStartPos + + signal pressed(var mouseArea) + signal dragged(var mouseArea, vector3d sceneRelativeDistance) + signal released(var mouseArea, vector3d sceneRelativeDistance) + + rotationOrder: Node.XYZr + source: "#Rectangle" + + DefaultMaterial { + id: gizmoMaterial + emissiveColor: "white" + lighting: DefaultMaterial.NoLighting + cullingMode: Material.DisableCulling + } + materials: gizmoMaterial + + function handlePressed(mouseArea, scenePos) + { + if (!targetNode) + return; + + _pointerPosPressed = mouseArea.mapPositionToScene(scenePos); + var sp = targetNode.scenePosition; + _targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z); + dragging = true; + pressed(mouseArea); + } + + function calcRelativeDistance(mouseArea, scenePos) + { + var scenePointerPos = mouseArea.mapPositionToScene(scenePos); + return Qt.vector3d(scenePointerPos.x - _pointerPosPressed.x, + scenePointerPos.y - _pointerPosPressed.y, + scenePointerPos.z - _pointerPosPressed.z); + } + + function handleDragged(mouseArea, scenePos) + { + if (!targetNode) + return; + + dragged(mouseArea, calcRelativeDistance(mouseArea, scenePos)); + } + + function handleReleased(mouseArea, scenePos) + { + if (!targetNode) + return; + + released(mouseArea, calcRelativeDistance(mouseArea, scenePos)); + dragging = false; + } + + MouseArea3D { + id: mouseArea + view3D: rootModel.view3D + x: -60 + y: -60 + width: 120 + height: 120 + grabsMouse: targetNode + active: rootModel.active + onPressed: rootModel.handlePressed(mouseArea, scenePos) + onDragged: rootModel.handleDragged(mouseArea, scenePos) + onReleased: rootModel.handleReleased(mouseArea, scenePos) + } +} + diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarMoveHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarMoveHandle.qml new file mode 100644 index 00000000000..f79ae6e248e --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarMoveHandle.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +PlanarDraggable { + id: planarHandle + scale: Qt.vector3d(0.024, 0.024, 0.024) + + signal positionCommit() + signal positionMove() + + function localPos(sceneRelativeDistance) + { + var newScenePos = Qt.vector3d( + _targetStartPos.x + sceneRelativeDistance.x, + _targetStartPos.y + sceneRelativeDistance.y, + _targetStartPos.z + sceneRelativeDistance.z); + return targetNode.parent.mapPositionFromScene(newScenePos); + } + + onDragged: { + targetNode.position = localPos(sceneRelativeDistance); + positionMove(); + } + + onReleased: { + targetNode.position = localPos(sceneRelativeDistance); + positionCommit(); + } +} diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml new file mode 100644 index 00000000000..dfdfb7c1969 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +PlanarDraggable { + id: planarHandle + scale: Qt.vector3d(0.024, 0.024, 0.024) + + property bool globalOrientation: false + + signal scaleCommit() + signal scaleChange() + + property var _startScale + + onPressed: { + // Recreate vector so we don't follow the changes in targetNode.sceneScale + _startScale = Qt.vector3d(targetNode.sceneScale.x, + targetNode.sceneScale.y, + targetNode.sceneScale.z); + } + + onDragged: { + targetNode.scale = mouseArea.getNewScale(targetNode, _startScale, + _pointerPosPressed, sceneRelativeDistance, + globalOrientation); + scaleChange(); + } + + onReleased: { + targetNode.scale = mouseArea.getNewScale(targetNode, _startScale, + _pointerPosPressed, sceneRelativeDistance, + globalOrientation); + scaleCommit(); + } +} diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml new file mode 100644 index 00000000000..8a55812e71a --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml @@ -0,0 +1,214 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +Node { + id: scaleGizmo + + property View3D view3D + property bool highlightOnHover: false + property Node targetNode: null + property bool globalOrientation: true + readonly property bool dragging: scaleRodX.dragging || scaleRodY.dragging || scaleRodZ.dragging + || planeX.dragging || planeY.dragging || planeZ.dragging + || centerMouseArea.dragging + + signal scaleCommit() + signal scaleChange() + + Node { + rotation: globalOrientation || !targetNode ? Qt.vector3d(0, 0, 0) : targetNode.sceneRotation + + ScaleRod { + id: scaleRodX + rotation: Qt.vector3d(0, 0, -90) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1)) + : Qt.rgba(1, 0, 0, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + + ScaleRod { + id: scaleRodY + rotation: Qt.vector3d(0, 0, 0) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1)) + : Qt.rgba(0, 0.6, 0, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + + ScaleRod { + id: scaleRodZ + rotation: Qt.vector3d(90, 0, 0) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) + : Qt.rgba(0, 0, 1, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + + PlanarScaleHandle { + id: planeX + + y: 10 + z: 10 + + rotation: Qt.vector3d(0, 90, 0) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1)) + : Qt.rgba(1, 0, 0, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + + PlanarScaleHandle { + id: planeY + + x: 10 + z: 10 + + rotation: Qt.vector3d(90, 0, 0) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1)) + : Qt.rgba(0, 0.6, 0, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + + PlanarScaleHandle { + id: planeZ + + x: 10 + y: 10 + + rotation: Qt.vector3d(0, 0, 0) + targetNode: scaleGizmo.targetNode + color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) + : Qt.rgba(0, 0, 1, 1) + view3D: scaleGizmo.view3D + active: scaleGizmo.visible + globalOrientation: scaleGizmo.globalOrientation + + onScaleCommit: scaleGizmo.scaleCommit() + onScaleChange: scaleGizmo.scaleChange() + } + } + + Model { + id: centerCube + + source: "#Cube" + scale: Qt.vector3d(0.024, 0.024, 0.024) + materials: DefaultMaterial { + id: material + emissiveColor: highlightOnHover + && (centerMouseArea.hovering || centerMouseArea.dragging) + ? Qt.lighter(Qt.rgba(0.5, 0.5, 0.5, 1)) + : Qt.rgba(0.5, 0.5, 0.5, 1) + lighting: DefaultMaterial.NoLighting + } + + MouseArea3D { + id: centerMouseArea + view3D: scaleGizmo.view3D + x: -60 + y: -60 + width: 120 + height: 120 + rotation: view3D.camera.rotation + grabsMouse: scaleGizmo.targetNode + priority: 1 + active: scaleGizmo.visible + + property var _startScale + property var _startScreenPos + + function localScale(screenPos) + { + var yDelta = screenPos.y - _startScreenPos.y; + if (yDelta === 0) + return; + var scaler = 1.0 + (yDelta * 0.025); + if (scaler === 0) + scaler = 0.0001; + if (scaler < 0) + scaler = -scaler; + return Qt.vector3d(scaler * _startScale.x, + scaler * _startScale.y, + scaler * _startScale.z); + } + + onPressed: { + if (!scaleGizmo.targetNode) + return; + + // Recreate vector so we don't follow the changes in targetNode.scale + _startScale = Qt.vector3d(scaleGizmo.targetNode.scale.x, + scaleGizmo.targetNode.scale.y, + scaleGizmo.targetNode.scale.z); + _startScreenPos = screenPos; + } + onDragged: { + if (!scaleGizmo.targetNode) + return; + + scaleGizmo.targetNode.scale = localScale(screenPos); + scaleGizmo.scaleChange(); + } + onReleased: { + if (!scaleGizmo.targetNode) + return; + + scaleGizmo.targetNode.scale = localScale(screenPos); + scaleGizmo.scaleCommit(); + } + } + } +} diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml new file mode 100644 index 00000000000..85fc39f900e --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick3D 1.0 +import MouseArea3D 1.0 + +DirectionalDraggable { + id: scaleRod + source: "meshes/scalerod.mesh" + + property bool globalOrientation: false + + signal scaleCommit() + signal scaleChange() + + property var _startScale + + Model { + source: "#Cube" + y: 10 + scale: Qt.vector3d(0.020, 0.020, 0.020) + materials: DefaultMaterial { + id: material + emissiveColor: scaleRod.color + lighting: DefaultMaterial.NoLighting + } + } + + onPressed: { + // Recreate vector so we don't follow the changes in targetNode.sceneScale + _startScale = Qt.vector3d(targetNode.sceneScale.x, + targetNode.sceneScale.y, + targetNode.sceneScale.z); + } + + onDragged: { + targetNode.scale = mouseArea.getNewScale(targetNode, _startScale, + _pointerPosPressed, sceneRelativeDistance, + globalOrientation); + scaleChange(); + } + + onReleased: { + targetNode.scale = mouseArea.getNewScale(targetNode, _startScale, + _pointerPosPressed, sceneRelativeDistance, + globalOrientation); + scaleCommit(); + } +} diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/meshes/scalerod.mesh b/share/qtcreator/qml/qmlpuppet/mockfiles/meshes/scalerod.mesh Binary files differnew file mode 100644 index 00000000000..b3c1bd883f9 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/meshes/scalerod.mesh diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.cpp index d681e106988..1091e45911b 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.cpp @@ -24,6 +24,8 @@ ****************************************************************************/ #include "cameracontrolhelper.h" +#include <QHash> + namespace QmlDesigner { namespace Internal { @@ -65,5 +67,12 @@ void CameraControlHelper::requestOverlayUpdate() m_overlayUpdateTimer.start(); } +QString CameraControlHelper::generateUniqueName(const QString &nameRoot) +{ + static QHash<QString, int> counters; + int count = counters[nameRoot]++; + return QStringLiteral("%1_%2").arg(nameRoot).arg(count); +} + } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.h index be00596ce8d..ae171960441 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/cameracontrolhelper.h @@ -42,6 +42,7 @@ public: void setEnabled(bool enabled); Q_INVOKABLE void requestOverlayUpdate(); + Q_INVOKABLE QString generateUniqueName(const QString &nameRoot); public slots: void handleUpdateTimer(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp new file mode 100644 index 00000000000..605a3dd08f6 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp @@ -0,0 +1,211 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#ifdef QUICK3D_MODULE + +#include "camerageometry.h" + +#include <QtQuick3DRuntimeRender/private/qssgrendergeometry_p.h> +#include <QtQuick3DRuntimeRender/private/qssgrendercamera_p.h> +#include <QtQuick3D/private/qquick3dcustomcamera_p.h> +#include <QtQuick3D/private/qquick3dfrustumcamera_p.h> +#include <QtQuick3D/private/qquick3dorthographiccamera_p.h> +#include <QtQuick3D/private/qquick3dperspectivecamera_p.h> + +#include <limits> + +namespace QmlDesigner { +namespace Internal { + +CameraGeometry::CameraGeometry() + : QQuick3DGeometry() +{ +} + +CameraGeometry::~CameraGeometry() +{ +} + +QQuick3DCamera *CameraGeometry::camera() const +{ + return m_camera; +} + +QRectF CameraGeometry::viewPortRect() const +{ + return m_viewPortRect; +} + +void CameraGeometry::setCamera(QQuick3DCamera *camera) +{ + if (m_camera == camera) + return; + + if (m_camera) + m_camera->disconnect(this); + m_camera = camera; + if (auto perspectiveCamera = qobject_cast<QQuick3DPerspectiveCamera *>(m_camera)) { + QObject::connect(perspectiveCamera, &QQuick3DPerspectiveCamera::clipNearChanged, + this, &CameraGeometry::update); + QObject::connect(perspectiveCamera, &QQuick3DPerspectiveCamera::clipFarChanged, + this, &CameraGeometry::update); + QObject::connect(perspectiveCamera, &QQuick3DPerspectiveCamera::fieldOfViewChanged, + this, &CameraGeometry::update); + QObject::connect(perspectiveCamera, &QQuick3DPerspectiveCamera::fieldOfViewOrientationChanged, + this, &CameraGeometry::update); + if (auto frustumCamera = qobject_cast<QQuick3DFrustumCamera *>(m_camera)) { + QObject::connect(frustumCamera, &QQuick3DFrustumCamera::topChanged, + this, &CameraGeometry::update); + QObject::connect(frustumCamera, &QQuick3DFrustumCamera::bottomChanged, + this, &CameraGeometry::update); + QObject::connect(frustumCamera, &QQuick3DFrustumCamera::rightChanged, + this, &CameraGeometry::update); + QObject::connect(frustumCamera, &QQuick3DFrustumCamera::leftChanged, + this, &CameraGeometry::update); + } + } else if (auto orthoCamera = qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) { + QObject::connect(orthoCamera, &QQuick3DOrthographicCamera::clipNearChanged, + this, &CameraGeometry::update); + QObject::connect(orthoCamera, &QQuick3DOrthographicCamera::clipFarChanged, + this, &CameraGeometry::update); + } else if (auto customCamera = qobject_cast<QQuick3DCustomCamera *>(m_camera)) { + QObject::connect(customCamera, &QQuick3DCustomCamera::projectionChanged, + this, &CameraGeometry::update); + } + emit cameraChanged(); + update(); +} + +void CameraGeometry::setViewPortRect(const QRectF &rect) +{ + if (m_viewPortRect == rect) + return; + + m_viewPortRect = rect; + emit viewPortRectChanged(); + update(); +} + +QSSGRenderGraphObject *CameraGeometry::updateSpatialNode(QSSGRenderGraphObject *node) +{ + if (!m_camera) + return node; + + node = QQuick3DGeometry::updateSpatialNode(node); + QSSGRenderGeometry *geometry = static_cast<QSSGRenderGeometry *>(node); + + geometry->clear(); + + QByteArray vertexData; + QByteArray indexData; + QVector3D minBounds; + QVector3D maxBounds; + fillVertexData(vertexData, indexData, minBounds, maxBounds); + + geometry->addAttribute(QSSGRenderGeometry::Attribute::PositionSemantic, 0, + QSSGRenderGeometry::Attribute::ComponentType::F32Type); + geometry->addAttribute(QSSGRenderGeometry::Attribute::IndexSemantic, 0, + QSSGRenderGeometry::Attribute::ComponentType::U16Type); + geometry->setStride(12); + geometry->setVertexData(vertexData); + geometry->setIndexData(indexData); + geometry->setPrimitiveType(QSSGRenderGeometry::Lines); + geometry->setBounds(minBounds, maxBounds); + + return node; +} + +void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexData, + QVector3D &minBounds, QVector3D &maxBounds) +{ + const int vertexSize = int(sizeof(float)) * 8 * 3; // 8 vertices, 3 floats/vert + vertexData.resize(vertexSize); + const int indexSize = int(sizeof(quint16)) * 12 * 2; // 16 lines, 2 vert/line + indexData.resize(indexSize); + + auto dataPtr = reinterpret_cast<float *>(vertexData.data()); + auto indexPtr = reinterpret_cast<quint16 *>(indexData.data()); + + QSSGRenderCamera *camera = m_camera->cameraNode(); + if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) { + // For some reason ortho cameras show double what projection suggests, + // so give them doubled viewport to match visualization to actual camera view + camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0, + m_viewPortRect.height() * 2.0)); + } else { + camera->calculateProjection(m_viewPortRect); + } + const QMatrix4x4 m = camera->projection.inverted(); + + const QVector3D farTopLeft = m * QVector3D(1.f, -1.f, 1.f); + const QVector3D farBottomRight = m * QVector3D(-1.f, 1.f, 1.f); + const QVector3D nearTopLeft = m * QVector3D(1.f, -1.f, -1.f); + const QVector3D nearBottomRight = m * QVector3D(-1.f, 1.f, -1.f); + + *dataPtr++ = nearTopLeft.x(); *dataPtr++ = nearBottomRight.y(); *dataPtr++ = nearTopLeft.z(); + *dataPtr++ = nearTopLeft.x(); *dataPtr++ = nearTopLeft.y(); *dataPtr++ = nearTopLeft.z(); + *dataPtr++ = nearBottomRight.x(); *dataPtr++ = nearTopLeft.y(); *dataPtr++ = nearTopLeft.z(); + *dataPtr++ = nearBottomRight.x(); *dataPtr++ = nearBottomRight.y(); *dataPtr++ = nearTopLeft.z(); + *dataPtr++ = farTopLeft.x(); *dataPtr++ = farBottomRight.y(); *dataPtr++ = farTopLeft.z(); + *dataPtr++ = farTopLeft.x(); *dataPtr++ = farTopLeft.y(); *dataPtr++ = farTopLeft.z(); + *dataPtr++ = farBottomRight.x(); *dataPtr++ = farTopLeft.y(); *dataPtr++ = farTopLeft.z(); + *dataPtr++ = farBottomRight.x(); *dataPtr++ = farBottomRight.y(); *dataPtr++ = farTopLeft.z(); + + // near rect + *indexPtr++ = 0; *indexPtr++ = 1; + *indexPtr++ = 1; *indexPtr++ = 2; + *indexPtr++ = 2; *indexPtr++ = 3; + *indexPtr++ = 3; *indexPtr++ = 0; + // near to far + *indexPtr++ = 0; *indexPtr++ = 4; + *indexPtr++ = 1; *indexPtr++ = 5; + *indexPtr++ = 2; *indexPtr++ = 6; + *indexPtr++ = 3; *indexPtr++ = 7; + // far rect + *indexPtr++ = 4; *indexPtr++ = 5; + *indexPtr++ = 5; *indexPtr++ = 6; + *indexPtr++ = 6; *indexPtr++ = 7; + *indexPtr++ = 7; *indexPtr++ = 4; + + static const float floatMin = std::numeric_limits<float>::lowest(); + static const float floatMax = std::numeric_limits<float>::max(); + auto vertexPtr = reinterpret_cast<QVector3D *>(vertexData.data()); + minBounds = QVector3D(floatMax, floatMax, floatMax); + maxBounds = QVector3D(floatMin, floatMin, floatMin); + for (int i = 0; i < vertexSize / 12; ++i) { + minBounds[0] = qMin((*vertexPtr)[0], minBounds[0]); + minBounds[1] = qMin((*vertexPtr)[1], minBounds[1]); + minBounds[2] = qMin((*vertexPtr)[2], minBounds[2]); + maxBounds[0] = qMax((*vertexPtr)[0], maxBounds[0]); + maxBounds[1] = qMax((*vertexPtr)[1], maxBounds[1]); + maxBounds[2] = qMax((*vertexPtr)[2], maxBounds[2]); + ++vertexPtr; + } +} + +} +} + +#endif // QUICK3D_MODULE diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h new file mode 100644 index 00000000000..9c0f5e1e3c4 --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#ifdef QUICK3D_MODULE + +#include <QtQuick3D/private/qquick3dgeometry_p.h> +#include <QtQuick3D/private/qquick3dcamera_p.h> + +namespace QmlDesigner { +namespace Internal { + +class CameraGeometry : public QQuick3DGeometry +{ + Q_OBJECT + Q_PROPERTY(QQuick3DCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged) + Q_PROPERTY(QRectF viewPortRect READ viewPortRect WRITE setViewPortRect NOTIFY viewPortRectChanged) + +public: + CameraGeometry(); + ~CameraGeometry() override; + + QQuick3DCamera *camera() const; + QRectF viewPortRect() const; + +public Q_SLOTS: + void setCamera(QQuick3DCamera *camera); + void setViewPortRect(const QRectF &rect); + +Q_SIGNALS: + void cameraChanged(); + void viewPortRectChanged(); + +protected: + QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override; + +private: + void fillVertexData(QByteArray &vertexData, QByteArray &indexData, + QVector3D &minBounds, QVector3D &maxBounds); + QQuick3DCamera *m_camera = nullptr; + QRectF m_viewPortRect; +}; + +} +} + +QML_DECLARE_TYPE(QmlDesigner::Internal::CameraGeometry) + +#endif // QUICK3D_MODULE diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri index a052b7285c9..4e39a4cba9a 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri @@ -1,5 +1,7 @@ HEADERS += $$PWD/cameracontrolhelper.h \ - $$PWD/mousearea3d.h + $$PWD/mousearea3d.h \ + $$PWD/camerageometry.h SOURCES += $$PWD/cameracontrolhelper.cpp \ - $$PWD/mousearea3d.cpp + $$PWD/mousearea3d.cpp \ + $$PWD/camerageometry.cpp diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp index 4c1fdcc78e6..d4135de9732 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp @@ -60,6 +60,11 @@ bool MouseArea3D::grabsMouse() const return m_grabsMouse; } +bool MouseArea3D::active() const +{ + return m_active; +} + qreal MouseArea3D::x() const { return m_x; @@ -103,6 +108,15 @@ void MouseArea3D::setGrabsMouse(bool grabsMouse) emit grabsMouseChanged(grabsMouse); } +void MouseArea3D::setActive(bool active) +{ + if (m_active == active) + return; + + m_active = active; + emit activeChanged(active); +} + void MouseArea3D::setX(qreal x) { if (qFuzzyCompare(m_x, x)) @@ -190,6 +204,80 @@ QVector3D MouseArea3D::rayIntersectsPlane(const QVector3D &rayPos0, return rayPos0 + distanceFromRayPos0ToPlane * rayDirection; } +// Get a new scale based on a relative scene distance along a drag axis. +// This function never returns a negative scaling. +// Note that scaling a rotated object in global coordinate space can't be meaningfully done without +// distorting the object beyond what current scale property can represent, so global scaling is +// effectively same as local scaling. +QVector3D MouseArea3D::getNewScale(QQuick3DNode *node, const QVector3D &startScale, + const QVector3D &pressPos, + const QVector3D &sceneRelativeDistance, bool global) +{ + if (node) { + // Note: This only returns correct scale when scale is positive + auto getScale = [&](const QMatrix4x4 &m) -> QVector3D { + return QVector3D(m.column(0).length(), m.column(1).length(), m.column(2).length()); + }; + const float nonZeroValue = 0.0001f; + + const QVector3D scenePos = node->scenePosition(); + const QMatrix4x4 parentTransform = node->parentNode()->sceneTransform(); + QMatrix4x4 newTransform = node->sceneTransform(); + const QVector3D nodeToPressPos = pressPos - scenePos; + const QVector3D nodeToRelPos = nodeToPressPos + sceneRelativeDistance; + const float sceneToPressLen = nodeToPressPos.length(); + QVector3D scaleDirVector = nodeToRelPos; + float magnitude = (scaleDirVector.length() / sceneToPressLen); + scaleDirVector.normalize(); + + // Reset everything but rotation to ensure translation and scale don't affect rotation below + newTransform(0, 3) = 0; + newTransform(1, 3) = 0; + newTransform(2, 3) = 0; + QVector3D curScale = getScale(newTransform); + if (qFuzzyIsNull(curScale.x())) + curScale.setX(nonZeroValue); + if (qFuzzyIsNull(curScale.y())) + curScale.setY(nonZeroValue); + if (qFuzzyIsNull(curScale.z())) + curScale.setZ(nonZeroValue); + newTransform.scale({1.f / curScale.x(), 1.f / curScale.y(), 1.f / curScale.z()}); + + // Rotate the local scale vector so that scale axes are parallel to global axes for easier + // scale vector manipulation + if (!global) + scaleDirVector = newTransform.inverted().map(scaleDirVector).normalized(); + + // Ensure scaling is always positive/negative according to direction + scaleDirVector.setX(qAbs(scaleDirVector.x())); + scaleDirVector.setY(qAbs(scaleDirVector.y())); + scaleDirVector.setZ(qAbs(scaleDirVector.z())); + + // Make sure the longest scale vec axis is equal to 1 before applying magnitude to avoid + // initial jump in size when planar drag starts + float maxDir = qMax(qMax(scaleDirVector.x(), scaleDirVector.y()), scaleDirVector.z()); + QVector3D scaleVec = scaleDirVector / maxDir; + scaleVec *= magnitude; + + // Zero axes on scale vector indicate directions we don't want scaling to affect + if (qFuzzyIsNull(scaleVec.x())) + scaleVec.setX(1.f); + if (qFuzzyIsNull(scaleVec.y())) + scaleVec.setY(1.f); + if (qFuzzyIsNull(scaleVec.z())) + scaleVec.setZ(1.f); + scaleVec *= startScale; + + newTransform = parentTransform; + newTransform.scale(scaleVec); + + const QMatrix4x4 localTransform = parentTransform.inverted() * newTransform; + return getScale(localTransform); + } + + return startScale; +} + QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const { const QVector3D mousePos1(float(mousePosInView.x()), float(mousePosInView.y()), 0); @@ -207,8 +295,8 @@ QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const bool MouseArea3D::eventFilter(QObject *, QEvent *event) { - if (m_grabsMouse && s_mouseGrab && s_mouseGrab != this - && (m_priority <= s_mouseGrab->m_priority || s_mouseGrab->m_dragging)) { + if (!m_active || (m_grabsMouse && s_mouseGrab && s_mouseGrab != this + && (m_priority <= s_mouseGrab->m_priority || s_mouseGrab->m_dragging))) { return false; } @@ -227,7 +315,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) m_mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); if (mouseOnTopOfMouseArea(m_mousePosInPlane)) { setDragging(true); - emit pressed(m_mousePosInPlane); + emit pressed(m_mousePosInPlane, mouseEvent->globalPos()); if (m_grabsMouse) { if (s_mouseGrab && s_mouseGrab != this) { s_mouseGrab->setDragging(false); @@ -250,7 +338,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) if (qFuzzyCompare(mousePosInPlane.z(), -1)) mousePosInPlane = m_mousePosInPlane; setDragging(false); - emit released(mousePosInPlane); + emit released(mousePosInPlane, mouseEvent->globalPos()); if (m_grabsMouse) { if (s_mouseGrab && s_mouseGrab != this) { s_mouseGrab->setDragging(false); @@ -290,7 +378,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) if (m_dragging && !qFuzzyCompare(mousePosInPlane.z(), -1)) { m_mousePosInPlane = mousePosInPlane; - emit dragged(mousePosInPlane); + emit dragged(mousePosInPlane, mouseEvent->globalPos()); } break; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h index 99a34be353d..af465576829 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h @@ -49,6 +49,7 @@ class MouseArea3D : public QQuick3DNode Q_PROPERTY(bool hovering READ hovering NOTIFY hoveringChanged) Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged) Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged) + Q_PROPERTY(int active READ active WRITE setActive NOTIFY activeChanged) Q_INTERFACES(QQmlParserStatus) @@ -66,10 +67,12 @@ public: bool hovering() const; bool dragging() const; bool grabsMouse() const; + bool active() const; public slots: void setView3D(QQuick3DViewport *view3D); void setGrabsMouse(bool grabsMouse); + void setActive(bool active); void setX(qreal x); void setY(qreal y); @@ -82,6 +85,10 @@ public slots: const QVector3D &planePos, const QVector3D &planeNormal) const; + Q_INVOKABLE QVector3D getNewScale(QQuick3DNode *node, const QVector3D &startScale, + const QVector3D &pressPos, + const QVector3D &sceneRelativeDistance, bool global); + signals: void view3DChanged(); @@ -93,9 +100,10 @@ signals: void hoveringChanged(); void draggingChanged(); - void pressed(const QVector3D &pointerPosition); - void released(const QVector3D &pointerPosition); - void dragged(const QVector3D &pointerPosition); + void activeChanged(bool active); + void pressed(const QVector3D &scenePos, const QPoint &screenPos); + void released(const QVector3D &scenePos, const QPoint &screenPos); + void dragged(const QVector3D &scenePos, const QPoint &screenPos); void grabsMouseChanged(bool grabsMouse); protected: @@ -118,6 +126,7 @@ private: bool m_hovering = false; bool m_dragging = false; + bool m_active = false; QVector3D getMousePosInPlane(const QPointF &mousePosInView) const; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index d97cc2d5038..a0783eff577 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -61,6 +61,7 @@ #include "dummycontextobject.h" #include "../editor3d/cameracontrolhelper.h" #include "../editor3d/mousearea3d.h" +#include "../editor3d/camerageometry.h" #include <designersupportdelegate.h> @@ -85,6 +86,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) #ifdef QUICK3D_MODULE qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D"); + qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry"); #endif QQmlComponent component(engine, QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml")); @@ -97,12 +99,12 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) } QObject::connect(window, SIGNAL(objectClicked(QVariant)), this, SLOT(objectClicked(QVariant))); - QObject::connect(window, SIGNAL(commitObjectPosition(QVariant)), - this, SLOT(handleObjectPositionCommit(QVariant))); - QObject::connect(window, SIGNAL(moveObjectPosition(QVariant)), - this, SLOT(handleObjectPositionMove(QVariant))); - QObject::connect(&m_moveTimer, &QTimer::timeout, - this, &Qt5InformationNodeInstanceServer::handleObjectPositionMoveTimeout); + QObject::connect(window, SIGNAL(commitObjectProperty(QVariant, QVariant)), + this, SLOT(handleObjectPropertyCommit(QVariant, QVariant))); + QObject::connect(window, SIGNAL(changeObjectProperty(QVariant, QVariant)), + this, SLOT(handleObjectPropertyChange(QVariant, QVariant))); + QObject::connect(&m_propertyChangeTimer, &QTimer::timeout, + this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout); //For macOS we have to use the 4.1 core profile QSurfaceFormat surfaceFormat = window->requestedFormat(); @@ -188,28 +190,44 @@ void Qt5InformationNodeInstanceServer::modifyVariantValue( } } -void Qt5InformationNodeInstanceServer::handleObjectPositionCommit(const QVariant &object) +void Qt5InformationNodeInstanceServer::handleObjectPropertyCommit(const QVariant &object, + const QVariant &propName) { - modifyVariantValue(object, "position", ValuesModifiedCommand::TransactionOption::End); - m_movedNode = {}; - m_moveTimer.stop(); + modifyVariantValue(object, propName.toByteArray(), + ValuesModifiedCommand::TransactionOption::End); + m_changedNode = {}; + m_changedProperty = {}; + m_propertyChangeTimer.stop(); } -void Qt5InformationNodeInstanceServer::handleObjectPositionMove(const QVariant &object) +void Qt5InformationNodeInstanceServer::handleObjectPropertyChange(const QVariant &object, + const QVariant &propName) { - if (m_movedNode.isNull()) { - modifyVariantValue(object, "position", ValuesModifiedCommand::TransactionOption::Start); - } else { - if (!m_moveTimer.isActive()) - m_moveTimer.start(); + PropertyName propertyName(propName.toByteArray()); + if (m_changedProperty != propertyName || m_changedNode != object) { + if (!m_changedNode.isNull()) + handleObjectPropertyCommit(m_changedNode, m_changedProperty); + modifyVariantValue(object, propertyName, + ValuesModifiedCommand::TransactionOption::Start); + } else if (!m_propertyChangeTimer.isActive()) { + m_propertyChangeTimer.start(); } - m_movedNode = object; + m_changedNode = object; + m_changedProperty = propertyName; +} + +void Qt5InformationNodeInstanceServer::updateViewPortRect() +{ + QRectF viewPortrect(0, 0, m_viewPortInstance.internalObject()->property("width").toDouble(), + m_viewPortInstance.internalObject()->property("height").toDouble()); + QQmlProperty viewPortProperty(m_editView3D, "viewPortRect", context()); + viewPortProperty.write(viewPortrect); } Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5NodeInstanceServer(nodeInstanceClient) { - m_moveTimer.setInterval(100); + m_propertyChangeTimer.setInterval(100); } void Qt5InformationNodeInstanceServer::sendTokenBack() @@ -282,9 +300,10 @@ void Qt5InformationNodeInstanceServer::modifyProperties( nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties)); } -void Qt5InformationNodeInstanceServer::handleObjectPositionMoveTimeout() +void Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout() { - modifyVariantValue(m_movedNode, "position", ValuesModifiedCommand::TransactionOption::None); + modifyVariantValue(m_changedNode, m_changedProperty, + ValuesModifiedCommand::TransactionOption::None); } QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport( @@ -307,7 +326,6 @@ void Qt5InformationNodeInstanceServer::findCamerasAndLights( const QList<ServerNodeInstance> &instanceList, QObjectList &cameras, QObjectList &lights) const { - QObjectList objList; for (const ServerNodeInstance &instance : instanceList) { if (instance.isSubclassOf("QQuick3DCamera")) cameras << instance.internalObject(); @@ -316,6 +334,16 @@ void Qt5InformationNodeInstanceServer::findCamerasAndLights( } } +ServerNodeInstance Qt5InformationNodeInstanceServer::findViewPort( + const QList<ServerNodeInstance> &instanceList) +{ + for (const ServerNodeInstance &instance : instanceList) { + if (instance.isSubclassOf("QQuick3DViewport")) + return instance; + } + return ServerNodeInstance(); +} + void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeInstance> &instanceList) { ServerNodeInstance root = rootNodeInstance(); @@ -341,8 +369,17 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns sceneProperty.write(objectToVariant(node)); QQmlProperty parentProperty(node, "parent", context()); parentProperty.write(objectToVariant(m_editView3D)); - QQmlProperty completeSceneProperty(m_editView3D, "showLight", context()); - completeSceneProperty.write(showCustomLight); + QQmlProperty showLightProperty(m_editView3D, "showLight", context()); + showLightProperty.write(showCustomLight); + + m_viewPortInstance = findViewPort(instanceList); + if (m_viewPortInstance.internalObject()) { + QObject::connect(m_viewPortInstance.internalObject(), SIGNAL(widthChanged()), + this, SLOT(updateViewPortRect())); + QObject::connect(m_viewPortInstance.internalObject(), SIGNAL(heightChanged()), + this, SLOT(updateViewPortRect())); + updateViewPortRect(); + } // Create camera and light gizmos QObjectList cameras; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index e8a0291a9f8..dc1e342fbd8 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -51,8 +51,9 @@ public: private slots: void objectClicked(const QVariant &object); - void handleObjectPositionCommit(const QVariant &object); - void handleObjectPositionMove(const QVariant &object); + void handleObjectPropertyCommit(const QVariant &object, const QVariant &propName); + void handleObjectPropertyChange(const QVariant &object, const QVariant &propName); + void updateViewPortRect(); protected: void collectItemChangesAndSendChangeCommands() override; @@ -64,12 +65,13 @@ protected: void modifyProperties(const QVector<InstancePropertyValueTriple> &properties); private: - void handleObjectPositionMoveTimeout(); + void handleObjectPropertyChangeTimeout(); QObject *createEditView3D(QQmlEngine *engine); void setup3DEditView(const QList<ServerNodeInstance> &instanceList); QObject *findRootNodeOf3DViewport(const QList<ServerNodeInstance> &instanceList) const; void findCamerasAndLights( const QList<ServerNodeInstance> &instanceList, QObjectList &cameras, QObjectList &lights) const; + ServerNodeInstance findViewPort(const QList<ServerNodeInstance> &instanceList); QVector<InstancePropertyValueTriple> vectorToPropertyValue(const ServerNodeInstance &instance, const PropertyName &propertyName, const QVariant &variant); @@ -81,8 +83,10 @@ private: QSet<ServerNodeInstance> m_parentChangedSet; QList<ServerNodeInstance> m_completedComponentList; QList<TokenCommand> m_tokenList; - QTimer m_moveTimer; - QVariant m_movedNode; + QTimer m_propertyChangeTimer; + QVariant m_changedNode; + PropertyName m_changedProperty; + ServerNodeInstance m_viewPortInstance; }; } // namespace QmlDesigner diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc index 4bbd30e8fcb..fd17d551d8a 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc @@ -15,7 +15,14 @@ <file>mockfiles/LightGizmo.qml</file> <file>mockfiles/IconGizmo.qml</file> <file>mockfiles/Overlay2D.qml</file> + <file>mockfiles/DirectionalDraggable.qml</file> + <file>mockfiles/PlanarDraggable.qml</file> + <file>mockfiles/PlanarMoveHandle.qml</file> + <file>mockfiles/PlanarScaleHandle.qml</file> + <file>mockfiles/ScaleRod.qml</file> + <file>mockfiles/ScaleGizmo.qml</file> <file>mockfiles/meshes/arrow.mesh</file> + <file>mockfiles/meshes/scalerod.mesh</file> <file>mockfiles/images/camera-pick-icon.png</file> <file>mockfiles/images/[email protected]</file> <file>mockfiles/images/light-pick-icon.png</file> diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml index 2b73c2fac4d..f8865e62cf9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml @@ -44,6 +44,8 @@ T.ComboBox { property real __actionIndicatorWidth: StudioTheme.Values.squareComponentWidth property real __actionIndicatorHeight: StudioTheme.Values.height + property alias textInput: comboBoxInput + signal compressedActivated(int index) width: StudioTheme.Values.squareComponentWidth * 5 diff --git a/share/qtcreator/scripts/openTerminal.py b/share/qtcreator/scripts/openTerminal.py index e931c6bb265..420e936d787 100755 --- a/share/qtcreator/scripts/openTerminal.py +++ b/share/qtcreator/scripts/openTerminal.py @@ -54,10 +54,10 @@ while read -r line; do done < <(env) ''' -def system_login_script(): +def system_login_script_bash(): return 'if [ -f /etc/profile ]; then source /etc/profile; fi\n' -def login_script(): +def login_script_bash(): return ''' if [ -f $HOME/.bash_profile ]; then source $HOME/.bash_profile @@ -68,6 +68,16 @@ elif [ -f $HOME/.profile ]; then fi ''' +def system_login_script_zsh(): + return '[ -r /etc/profile ] && source /etc/profile\n' + +def login_script_zsh(): + return ''' +[ -r $HOME/.zprofile ] && source $HOME/.zprofile +[ -r $HOME/.zshrc ] && source $HOME/.zshrc +[ -r $HOME/.zlogin ] && source $HOME/.zlogin +''' + def environment_script(): return ''.join(['export ' + quote_shell(key + '=' + os.environ[key]) + '\n' for key in os.environ]) @@ -98,6 +108,10 @@ end tell def main(): # create temporary file to be sourced into bash that deletes itself with NamedTemporaryFile(delete=False) as shell_script: + shell = os.environ.get('SHELL') + shell_is_zsh = shell is not None and shell.endswith('/zsh') + system_login_script = system_login_script_zsh if shell_is_zsh else system_login_script_bash + login_script = login_script_zsh if shell_is_zsh else login_script_bash quoted_shell_script = quote_shell(shell_script.name) commands = (clean_environment_script() + system_login_script() + # /etc/profile by default resets the path, so do first @@ -106,7 +120,7 @@ def main(): 'cd ' + quote_shell(os.getcwd()) + '\n' + ' '.join([quote_shell(arg) for arg in sys.argv[1:]]) + '\n' + 'rm ' + quoted_shell_script + '\n' + - 'exit\n' if len(sys.argv) > 1 else '' + ('exit\n' if len(sys.argv) > 1 else '') ) shell_script.write(commands) shell_script.flush() diff --git a/src/libs/3rdparty/cplusplus/AST.h b/src/libs/3rdparty/cplusplus/AST.h index dbc79f37e04..f3eb70aa4ac 100644 --- a/src/libs/3rdparty/cplusplus/AST.h +++ b/src/libs/3rdparty/cplusplus/AST.h @@ -2415,7 +2415,7 @@ class CPLUSPLUS_EXPORT AlignofExpressionAST: public ExpressionAST public: int alignof_token = 0; int lparen_token = 0; - TypeIdAST *typeId; + TypeIdAST *typeId = nullptr; int rparen_token = 0; public: 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 33cc7511aa8..f7b7570cf43 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.xml.tpl @@ -9,7 +9,7 @@ Copyright 2004 Alexander Neundorf ([email protected]) Copyright 2005 Dominik Haumann ([email protected]) Copyright 2007,2008,2013,2014 Matthew Woehlke ([email protected]) - Copyright 2013-2015,2017-2018 Alex Turbov ([email protected]) + Copyright 2013-2015,2017-2019 Alex Turbov ([email protected]) ********************************************************************** * This library is free software; you can redistribute it and/or * @@ -31,7 +31,7 @@ <language name="CMake" - version="11" + version="16" kateversion="2.4" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" @@ -70,6 +70,12 @@ {%- endfor %} </list> + <list name="environment-variables"> + {%- for var in environment_variables.kw %} + <item>{{var}}</item> + {%- endfor %} + </list> + {%- for kind in properties.kinds %} <list name="{{ kind|replace('_', '-') }}"> {%- for prop in properties[kind].kw %} @@ -197,11 +203,27 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions"> - <RegExpr attribute="Environment Variable Substitution" context="#stay" String="\$ENV\{\s*[\w-]+\s*\}" /> + <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" /> <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="}" /> + </context> + <context attribute="Variable Substitution" lineEndContext="#pop" name="VarSubst"> <IncludeRules context="Detect Builtin Variables" /> <DetectIdentifier /> @@ -300,10 +322,12 @@ <itemData name="Strings" defStyleNum="dsString" spellChecking="true" /> <itemData name="Escapes" defStyleNum="dsChar" 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="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" /> <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" /> - <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" /> + <itemData name="Cache Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> <itemData name="Environment Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> + <itemData name="Standard Environment Variable" defStyleNum="dsFloat" spellChecking="false" /> <itemData name="Generator Expression Keyword" defStyleNum="dsKeyword" color="#b84040" selColor="#b84040" spellChecking="false" /> <itemData name="Generator Expression" defStyleNum="dsOthers" color="#b86050" selColor="#b86050" spellChecking="false" /> <itemData name="Comment" defStyleNum="dsComment" spellChecking="true" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml index 1174c35215d..f3fa77756f0 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/cmake.yaml @@ -7,6 +7,7 @@ global-properties: - AUTORCC_SOURCE_GROUP - CMAKE_C_KNOWN_FEATURES - CMAKE_CXX_KNOWN_FEATURES + - CMAKE_ROLE # Since 3.14 - DEBUG_CONFIGURATIONS - DISABLED_FEATURES - ENABLED_FEATURES @@ -42,6 +43,7 @@ global-properties: - FeatureSummary_<TYPE>_DESCRIPTION directory-properties: + - ADDITIONAL_CLEAN_FILES # Since 3.15 - ADDITIONAL_MAKE_CLEAN_FILES - BINARY_DIR - BUILDSYSTEM_TARGETS @@ -78,6 +80,7 @@ directory-properties: # NOTE Copy-n-pasting this list from official docs may contain a redudant item `Example`! Check it! target-properties: + - ADDITIONAL_CLEAN_FILES # Since 3.15 - ALIASED_TARGET - ANDROID_ANT_ADDITIONAL_OPTIONS - ANDROID_API @@ -101,17 +104,24 @@ target-properties: - ARCHIVE_OUTPUT_NAME_<CONFIG> - ARCHIVE_OUTPUT_NAME - AUTOGEN_BUILD_DIR + - AUTOGEN_ORIGIN_DEPENDS # Since 3.14 - AUTOGEN_TARGET_DEPENDS + - AUTOMOC_COMPILER_PREDEFINES # Since ??? - AUTOMOC_DEPEND_FILTERS - - AUTOMOC_MOC_OPTIONS + - AUTOMOC_EXECUTABLE # Since 3.14 + - AUTOMOC_MACRO_NAMES + - AUTOMOC_MOC_OPTIONS # Since ??? - AUTOMOC - AUTOUIC + - AUTOUIC_EXECUTABLE # Since 3.14 - AUTOUIC_OPTIONS - AUTOUIC_SEARCH_PATHS - AUTORCC + - AUTORCC_EXECUTABLE # Since 3.14 - AUTORCC_OPTIONS - BINARY_DIR - BUILD_RPATH + - BUILD_RPATH_USE_ORIGIN # Since 3.14 - BUILD_WITH_INSTALL_NAME_DIR - BUILD_WITH_INSTALL_RPATH - BUNDLE_EXTENSION @@ -246,6 +256,7 @@ target-properties: - MACOSX_RPATH - MANUALLY_ADDED_DEPENDENCIES - MAP_IMPORTED_CONFIG_<CONFIG> + - MSVC_RUNTIME_LIBRARY # Since 3.15 - NAME - NO_SONAME - NO_SYSTEM_FROM_IMPORTED @@ -278,6 +289,9 @@ target-properties: - STATIC_LIBRARY_FLAGS - STATIC_LIBRARY_OPTIONS # Since 3.13 - SUFFIX + - Swift_DEPENDENCIES_FILE # Since 3.15 + - Swift_MODULE_DIRECTORY # Since 3.15 + - Swift_MODULE_NAME # Since 3.15 - TYPE - VERSION - VISIBILITY_INLINES_HIDDEN @@ -298,8 +312,13 @@ target-properties: - VS_GLOBAL_<variable> - VS_IOT_EXTENSIONS_VERSION - VS_IOT_STARTUP_TASK + - VS_JUST_MY_CODE_DEBUGGING # Since 3.15 - VS_KEYWORD - VS_MOBILE_EXTENSIONS_VERSION + - VS_NO_SOLUTION_DEPLOY # Since 3.15 + - VS_PACKAGE_REFERENCES # Since 3.15 + - VS_PROJECT_IMPORT # Since 3.15 + - VS_PACKAGE_REFERENCES - VS_SCC_AUXPATH - VS_SCC_LOCALPATH - VS_SCC_PROJECTNAME @@ -314,9 +333,12 @@ target-properties: - WINDOWS_EXPORT_ALL_SYMBOLS - XCODE_ATTRIBUTE_<an-attribute> - XCODE_EXPLICIT_FILE_TYPE + - XCODE_GENERATE_SCHEME # Since 3.15 - XCODE_PRODUCT_TYPE - XCODE_SCHEME_ADDRESS_SANITIZER # Since 3.13 - XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN # Since 3.13 + - XCODE_SCHEME_ARGUMENTS # Since 3.13 + - XCODE_SCHEME_DEBUG_AS_ROOT # Since 3.15 - XCODE_SCHEME_THREAD_SANITIZER # Since 3.13 - XCODE_SCHEME_THREAD_SANITIZER_STOP # Since 3.13 - XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER # Since 3.13 @@ -331,7 +353,6 @@ target-properties: - XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE # Since 3.13 - XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS # Since 3.13 - XCODE_SCHEME_EXECUTABLE # Since 3.13 - - XCODE_SCHEME_ARGUMENTS # Since 3.13 - XCODE_SCHEME_ENVIRONMENT # Since 3.13 - XCTEST @@ -383,6 +404,8 @@ source-properties: - SKIP_AUTOMOC - SKIP_AUTORCC - SKIP_AUTOUIC + - Swift_DEPENDENCIES_FILE # Since 3.15 + - Swift_DIAGNOSTICS_FILE # Since 3.15 - SYMBOLIC - VS_COPY_TO_OUT_DIR - VS_CSHARP_<tagname> @@ -423,69 +446,95 @@ install-properties: - CPACK_WIX_ACL generator-expressions: + # Boolean Generator Expressions + # * Logical Operators - 0 - 1 - - AND - - ANGLE-R - BOOL - - BUILD_INTERFACE - - COMMA - - COMPILE_FEATURES - - COMPILE_LANGUAGE + - AND + - OR + - NOT + # * String Comparisons + - STREQUAL + - EQUAL + - IN_LIST # Since 3.12 + - VERSION_LESS + - VERSION_GREATER + - VERSION_EQUAL + - VERSION_LESS_EQUAL + - VERSION_GREATER_EQUAL + # * Variable Queries + - TARGET_EXISTS # Since 3.12 - CONFIG - - CXX_COMPILER_ID - - CXX_COMPILER_VERSION + - PLATFORM_ID - C_COMPILER_ID + - CXX_COMPILER_ID + - CUDA_COMPILER_ID # Since 3.15 + - Fortran_COMPILER_ID - C_COMPILER_VERSION - - EQUAL - - GENEX_EVAL # Since 3.12 + - CXX_COMPILER_VERSION + - CUDA_COMPILER_VERSION # Since 3.15 + - Fortran_COMPILER_VERSION + - TARGET_POLICY + - COMPILE_FEATURES + - COMPILE_LANG_AND_ID # Since 3.15 + - COMPILE_LANGUAGE + # String-Valued Generator Expressions + # * Escaped Characters + - ANGLE-R + - COMMA + - SEMICOLON + # * Conditional Expressions - IF - - INSTALL_INTERFACE - - INSTALL_PREFIX - - IN_LIST # Since 3.12 + # * String Transformations - JOIN - - LINK_ONLY + - REMOVE_DUPLICATES # Since 3.15 + - FILTER # Since 3.15 - LOWER_CASE - - MAKE_C_IDENTIFIER - - NOT - - OR - - PLATFORM_ID - - SEMICOLON - - SHELL_PATH - - STREQUAL - - TARGET_BUNDLE_CONTENT_DIR - - TARGET_BUNDLE_DIR - - TARGET_EXISTS # Since 3.12 + - UPPER_CASE + - GENEX_EVAL # Since 3.12 + - TARGET_GENEX_EVAL # Since 3.12 + # * Variable Queries (NOTE Already included above) + # * Target-Dependent Queries + - TARGET_NAME_IF_EXISTS # Since 3.12 - TARGET_FILE - - TARGET_FILE_DIR + - TARGET_FILE_BASE_NAME # Since 3.15 + - TARGET_FILE_PREFIX # Since 3.15 + - TARGET_FILE_SUFFIX # Since 3.15 - TARGET_FILE_NAME - - TARGET_GENEX_EVAL # Since 3.12 + - TARGET_FILE_DIR - TARGET_LINKER_FILE - - TARGET_LINKER_FILE_DIR + - TARGET_LINKER_FILE_BASE_NAME # Since 3.15 + - TARGET_LINKER_FILE_PREFIX # Since 3.15 + - TARGET_LINKER_FILE_SUFFIX # Since 3.15 - TARGET_LINKER_FILE_NAME - - TARGET_NAME - - TARGET_NAME_IF_EXISTS # Since 3.12 - - TARGET_OBJECTS + - TARGET_LINKER_FILE_DIR + - TARGET_SONAME_FILE + - TARGET_SONAME_FILE + - TARGET_SONAME_FILE_NAME + - TARGET_SONAME_FILE_DIR - TARGET_PDB_FILE - - TARGET_PDB_FILE_DIR + - TARGET_PDB_FILE_BASE_NAME # Since 3.15 - TARGET_PDB_FILE_NAME - - TARGET_POLICY + - TARGET_PDB_FILE_DIR + - TARGET_BUNDLE_DIR + - TARGET_BUNDLE_CONTENT_DIR - TARGET_PROPERTY - - TARGET_SONAME_FILE - - TARGET_SONAME_FILE_DIR - - TARGET_SONAME_FILE_NAME - - UPPER_CASE - - VERSION_EQUAL - - VERSION_GREATER - - VERSION_GREATER_EQUAL - - VERSION_LESS - - VERSION_LESS_EQUAL + - INSTALL_PREFIX + # Output-Related Expressions + - TARGET_NAME + - LINK_ONLY + - INSTALL_INTERFACE + - BUILD_INTERFACE + - MAKE_C_IDENTIFIER + - TARGET_OBJECTS + - SHELL_PATH variables: # Variables that Provide Information - CMAKE_AR - CMAKE_ARGC - - CMAKE_ARGV0 + - CMAKE_ARGV<n> - CMAKE_BINARY_DIR - CMAKE_BUILD_TOOL - CMAKE_CACHEFILE_DIR @@ -558,6 +607,7 @@ variables: - CMAKE_SOURCE_DIR - CMAKE_STATIC_LIBRARY_PREFIX - CMAKE_STATIC_LIBRARY_SUFFIX + - CMAKE_Swift_MODULE_DIRECTORY # Since 3.15 - CMAKE_TOOLCHAIN_FILE - CMAKE_TWEAK_VERSION - CMAKE_VERBOSE_MAKEFILE @@ -611,7 +661,9 @@ variables: - CMAKE_ECLIPSE_VERSION - CMAKE_ERROR_DEPRECATED - CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + - CMAKE_EXECUTE_PROCESS_COMMAND_ECHO # Since 3.15 - CMAKE_EXPORT_COMPILE_COMMANDS + - CMAKE_EXPORT_PACKAGE_REGISTRY # Since 3.15 - CMAKE_EXPORT_NO_PACKAGE_REGISTRY - CMAKE_FIND_APPBUNDLE - CMAKE_FIND_FRAMEWORK @@ -621,6 +673,8 @@ variables: - CMAKE_FIND_NO_INSTALL_PREFIX - CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY - CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY + - CMAKE_FIND_PACKAGE_PREFER_CONFIG # Since 3.15 + - CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS # Since 3.14 - CMAKE_FIND_PACKAGE_WARN_NO_MODULE - CMAKE_FIND_ROOT_PATH - CMAKE_FIND_ROOT_PATH_MODE_INCLUDE @@ -639,6 +693,7 @@ variables: - CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT - CMAKE_LIBRARY_PATH - CMAKE_LINK_DIRECTORIES_BEFORE # Since 3.13 + - CMAKE_MAXIMUM_RECURSION_DEPTH # Since 3.14 - CMAKE_MFC_FLAG - CMAKE_MODULE_PATH - CMAKE_NOT_USING_CONFIG_FLAGS @@ -646,6 +701,8 @@ variables: - CMAKE_POLICY_WARNING_CMP<NNNN> - CMAKE_PREFIX_PATH - CMAKE_PROGRAM_PATH + - CMAKE_PROJECT_INCLUDE # Since 3.15 + - CMAKE_PROJECT_INCLUDE_BEFORE # Since 3.15 - CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE - CMAKE_SKIP_INSTALL_ALL_DEPENDENCY - CMAKE_STAGING_PREFIX @@ -757,6 +814,7 @@ variables: - CMAKE_ANDROID_STL_TYPE - CMAKE_ARCHIVE_OUTPUT_DIRECTORY - CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> + - CMAKE_AUTOGEN_ORIGIN_DEPENDS # Since 3.14 - CMAKE_AUTOGEN_PARALLEL - CMAKE_AUTOGEN_VERBOSE # Since 3.13 - CMAKE_AUTOMOC @@ -768,6 +826,7 @@ variables: - CMAKE_AUTOUIC_OPTIONS - CMAKE_AUTOUIC_SEARCH_PATHS - CMAKE_BUILD_RPATH + - CMAKE_BUILD_RPATH_USE_ORIGIN # Since 3.14 - CMAKE_BUILD_WITH_INSTALL_NAME_DIR - CMAKE_BUILD_WITH_INSTALL_RPATH - CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY @@ -781,8 +840,13 @@ variables: - CMAKE_EXE_LINKER_FLAGS_<CONFIG>_INIT - CMAKE_EXE_LINKER_FLAGS_INIT - CMAKE_FOLDER # Since 3.12 + - CMAKE_FRAMEWORK # Since 3.15 - CMAKE_Fortran_FORMAT - CMAKE_Fortran_MODULE_DIRECTORY + - CMAKE_GLOBAL_AUTOGEN_TARGET # Since 3.14 + - CMAKE_GLOBAL_AUTOGEN_TARGET_NAME # Since 3.14 + - CMAKE_GLOBAL_AUTORCC_TARGET # Since 3.14 + - CMAKE_GLOBAL_AUTORCC_TARGET_NAME # Since 3.14 - CMAKE_GNUtoMS - CMAKE_INCLUDE_CURRENT_DIR - CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE @@ -814,6 +878,8 @@ variables: - CMAKE_MODULE_LINKER_FLAGS_<CONFIG> - CMAKE_MODULE_LINKER_FLAGS_<CONFIG>_INIT - CMAKE_MODULE_LINKER_FLAGS_INIT + - CMAKE_MSVCIDE_RUN_PATH # Since 3.15 + - CMAKE_MSVC_RUNTIME_LIBRARY # Since 3.15 - CMAKE_NINJA_OUTPUT_PATH_PREFIX - CMAKE_NO_BUILTIN_CHRPATH - CMAKE_NO_SYSTEM_FROM_IMPORTED @@ -843,6 +909,7 @@ variables: - CMAKE_VS_GLOBALS # Since 3.13 - CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD - CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD + - CMAKE_VS_JUST_MY_CODE_DEBUGGING # Since 3.15 - CMAKE_VS_SDK_EXCLUDE_DIRECTORIES # Since 3.12 - CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES # Since 3.12 - CMAKE_VS_SDK_INCLUDE_DIRECTORIES # Since 3.12 @@ -986,6 +1053,7 @@ variables: - CTEST_P4_UPDATE_OPTIONS - CTEST_SCP_COMMAND - CTEST_SITE + - CTEST_SUBMIT_URL # Since 3.14 - CTEST_SOURCE_DIRECTORY - CTEST_SVN_COMMAND - CTEST_SVN_OPTIONS @@ -996,6 +1064,7 @@ variables: - CTEST_UPDATE_COMMAND - CTEST_UPDATE_OPTIONS - CTEST_UPDATE_VERSION_ONLY + - CTEST_UPDATE_VERSION_OVERRIDE # Since 3.15 - CTEST_USE_LAUNCHERS # Variables for CPack - CPACK_ABSOLUTE_DESTINATION_FILES @@ -1064,6 +1133,7 @@ variables: - CMAKE_REQUIRED_DEFINITIONS - CMAKE_REQUIRED_FLAGS - CMAKE_REQUIRED_INCLUDES + - CMAKE_REQUIRED_LINK_OPTIONS # Since 3.14 - CMAKE_REQUIRED_LIBRARIES - CMAKE_REQUIRED_QUIET # - CheckTypeSize @@ -1198,6 +1268,7 @@ variables: - CPACK_IFW_PACKAGE_BANNER - CPACK_IFW_PACKAGE_BACKGROUND - CPACK_IFW_PACKAGE_WIZARD_STYLE + - CPACK_IFW_PACKAGE_STYLE_SHEET # Since 3.15 - CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH - CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT - CPACK_IFW_PACKAGE_TITLE_COLOR @@ -1546,7 +1617,59 @@ variables: # - UseSWIG - CMAKE_SWIG_FLAGS - CMAKE_SWIG_OUTDIR + - SWIG_OUTFILE_DIR - SWIG_MODULE_<name>_EXTRA_DEPS + - SWIG_SOURCE_FILE_EXTENSIONS # Since 3.14 + +# 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: + # Environment Variables that Control the Build + - CMAKE_BUILD_PARALLEL_LEVEL + - CMAKE_CONFIG_TYPE + - CMAKE_GENERATOR + - CMAKE_GENERATOR_INSTANCE + - CMAKE_GENERATOR_PLATFORM + - CMAKE_GENERATOR_TOOLSET + - CMAKE_MSVCIDE_RUN_PATH + - CMAKE_NO_VERBOSE + - CMAKE_OSX_ARCHITECTURES + - DESTDIR + - LDFLAGS + - MACOSX_DEPLOYMENT_TARGET + - <PackageName>_ROOT + - VERBOSE + # Environment Variables for Languages + - ASM<DIALECT> + - ASM<DIALECT>FLAGS + - CC + - CFLAGS + - CSFLAGS + - CUDACXX + - CUDAFLAGS + - CUDAHOSTCXX + - CXX + - CXXFLAGS + - FC + - FFLAGS + - RC + - RCFLAGS + - SWIFTC + # Environment Variables for CTest + - CMAKE_CONFIG_TYPE + - CTEST_INTERACTIVE_DEBUG_MODE + - CTEST_OUTPUT_ON_FAILURE + - CTEST_PARALLEL_LEVEL + - CTEST_PROGRESS_OUTPUT + - CTEST_USE_LAUNCHERS_DEFAULT + - DASHBOARD_TEST_FROM_CTEST + # Here are the `find_package` specific variables described at the + # https://cmake.org/cmake/help/latest/command/find_package.html + - <PackageName>_DIR + - CMAKE_PREFIX_PATH + - CMAKE_FRAMEWORK_PATH + - CMAKE_APPBUNDLE_PATH + - PATH scripting-commands: - @@ -1670,11 +1793,21 @@ scripting-commands: , ERROR_FILE , OUTPUT_QUIET , ERROR_QUIET + , COMMAND_ECHO # Since 3.15 , OUTPUT_STRIP_TRAILING_WHITESPACE , ERROR_STRIP_TRAILING_WHITESPACE , ENCODING ] - special-args: [NONE, AUTO, ANSI, OEM, UTF8] + special-args: [ + NONE + , AUTO + , ANSI + , OEM + , UTF8 + , STDERR # Since 3.15: the value for `COMMAND_ECHO` + , STDOUT # Since 3.15: the value for `COMMAND_ECHO` + ] + nested-parentheses?: true - name: file named-args: [ @@ -1746,6 +1879,7 @@ scripting-commands: , DIRECTORY_PERMISSIONS , NO_SOURCE_PERMISSIONS , USE_SOURCE_PERMISSIONS + , FOLLOW_SYMLINK_CHAIN # Since 3.15 , FILES_MATCHING , PATTERN , REGEX @@ -1760,6 +1894,9 @@ scripting-commands: # Sub-options of UPLOAD/DOWNLOAD since 3.11 , NETRC , NETRC_FILE + # New sub-options since 3.14 + , READ_SYMLINK + , SIZE ] special-args: [ UTF-8 @@ -1871,7 +2008,21 @@ scripting-commands: property-args: &get_directory_property [directory-properties] - name: get_filename_component - named-args: [DIRECTORY, NAME, EXT, NAME_WE, PATH, CACHE, BASE_DIR, ABSOLUTE, REALPATH, PROGRAM, PROGRAM_ARGS] + named-args: [ + DIRECTORY + , NAME + , EXT + , NAME_WE + , PATH + , CACHE + , BASE_DIR + , ABSOLUTE + , REALPATH + , PROGRAM + , PROGRAM_ARGS + , LAST_EXT # Since 3.14 + , NAME_WLE # Since 3.14 + ] - name: get_property named-args: [GLOBAL, DIRECTORY, TARGET, SOURCE, INSTALL, TEST, CACHE, VARIABLE, PROPERTY, SET, DEFINED, BRIEF_DOCS, FULL_DOCS] @@ -1933,6 +2084,10 @@ scripting-commands: , FOR # NOTE Another `REGEX` named arg has already added , OUTPUT_VARIABLE + # Since 3.15 + # NOTE Another `PREPEND` named arg has already added + , POP_FRONT + , POP_BACK ] # Since 3.13 special-args: [STRING, FILE_BASENAME, SENSITIVE, INSENSITIVE, ASCENDING, DESCENDING] @@ -1951,7 +2106,19 @@ scripting-commands: special-args: [DECIMAL, HEXADECIMAL] - name: message - named-args: [STATUS, WARNING, AUTHOR_WARNING, SEND_ERROR, FATAL_ERROR, DEPRECATION] + named-args: [ + STATUS + , WARNING + , AUTHOR_WARNING + , SEND_ERROR + , FATAL_ERROR + , DEPRECATION + # Since 3.15 + , NOTICE + , VERBOSE + , DEBUG + , TRACE + ] - name: option - @@ -1993,6 +2160,7 @@ scripting-commands: , SUBSTRING , STRIP , GENEX_STRIP + , REPEAT # Since 3.15 , COMPARE , LESS , GREATER @@ -2055,6 +2223,7 @@ project-commands: , WORKING_DIRECTORY , COMMENT , DEPFILE + , JOB_POOL # Since 3.15 , VERBATIM , APPEND , USES_TERMINAL @@ -2064,6 +2233,7 @@ project-commands: , PRE_LINK , POST_BUILD ] + nested-parentheses?: true - name: add_custom_target named-args: [ @@ -2075,12 +2245,14 @@ project-commands: , WORKING_DIRECTORY , COMMENT , DEPFILE + , JOB_POOL # Since 3.15 , VERBATIM , APPEND , USES_TERMINAL , COMMAND_EXPAND_LISTS , SOURCES ] + nested-parentheses?: true - name: add_definitions - @@ -2099,6 +2271,7 @@ project-commands: - name: add_test named-args: [NAME, COMMAND, CONFIGURATIONS, WORKING_DIRECTORY] + nested-parentheses?: true - name: aux_source_directory - @@ -2347,6 +2520,7 @@ project-commands: , SOURCES , COMPILE_DEFINITIONS , LINK_LIBRARIES + , LINK_OPTIONS # Since 3.14 , COPY_FILE , COPY_FILE_ERROR , <LANG>_STANDARD @@ -2361,6 +2535,7 @@ project-commands: , CMAKE_FLAGS , COMPILE_DEFINITIONS , LINK_LIBRARIES + , LINK_OPTIONS # Since 3.14 , COMPILE_OUTPUT_VARIABLE , RUN_OUTPUT_VARIABLE , OUTPUT_VARIABLE @@ -2414,7 +2589,19 @@ ctest-commands: named-args: [TRACK, APPEND, QUIET] - name: ctest_submit - named-args: [PARTS, FILES, HTTPHEADER, RETRY_COUNT, RETRY_DELAY, RETURN_VALUE, QUIET, CDASH_UPLOAD, CDASH_UPLOAD_TYPE] + named-args: [ + PARTS + , FILES + , BUILD_ID # Since 3.15 + , SUBMIT_URL # Since 3.14 + , HTTPHEADER + , RETRY_COUNT + , RETRY_DELAY + , RETURN_VALUE + , QUIET + , CDASH_UPLOAD + , CDASH_UPLOAD_TYPE + ] - name: ctest_test named-args: [ 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 61f60a682d6..ff94189b811 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, Alex Turbov <[email protected]> +# Copyright (c) 2017-2019 Alex Turbov <[email protected]> # # To install prerequisites: # @@ -33,6 +33,7 @@ _PROPERTY_KEYS = [ , 'install-properties' ] _KW_RE_LIST = ['kw', 're'] +_VAR_KIND_LIST = ['variables', 'environment-variables'] def try_transform_placeholder_string_to_regex(name): @@ -44,6 +45,9 @@ def try_transform_placeholder_string_to_regex(name): if 'CMAKE_MATCH_' in m: return '\\bCMAKE_MATCH_[0-9]+\\b' + if 'CMAKE_ARGV' in m: + return '\\bCMAKE_ARGV[0-9]+\\b' + return '\\b{}\\b'.format('&id_re;'.join(list(m))) if 1 < len(m) else name @@ -109,11 +113,20 @@ def cmd_is_nulary(cmd): def cli(input_yaml, template): data = yaml.load(input_yaml) - # Partition `variables` list into "pure" words and regexes to match - data['variables'] = { - k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [*partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data['variables'])]) - } - data['variables']['re'] = [*map(lambda x: try_transform_placeholder_string_to_regex(x), data['variables']['re'])] + # Partition `variables` and `environment-variables` lists into "pure" (key)words and regexes to match + for var_key in _VAR_KIND_LIST: + data[var_key] = { + k: sorted(set(v)) for k, v in zip( + _KW_RE_LIST + , [*partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data[var_key])] + ) + } + data[var_key]['re'] = [ + *map( + lambda x: try_transform_placeholder_string_to_regex(x) + , data[var_key]['re'] + ) + ] # Transform properties and make all-properties list data['properties'] = {} @@ -122,17 +135,27 @@ def cli(input_yaml, template): props, props_re = partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data[prop]) del data[prop] - data['properties'][python_prop_list_name] = {k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [props, props_re])} - data['properties'][python_prop_list_name]['re'] = [*map(lambda x: try_transform_placeholder_string_to_regex(x), props_re)] - + data['properties'][python_prop_list_name] = { + k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [props, props_re]) + } + data['properties'][python_prop_list_name]['re'] = [ + *map(lambda x: try_transform_placeholder_string_to_regex(x), props_re) + ] data['properties']['kinds'] = [*map(lambda name: name.replace('-', '_'), _PROPERTY_KEYS)] # Make all commands list - data['commands'] = [*map(lambda cmd: transform_command(cmd), data['scripting-commands'] + data['project-commands'] + data['ctest-commands'])] + data['commands'] = [ + *map( + lambda cmd: transform_command(cmd) + , data['scripting-commands'] + data['project-commands'] + data['ctest-commands']) + ] + # Fix node names to be accessible from Jinja template data['generator_expressions'] = data['generator-expressions'] - + data['environment_variables'] = data['environment-variables'] + del data['generator-expressions'] + del data['environment-variables'] env = jinja2.Environment( keep_trailing_newline=True 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 c8274aab582..f034bcada72 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl +++ b/src/libs/3rdparty/syntax-highlighting/data/generators/generate-php.pl @@ -42,7 +42,14 @@ if ($root == 1) } else { - $file =~ s/<language([^>]+)name="([^"]*)"/<language$1name="$2\/PHP" hidden="true"/s; + if ($file =~ /<language[^>]+hidden="[^"]*"/) { + $file =~ s/<language([^>]+)name="([^"]*)"/<language$1name="$2\/PHP"/s; + $file =~ s/<language([^>]+)hidden="[^"]*"/<language$1hidden="true"/s; + } + else + { + $file =~ s/<language([^>]+)name="([^"]*)"/<language$1name="$2\/PHP" hidden="true"/s; + } $file =~ s/<language([^>]+)section="[^"]*"/<language$1section="Other"/s; $file =~ s/<language([^>]+)extensions="[^"]*"/<language$1extensions=""/s; $file =~ s/<language([^>]+)mimetype="[^"]*"/<language$1mimetype=""/s; @@ -51,7 +58,8 @@ else $findphp = "<context name=\"FindPHP\" attribute=\"Normal Text\" lineEndContext=\"#stay\">\n<RegExpr context=\"##PHP/PHP\" String=\"<\\?(?:=|php)?\" lookAhead=\"true\" />\n</context>\n"; $file =~ s/<IncludeRules\s([^>]*)context="([^"#]*)##(?!Alerts|Doxygen|Modelines)([^"]+)"/<IncludeRules $1context="$2##$3\/PHP"/g; -$file =~ s/(<context\s[^>]*>)/$1\n<IncludeRules context="FindPHP" \/>/g; +$file =~ s/(<context\s[^>]*[^>\/]>)/$1\n<IncludeRules context="FindPHP" \/>/g; +$file =~ s/(<context\s[^>]*[^>\/])\s*\/>/$1>\n<IncludeRules context="FindPHP" \/>\n<\/context>/g; $file =~ s/(?=<\/contexts\s*>)/$findphp/; print $file; diff --git a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd index 6f05aad7b51..9a03ef2b780 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd +++ b/src/libs/3rdparty/syntax-highlighting/data/schema/language.xsd @@ -279,9 +279,10 @@ --> <xs:element name="list"> <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="item"/> - </xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="item"/> + <xs:element ref="include"/> + </xs:choice> <xs:attribute name="name" use="required"/> </xs:complexType> </xs:element> @@ -290,6 +291,11 @@ contains string used in <keyword> --> <xs:element name="item" type="xs:string"/> + <!-- + List include + contains a name of <keyword> + --> + <xs:element name="include" type="xs:string"/> <!-- List of contexts --> <xs:element name="contexts"> <xs:complexType> @@ -305,6 +311,7 @@ lineEndContext: Next context if end of line is encountered lineEmptyContext: Next context if an empty line is encountered [optional] fallthrough: Use a fallthrough context [optional] + deprecated since 5.62 but preserved to maintain compatibility in older versions of KF5 fallthroughContext: Fall through to this context [optional] dynamic: Dynamic context [boolean, optional] noIndentationBasedFolding: Python uses indentation based folding. However, Python has parts where @@ -314,7 +321,6 @@ TODO: - Explain fallthrough. - - Do we need fallthrough at all? It could be true, if fallthroughContext is set, false otherwise. - Make lineEndContext optional, defaults to '#stay'. Reasonable? --> <xs:element name="context"> @@ -344,7 +350,15 @@ <xs:attribute name="attribute" use="required"/> <xs:attribute name="lineEndContext" use="required"/> <xs:attribute name="lineEmptyContext"/> - <xs:attribute name="fallthrough" type="xs:boolean"/> + <xs:attribute name="fallthrough"> + <xs:simpleType> + <!-- alway true since 5.62 --> + <xs:restriction base="xs:token"> + <xs:enumeration value="1"/> + <xs:enumeration value="true"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="fallthroughContext"/> <xs:attribute name="dynamic" type="xs:boolean"/> <xs:attribute name="noIndentationBasedFolding" type="xs:boolean"/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml index 6d170e4eaaa..def91cc4ddd 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/cmake.xml @@ -9,7 +9,7 @@ Copyright 2004 Alexander Neundorf ([email protected]) Copyright 2005 Dominik Haumann ([email protected]) Copyright 2007,2008,2013,2014 Matthew Woehlke ([email protected]) - Copyright 2013-2015,2017-2018 Alex Turbov ([email protected]) + Copyright 2013-2015,2017-2019 Alex Turbov ([email protected]) ********************************************************************** * This library is free software; you can redistribute it and/or * @@ -31,7 +31,7 @@ <language name="CMake" - version="12" + version="16" kateversion="2.4" section="Other" extensions="CMakeLists.txt;*.cmake;*.cmake.in" @@ -248,6 +248,7 @@ </list> <list name="execute_process_nargs"> <item>COMMAND</item> + <item>COMMAND_ECHO</item> <item>ENCODING</item> <item>ERROR_FILE</item> <item>ERROR_QUIET</item> @@ -268,6 +269,8 @@ <item>AUTO</item> <item>NONE</item> <item>OEM</item> + <item>STDERR</item> + <item>STDOUT</item> <item>UTF8</item> </list> <list name="file_nargs"> @@ -287,6 +290,7 @@ <item>FILES_MATCHING</item> <item>FILE_PERMISSIONS</item> <item>FOLLOW_SYMLINKS</item> + <item>FOLLOW_SYMLINK_CHAIN</item> <item>GENERATE</item> <item>GLOB</item> <item>GLOB_RECURSE</item> @@ -567,6 +571,8 @@ <item>LENGTH</item> <item>ORDER</item> <item>OUTPUT_VARIABLE</item> + <item>POP_BACK</item> + <item>POP_FRONT</item> <item>PREPEND</item> <item>REGEX</item> <item>REMOVE_AT</item> @@ -602,10 +608,14 @@ </list> <list name="message_nargs"> <item>AUTHOR_WARNING</item> + <item>DEBUG</item> <item>DEPRECATION</item> <item>FATAL_ERROR</item> + <item>NOTICE</item> <item>SEND_ERROR</item> <item>STATUS</item> + <item>TRACE</item> + <item>VERBOSE</item> <item>WARNING</item> </list> <list name="separate_arguments_nargs"> @@ -671,6 +681,7 @@ <item>RANDOM</item> <item>RANDOM_SEED</item> <item>REGEX</item> + <item>REPEAT</item> <item>REPLACE</item> <item>REVERSE</item> <item>SHA1</item> @@ -737,6 +748,7 @@ <item>DEPENDS</item> <item>DEPFILE</item> <item>IMPLICIT_DEPENDS</item> + <item>JOB_POOL</item> <item>MAIN_DEPENDENCY</item> <item>OUTPUT</item> <item>POST_BUILD</item> @@ -757,6 +769,7 @@ <item>DEPENDS</item> <item>DEPFILE</item> <item>IMPLICIT_DEPENDS</item> + <item>JOB_POOL</item> <item>SOURCES</item> <item>USES_TERMINAL</item> <item>VERBATIM</item> @@ -1135,6 +1148,7 @@ <item>TRACK</item> </list> <list name="ctest_submit_nargs"> + <item>BUILD_ID</item> <item>CDASH_UPLOAD</item> <item>CDASH_UPLOAD_TYPE</item> <item>FILES</item> @@ -1144,6 +1158,7 @@ <item>RETRY_COUNT</item> <item>RETRY_DELAY</item> <item>RETURN_VALUE</item> + <item>SUBMIT_URL</item> </list> <list name="ctest_test_nargs"> <item>APPEND</item> @@ -1214,7 +1229,6 @@ <item>CMAKE_AR</item> <item>CMAKE_ARCHIVE_OUTPUT_DIRECTORY</item> <item>CMAKE_ARGC</item> - <item>CMAKE_ARGV0</item> <item>CMAKE_AUTOGEN_ORIGIN_DEPENDS</item> <item>CMAKE_AUTOGEN_PARALLEL</item> <item>CMAKE_AUTOGEN_VERBOSE</item> @@ -1288,10 +1302,12 @@ <item>CMAKE_ERROR_DEPRECATED</item> <item>CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION</item> <item>CMAKE_EXECUTABLE_SUFFIX</item> + <item>CMAKE_EXECUTE_PROCESS_COMMAND_ECHO</item> <item>CMAKE_EXE_LINKER_FLAGS</item> <item>CMAKE_EXE_LINKER_FLAGS_INIT</item> <item>CMAKE_EXPORT_COMPILE_COMMANDS</item> <item>CMAKE_EXPORT_NO_PACKAGE_REGISTRY</item> + <item>CMAKE_EXPORT_PACKAGE_REGISTRY</item> <item>CMAKE_EXTRA_GENERATOR</item> <item>CMAKE_EXTRA_INCLUDE_FILES</item> <item>CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES</item> @@ -1305,6 +1321,7 @@ <item>CMAKE_FIND_PACKAGE_NAME</item> <item>CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY</item> <item>CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY</item> + <item>CMAKE_FIND_PACKAGE_PREFER_CONFIG</item> <item>CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS</item> <item>CMAKE_FIND_PACKAGE_SORT_DIRECTION</item> <item>CMAKE_FIND_PACKAGE_SORT_ORDER</item> @@ -1315,6 +1332,7 @@ <item>CMAKE_FIND_ROOT_PATH_MODE_PACKAGE</item> <item>CMAKE_FIND_ROOT_PATH_MODE_PROGRAM</item> <item>CMAKE_FOLDER</item> + <item>CMAKE_FRAMEWORK</item> <item>CMAKE_FRAMEWORK_PATH</item> <item>CMAKE_Fortran_FORMAT</item> <item>CMAKE_Fortran_MODDIR_DEFAULT</item> @@ -1432,6 +1450,8 @@ <item>CMAKE_MODULE_LINKER_FLAGS</item> <item>CMAKE_MODULE_LINKER_FLAGS_INIT</item> <item>CMAKE_MODULE_PATH</item> + <item>CMAKE_MSVCIDE_RUN_PATH</item> + <item>CMAKE_MSVC_RUNTIME_LIBRARY</item> <item>CMAKE_NETRC</item> <item>CMAKE_NETRC_FILE</item> <item>CMAKE_NINJA_OUTPUT_PATH_PREFIX</item> @@ -1454,6 +1474,8 @@ <item>CMAKE_PROGRAM_PATH</item> <item>CMAKE_PROJECT_DESCRIPTION</item> <item>CMAKE_PROJECT_HOMEPAGE_URL</item> + <item>CMAKE_PROJECT_INCLUDE</item> + <item>CMAKE_PROJECT_INCLUDE_BEFORE</item> <item>CMAKE_PROJECT_NAME</item> <item>CMAKE_PROJECT_VERSION</item> <item>CMAKE_PROJECT_VERSION_MAJOR</item> @@ -1465,6 +1487,7 @@ <item>CMAKE_REQUIRED_FLAGS</item> <item>CMAKE_REQUIRED_INCLUDES</item> <item>CMAKE_REQUIRED_LIBRARIES</item> + <item>CMAKE_REQUIRED_LINK_OPTIONS</item> <item>CMAKE_REQUIRED_QUIET</item> <item>CMAKE_ROOT</item> <item>CMAKE_RUNTIME_OUTPUT_DIRECTORY</item> @@ -1509,6 +1532,7 @@ <item>CMAKE_SYSTEM_PROGRAM_PATH</item> <item>CMAKE_SYSTEM_VERSION</item> <item>CMAKE_Swift_LANGUAGE_VERSION</item> + <item>CMAKE_Swift_MODULE_DIRECTORY</item> <item>CMAKE_THREAD_LIBS_INIT</item> <item>CMAKE_THREAD_PREFER_PTHREAD</item> <item>CMAKE_TOOLCHAIN_FILE</item> @@ -1529,6 +1553,7 @@ <item>CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD</item> <item>CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD</item> <item>CMAKE_VS_INTEL_Fortran_PROJECT_VERSION</item> + <item>CMAKE_VS_JUST_MY_CODE_DEBUGGING</item> <item>CMAKE_VS_MSBUILD_COMMAND</item> <item>CMAKE_VS_NsightTegra_VERSION</item> <item>CMAKE_VS_PLATFORM_NAME</item> @@ -1658,6 +1683,7 @@ <item>CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR</item> <item>CPACK_IFW_PACKAGE_RESOURCES</item> <item>CPACK_IFW_PACKAGE_START_MENU_DIRECTORY</item> + <item>CPACK_IFW_PACKAGE_STYLE_SHEET</item> <item>CPACK_IFW_PACKAGE_TITLE</item> <item>CPACK_IFW_PACKAGE_TITLE_COLOR</item> <item>CPACK_IFW_PACKAGE_WATERMARK</item> @@ -1908,6 +1934,7 @@ <item>CTEST_UPDATE_COMMAND</item> <item>CTEST_UPDATE_OPTIONS</item> <item>CTEST_UPDATE_VERSION_ONLY</item> + <item>CTEST_UPDATE_VERSION_OVERRIDE</item> <item>CTEST_USE_LAUNCHERS</item> <item>CYGWIN</item> <item>EXECUTABLE_OUTPUT_PATH</item> @@ -1990,6 +2017,45 @@ <item>XCODE</item> <item>XCODE_VERSION</item> </list> + + <list name="environment-variables"> + <item>CC</item> + <item>CFLAGS</item> + <item>CMAKE_APPBUNDLE_PATH</item> + <item>CMAKE_BUILD_PARALLEL_LEVEL</item> + <item>CMAKE_CONFIG_TYPE</item> + <item>CMAKE_FRAMEWORK_PATH</item> + <item>CMAKE_GENERATOR</item> + <item>CMAKE_GENERATOR_INSTANCE</item> + <item>CMAKE_GENERATOR_PLATFORM</item> + <item>CMAKE_GENERATOR_TOOLSET</item> + <item>CMAKE_MSVCIDE_RUN_PATH</item> + <item>CMAKE_NO_VERBOSE</item> + <item>CMAKE_OSX_ARCHITECTURES</item> + <item>CMAKE_PREFIX_PATH</item> + <item>CSFLAGS</item> + <item>CTEST_INTERACTIVE_DEBUG_MODE</item> + <item>CTEST_OUTPUT_ON_FAILURE</item> + <item>CTEST_PARALLEL_LEVEL</item> + <item>CTEST_PROGRESS_OUTPUT</item> + <item>CTEST_USE_LAUNCHERS_DEFAULT</item> + <item>CUDACXX</item> + <item>CUDAFLAGS</item> + <item>CUDAHOSTCXX</item> + <item>CXX</item> + <item>CXXFLAGS</item> + <item>DASHBOARD_TEST_FROM_CTEST</item> + <item>DESTDIR</item> + <item>FC</item> + <item>FFLAGS</item> + <item>LDFLAGS</item> + <item>MACOSX_DEPLOYMENT_TARGET</item> + <item>PATH</item> + <item>RC</item> + <item>RCFLAGS</item> + <item>SWIFTC</item> + <item>VERBOSE</item> + </list> <list name="global-properties"> <item>ALLOW_DUPLICATE_CUSTOM_TARGETS</item> <item>AUTOGEN_SOURCE_GROUP</item> @@ -2032,6 +2098,7 @@ <item>XCODE_EMIT_EFFECTIVE_PLATFORM_NAME</item> </list> <list name="directory-properties"> + <item>ADDITIONAL_CLEAN_FILES</item> <item>ADDITIONAL_MAKE_CLEAN_FILES</item> <item>BINARY_DIR</item> <item>BUILDSYSTEM_TARGETS</item> @@ -2064,6 +2131,7 @@ <item>VS_STARTUP_PROJECT</item> </list> <list name="target-properties"> + <item>ADDITIONAL_CLEAN_FILES</item> <item>ALIASED_TARGET</item> <item>ANDROID_ANT_ADDITIONAL_OPTIONS</item> <item>ANDROID_API</item> @@ -2207,6 +2275,7 @@ <item>MACOSX_FRAMEWORK_INFO_PLIST</item> <item>MACOSX_RPATH</item> <item>MANUALLY_ADDED_DEPENDENCIES</item> + <item>MSVC_RUNTIME_LIBRARY</item> <item>NAME</item> <item>NO_SONAME</item> <item>NO_SYSTEM_FROM_IMPORTED</item> @@ -2232,6 +2301,9 @@ <item>STATIC_LIBRARY_FLAGS</item> <item>STATIC_LIBRARY_OPTIONS</item> <item>SUFFIX</item> + <item>Swift_DEPENDENCIES_FILE</item> + <item>Swift_MODULE_DIRECTORY</item> + <item>Swift_MODULE_NAME</item> <item>TYPE</item> <item>VERSION</item> <item>VISIBILITY_INLINES_HIDDEN</item> @@ -2249,8 +2321,12 @@ <item>VS_GLOBAL_ROOTNAMESPACE</item> <item>VS_IOT_EXTENSIONS_VERSION</item> <item>VS_IOT_STARTUP_TASK</item> + <item>VS_JUST_MY_CODE_DEBUGGING</item> <item>VS_KEYWORD</item> <item>VS_MOBILE_EXTENSIONS_VERSION</item> + <item>VS_NO_SOLUTION_DEPLOY</item> + <item>VS_PACKAGE_REFERENCES</item> + <item>VS_PROJECT_IMPORT</item> <item>VS_SCC_AUXPATH</item> <item>VS_SCC_LOCALPATH</item> <item>VS_SCC_PROJECTNAME</item> @@ -2264,10 +2340,12 @@ <item>WIN32_EXECUTABLE</item> <item>WINDOWS_EXPORT_ALL_SYMBOLS</item> <item>XCODE_EXPLICIT_FILE_TYPE</item> + <item>XCODE_GENERATE_SCHEME</item> <item>XCODE_PRODUCT_TYPE</item> <item>XCODE_SCHEME_ADDRESS_SANITIZER</item> <item>XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN</item> <item>XCODE_SCHEME_ARGUMENTS</item> + <item>XCODE_SCHEME_DEBUG_AS_ROOT</item> <item>XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER</item> <item>XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS</item> <item>XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE</item> @@ -2309,6 +2387,8 @@ <item>SKIP_AUTORCC</item> <item>SKIP_AUTOUIC</item> <item>SYMBOLIC</item> + <item>Swift_DEPENDENCIES_FILE</item> + <item>Swift_DIAGNOSTICS_FILE</item> <item>VS_COPY_TO_OUT_DIR</item> <item>VS_DEPLOYMENT_CONTENT</item> <item>VS_DEPLOYMENT_LOCATION</item> @@ -2375,61 +2455,76 @@ <list name="generator-expressions"> <item>0</item> <item>1</item> - <item>AND</item> - <item>ANGLE-R</item> <item>BOOL</item> - <item>BUILD_INTERFACE</item> - <item>COMMA</item> - <item>COMPILE_FEATURES</item> - <item>COMPILE_LANGUAGE</item> + <item>AND</item> + <item>OR</item> + <item>NOT</item> + <item>STREQUAL</item> + <item>EQUAL</item> + <item>IN_LIST</item> + <item>VERSION_LESS</item> + <item>VERSION_GREATER</item> + <item>VERSION_EQUAL</item> + <item>VERSION_LESS_EQUAL</item> + <item>VERSION_GREATER_EQUAL</item> + <item>TARGET_EXISTS</item> <item>CONFIG</item> - <item>CXX_COMPILER_ID</item> - <item>CXX_COMPILER_VERSION</item> + <item>PLATFORM_ID</item> <item>C_COMPILER_ID</item> + <item>CXX_COMPILER_ID</item> + <item>CUDA_COMPILER_ID</item> + <item>Fortran_COMPILER_ID</item> <item>C_COMPILER_VERSION</item> - <item>EQUAL</item> - <item>GENEX_EVAL</item> + <item>CXX_COMPILER_VERSION</item> + <item>CUDA_COMPILER_VERSION</item> + <item>Fortran_COMPILER_VERSION</item> + <item>TARGET_POLICY</item> + <item>COMPILE_FEATURES</item> + <item>COMPILE_LANG_AND_ID</item> + <item>COMPILE_LANGUAGE</item> + <item>ANGLE-R</item> + <item>COMMA</item> + <item>SEMICOLON</item> <item>IF</item> - <item>INSTALL_INTERFACE</item> - <item>INSTALL_PREFIX</item> - <item>IN_LIST</item> <item>JOIN</item> - <item>LINK_ONLY</item> + <item>REMOVE_DUPLICATES</item> + <item>FILTER</item> <item>LOWER_CASE</item> - <item>MAKE_C_IDENTIFIER</item> - <item>NOT</item> - <item>OR</item> - <item>PLATFORM_ID</item> - <item>SEMICOLON</item> - <item>SHELL_PATH</item> - <item>STREQUAL</item> - <item>TARGET_BUNDLE_CONTENT_DIR</item> - <item>TARGET_BUNDLE_DIR</item> - <item>TARGET_EXISTS</item> + <item>UPPER_CASE</item> + <item>GENEX_EVAL</item> + <item>TARGET_GENEX_EVAL</item> + <item>TARGET_NAME_IF_EXISTS</item> <item>TARGET_FILE</item> - <item>TARGET_FILE_DIR</item> + <item>TARGET_FILE_BASE_NAME</item> + <item>TARGET_FILE_PREFIX</item> + <item>TARGET_FILE_SUFFIX</item> <item>TARGET_FILE_NAME</item> - <item>TARGET_GENEX_EVAL</item> + <item>TARGET_FILE_DIR</item> <item>TARGET_LINKER_FILE</item> - <item>TARGET_LINKER_FILE_DIR</item> + <item>TARGET_LINKER_FILE_BASE_NAME</item> + <item>TARGET_LINKER_FILE_PREFIX</item> + <item>TARGET_LINKER_FILE_SUFFIX</item> <item>TARGET_LINKER_FILE_NAME</item> - <item>TARGET_NAME</item> - <item>TARGET_NAME_IF_EXISTS</item> - <item>TARGET_OBJECTS</item> + <item>TARGET_LINKER_FILE_DIR</item> + <item>TARGET_SONAME_FILE</item> + <item>TARGET_SONAME_FILE</item> + <item>TARGET_SONAME_FILE_NAME</item> + <item>TARGET_SONAME_FILE_DIR</item> <item>TARGET_PDB_FILE</item> - <item>TARGET_PDB_FILE_DIR</item> + <item>TARGET_PDB_FILE_BASE_NAME</item> <item>TARGET_PDB_FILE_NAME</item> - <item>TARGET_POLICY</item> + <item>TARGET_PDB_FILE_DIR</item> + <item>TARGET_BUNDLE_DIR</item> + <item>TARGET_BUNDLE_CONTENT_DIR</item> <item>TARGET_PROPERTY</item> - <item>TARGET_SONAME_FILE</item> - <item>TARGET_SONAME_FILE_DIR</item> - <item>TARGET_SONAME_FILE_NAME</item> - <item>UPPER_CASE</item> - <item>VERSION_EQUAL</item> - <item>VERSION_GREATER</item> - <item>VERSION_GREATER_EQUAL</item> - <item>VERSION_LESS</item> - <item>VERSION_LESS_EQUAL</item> + <item>INSTALL_PREFIX</item> + <item>TARGET_NAME</item> + <item>LINK_ONLY</item> + <item>INSTALL_INTERFACE</item> + <item>BUILD_INTERFACE</item> + <item>MAKE_C_IDENTIFIER</item> + <item>TARGET_OBJECTS</item> + <item>SHELL_PATH</item> </list> <contexts> @@ -2662,11 +2757,18 @@ <DetectChar attribute="Normal Text" context="execute_process_ctx_op" char="(" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="execute_process_ctx_op"> + <DetectChar attribute="Normal Text" context="execute_process_ctx_op_nested" char="(" /> <IncludeRules context="EndCmdPop2" /> <keyword attribute="Named Args" context="#stay" String="execute_process_nargs" /> <keyword attribute="Special Args" context="#stay" String="execute_process_sargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="execute_process_ctx_op_nested"> + <IncludeRules context="EndCmdPop" /> + <keyword attribute="Named Args" context="#stay" String="execute_process_nargs" /> + <keyword attribute="Special Args" context="#stay" String="execute_process_sargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="file_ctx"> <DetectChar attribute="Normal Text" context="file_ctx_op" char="(" /> </context> @@ -2978,18 +3080,30 @@ <DetectChar attribute="Normal Text" context="add_custom_command_ctx_op" char="(" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="add_custom_command_ctx_op"> + <DetectChar attribute="Normal Text" context="add_custom_command_ctx_op_nested" char="(" /> <IncludeRules context="EndCmdPop2" /> <keyword attribute="Named Args" context="#stay" String="add_custom_command_nargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="add_custom_command_ctx_op_nested"> + <IncludeRules context="EndCmdPop" /> + <keyword attribute="Named Args" context="#stay" String="add_custom_command_nargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="add_custom_target_ctx"> <DetectChar attribute="Normal Text" context="add_custom_target_ctx_op" char="(" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="add_custom_target_ctx_op"> + <DetectChar attribute="Normal Text" context="add_custom_target_ctx_op_nested" char="(" /> <IncludeRules context="EndCmdPop2" /> <keyword attribute="Named Args" context="#stay" String="add_custom_target_nargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="add_custom_target_ctx_op_nested"> + <IncludeRules context="EndCmdPop" /> + <keyword attribute="Named Args" context="#stay" String="add_custom_target_nargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="add_definitions_ctx"> <DetectChar attribute="Normal Text" context="add_definitions_ctx_op" char="(" /> </context> @@ -3039,10 +3153,16 @@ <DetectChar attribute="Normal Text" context="add_test_ctx_op" char="(" /> </context> <context attribute="Normal Text" lineEndContext="#stay" name="add_test_ctx_op"> + <DetectChar attribute="Normal Text" context="add_test_ctx_op_nested" char="(" /> <IncludeRules context="EndCmdPop2" /> <keyword attribute="Named Args" context="#stay" String="add_test_nargs" /> <IncludeRules context="User Function Args" /> </context> + <context attribute="Normal Text" lineEndContext="#stay" name="add_test_ctx_op_nested"> + <IncludeRules context="EndCmdPop" /> + <keyword attribute="Named Args" context="#stay" String="add_test_nargs" /> + <IncludeRules context="User Function Args" /> + </context> <context attribute="Normal Text" lineEndContext="#stay" name="aux_source_directory_ctx"> <DetectChar attribute="Normal Text" context="aux_source_directory_ctx_op" char="(" /> </context> @@ -3619,6 +3739,7 @@ <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_STANDARD_LIBRARIES\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_VISIBILITY_PRESET\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_ARCHIVE_OUTPUT_DIRECTORY_&id_re;\b" /> + <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_ARGV[0-9]+\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_&id_re;\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_DISABLE_FIND_PACKAGE_&id_re;\b" /> <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_EXE_LINKER_FLAGS_&id_re;\b" /> @@ -3727,11 +3848,28 @@ </context> <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions"> - <RegExpr attribute="Environment Variable Substitution" context="#stay" String="\$ENV\{\s*[\w-]+\s*\}" /> + <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" /> <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" /> + <RegExpr attribute="Standard Environment Variable" context="#stay" String="\b&id_re;_DIR\b" /> + <RegExpr attribute="Standard Environment Variable" context="#stay" String="\b&id_re;_ROOT\b" /> + <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bASM&id_re;\b" /> + <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bASM&id_re;FLAGS\b" /> + <DetectIdentifier /> + <DetectChar attribute="Environment Variable Substitution" context="#pop#pop" char="}" /> + </context> + <context attribute="Variable Substitution" lineEndContext="#pop" name="VarSubst"> <IncludeRules context="Detect Builtin Variables" /> <DetectIdentifier /> @@ -3830,10 +3968,12 @@ <itemData name="Strings" defStyleNum="dsString" spellChecking="true" /> <itemData name="Escapes" defStyleNum="dsChar" 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="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" /> <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" /> - <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" /> + <itemData name="Cache Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> <itemData name="Environment Variable Substitution" defStyleNum="dsFloat" spellChecking="false" /> + <itemData name="Standard Environment Variable" defStyleNum="dsFloat" spellChecking="false" /> <itemData name="Generator Expression Keyword" defStyleNum="dsKeyword" color="#b84040" selColor="#b84040" spellChecking="false" /> <itemData name="Generator Expression" defStyleNum="dsOthers" color="#b86050" selColor="#b86050" spellChecking="false" /> <itemData name="Comment" defStyleNum="dsComment" spellChecking="true" /> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml index 25a614e826f..228bb45b854 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/css.xml @@ -38,7 +38,8 @@ Changelog: --> -<language name="CSS" version="8" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen ([email protected])" license="LGPL" priority="10"> +<language name="CSS" version="9" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen ([email protected])" license="LGPL" priority="10"> + <!-- https://www.w3.org/Style/CSS/current-work --> <highlighting> <list name="properties"> @@ -1258,8 +1259,9 @@ Changelog: <item>selection</item> </list> - <list name="pseudoclass-not"> + <list name="pseudoclass-selector"> <item>not</item> + <item>matches</item> </list> <list name="pseudoclasses-@page"> @@ -1383,8 +1385,8 @@ Changelog: <keyword attribute="Value Keyword" context="#stay" String="value keywords" /> <keyword attribute="Value" context="#stay" String="values" /> <keyword attribute="Color" context="#stay" String="colors" /> - <RegExpr attribute="Color" context="#stay" String="#([0-9A-Fa-f]{3}){1,2}\b" /> - <RegExpr attribute="Number" context="FindUnits" String="[-+]?[0-9.]+(?![-+])" /> + <RegExpr attribute="Color" context="#stay" String="#([0-9A-Fa-f]{3,4}){1,2}\b" /> + <RegExpr attribute="Number" context="FindUnits" String="[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?(?![-+])" /> <RegExpr attribute="Normal Text" context="#stay" String="[-]?(&nmstart;)(&nmchar;)*" /> </context> @@ -1393,7 +1395,8 @@ Changelog: </context> <context name="FindUnits" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> - <RegExpr attribute="Unit" context="#stay" String="(%|(em|ex|ch|rem|vw|vh|vm|px|in|cm|mm|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz)\b)(?![-+])" /> + <!-- https://drafts.csswg.org/css-values-4/#lengths --> + <RegExpr attribute="Unit" context="#stay" String="(%|(em|ex|cap|ch|ic|rem|lh|rlh|vw|vh|vi|vb|vmin|vmax|cm|mm|Q|in|pc|pt|px|deg|rad|grad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx|x)\b)(?![-+])" /> </context> <!-- find strings // "some words" 'some words' --> @@ -1548,7 +1551,7 @@ Changelog: <context name="SelectorPseudo" attribute="Selector Pseudo" lineEndContext="#pop"> <DetectChar attribute="Selector Pseudo" context="SelectorPseudoElements" char=":" /> - <keyword attribute="Selector Pseudo" context="SelectorPseudoValueSelector" String="pseudoclass-not" /> + <keyword attribute="Selector Pseudo" context="SelectorPseudoValueSelector" String="pseudoclass-selector" /> <keyword attribute="Selector Pseudo" context="SelectorPseudoValue" String="pseudoclasses" /> <RegExpr attribute="Selector Pseudo" context="SelectorPseudoValue" String="[-a-zA-Z][-a-zA-Z0-9]*" /> </context> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml index 107e1067da8..7f0d52b353c 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="7" kateversion="3.4" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen ([email protected])" license="LGPL" priority="10"> +<language name="HTML" version="9" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen ([email protected])" license="LGPL" priority="10"> <highlighting> <contexts> @@ -20,8 +20,19 @@ <StringDetect attribute="CDATA" context="CDATA" String="<![CDATA[" beginRegion="cdata" /> <RegExpr attribute="Doctype" context="Doctype" String="<!DOCTYPE\s+" insensitive="true" beginRegion="doctype" /> <RegExpr attribute="Processing Instruction" context="PI" String="<\?[\w:-]*" beginRegion="pi" /> + <IncludeRules context="FindSpecialHTMLTags" /> + <IncludeRules context="FindHTMLTags" /> + <!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" /> + <IncludeRules context="FindEntityRefs" /> + </context> + + <!-- This allows you to insert HTML tags in other syntax definitions --> + <context name="FindSpecialHTMLTags" attribute="Normal Text" lineEndContext="#stay"> <RegExpr attribute="Element" context="CSS" String="<style\b" insensitive="true" beginRegion="style" /> <RegExpr attribute="Element" context="JS" String="<script\b" insensitive="true" beginRegion="script" /> + </context> + + <context name="FindHTMLTags" attribute="Normal Text" lineEndContext="#stay"> <RegExpr attribute="Element" context="El Open" String="<pre\b" insensitive="true" beginRegion="pre" /> <RegExpr attribute="Element" context="El Open" String="<div\b" insensitive="true" beginRegion="div" /> <RegExpr attribute="Element" context="El Open" String="<table\b" insensitive="true" beginRegion="table" /> @@ -54,8 +65,6 @@ <RegExpr attribute="Element" context="El Close" String="</nav\b" insensitive="true" endRegion="nav" /> <RegExpr attribute="Element" context="El Close" String="</section\b" insensitive="true" endRegion="section" /> <RegExpr attribute="Element" context="El Close" String="</&name;" /> - <!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" /> - <IncludeRules context="FindEntityRefs" /> </context> <context name="FindEntityRefs" attribute="Other Text" lineEndContext="#stay"> @@ -230,7 +239,7 @@ <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""x-tmpl-mustache""/> <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'x-tmpl-mustache'"/> <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/mustache""/> - <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/mustache'"/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/mustache'"/> <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/x-mustache-template""/> <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/x-mustache-template'"/> <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/x-handlebars-template""/> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/json.xml index 28ad8e8a33d..e9f80a534ea 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="3" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.gltf" mimetype="application/json" author="Sebastian Pipping ([email protected])" license="GPL"> +<language name="JSON" section="Markup" version="4" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.geojson;*.gltf" mimetype="application/json" author="Sebastian Pipping ([email protected])" license="GPL"> <highlighting> <list name="Constants"> <item>null</item> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml index f88848729fb..7d11b34e6b6 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/markdown.xml @@ -6,6 +6,7 @@ Dual-Licensed under both GPL and BSD licenses. Extended 2009 Claes Holmerson. http://github.com/claes/kate-markdown/ + Extended 2019 Nibaldo González S. <[email protected]> (changes under MIT license). --> <!-- The [^\s]{1} is in the regex to avoid interfering with bullet list which @@ -15,189 +16,623 @@ Match space or newline, followed by "*", followed by one non-space, followed by anything non-asterisk, followed by "*", followed by space, end-of-sentence punctuation, or the end of the line. + + TODO: We can be more specific and highlight text combinations in bold, + italic and strikethrough. + Example: **bold text and _italic and bold text_** + __bold and ~~strikeout and bold~~__ --> <!DOCTYPE language SYSTEM "language.dtd" [ -<!ENTITY strongemphasisregex "(\s|^)[\*_]{3}[^\*_]+[\*_]{3}(\s|\.|,|;|:|\-|\?|$)"> -<!ENTITY strongregex "(\s|^)[\*_]{2}[^\s]{1}[^\*_]+[\*_]{2}(\s|\.|,|;|:|\-|\?|$)"> -<!ENTITY emphasisregex "(\s|^)[\*_]{1}[^\s]{1}[^\*_]+[\*_]{1}(\s|\.|,|;|:|\-|\?|$)"> -<!ENTITY reflinkregex '\[[^\]\^]+\]\s*\[[^\]]*\]\s*(\s+\"[^\"]*\"){0,1}'> -<!ENTITY reflinktargetregex '\[[^\]\^]+\]\:\s+[^\s]+(\s+\"[^\"]*\"){0,1}'> -<!ENTITY footnoteregex "\[\^[^\]]+\]"> -<!ENTITY inlinelinkregex "\[[^\]\^]+\]\s*\([^\(]*\)"> -<!ENTITY inlineimageregex "\!\[[^\]\^]+\]\([^\(]*\)"> -<!ENTITY refimageregex "\!\[[^\]\^]+\]\[[^\[]*\]"> -<!ENTITY autolinkregex '<(https?|ftp):[^\">\s]+>'> -<!ENTITY mailtolinkregex "<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>"> -<!ENTITY rulerregex "\s*([\*\-_]\s?){3,}\s*"> +<!-- NOTE: To correctly detect bold, italic or strike out text, use minimal="true" in RegExpr rules --> +<!ENTITY contentregex_ast "(?:(?:[^\*\s\\]|\\.)(?:[^\\]|\\.)*)?(?:[^\*\s\\]|\\\S)"> +<!ENTITY contentregex_und "(?:(?:[^_\s\\]|\\.)(?:[^\\]|\\.)*)?(?:[^_\s\\]|\\\S)"> +<!-- strong + emphasis text --> +<!ENTITY strongemphasisregex_ast "\*{3,5}&contentregex_ast;\*{3}"> +<!ENTITY strongemphasisregex_und "\b_{3,5}&contentregex_und;_{3}"> +<!ENTITY strongemphasisregex_ast_und "\*{2,5}(?:(?:_|_{3}|_{5})&contentregex_und;_+|(?:_{2}|_{4})&contentregex_und;_)\*{2}"> +<!ENTITY strongemphasisregex_ast_und2 "\*_{2,5}&contentregex_und;_{2,5}\*(?!\*)"> +<!ENTITY strongemphasisregex_und_ast "\b_{2,5}(?:(?:\*|\*{3}|\*{5})&contentregex_ast;\*+|(?:\*{2}|\*{4})&contentregex_ast;\*)_{2}"> +<!ENTITY strongemphasisregex_und_ast2 "\b_(?:\*{2,5}&contentregex_ast;\*{2,5}_{0,4}|_{0,4}\*{2,5}&contentregex_ast;\*{2,5})_\b"> +<!-- strong text --> +<!ENTITY strongregex_ast "\*{2}(?:&contentregex_ast;\*{2}|\*{1,3}&contentregex_ast;\*{2}(?!\*))"> +<!ENTITY strongregex_und "\b_{2}(?:&contentregex_und;_{2}|_{1,3}&contentregex_und;_{2}(?!_))"> +<!-- emphasis text --> +<!ENTITY emphasisregex_ast "\*(?:&contentregex_ast;\*|\*{1,4}&contentregex_ast;\*(?!\*))"> +<!ENTITY emphasisregex_und "\b_(?:&contentregex_und;_+|_{1,4}&contentregex_und;_)\b"> +<!-- links --> +<!ENTITY startlink "(?:https?|ftp)\://"> +<!ENTITY link "&startlink;[^">\s]+"> +<!-- link in normal text --> +<!ENTITY implicitlink "\b&startlink;[^">\s`\)]*[^\s!"'`\(\)\*,\.:;<>\?~\]\}\\](?=[[:punct:]]*(?:[\s\)]|$))"> +<!-- references: [name], [name][id], [name][id] "title", [name](https://example.com) --> +<!ENTITY refchar "(?:\\.|[^\]\\])"> +<!ENTITY refname "(?:\\.|[^\s\[\]\\])&refchar;*"> +<!ENTITY reflinkid "\s*(?:&refname;)?"> +<!ENTITY reflinkidregex "(?:\s?\[&reflinkid;\]|\((?:\\.|[^\(\)\\])*\))"> +<!ENTITY reflinkregex "\[(?:(?=\s*&refname;\])|\s+(?=\]))"> +<!-- target ref.: [id]: https://example.com "Title" --> +<!ENTITY reflinktargetregex '\[\s*(?:&refname;|\s)\]\:\s+(?=\S)'> +<!-- footnote: [^name] --> +<!ENTITY footnoteregex "\[\^&refchar;+\]"> +<!-- image: , ![title][id] --> +<!ENTITY startinlineimage "\!\[(?:\\.|[^\[\]\\])*\]\("> +<!ENTITY endinlineimage "(?:\\.|[^\(\)\\])*\)"> +<!ENTITY inlineimageregex "&startinlineimage;(?=&endinlineimage;)"> +<!ENTITY refimageregex "\!\[(?:\\.|[^\[\]\\])*\]\[&reflinkid;\]"> +<!-- autolink & email: <https://example.com>, <[email protected]>, <mailto:[email protected]> --> +<!ENTITY autolinkregex '<&link;>'> +<!ENTITY email "[\-\.\w]+\@[\-a-z0-9]+(?:\.[\-a-z0-9]+)*\.[a-z]+"> +<!ENTITY mailtolinkregex "<(?:mailto:)?(?=&email;>)"> +<!-- horizontal rule: avoid conflicts with strong-emphasis text, lists and code blocks --> +<!ENTITY rulerregex "\s*(?:(?:\*\s*){3,}|(?:_\s*){3,}|(?:\-\s*){3,})\s*$"> <!-- two spaces at end of line generates linebreak --> <!ENTITY linebreakregex " $"> -<!ENTITY strikeoutregex "[~]{2}[^~].*[^~][~]{2}"> -<!-- pandoc style --> +<!-- strikethrough text, pandoc style --> +<!ENTITY strikeoutregex "[~]{2}[^~](?:.*[^~])?[~]{2}"> +<!-- start of fenced code block --> +<!ENTITY fcode "(`{3,}|~{3,})"> +<!-- end of line & empty line --> +<!ENTITY end "\s*$"> +<!ENTITY emptyline "^\s*$"> +<!-- indented code block --> +<!ENTITY indentedcodeblock "(?:\s{4}|\t).*$"> +<!-- bullet of list --> +<!ENTITY listbullet "[\*\+\-]"> +<!-- metadata key & name of html tag --> +<!ENTITY metadatakey "[a-zA-Z0-9][\w\-\s]*\:"> +<!ENTITY htmlname "[A-Za-z_\:][\w\.\:\-]*"> +<!-- comment --> +<!ENTITY startcomment "<!--"> +<!ENTITY endcomment "-->"> +<!ENTITY checkbox "\[[ x]\](?=\s)"> ]> -<language name="Markdown" version="6" kateversion="5.0" section="Markup" extensions="*.md;*.mmd;*.markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD"> + +<language name="Markdown" version="10" kateversion="5.53" section="Markup" extensions="*.md;*.mmd;*.markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD"> <highlighting> <contexts> - <context attribute="Normal Text" lineEndContext="#stay" name="Normal Text"> - <DetectChar context="blockquote" char=">" column="0"/> - <RegExpr attribute="h1" String="^#\s.*[#]?$"/> - <RegExpr attribute="h2" String="^##\s.*[#]?$"/> - <RegExpr attribute="h3" String="^###\s.*[#]?$"/> - <RegExpr attribute="h4" String="^####\s.*[#]?$"/> - <RegExpr attribute="h5" String="^#####\s.*[#]?$"/> - <RegExpr attribute="h6" String="^######\s.*[#]?$"/> - <RegExpr attribute="ruler" String="&rulerregex;"/> - <RegExpr attribute="strong" String="&strongregex;"/> - <RegExpr attribute="emphasis" String="&emphasisregex;"/> - <RegExpr attribute="strongemphasis" String="&strongemphasisregex;"/> - <RegExpr attribute="code" String="^([\s]{4,}|\t+).*$"/> - <RegExpr context="bullet" String="^[\*\+\-]\s"/> - <RegExpr context="numlist" String="^[\d]+\.\s"/> - <RegExpr attribute="meta" String="^(Title|Author|Date|Copyright|Revision|CSS|LaTeX\ XSLT|Categories|Tags|BaseName|Excerpt):(.*)+$"/> - <IncludeRules context="inc"/> + <!-- Start of the Markdown document: find metadata or code block --> + <context name="Start Document" attribute="Normal Text" lineEndContext="Normal Text" lineEmptyContext="Normal Text" fallthrough="true" fallthroughContext="Normal Text"> + <!-- Some titles: (Title|Author|Date|Copyright|Revision|CSS|LaTeX\ XSLT|Categories|Tags|BaseName|Excerpt) --> + <!-- Metadata: Markdown format --> + <RegExpr attribute="Metadata" context="metadata" String="\-{3}&end;" column="0" beginRegion="metadata"/> + <!-- Metadata: MultiMarkdown format --> + <RegExpr attribute="Metadata Title" context="metadata-mm-value" String="^&metadatakey;(?=\s|$)" column="0"/> + <!-- Code Block --> + <RegExpr attribute="Code" context="find-code-block-start" String="^&indentedcodeblock;" column="0"/> + </context> + <context name="metadata" attribute="Metadata" lineEndContext="#stay"> + <StringDetect attribute="Metadata" context="#pop!Normal Text" String="---" column="0" endRegion="metadata"/> + <StringDetect attribute="Metadata" context="#pop!Normal Text" String="..." column="0" endRegion="metadata"/> + <RegExpr attribute="Metadata Title" String="^&metadatakey;(?=\s|$)" column="0"/> </context> - <context attribute="blockquote" lineEndContext="#stay" lineEmptyContext="#pop" name="blockquote"> - <RegExpr attribute="bq-strong" String="&strongregex;"/> - <RegExpr attribute="bq-emphasis" String="&emphasisregex;"/> + <context name="metadata-mm-value" attribute="Metadata" lineEndContext="#pop!metadata-mm"/> + <context name="metadata-mm" attribute="Metadata" lineEndContext="#stay" lineEmptyContext="#pop!Normal Text" fallthrough="true" fallthroughContext="#pop!Normal Text"> + <!-- Find Metadata key or value --> + <RegExpr attribute="Metadata Title" context="#pop!metadata-mm-value" String="^&metadatakey;(?=\s|$)" column="0"/> + <RegExpr attribute="Metadata" context="#pop!metadata-mm-value" String="^(?:\s{4}|\t)" column="0"/> + </context> + <context name="find-code-block-start" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay" fallthrough="true" fallthroughContext="#pop!Normal Text"> + <IncludeRules context="find-code-block"/> + </context> + + <!-- Normal Text Document --> + <context name="Normal Text" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="find-code-block"> + <!-- Header --> + <DetectChar context="find-header" char="#" column="0" lookAhead="true"/> + <RegExpr attribute="Header H1" String="(?:\=\s*){2,}$" firstNonSpace="true"/> + <!-- Highlight code block after line only with spaces or comment --> + <RegExpr attribute="Normal Text" context="find-code-block" String="&emptyline;" column="0"/> + <StringDetect attribute="Comment" context="find-code-block" String="&startcomment;" column="0" lookAhead="true"/> + <!-- Horizontal rules, Blockquotes and Lists. + NOTE: The indentation of the lists is captured. --> + <RegExpr attribute="Horizontal Rule" context="find-code-block" String="^&rulerregex;" column="0"/> + <DetectChar attribute="Blockquote" context="blockquote" char=">" firstNonSpace="true"/> + <RegExpr attribute="List" context="list" String="(\s*)&listbullet;(\s+)" column="0"/> + <RegExpr attribute="Number List" context="numlist" String="(\s*)\d\.(\s+)" column="0"/> + <RegExpr attribute="Number List" context="numlist2" String="(\s*)\d\d+\.(\s+)" column="0"/> + <!-- Find Strong, Emphasis and Strikethrough Text --> + <DetectChar context="find-strong-normal" char="*" lookAhead="true"/> + <DetectChar context="find-emphasis-normal" char="_" lookAhead="true"/> + <RegExpr attribute="Strikethrough Text" minimal="true" String="&strikeoutregex;"/> + <!-- Common --> <IncludeRules context="inc"/> + <RegExpr attribute="Normal Text: Link" String="&implicitlink;"/> + </context> + <!-- Find indented code blocks. These are only allowed after an empty line or on the first line --> + <context name="find-code-block" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Code" String="^&indentedcodeblock;" column="0"/> + <RegExpr attribute="Normal Text" String="&end;" /> + <RegExpr attribute="Comment" context="comment" String="\s*&startcomment;" column="0" beginRegion="comment"/> + <RegExpr attribute="Comment" context="comment" String="\s*&startcomment;(?=.*&endcomment;)" beginRegion="comment"/> </context> - <context attribute="bullet" lineEndContext="#stay" lineEmptyContext="#pop" name="bullet"> - <RegExpr attribute="bl-strong" String="&strongregex;"/> - <RegExpr attribute="bl-emphasis" String="&emphasisregex;"/> + + <context name="find-header" attribute="Normal Text" lineEndContext="#pop"> + <RegExpr attribute="Header H1" context="#pop" String="^#\s.*[#]?$"/> + <RegExpr attribute="Header H2" context="#pop" String="^##\s.*[#]?$"/> + <RegExpr attribute="Header H3" context="#pop" String="^###\s.*[#]?$"/> + <RegExpr attribute="Header H4" context="#pop" String="^####\s.*[#]?$"/> + <RegExpr attribute="Header H5" context="#pop" String="^#####\s.*[#]?$"/> + <RegExpr attribute="Header H6" context="#pop" String="^######\s.*[#]?$"/> + <DetectChar attribute="Normal Text" context="#pop" char="#"/> + </context> + <context name="find-strong-normal" attribute="Normal Text" lineEndContext="#pop"> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;"/> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und2;"/> + <RegExpr attribute="Strong Text" context="#pop" minimal="true" String="&strongregex_ast;"/> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;"/> + <RegExpr attribute="Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;"/> + <DetectChar attribute="Normal Text" context="#pop" char="*"/> + </context> + <context name="find-emphasis-normal" attribute="Normal Text" lineEndContext="#pop"> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast;"/> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast2;"/> + <RegExpr attribute="Strong Text" context="#pop" minimal="true" String="&strongregex_und;"/> + <RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und;"/> + <RegExpr attribute="Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_und;"/> + <DetectChar attribute="Normal Text" context="#pop" char="_"/> + </context> + + <!-- Blockquote --> + <context name="blockquote" attribute="Blockquote: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop"> + <IncludeRules context="default-blockquote-1"/> + <!-- Find code block --> + <RegExpr attribute="Normal Text" context="#pop!find-code-block" String="&emptyline;" column="0"/> + <StringDetect attribute="Comment" context="#pop!find-code-block" String="&startcomment;" column="0" lookAhead="true"/> + <IncludeRules context="default-blockquote-2"/> + </context> + <!-- Blockquote within a list --> + <context name="blockquote-list" attribute="Blockquote: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop"> + <IncludeRules context="default-blockquote-1"/> + <!-- Don't find code block --> + <RegExpr attribute="Normal Text" context="#pop" String="&emptyline;" column="0"/> + <StringDetect attribute="Comment" context="#pop!comment" String="&startcomment;" firstNonSpace="true"/> + <IncludeRules context="default-blockquote-2"/> + </context> + + <context name="default-blockquote-1" attribute="Blockquote: Normal Text" lineEndContext="#stay"> + <DetectChar attribute="Blockquote" char=">" firstNonSpace="true"/> + <!-- End with header, horizontal rule or list/numlist --> + <RegExpr context="#pop" String="(?:\s*(?:&listbullet;|[\d]+\.)\s|#{1,6}\s|&rulerregex;)" column="0" lookAhead="true"/> + </context> + <context name="default-blockquote-2" attribute="Blockquote: Normal Text" lineEndContext="#stay"> + <!-- Strong, emphasis, strong-emphasis and strikethrough text --> + <AnyChar context="find-strong-emphasis-blockquote" String="*_" lookAhead="true"/> + <RegExpr attribute="Blockquote: Strikethrough Text" minimal="true" String="&strikeoutregex;"/> + <!-- Common --> <IncludeRules context="inc"/> + <RegExpr attribute="Blockquote: Link" String="&implicitlink;"/> + </context> + <context name="find-strong-emphasis-blockquote" attribute="Blockquote: Normal Text" lineEndContext="#pop"> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;"/> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast;"/> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und2;"/> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast2;"/> + <RegExpr attribute="Blockquote: Strong Text" context="#pop" minimal="true" String="&strongregex_ast;"/> + <RegExpr attribute="Blockquote: Strong Text" context="#pop" minimal="true" String="&strongregex_und;"/> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;"/> + <RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und;"/> + <RegExpr attribute="Blockquote: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;" /> + <RegExpr attribute="Blockquote: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_und;"/> + <AnyChar attribute="Blockquote: Normal Text" context="#pop" String="*_"/> + </context> + + <!-- List and Numbered List --> + <!-- NOTE: The indentation of the lists is captured. New paragraphs, code blocks, blockquotes or + horizontal rules must have an indentation equal to or greater than the list, to be part of it. --> + <!-- * list --> + <context name="list" attribute="List: Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="content-list"> + <!-- Find indented code blocks, blockquotes and horizontal rules --> + <RegExpr attribute="Code" String="%1%2\s&indentedcodeblock;" column="0" dynamic="true"/> + <RegExpr attribute="Blockquote" context="blockquote-list" String="%1%2\s+>" column="0" dynamic="true"/> + <RegExpr attribute="Horizontal Rule" String="%1%2\s+&rulerregex;" column="0" dynamic="true"/> + <RegExpr String="&emptyline;" column="0"/> + <!-- Text with the same indentation captured corresponds to the item list --> + <RegExpr context="content-list" String="%1%2\s" column="0" lookAhead="true" dynamic="true"/> + <!-- Finish when the text has a lower indentation than the list --> + <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/> + <!-- Highlight checkbox at the start of the item (task list) --> + <RegExpr attribute="List: Checkbox" context="content-list" String="\s*&checkbox;"/> </context> - <context attribute="numlist" lineEndContext="#stay" lineEmptyContext="#pop" name="numlist"> - <RegExpr attribute="nl-strong" String="&strongregex;"/> - <RegExpr attribute="nl-emphasis" String="&emphasisregex;"/> + <!-- 1. numlist (one digit) --> + <context name="numlist" attribute="List: Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="content-list"> + <!-- Find indented code blocks, blockquotes and horizontal rules --> + <RegExpr attribute="Code" String="%1%2\s{2}&indentedcodeblock;" column="0" dynamic="true"/> + <RegExpr attribute="Blockquote" context="blockquote-list" String="%1%2\s{2,}>" column="0" dynamic="true"/> + <RegExpr attribute="Horizontal Rule" String="%1%2\s{2,}&rulerregex;" column="0" dynamic="true"/> + <RegExpr String="&emptyline;" column="0"/> + <!-- Text with the same indentation captured --> + <RegExpr context="content-list" String="%1%2\s{2}" column="0" lookAhead="true" dynamic="true"/> + <!-- Finish when the text has a lower indentation than the list --> + <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/> + </context> + <!-- 10. numlist (two or more digits) --> + <context name="numlist2" attribute="List: Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="content-list"> + <!-- Find indented code blocks, blockquotes and horizontal rules --> + <RegExpr attribute="Code" String="%1%2\s{3}&indentedcodeblock;" column="0" dynamic="true"/> + <RegExpr attribute="Blockquote" context="blockquote-list" String="%1%2\s{3,}>" column="0" dynamic="true"/> + <RegExpr attribute="Horizontal Rule" String="%1%2\s{3,}&rulerregex;" column="0" dynamic="true"/> + <RegExpr String="&emptyline;" column="0"/> + <!-- Text with the same indentation captured --> + <RegExpr context="content-list" String="%1%2\s{3}" column="0" lookAhead="true" dynamic="true"/> + <!-- Finish when the text has a lower indentation than the list --> + <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/> + </context> + + <!-- NOTE: Empty lines, blockquotes and horizontal rules send to contexts "list", "numlist" or "numlist2" (#pop), + to check the indentation of the text and determine if the content of the list ends. --> + <context name="content-list" attribute="List: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop"> + <RegExpr context="#pop" String="&emptyline;" column="0"/> + <!-- Blockquote and horzontal rule (check indentation) --> + <RegExpr context="#pop" String="^\s*(?:>|&rulerregex;)" column="0" lookAhead="true"/> + <!-- End with header or new list/numlist --> + <RegExpr context="#pop#pop" String="(?:\s*(?:&listbullet;|[\d]+\.)\s|#{1,6}\s)" column="0" lookAhead="true"/> + <!-- Strong, emphasis, strong-emphasis and strikethrough text --> + <AnyChar context="find-strong-emphasis-list" String="*_" lookAhead="true"/> + <RegExpr attribute="List: Strikethrough Text" minimal="true" String="&strikeoutregex;"/> + <!-- Common --> <IncludeRules context="inc"/> + <RegExpr attribute="List: Link" String="&implicitlink;"/> </context> - <context attribute="comment" lineEndContext="#stay" name="comment"> - <RegExpr String="-->" attribute="comment" context="#pop" endRegion="comment"/> + <context name="find-strong-emphasis-list" attribute="List: Normal Text" lineEndContext="#pop"> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;"/> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast;"/> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und2;"/> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast2;"/> + <RegExpr attribute="List: Strong Text" context="#pop" minimal="true" String="&strongregex_ast;"/> + <RegExpr attribute="List: Strong Text" context="#pop" minimal="true" String="&strongregex_und;"/> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;"/> + <RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und;"/> + <RegExpr attribute="List: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;" /> + <RegExpr attribute="List: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_und;"/> + <AnyChar attribute="List: Normal Text" context="#pop" String="*_"/> </context> - <context attribute="code" lineEndContext="#stay" name="bash-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + + <!-- Comments --> + <context name="comment" attribute="Comment" lineEndContext="#stay"> + <StringDetect attribute="Comment" context="#pop" String="&endcomment;" endRegion="comment"/> + <IncludeRules context="##Alerts"/> + <IncludeRules context="##Modelines"/> + </context> + + <!-- Fenced Code Blocks --> + <context name="find-lang-fenced-code" attribute="Normal Text" lineEndContext="#pop"> + <!-- Apply syntax highlighting to fenced code blocks for some languages --> + <RegExpr attribute="Fenced Code" context="#pop!code" String="&fcode;&end;"/> + <RegExpr attribute="Fenced Code" context="#pop!bash-code" String="&fcode;\s*(?:bash(?:rc|_profile|_login|_logout)?|shell|sh|zsh|profile|PKGBUILD|APKBUILD|ebuild|eclass|nix)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!cpp-code" String="&fcode;\s*(?:[ch]pp|[ch]\+\+|[ch]xx|h?cc|hh|cuh?|ino|pde|moc)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!csharp-code" String="&fcode;\s*(?:cs|csharp|c\#)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!cmake-code" String="&fcode;\s*(?:cmake|CMakeLists(?:\.txt)?)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!css-code" String="&fcode;\s*css&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!c-code" String="&fcode;\s*[ch]&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!doxygen-code" String="&fcode;\s*doxygen&end;" insensitive="true"/> <!-- Block comment of Doxygen --> + <RegExpr attribute="Fenced Code" context="#pop!email-code" String="&fcode;\s*(?:email|emlx?|mbo?x)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!go-code" String="&fcode;\s*go(?:lang)?&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!hamlet-code" String="&fcode;\s*[wxs]?hamlet&end;" insensitive="true"/> <!-- Included in the Haskell definition --> + <RegExpr attribute="Fenced Code" context="#pop!haskell-code" String="&fcode;\s*(?:haskell|c?hs|hs\-boot)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!html-code" String="&fcode;\s*(?:[sx]?html?|inc|tmpl|tpl)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!java-code" String="&fcode;\s*(?:java|bsh)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!javascript-code" String="&fcode;\s*(?:javascript|m?js|es6|kwinscript|julius)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!jsx-code" String="&fcode;\s*(?:jsx|tsx|(?:java|type)script\-react)&end;" insensitive="true"/> <!-- Included in the HTML definition. Also apply for TSX. --> + <RegExpr attribute="Fenced Code" context="#pop!json-code" String="&fcode;\s*(?:json5?|gltf)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!matlab-code" String="&fcode;\s*matlab&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!markdown-code" String="&fcode;\s*(?:markdown|m?md)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!mustache-code" String="&fcode;\s*(?:handlebars|hbs|mustache|mst|ractive|hogan|hulk)&end;" insensitive="true"/> <!-- Included in the HTML definition --> + <RegExpr attribute="Fenced Code" context="#pop!perl-code" String="&fcode;\s*(?:perl|p[lm]|pod|psgi|vcl|perl6|p[lm]?6|nqp)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!php-code" String="&fcode;\s*(?:php[3457t]?|wml|phtml?|aw|ctp)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!python-code" String="&fcode;\s*(?:python[23]?|py[23w]?|[rc]py|sconstruct|gypi?)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!qml-code" String="&fcode;\s*qml(?:types)?&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!r-code" String="&fcode;\s*(?:r|rprofile|rscript)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!rest-code" String="&fcode;\s*(?:rst|rest|restructuredtext)&end;" insensitive="true"/> <!-- Included in the CMake definition --> + <RegExpr attribute="Fenced Code" context="#pop!ruby-code" String="&fcode;\s*(?:ruby|rbx?|rjs|rake|f?cgi|gemspec|irbrc|ru|prawn|Appraisals|(?:Rake|Cap|Chef|Gem|Guard|Hobo|Vagrant||Rant|Berks|Thor|Puppet)file|rxml|(?:xml|js)\.erb)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!rust-code" String="&fcode;\s*(?:rust|rs)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!mysql-code" String="&fcode;\s*(?:mysql|sql|ddl)&end;" insensitive="true"/> <!-- Included in the PHP definition --> + <RegExpr attribute="Fenced Code" context="#pop!typescript-code" String="&fcode;\s*(?:typescript|ts)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!xml-code" String="&fcode;\s*(?:xml|xsd|xspf|tld|jsp|c?pt|dtml|rss|opml|svg|daml|rdf|ui|kcfg|qrc|wsdl|scxml|xbel|dae|sch|brd|docbook)&end;" insensitive="true"/> + <RegExpr attribute="Fenced Code" context="#pop!code" String="&fcode;.*$"/> + </context> + <context name="code" attribute="Code" lineEndContext="#stay"> <!-- Unknown language --> + <RegExpr attribute="Fenced Code" context="#pop" String="%1[~`]*(?=&end;)" firstNonSpace="true" dynamic="true" endRegion="code-block"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="bash-code"> + <IncludeRules context="code"/> <IncludeRules context="##Bash" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="cmake-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="cmake-code"> + <IncludeRules context="code"/> <IncludeRules context="##CMake" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="cpp-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="c-code"> + <IncludeRules context="code"/> + <IncludeRules context="##C" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="cpp-code"> + <IncludeRules context="code"/> <IncludeRules context="##C++" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="css-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="csharp-code"> + <IncludeRules context="code"/> + <IncludeRules context="##C#" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="css-code"> + <IncludeRules context="code"/> <IncludeRules context="##CSS" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="email-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="doxygen-code"> + <IncludeRules context="code"/> + <IncludeRules context="BlockComment##Doxygen" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="email-code"> + <IncludeRules context="code"/> <IncludeRules context="##Email" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="haskell-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="go-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Go" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="hamlet-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Hamlet" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="haskell-code"> + <IncludeRules context="code"/> <IncludeRules context="##Haskell" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="html-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="html-code"> + <IncludeRules context="code"/> <IncludeRules context="##HTML" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="json-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="java-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Java" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="javascript-code"> + <IncludeRules context="code"/> + <IncludeRules context="Normal##JavaScript" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="jsx-code"> + <IncludeRules context="code"/> + <IncludeRules context="Normal##JavaScript React" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="json-code"> + <IncludeRules context="code"/> <IncludeRules context="##JSON" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="php-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="find-code-block" name="markdown-code"> + <IncludeRules context="code"/> + <IncludeRules context="Normal Text"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="matlab-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Matlab" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="mustache-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Mustache/Handlebars (HTML)" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="perl-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Perl" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="php-code"> + <IncludeRules context="code"/> <IncludeRules context="phpsource##PHP/PHP" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="python-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="python-code"> + <IncludeRules context="code"/> <IncludeRules context="##Python" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="qml-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="qml-code"> + <IncludeRules context="code"/> <IncludeRules context="##QML" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="rust-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="r-code"> + <IncludeRules context="code"/> + <IncludeRules context="##R Script" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="rest-code"> + <IncludeRules context="code"/> + <IncludeRules context="##reStructuredText" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="ruby-code"> + <IncludeRules context="code"/> + <IncludeRules context="##Ruby" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="rust-code"> + <IncludeRules context="code"/> <IncludeRules context="##Rust" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="xml-code"> - <WordDetect attribute="code" context="#pop" String="```"/> + <context attribute="Normal Text" lineEndContext="#stay" name="mysql-code"> + <IncludeRules context="code"/> + <IncludeRules context="##SQL (MySQL)" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="typescript-code"> + <IncludeRules context="code"/> + <IncludeRules context="Normal##TypeScript" includeAttrib="true"/> + </context> + <context attribute="Normal Text" lineEndContext="#stay" name="xml-code"> + <IncludeRules context="code"/> <IncludeRules context="##XML" includeAttrib="true"/> </context> - <context attribute="code" lineEndContext="#stay" name="code"> - <WordDetect attribute="code" context="#pop" String="```"/> - </context> - <context attribute="common" name="inc" lineEndContext="#stay"> - <RegExpr attribute="code" String="`[^`]+`"/> - <RegExpr context="comment" String="<!--" beginRegion="comment"/> - <RegExpr attribute="reflink" String="&reflinkregex;"/> - <RegExpr attribute="footnote" String="&footnoteregex;"/> - <RegExpr attribute="inlinelink" String="&inlinelinkregex;"/> - <RegExpr attribute="reflinktarget" String="&reflinktargetregex;"/> - <RegExpr attribute="inlineimage" String="&inlineimageregex;"/> - <RegExpr attribute="refimage" String="&refimageregex;"/> - <RegExpr attribute="autolink" String="&autolinkregex;"/> - <RegExpr attribute="mailtolink" String="&mailtolinkregex;"/> - <RegExpr attribute="strikeout" minimal="true" String="&strikeoutregex;"/> - <RegExpr attribute="linebreak" minimal="true" String="&linebreakregex;"/> - <WordDetect attribute="code" context="bash-code" String="```bash"/> - <WordDetect attribute="code" context="cmake-code" String="```cmake"/> - <WordDetect attribute="code" context="cpp-code" String="```cpp"/> - <WordDetect attribute="code" context="css-code" String="```css"/> - <WordDetect attribute="code" context="email-code" String="```email"/> - <WordDetect attribute="code" context="haskell-code" String="```haskell"/> - <WordDetect attribute="code" context="html-code" String="```html"/> - <WordDetect attribute="code" context="json-code" String="```json"/> - <WordDetect attribute="code" context="php-code" String="```php"/> - <WordDetect attribute="code" context="python-code" String="```python"/> - <WordDetect attribute="code" context="qml-code" String="```qml"/> - <WordDetect attribute="code" context="rust-code" String="```rust"/> - <WordDetect attribute="code" context="xml-code" String="```xml"/> - <StringDetect attribute="code" context="code" String="```"/> + + <!-- Common --> + <context name="inc" attribute="Normal Text" lineEndContext="#stay"> + <!-- Code --> + <RegExpr attribute="Code" String="`[^`]+`(?!`)"/> + <RegExpr attribute="Code" minimal="true" String="`{2}[^`](?:.*[^`])?`{2}(?!`)"/> + <RegExpr attribute="Code" minimal="true" String="`{3}[^`](?:.*[^`])?`{3}(?!`)"/> + <RegExpr attribute="Code" minimal="true" String="`{4}[^`](?:.*[^`])?`{4}(?!`)"/> + <RegExpr attribute="Code" minimal="true" String="`{5,}[^`](?:.*[^`])?`{5,}"/> + <!-- Find Fenced Code Block --> + <RegExpr attribute="Fenced Code" context="find-lang-fenced-code" String="`{3,}(?=[^`]*$)" firstNonSpace="true" lookAhead="true" beginRegion="code-block"/> + <RegExpr attribute="Fenced Code" context="find-lang-fenced-code" String="~{3,}(?=[^~]*$)" firstNonSpace="true" lookAhead="true" beginRegion="code-block"/> + <!-- Comment --> + <StringDetect attribute="Comment" context="comment" String="&startcomment;" beginRegion="comment"/> + <!-- Links and References --> + <RegExpr attribute="Reference-Link Target" context="reflinktarget" String="&reflinktargetregex;" firstNonSpace="true"/> + <RegExpr attribute="Footnote" String="&footnoteregex;"/> + <RegExpr attribute="Reference-Link" context="find-reflink" String="&reflinkregex;"/> + <RegExpr attribute="Inline Image" context="inlineimage" String="&inlineimageregex;"/> + <RegExpr attribute="Reference Image" String="&refimageregex;"/> + <RegExpr attribute="Auto-Link" context="autolink" String="&autolinkregex;" lookAhead="true"/> + <RegExpr attribute="Mailto-Link" context="mailtolink" String="&mailtolinkregex;"/> + <!-- Line Break --> + <RegExpr attribute="Line Break" minimal="true" String="&linebreakregex;"/> + <!-- Backslash Escapes --> + <Detect2Chars attribute="Backslash Escape" char="\" char1="\"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="`"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="*"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="_"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="{"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="}"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="["/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="]"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="("/> + <Detect2Chars attribute="Backslash Escape" char="\" char1=")"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="#"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="+"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="-"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="."/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="!"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="<"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1=">"/> + <Detect2Chars attribute="Backslash Escape" char="\" char1="&"/> + <!-- Inline HTML --> + <RegExpr attribute="EntityRef" String="&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&htmlname;);"/> + <RegExpr context="find-html-block" String="</?&htmlname;(?:[\s>]|/>|$)" lookAhead="true"/> + </context> + <context name="find-html-block" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <IncludeRules context="FindSpecialHTMLTags##HTML"/> + <IncludeRules context="FindHTMLTags##HTML"/> + </context> + + <!-- Links and email: <https://example.com>, <[email protected]> --> + <context name="autolink" attribute="Auto-Link" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <DetectChar attribute="Auto-Link" char="<"/> + <DetectChar attribute="Auto-Link" context="#pop" char=">"/> + <RegExpr attribute="Link" String="&startlink;[^">\s]+"/> + </context> + <context name="mailtolink" attribute="Email" lineEndContext="#pop"> + <DetectChar attribute="Mailto-Link" context="#pop" char=">"/> + </context> + + <!-- References: [example][id], [example](http://example.com) --> + <context name="find-reflink" attribute="Reference-Link Name" lineEndContext="#pop"> + <Detect2Chars attribute="Reference-Link Name" char="\" char1="]"/> + <RegExpr attribute="Reference-Link" context="#pop!find-reflink-id" String="\](?=&reflinkidregex;)"/> <!-- Find id --> + <DetectChar attribute="Reference-Link" context="#pop" char="]"/> + <!-- Image as link or reference --> + <RegExpr attribute="Inline Image" context="inlineimage" String="&startinlineimage;(?=&endinlineimage;&refchar;*\])"/> + <RegExpr attribute="Reference Image" String="&refimageregex;(?=&refchar;*\])"/> + <RegExpr attribute="Reference-Link Name" context="#stay" String="(?:\[(?:\\.|[^\[\]\\])*\](?:\\.|[^\[\]\\])*)+(?=\])" minimal="true"/> + </context> + <context name="find-reflink-id" attribute="Reference-Link" lineEndContext="#pop"> + <DetectSpaces /> + <!-- Ref.: [an example][id] "Optional title" --> + <DetectChar attribute="Reference-Link" context="#pop!reflink-id" char="["/> + <!-- Inline Ref.: [an example](http://example.com/ "Title") --> + <DetectChar attribute="Reference-Link" context="#pop!reflink-inline-id" char="("/> + </context> + <context name="reflink-inline-id" attribute="Reference-Link" lineEndContext="#pop"> + <Detect2Chars attribute="Reference-Link" char="\" char1=")"/> + <DetectChar attribute="Reference-Link" context="#pop" char=")"/> + <RegExpr attribute="Reference-Link: Link" String="\b&startlink;(?:\\.|[^">\s\)\\])+"/> + <RegExpr attribute="Reference-Link: Email" String="\b&email;\b"/> + </context> + <context name="reflink-id" attribute="Reference-Link ID" lineEndContext="#pop"> + <Detect2Chars attribute="Reference-Link ID" char="\" char1="]"/> + <DetectChar attribute="Reference-Link" context="#pop!reflink-title" char="]"/> + <RegExpr attribute="Reference-Link: Link" String="\b&startlink;(?:\\.|[^">\s\]\\])+"/> + </context> + <!-- [an example][id] "title" --> + <context name="reflink-title" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Reference-Link" context="#pop" String="\s+"(?:\\.|[^"\\])*""/> + </context> + + <!-- Target Ref.: [foo]: http://example.com/ "Optional Title Here" --> + <context name="reflinktarget" attribute="Reference-Link Target" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Reference-Link Target: Link" context="#pop!reflinktarget-title" String="\s*&link;(?=\s|$)"/> + <RegExpr attribute="Reference-Link Target" context="#pop!reflinktarget-link" String="\s*<(?=&link;>(?:\s|$))"/> + <RegExpr attribute="Reference-Link Target" context="#pop!reflinktarget-title" String="\s*#[\w\.\:\-]+\b"/> + </context> + <context name="reflinktarget-link" attribute="Reference-Link Target" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <DetectChar attribute="Reference-Link Target" context="#pop!reflinktarget-title" char=">"/> + <RegExpr attribute="Reference-Link Target: Link" String="&link;"/> + </context> + <context name="reflinktarget-title" attribute="Reference-Link Target" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> + <DetectSpaces attribute="Reference-Link Target"/> + <RegExpr attribute="Reference-Link Target" context="#pop" String=""(?:\\.|[^"\\])*""/> + <RegExpr attribute="Reference-Link Target" context="#pop" String="'(?:\\.|[^'\\])*'"/> + <RegExpr attribute="Reference-Link Target" context="#pop" String="\((?:\\.|[^\)\\])*\)"/> + </context> + + <!-- Image --> + <context name="inlineimage" attribute="Inline Image" lineEndContext="#pop"> + <DetectChar attribute="Inline Image" context="#pop" char=")"/> + <Detect2Chars attribute="Inline Image" char="\" char1=")"/> + <RegExpr attribute="Inline Image: Link" String="\b&startlink;(?:\\.|[^">\s\)\\])+"/> </context> </contexts> <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal"/> - <itemData name="common" defStyleNum="dsNormal"/> - <itemData name="strongemphasis" defStyleNum="dsNormal" italic="true" bold="true"/> - <itemData name="emphasis" defStyleNum="dsNormal" italic="true"/> - <itemData name="strong" defStyleNum="dsNormal" bold="true"/> - <itemData name="ruler" defStyleNum="dsNormal" bold="true"/> - <itemData name="strikeout" defStyleNum="dsNormal" strikeOut="true"/> - <itemData name="linebreak" defStyleNum="dsNormal" underline="true" color="#999999"/> - <itemData name="h1" defStyleNum="dsFunction" bold="true"/> - <itemData name="h2" defStyleNum="dsFunction" bold="true"/> - <itemData name="h3" defStyleNum="dsFunction" bold="true"/> - <itemData name="h4" defStyleNum="dsFunction" bold="true"/> - <itemData name="h5" defStyleNum="dsFunction" bold="true"/> - <itemData name="h6" defStyleNum="dsFunction" bold="true"/> - <itemData name="blockquote" defStyleNum="dsDataType"/> - <itemData name="bq-emphasis" defStyleNum="dsDataType" italic="true"/> - <itemData name="bq-strong" defStyleNum="dsDataType" bold="true"/> - <itemData name="bullet" defStyleNum="dsString"/> - <itemData name="bl-emphasis" defStyleNum="dsString" italic="true"/> - <itemData name="bl-strong" defStyleNum="dsString" bold="true"/> - <itemData name="numlist" defStyleNum="dsString"/> - <itemData name="nl-emphasis" defStyleNum="dsString" italic="true"/> - <itemData name="nl-strong" defStyleNum="dsString" bold="true"/> - <itemData name="comment" defStyleNum="dsComment"/> - <itemData name="code" defStyleNum="dsBaseN"/> - <itemData name="reflink" defStyleNum="dsOthers" underline="true"/> - <itemData name="inlinelink" defStyleNum="dsOthers" underline="true"/> - <itemData name="autolink" defStyleNum="dsOthers" underline="true"/> - <itemData name="mailtolink" defStyleNum="dsOthers" underline="true"/> - <itemData name="footnote" defStyleNum="dsOthers" italic="true"/> - <itemData name="meta" defStyleNum="dsComment"/> - <itemData name="reflinktarget" defStyleNum="dsOthers" italic="false" bold="false"/> - <itemData name="inlineimage" defStyleNum="dsAlert" italic="false" bold="false"/> - <itemData name="refimage" defStyleNum="dsAlert" italic="false" bold="false"/> + <itemData name="Emphasis Text" defStyleNum="dsNormal" italic="true"/> + <itemData name="Strong Text" defStyleNum="dsNormal" bold="true"/> + <itemData name="Strong-Emphasis Text" defStyleNum="dsNormal" italic="true" bold="true"/> + <itemData name="Strikethrough Text" defStyleNum="dsNormal" strikeOut="true"/> + <itemData name="Normal Text: Link" defStyleNum="dsNormal" underline="true" spellChecking="false"/> + <itemData name="Horizontal Rule" defStyleNum="dsNormal" bold="true" spellChecking="false"/> + <itemData name="Line Break" defStyleNum="dsNormal" underline="true" color="#999999" spellChecking="false"/> + <itemData name="Header H1" defStyleNum="dsFunction" bold="true"/> + <itemData name="Header H2" defStyleNum="dsFunction" bold="true"/> + <itemData name="Header H3" defStyleNum="dsFunction" bold="true"/> + <itemData name="Header H4" defStyleNum="dsFunction" bold="true"/> + <itemData name="Header H5" defStyleNum="dsFunction" bold="true"/> + <itemData name="Header H6" defStyleNum="dsFunction" bold="true"/> + <itemData name="Blockquote" defStyleNum="dsAttribute" spellChecking="false"/> + <itemData name="Blockquote: Normal Text" defStyleNum="dsAttribute"/> + <itemData name="Blockquote: Emphasis Text" defStyleNum="dsAttribute" italic="true"/> + <itemData name="Blockquote: Strong Text" defStyleNum="dsAttribute" bold="true"/> + <itemData name="Blockquote: Strong-Emphasis Text" defStyleNum="dsAttribute" italic="true" bold="true"/> + <itemData name="Blockquote: Strikethrough Text" defStyleNum="dsAttribute" strikeOut="true"/> + <itemData name="Blockquote: Link" defStyleNum="dsAttribute" underline="true" spellChecking="false"/> + <itemData name="List" defStyleNum="dsSpecialString" bold="1" spellChecking="false"/> + <itemData name="Number List" defStyleNum="dsSpecialString" spellChecking="false"/> + <itemData name="List: Normal Text" defStyleNum="dsNormal"/> + <itemData name="List: Emphasis Text" defStyleNum="dsNormal" italic="true"/> + <itemData name="List: Strong Text" defStyleNum="dsNormal" bold="true"/> + <itemData name="List: Strong-Emphasis Text" defStyleNum="dsNormal" italic="true" bold="true"/> + <itemData name="List: Strikethrough Text" defStyleNum="dsNormal" strikeOut="true"/> + <itemData name="List: Link" defStyleNum="dsNormal" underline="true" spellChecking="false"/> + <itemData name="List: Checkbox" defStyleNum="dsVariable" spellChecking="false"/> + <itemData name="Comment" defStyleNum="dsComment"/> + <itemData name="Code" defStyleNum="dsInformation"/> + <itemData name="Fenced Code" defStyleNum="dsInformation" spellChecking="false"/> + <itemData name="Auto-Link" defStyleNum="dsOthers" spellChecking="false"/> + <itemData name="Link" defStyleNum="dsOthers" underline="true" spellChecking="false"/> + <itemData name="Mailto-Link" defStyleNum="dsOthers" spellChecking="false"/> + <itemData name="Email" defStyleNum="dsOthers" italic="true" underline="true" spellChecking="false"/> + <itemData name="Footnote" defStyleNum="dsOthers" italic="true"/> + <itemData name="Reference-Link" defStyleNum="dsComment" italic="false"/> + <itemData name="Reference-Link Name" defStyleNum="dsOthers" underline="true" italic="false"/> + <itemData name="Reference-Link ID" defStyleNum="dsComment" italic="false"/> + <itemData name="Reference-Link: Link" defStyleNum="dsComment" underline="true" italic="false" spellChecking="false"/> + <itemData name="Reference-Link: Email" defStyleNum="dsComment" italic="true" underline="true" spellChecking="false"/> + <itemData name="Reference-Link Target" defStyleNum="dsOthers" italic="false" bold="false"/> + <itemData name="Reference-Link Target: Link" defStyleNum="dsOthers" underline="true" spellChecking="false"/> + <itemData name="Inline Image" defStyleNum="dsAlert" italic="false" bold="false"/> + <itemData name="Reference Image" defStyleNum="dsAlert" italic="false" bold="false"/> + <itemData name="Inline Image: Link" defStyleNum="dsAlert" italic="false" bold="false" underline="true"/> + <itemData name="Metadata Title" defStyleNum="dsAnnotation"/> + <itemData name="Metadata" defStyleNum="dsComment" italic="0"/> + <itemData name="Backslash Escape" defStyleNum="dsSpecialChar" spellChecking="false"/> + <itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false"/> </itemDatas> </highlighting> <general> + <keywords additionalDeliminator="`"/> <comments> - <comment name="multiLine" start="<!--" end="-->" region="comment"/> + <comment name="multiLine" start="&startcomment;" end="&endcomment;" region="comment"/> </comments> </general> </language> +<!-- kate: replace-tabs on; indent-width 2; tab-width 2; --> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl.xml index 0d1931649c5..c2d366d1f30 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="8" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm;*.pl6;*.PL6;*.p6;*.pm6;" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund ([email protected])" license="LGPLv2"> +<language name="Perl" version="9" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund ([email protected])" license="LGPLv2"> <highlighting> <list name="keywords"> <item>if</item> diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml new file mode 100644 index 00000000000..71ea0a80e81 --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/perl6.xml @@ -0,0 +1,1785 @@ +<?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 ([email protected])" 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/src/cli/kate-syntax-highlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/cli/kate-syntax-highlighter.cpp index 8334dd32e9d..92df89dc46e 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 @@ -32,7 +32,6 @@ #include <QCommandLineParser> #include <QCoreApplication> #include <QFile> -#include <QVector> #include <iostream> diff --git a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp index 3534cfde904..2a2ea0081ec 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/indexer/katehighlightingindexer.cpp @@ -24,7 +24,6 @@ #include <QCoreApplication> #include <QFile> #include <QFileInfo> -#include <QTextStream> #include <QVariant> #include <QXmlStreamReader> #include <QJsonDocument> @@ -59,6 +58,7 @@ QStringList readListing(const QString &fileName) if (xml.hasError()) { qWarning() << "XML error while reading" << fileName << " - " << qPrintable(xml.errorString()) << "@ offset" << xml.characterOffset(); + listing.clear(); } return listing; @@ -69,7 +69,7 @@ QStringList readListing(const QString &fileName) * @param extensions extensions string to check * @return valid? */ -bool checkExtensions(QString extensions) +bool checkExtensions(const QString &extensions) { // get list of extensions const QStringList extensionParts = extensions.split(QLatin1Char(';'), QString::SkipEmptyParts); @@ -163,6 +163,7 @@ bool checkSingleChars(const QString &hlFilename, QXmlStreamReader &xml) const QString c = xml.attributes().value(QLatin1String("char")).toString(); if (c.size() != 1) { qWarning() << hlFilename << "line" << xml.lineNumber() << "'char' must contain exactly one char:" << c; + return false; } } @@ -170,6 +171,7 @@ bool checkSingleChars(const QString &hlFilename, QXmlStreamReader &xml) const QString c = xml.attributes().value(QLatin1String("char1")).toString(); if (c.size() != 1) { qWarning() << hlFilename << "line" << xml.lineNumber() << "'char1' must contain exactly one char:" << c; + return false; } } @@ -285,6 +287,7 @@ public: const QString name = xml.attributes().value(QLatin1String("name")).toString(); if (m_existingNames.contains(name)) { qWarning() << m_filename << "list duplicate:" << name; + m_success = false; } m_existingNames.insert(name); } else if (xml.name() == QLatin1String("keyword")) { @@ -296,7 +299,7 @@ public: bool check() const { - bool success = true; + bool success = m_success; const auto invalidNames = m_usedNames - m_existingNames; if (!invalidNames.isEmpty()) { qWarning() << m_filename << "Reference of non-existing keyword list:" << invalidNames; @@ -306,6 +309,7 @@ public: const auto unusedNames = m_existingNames - m_usedNames; if (!unusedNames.isEmpty()) { qWarning() << m_filename << "Unused keyword lists:" << unusedNames; + success = false; } return success; @@ -315,14 +319,27 @@ private: QString m_filename; QSet<QString> m_usedNames; QSet<QString> m_existingNames; + bool m_success = true; }; /** - * Helper class to search for non-existing contexts + * Helper class to search for non-existing contexts and invalid version */ class ContextChecker { public: + void setKateVersion(const QStringRef &verStr, const QString &hlFilename, const QString &hlName) + { + const auto idx = verStr.indexOf(QLatin1Char('.')); + if (idx <= 0) { + qWarning() << hlFilename << "invalid kateversion" << verStr; + m_success = false; + } else { + auto &language = m_contextMap[hlName]; + language.version = {verStr.left(idx).toInt(), verStr.mid(idx + 1).toInt()}; + } + } + void processElement(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml) { if (xml.name() == QLatin1String("context")) { @@ -336,22 +353,28 @@ public: if (language.existingContextNames.contains(name)) { qWarning() << hlFilename << "Duplicate context:" << name; + m_success = false; } else { 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; } processContext(hlName, xml.attributes().value(QLatin1String("lineEndContext")).toString()); processContext(hlName, xml.attributes().value(QLatin1String("lineEmptyContext")).toString()); processContext(hlName, xml.attributes().value(QLatin1String("fallthroughContext")).toString()); + } else if (xml.name() == QLatin1String("include")) { + // <include> tag inside <list> + processVersion(hlFilename, hlName, xml, {5, 53}, QLatin1String("<include>")); } else { if (xml.attributes().hasAttribute(QLatin1String("context"))) { const QString context = xml.attributes().value(QLatin1String("context")).toString(); if (context.isEmpty()) { qWarning() << hlFilename << "Missing context name in line" << xml.lineNumber(); + m_success = false; } else { processContext(hlName, context); } @@ -361,7 +384,30 @@ public: bool check() const { - bool success = true; + bool success = m_success; + + // recursive search for the required miximal version + struct GetRequiredVersion + { + QHash<const Language*, Version> versionMap; + + Version operator()(const QHash<QString, Language> &contextMap, const Language &language) + { + auto& version = versionMap[&language]; + if (version < language.version) { + version = language.version; + for (auto &languageName : language.usedLanguageName) { + auto it = contextMap.find(languageName); + if (it != contextMap.end()) { + version = std::max(operator()(contextMap, *it), version); + } + } + } + return version; + }; + }; + GetRequiredVersion getRequiredVersion; + for (auto &language : m_contextMap) { const auto invalidContextNames = language.usedContextNames - language.existingContextNames; if (!invalidContextNames.isEmpty()) { @@ -374,6 +420,12 @@ public: qWarning() << language.hlFilename << "Unused contexts:" << unusedNames; success = false; } + + auto requiredVersion = getRequiredVersion(m_contextMap, language); + if (language.version < requiredVersion) { + qWarning().nospace() << language.hlFilename << " depends on a language in version " << requiredVersion.majorRevision << "." << requiredVersion.minorRevision << ". Please, increase kateversion."; + success = false; + } } return success; @@ -405,6 +457,7 @@ private: } else if (list.size() == 2) { // specific context of other language, e.g. Comment##ISO C++ m_contextMap[list[1]].usedContextNames.insert(list[0]); + m_contextMap[language].usedLanguageName.insert(list[1]); } return; } @@ -418,6 +471,34 @@ private: } private: + struct Version + { + int majorRevision; + int minorRevision; + + Version(int majorRevision = 0, int minorRevision = 0) + : majorRevision(majorRevision) + , minorRevision(minorRevision) + {} + + bool operator<(const Version &version) const + { + return majorRevision < version.majorRevision || (majorRevision == version.majorRevision && minorRevision < version.minorRevision); + } + }; + + void processVersion(const QString &hlFilename, const QString &hlName, QXmlStreamReader &xml, Version const& requiredVersion, QLatin1String item) + { + auto &language = m_contextMap[hlName]; + + if (language.version < requiredVersion) { + qWarning().nospace() << hlFilename << " " << item << " in line " << xml.lineNumber() << " is only available since version " << requiredVersion.majorRevision << "." << requiredVersion.minorRevision << ". Please, increase kateversion."; + // update the version to cancel future warnings + language.version = requiredVersion; + m_success = false; + } + } + class Language { public: @@ -435,6 +516,12 @@ private: // holds all existing context names QSet<QString> existingContextNames; + + // holds all existing language names + QSet<QString> usedLanguageName; + + // kateversion language attribute + Version version; }; /** @@ -442,6 +529,7 @@ private: * Example key: "Doxygen" */ QHash<QString, Language> m_contextMap; + bool m_success = true; }; /** @@ -461,6 +549,7 @@ public: if (!name.isEmpty()) { if (m_existingAttributeNames.contains(name)) { qWarning() << m_filename << "itemData duplicate:" << name; + m_success = false; } else { m_existingAttributeNames.insert(name); } @@ -469,6 +558,7 @@ public: const QString name = xml.attributes().value(QLatin1String("attribute")).toString(); if (name.isEmpty()) { qWarning() << m_filename << "specified attribute is empty:" << xml.name(); + m_success = false; } else { m_usedAttributeNames.insert(name); } @@ -477,7 +567,7 @@ public: bool check() const { - bool success = true; + bool success = m_success; const auto invalidNames = m_usedAttributeNames - m_existingAttributeNames; if (!invalidNames.isEmpty()) { qWarning() << m_filename << "Reference of non-existing itemData attributes:" << invalidNames; @@ -487,6 +577,7 @@ public: auto unusedNames = m_existingAttributeNames - m_usedAttributeNames; if (!unusedNames.isEmpty()) { qWarning() << m_filename << "Unused itemData:" << unusedNames; + success = false; } return success; @@ -496,6 +587,7 @@ private: QString m_filename; QSet<QString> m_usedAttributeNames; QSet<QString> m_existingAttributeNames; + bool m_success = true; }; } @@ -594,8 +686,11 @@ int main(int argc, char *argv[]) AttributeChecker attributeChecker(hlFilename); KeywordChecker keywordChecker(hlFilename); + const QString hlName = hl[QStringLiteral("name")].toString(); + contextChecker.setKateVersion(xml.attributes().value(QStringLiteral("kateversion")), hlFilename, hlName); + // scan for broken regex or keywords with spaces while (!xml.atEnd()) { xml.readNext(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt index 95bf4c349e5..9e95772f6e3 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/CMakeLists.txt @@ -69,6 +69,8 @@ if(BUILD_QCH) LINK_QCHS Qt5Core_QCH Qt5Gui_QCH + INCLUDE_DIRS + ${CMAKE_CURRENT_BINARY_DIR} BLANK_MACROS KSYNTAXHIGHLIGHTING_EXPORT KSYNTAXHIGHLIGHTING_DEPRECATED diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp index 9887b959d0c..9d5597e7d28 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/context.cpp @@ -61,10 +61,8 @@ void Context::load(QXmlStreamReader& reader) 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_fallthrough = Xml::attrToBool(reader.attributes().value(QStringLiteral("fallthrough"))); m_fallthroughContext.parse(reader.attributes().value(QStringLiteral("fallthroughContext"))); - if (m_fallthroughContext.isStay()) - m_fallthrough = false; + m_fallthrough = !m_fallthroughContext.isStay(); m_noIndentationBasedFolding = Xml::attrToBool(reader.attributes().value(QStringLiteral("noIndentationBasedFolding"))); reader.readNext(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp index ae95a6b235f..6a204dc3ac0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.cpp @@ -39,7 +39,6 @@ #include "xml_p.h" #include <QCoreApplication> -#include <QDebug> #include <QFile> #include <QHash> #include <QJsonObject> @@ -234,6 +233,19 @@ QStringList Definition::keywordList(const QString& name) const return list ? list->keywords() : QStringList(); } +bool Definition::setKeywordList(const QString& name, const QStringList& content) +{ + d->load(DefinitionData::OnlyKeywords(true)); + KeywordList* list = d->keywordList(name); + if (list) + { + list->setKeywordList(content); + return true; + } + else + return false; +} + QVector<Format> Definition::formats() const { d->load(); diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h index 6f0dba9a454..3ba5be9a7a2 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition.h @@ -26,9 +26,8 @@ #include "ksyntaxhighlighting_export.h" -#include <QTypeInfo> #include <QPair> - +#include <QVector> #include <memory> QT_BEGIN_NAMESPACE @@ -329,11 +328,29 @@ public: /** * Returns the list of keywords for the keyword list @p name. * @since 5.49 - * @see keywordLists() + * @see keywordLists(), setKeywordList() */ QStringList keywordList(const QString& name) const; /** + * Set the contents of the keyword list @p name to @p content. + * Only existing keywordLists() can be changed. For non-existent keyword lists, + * false is returned. + * + * Whenever you change a keyword list, make sure to trigger a rehighlight of + * your documents. In case you are using QSyntaxHighlighter via SyntaxHighlighter, + * this can be done by calling SyntaxHighlighter::rehighlight(). + * + * @note In general, changing keyword lists via setKeywordList() is discouraged, + * since if a keyword list name in the syntax highlighting definition + * file changes, the call setKeywordList() may suddenly fail. + * + * @see keywordList(), keywordLists() + * @since 5.62 + */ + bool setKeywordList(const QString& name, const QStringList& content); + + /** * Returns a list of all Format items used by this definition. * The order of the Format items equals the order of the itemDatas in the xml file. * @since 5.49 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 9bbf59691c1..c73ca86eb95 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definition_p.h @@ -101,7 +101,7 @@ public: QVector<QPair<QChar, QString>> characterEncodings; QString fileName; - QString name = QStringLiteral(QT_TRANSLATE_NOOP("Syntax highlighting", "None")); + QString name = QStringLiteral(QT_TRANSLATE_NOOP("Language", "None")); QString section; QString style; QString indenter; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp index 4c3e5f5f1e4..89a5952a3e4 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp @@ -27,7 +27,6 @@ #include "ksyntaxhighlighting_logging.h" #include "ksyntaxhighlighting_version.h" -#include <QDebug> #include <QDir> #include <QFile> #include <QNetworkAccessManager> diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp index d1808cafefc..3407fee9f3e 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.cpp @@ -30,7 +30,6 @@ #include "xml_p.h" #include <QColor> -#include <QDebug> #include <QMetaEnum> #include <QXmlStreamReader> @@ -207,6 +206,46 @@ bool Format::spellCheck() const return d->spellCheck; } +bool Format::hasBoldOverride() const +{ + return d->style.hasBold; +} + +bool Format::hasItalicOverride() const +{ + return d->style.hasItalic; +} + +bool Format::hasUnderlineOverride() const +{ + return d->style.hasUnderline; +} + +bool Format::hasStrikeThroughOverride() const +{ + return d->style.hasStrikeThrough; +} + +bool Format::hasTextColorOverride() const +{ + return d->style.textColor; +} + +bool Format::hasBackgroundColorOverride() const +{ + return d->style.backgroundColor; +} + +bool Format::hasSelectedTextColorOverride() const +{ + return d->style.selectedTextColor; +} + +bool Format::hasSelectedBackgroundColorOverride() const +{ + return d->style.selectedBackgroundColor; +} + void FormatPrivate::load(QXmlStreamReader& reader) { diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h index 24c58e73f65..7c1b9602bab 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/format.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/format.h @@ -28,7 +28,6 @@ #include "theme.h" #include <QExplicitlySharedDataPointer> -#include <QTypeInfo> QT_BEGIN_NAMESPACE class QColor; @@ -139,6 +138,70 @@ public: */ bool spellCheck() const; + /** Returns @c true if the syntax definition file sets a value for the bold text + * attribute and, therefore, overrides the theme and the default formatting + * style. If the return is @p true, this value is obtained by isBold(). + * @see isBold() + * @since 5.62 + */ + bool hasBoldOverride() const; + + /** Returns @c true if the syntax definition file sets a value for the italic text + * attribute and, therefore, overrides the theme and the default formatting style. + * If the return is @p true, this value is obtained by isItalic(). + * @see isItalic() + * @since 5.62 + */ + bool hasItalicOverride() const; + + /** Returns @c true if the syntax definition file sets a value for the underlined + * text attribute and, therefore, overrides the theme and the default formatting + * style. If the return is @p true, this value is obtained by isUnderline(). + * @see isUnderline() + * @since 5.62 + */ + bool hasUnderlineOverride() const; + + /** Returns @c true if the syntax definition file specifies a value for the + * struck through text attribute. If the return is @p true, this value + * is obtained by isStrikeThrough(). + * @see isStrikeThrough() + * @since 5.62 + */ + bool hasStrikeThroughOverride() const; + + /** Returns @c true if the syntax definition file sets a value for the foreground + * text color attribute and, therefore, overrides the theme and the default formatting + * style. If the return is @p true, this value is obtained by textColor(). + * @see textColor(), hasTextColor() + * @since 5.62 + */ + bool hasTextColorOverride() const; + + /** Returns @c true if the syntax definition file sets a value for the background + * color attribute and, therefore, overrides the theme and the default formatting + * style. If the return is @p true, this value is obtained by backgroundColor(). + * @see backgroundColor(), hasBackgroundColor() + * @since 5.62 + */ + bool hasBackgroundColorOverride() const; + + /** Returns @c true if the syntax definition file specifies a value for the + * selected text color attribute. If the return is @p true, this value is + * obtained by selectedTextColor(). + * @see selectedTextColor() + * @since 5.62 + */ + bool hasSelectedTextColorOverride() const; + + /** Returns @c true if the syntax definition file specifies a value for the + * selected background color attribute. If the return is @p true, this + * value is obtained by selectedBackgroundColor(). + * @see selectedBackgroundColor() + * @since 5.62 + */ + bool hasSelectedBackgroundColorOverride() const; + private: friend class FormatPrivate; QExplicitlySharedDataPointer<FormatPrivate> d; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp index 4ebd465b779..224fb72c34d 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/htmlhighlighter.cpp @@ -29,7 +29,6 @@ #include "theme.h" #include "ksyntaxhighlighting_logging.h" -#include <QDebug> #include <QFile> #include <QFileInfo> #include <QTextStream> diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp index f042baac27d..144ced2c00c 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist.cpp @@ -26,7 +26,6 @@ #include "definition_p.h" #include "ksyntaxhighlighting_logging.h" -#include <QDebug> #include <QXmlStreamReader> #include <algorithm> 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 25d0022dbef..f99a027823e 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h @@ -24,9 +24,8 @@ #ifndef KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H #define KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H -#include <QSet> #include <QString> -#include <QVector> +#include <QStringList> #include <vector> @@ -60,6 +59,14 @@ public: return m_keywords; } + void setKeywordList(const QStringList& keywords) + { + m_keywords = keywords; + m_keywordsSortedCaseSensitive.clear(); + m_keywordsSortedCaseInsensitive.clear(); + initLookupForCaseSensitivity(m_caseSensitive); + } + /** Checks if @p str is a keyword in this list. */ bool contains(const QStringRef &str) const { diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp index aaba9616dcf..c4e4889fa29 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/repository.cpp @@ -30,7 +30,6 @@ #include "ksyntaxhighlighting_logging.h" #include "wildcardmatcher_p.h" -#include <QDebug> #include <QDirIterator> #include <QFile> #include <QFileInfo> diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp index d9cf5eb2116..79b110d70a3 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule.cpp @@ -101,9 +101,6 @@ Definition Rule::definition() const void Rule::setDefinition(const Definition &def) { m_def = def; - - // cache for DefinitionData::wordDelimiters, is accessed VERY often - m_wordDelimiter = &DefinitionData::get(m_def.definition())->wordDelimiters; } bool Rule::load(QXmlStreamReader &reader) @@ -140,6 +137,9 @@ bool Rule::load(QXmlStreamReader &reader) void Rule::resolveContext() { m_context.resolve(m_def.definition()); + + // cache for DefinitionData::wordDelimiters, is accessed VERY often + m_wordDelimiter = &DefinitionData::get(m_def.definition())->wordDelimiters; } void Rule::resolveAttributeFormat(Context *lookupContext) @@ -612,8 +612,10 @@ MatchResult RegExpr::doMatch(const QString& text, int offset, const QStringList /** * no match + * the pattern of a dynamic regex depends on the previous contexts + * so that skipOffset cannot be computed */ - return MatchResult(offset, result.capturedStart()); + return MatchResult(offset, m_dynamic ? 0 : result.capturedStart()); } @@ -650,13 +652,17 @@ MatchResult WordDetect::doMatch(const QString& text, int offset, const QStringLi if (text.size() - offset < m_word.size()) return offset; - if (offset > 0 && !isWordDelimiter(text.at(offset - 1))) + /** + * detect delimiter characters on the inner and outer boundaries of the string + * NOTE: m_word isn't empty + */ + if (offset > 0 && !isWordDelimiter(text.at(offset - 1)) && !isWordDelimiter(text.at(offset))) return offset; 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()))) + if (text.size() == offset + m_word.size() || isWordDelimiter(text.at(offset + m_word.size())) || isWordDelimiter(text.at(offset + m_word.size() - 1))) return offset + m_word.size(); return offset; diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h index 538fdeda8a9..4ddee3cbfd9 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/rule_p.h @@ -34,7 +34,6 @@ #include <QRegularExpression> #include <QString> -#include <QVector> #include <memory> diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h index fce4bc71e8c..865589f28e6 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/state.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/state.h @@ -27,7 +27,6 @@ #include "ksyntaxhighlighting_export.h" #include <QExplicitlySharedDataPointer> -#include <QTypeInfo> namespace KSyntaxHighlighting { diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp index 4987dc95f08..89663d8af31 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp @@ -29,7 +29,6 @@ #include "state.h" #include "theme.h" -#include <QDebug> Q_DECLARE_METATYPE(QTextBlock) 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 40c5ef679ed..50980e0aa02 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/textstyledata_p.h @@ -24,7 +24,6 @@ #ifndef KSYNTAXHIGHLIGHTING_TEXTSTYLEDATA_P_H #define KSYNTAXHIGHLIGHTING_TEXTSTYLEDATA_P_H -#include <QColor> namespace KSyntaxHighlighting { diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp index eac9a92264a..9e9f7b913c0 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata.cpp @@ -32,7 +32,6 @@ #include <QJsonValue> #include <QMetaEnum> -#include <QDebug> using namespace KSyntaxHighlighting; diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp index e8b8186b505..2f1ae79b00e 100644 --- a/src/plugins/boot2qt/qdbdevice.cpp +++ b/src/plugins/boot2qt/qdbdevice.cpp @@ -251,7 +251,7 @@ public: QdbDeviceWizard(QWidget *parent) : QWizard(parent) { - setWindowTitle(QdbDeviceWizard::tr("Boot2Qt Network Device Setup")); + setWindowTitle(QdbDevice::tr("Boot2Qt Network Device Setup")); settingsPage.setCommitPage(true); enum { SettingsPageId }; diff --git a/src/plugins/boot2qt/qdbdevice.h b/src/plugins/boot2qt/qdbdevice.h index a0f6f9338f3..214db74a524 100644 --- a/src/plugins/boot2qt/qdbdevice.h +++ b/src/plugins/boot2qt/qdbdevice.h @@ -34,6 +34,8 @@ namespace Internal { class QdbDevice : public RemoteLinux::LinuxDevice { + Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbDevice) + public: typedef QSharedPointer<QdbDevice> Ptr; typedef QSharedPointer<const QdbDevice> ConstPtr; diff --git a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp index 72d55615567..c7e7d645aa8 100644 --- a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp +++ b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp @@ -106,7 +106,7 @@ void ConfigModelItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) { auto edit = static_cast<Utils::PathChooser *>(editor); if (edit->rawPath() != data.value) - model->setData(index, edit->fileName().toUserOutput(), Qt::EditRole); + model->setData(index, edit->fileName().toString(), Qt::EditRole); return; } else if (!data.values.isEmpty()) { auto edit = static_cast<QComboBox *>(editor); diff --git a/src/plugins/ctfvisualizer/ctfstatisticsmodel.h b/src/plugins/ctfvisualizer/ctfstatisticsmodel.h index 434d7c9c96b..32ae272173e 100644 --- a/src/plugins/ctfvisualizer/ctfstatisticsmodel.h +++ b/src/plugins/ctfvisualizer/ctfstatisticsmodel.h @@ -39,6 +39,7 @@ namespace Internal { class CtfStatisticsModel : public QAbstractTableModel { + Q_OBJECT public: enum Role { diff --git a/src/plugins/ctfvisualizer/ctftracemanager.cpp b/src/plugins/ctfvisualizer/ctftracemanager.cpp index 52859e08b14..157c565a32f 100644 --- a/src/plugins/ctfvisualizer/ctftracemanager.cpp +++ b/src/plugins/ctfvisualizer/ctftracemanager.cpp @@ -153,7 +153,7 @@ void CtfTraceManager::addEvent(const json &event) } } -void CtfVisualizer::Internal::CtfTraceManager::load(const QString &filename) +void CtfTraceManager::load(const QString &filename) { clearAll(); diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index b585980c3bc..983f0363f9c 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -99,8 +99,7 @@ GenericProjectPluginPrivate::GenericProjectPluginPrivate() genericProject->editFilesTriggered(); }); - - const auto removeDirAction = new QAction(tr("Remove Directory"), this); + const auto removeDirAction = new QAction(GenericProjectPlugin::tr("Remove Directory"), this); Command * const cmd = ActionManager::registerAction(removeDirAction, "GenericProject.RemoveDir", Context(PEC::C_PROJECT_TREE)); ActionManager::actionContainer(PEC::M_FOLDERCONTEXT)->addAction(cmd, PEC::G_FOLDER_OTHER); diff --git a/src/plugins/help/qlitehtml/container_qpainter.cpp b/src/plugins/help/qlitehtml/container_qpainter.cpp index 0e621648ddc..ebf6c095f41 100644 --- a/src/plugins/help/qlitehtml/container_qpainter.cpp +++ b/src/plugins/help/qlitehtml/container_qpainter.cpp @@ -1165,7 +1165,7 @@ void DocumentContainer::findText(const QString &text, return Selection::Element{e.element, e.index, fm.size(0, text.left(e.index)).width()}; }; - QString term = text; + QString term = QRegularExpression::escape(text); if (flags & QTextDocument::FindWholeWords) term = QString("\\b%1\\b").arg(term); const QRegularExpression::PatternOptions patternOptions diff --git a/src/plugins/ios/iosbuildstep.cpp b/src/plugins/ios/iosbuildstep.cpp index 2ca3db27437..bbcc3937f6c 100644 --- a/src/plugins/ios/iosbuildstep.cpp +++ b/src/plugins/ios/iosbuildstep.cpp @@ -79,14 +79,14 @@ public: : BuildStepConfigWidget(buildStep), m_buildStep(buildStep) { auto buildArgumentsLabel = new QLabel(this); - buildArgumentsLabel->setText(tr("Base arguments:")); + buildArgumentsLabel->setText(IosBuildStep::tr("Base arguments:")); m_buildArgumentsTextEdit = new QPlainTextEdit(this); m_buildArgumentsTextEdit->setPlainText(QtcProcess::joinArgs(m_buildStep->baseArguments())); m_resetDefaultsButton = new QPushButton(this); m_resetDefaultsButton->setLayoutDirection(Qt::RightToLeft); - m_resetDefaultsButton->setText(tr("Reset Defaults")); + m_resetDefaultsButton->setText(IosBuildStep::tr("Reset Defaults")); m_resetDefaultsButton->setEnabled(!m_buildStep->m_useDefaultArguments); auto extraArgumentsLabel = new QLabel(this); @@ -101,9 +101,9 @@ public: gridLayout->addWidget(extraArgumentsLabel, 2, 0, 1, 1); gridLayout->addWidget(m_extraArgumentsLineEdit, 2, 1, 1, 1); - extraArgumentsLabel->setText(tr("Extra arguments:")); + extraArgumentsLabel->setText(IosBuildStep::tr("Extra arguments:")); - setDisplayName(tr("iOS build", "iOS BuildStep display name.")); + setDisplayName(IosBuildStep::tr("iOS build", "iOS BuildStep display name.")); updateDetails(); diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 3757800a070..c036646c59e 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -377,7 +377,7 @@ void Client::activateDocument(TextEditor::TextDocument *document) for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(document)) { updateEditorToolBar(editor); if (auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor)) - textEditor->editorWidget()->addHoverHandler(hoverHandler()); + textEditor->editorWidget()->addHoverHandler(&m_hoverHandler); } } @@ -387,6 +387,10 @@ void Client::deactivateDocument(TextEditor::TextDocument *document) resetAssistProviders(document); if (TextEditor::SyntaxHighlighter *highlighter = document->syntaxHighlighter()) highlighter->clearAllExtraFormats(); + for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(document)) { + if (auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor)) + textEditor->editorWidget()->removeHoverHandler(&m_hoverHandler); + } } bool Client::documentOpen(TextEditor::TextDocument *document) const diff --git a/src/plugins/mcusupport/mcusupportconstants.h b/src/plugins/mcusupport/mcusupportconstants.h index 2cc5bee41a1..4643ed34758 100644 --- a/src/plugins/mcusupport/mcusupportconstants.h +++ b/src/plugins/mcusupport/mcusupportconstants.h @@ -34,6 +34,7 @@ const char DEVICE_ID[] = "McuSupport.Device"; const char MCUSUPPORT_QT_VERSION[] = "Qt4ProjectManager.QtVersion.McuSupport"; const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration"; const char SETTINGS_ID[] = "CC.McuSupport.Configuration"; +const char KIT_BOARD_VENDOR_KEY[] = "McuSupport.BoardVendor"; const char KIT_BOARD_MODEL_KEY[] = "McuSupport.BoardModel"; const char ENVVAR_ARMGCC_DIR[] = "ARMGCC_DIR"; diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 9cbd8a5a834..4352f49f1fd 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -198,10 +198,13 @@ void PackageOptions::updateStatus() m_statusLabel->setText(statusText); } -BoardOptions::BoardOptions(const QString &model, const QString &toolChainFileName, +BoardOptions::BoardOptions(const QString &vendor, const QString &model, + const QString &toolChainFileName, const QString &qulPlatform, const QVector<PackageOptions*> &packages) - : m_model(model) + : m_vendor(vendor) + , m_model(model) , m_toolChainFile(toolChainFileName) + , m_qulPlatform(qulPlatform) , m_packages(packages) { } @@ -216,11 +219,21 @@ QString BoardOptions::toolChainFile() const return m_toolChainFile; } +QString BoardOptions::qulPlatform() const +{ + return m_qulPlatform; +} + QVector<PackageOptions *> BoardOptions::packages() const { return m_packages; } +QString BoardOptions::vendor() const +{ + return m_vendor; +} + static PackageOptions *createQulPackage() { auto result = new PackageOptions( @@ -313,7 +326,8 @@ static PackageOptions *createSeggerJLinkPackage() { const QString defaultPath = Utils::HostOsInfo::isWindowsHost() ? - QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles")) + "/SEGGER/JLink" + QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles(x86)")) + + "/SEGGER/JLink" : QString("%{Env:SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH}"); auto result = new PackageOptions( PackageOptions::tr("SEGGER JLink"), @@ -342,15 +356,21 @@ McuSupportOptions::McuSupportOptions(QObject *parent) qulPackage}; auto nxpPackages = {armGccPackage, evkbImxrt1050SdkPackage, seggerJLinkPackage, qulPackage}; + auto desktopPackages = {qulPackage}; packages = {armGccPackage, stm32CubeFwF7SdkPackage, stm32CubeProgrammerPackage, evkbImxrt1050SdkPackage, seggerJLinkPackage, qulPackage}; - boards.append(new BoardOptions( - "stm32f7508", "CMake/stm32f7508-discovery.cmake", stmPackages)); - boards.append(new BoardOptions( - "stm32f769i", "CMake/stm32f769i-discovery.cmake", stmPackages)); - boards.append(new BoardOptions( - "evkbimxrt1050", "CMake/evkbimxrt1050-toolchain.cmake", nxpPackages)); + const QString vendorStm = "STM"; + const QString vendorNxp = "NXP"; + const QString vendorQt = "Qt"; + boards.append(new BoardOptions(vendorStm, + "stm32f7508", "CMake/stm32f7508-discovery.cmake", "", stmPackages)); + boards.append(new BoardOptions(vendorStm, + "stm32f769i", "CMake/stm32f769i-discovery.cmake", "", stmPackages)); + boards.append(new BoardOptions(vendorNxp, + "evkbimxrt1050", "CMake/evkbimxrt1050-toolchain.cmake", "", nxpPackages)); + boards.append(new BoardOptions(vendorQt, + "Desktop", "", "Qt", desktopPackages)); for (auto package : packages) connect(package, &PackageOptions::changed, [this](){ @@ -400,17 +420,24 @@ static ProjectExplorer::ToolChain* armGccToolchain(const Utils::FilePath &path, return toolChain; } +static bool isDesktop(const BoardOptions* board) +{ + return board->qulPlatform() == "Qt"; +} + static void setKitProperties(ProjectExplorer::Kit *k, const BoardOptions* board) { using namespace ProjectExplorer; - k->setUnexpandedDisplayName("Qt MCU - " + board->model()); + k->setUnexpandedDisplayName("QtMCU - " + board->model()); + k->setValue(Constants::KIT_BOARD_VENDOR_KEY, board->vendor()); k->setValue(Constants::KIT_BOARD_MODEL_KEY, board->model()); k->setAutoDetected(false); - k->setIrrelevantAspects({ - SysRootKitAspect::id(), - "QtSupport.QtInformation" // QtKitAspect::id() - }); + if (!isDesktop(board)) { + k->setIrrelevantAspects({SysRootKitAspect::id(), + "QtSupport.QtInformation" // QtKitAspect::id() + }); + } } static void setKitToolchains(ProjectExplorer::Kit *k, const QString &armGccPath) @@ -483,9 +510,18 @@ static void setKitCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* boar using namespace CMakeProjectManager; CMakeConfig config = CMakeConfigurationKitAspect::configuration(k); - config.append(CMakeConfigItem("CMAKE_TOOLCHAIN_FILE", - ("%{CurrentBuild:Env:Qul_DIR}/" + - board->toolChainFile()).toUtf8())); + if (!board->toolChainFile().isEmpty()) + config.append(CMakeConfigItem("CMAKE_TOOLCHAIN_FILE", + ("%{CurrentBuild:Env:Qul_DIR}/" + + board->toolChainFile()).toUtf8())); + if (!board->qulPlatform().isEmpty()) + config.append(CMakeConfigItem("QUL_PLATFORM", + board->qulPlatform().toUtf8())); + if (isDesktop(board)) { + config.append(CMakeConfigItem("CMAKE_PREFIX_PATH", "%{Qt:QT_INSTALL_PREFIX}")); + // TODO: Hack! Implement color depth variants of all targets + config.append(CMakeConfigItem("QUL_COLOR_DEPTH", "32")); + } CMakeConfigurationKitAspect::setConfiguration(k, config); if (Utils::HostOsInfo::isWindowsHost()) CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM"); @@ -504,9 +540,11 @@ ProjectExplorer::Kit *McuSupportOptions::kit(const BoardOptions* board) KitGuard kitGuard(k); setKitProperties(k, board); - setKitToolchains(k, armGccPath); - setKitDebugger(k, armGccPath); - setKitDevice(k); + if (!isDesktop(board)) { + setKitToolchains(k, armGccPath); + setKitDebugger(k, armGccPath); + setKitDevice(k); + } setKitEnvironment(k, board); setKitCMakeOptions(k, board); diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index 3df2d065aba..f7f2d84b390 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -101,16 +101,20 @@ class BoardOptions : public QObject Q_OBJECT public: - BoardOptions(const QString &model, const QString &toolChainFile, - const QVector<PackageOptions *> &packages); + BoardOptions(const QString &vendor, const QString &model, const QString &toolChainFile, + const QString &qulPlatform, const QVector<PackageOptions *> &packages); + QString vendor() const; QString model() const; QString toolChainFile() const; + QString qulPlatform() const; QVector<PackageOptions *> packages() const; private: + const QString m_vendor; const QString m_model; const QString m_toolChainFile; + const QString m_qulPlatform; const QVector<PackageOptions*> m_packages; }; diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp index 9057e2a054b..02c2044cf40 100644 --- a/src/plugins/mcusupport/mcusupportoptionspage.cpp +++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp @@ -108,14 +108,14 @@ void McuSupportOptionsWidget::updateStatus() { const QVector<BoardOptions*> validBoards = m_options->validBoards(); m_statusLabel->setText(validBoards.isEmpty() - ? McuSupportOptionsPage::tr("No devices and kits can currently be generated. " - "Select a board and provide the package paths. " - "Afterwards, press Apply to generate device and kit for " + ? McuSupportOptionsPage::tr("No kits can currently be generated. " + "Select a target and provide the package paths. " + "Afterwards, press Apply to generate a kit for " "your board.") - : McuSupportOptionsPage::tr("Devices and kits for the following boards can be generated: " + : McuSupportOptionsPage::tr("Kits for the following targets can be generated: " "%1 " - "Press Apply to generate device and kit for " - "your board.").arg(ulOfBoardModels(validBoards))); + "Press Apply to generate a kit for " + "your target.").arg(ulOfBoardModels(validBoards))); } void McuSupportOptionsWidget::showBoardPackages(int boardIndex) diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp index 4ec72227e16..83acc2035bf 100644 --- a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp +++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp @@ -49,37 +49,39 @@ static CommandLine flashAndRunCommand(Target *target) const CMakeProjectManager::CMakeTool *tool = CMakeProjectManager::CMakeKitAspect::cmakeTool(target->kit()); + // TODO: Hack! Implement flash target name handling, properly + const QString targetName = + target->kit()->value(Constants::KIT_BOARD_VENDOR_KEY).toString() == "NXP" + ? QString("flash_%1").arg(projectName) + : QString("flash_%1_and_bootloader").arg(projectName); + return CommandLine(tool->filePath(), { "--build", ".", "--target", - QString("flash_%1_and_bootloader").arg(projectName) + targetName }); } -class FlashAndRunConfiguration : public ProjectExplorer::RunConfiguration +FlashAndRunConfiguration::FlashAndRunConfiguration(Target *target, Core::Id id) + : RunConfiguration(target, id) { -public: - FlashAndRunConfiguration(Target *target, Core::Id id) - : RunConfiguration(target, id) - { - auto effectiveFlashAndRunCall = addAspect<BaseStringAspect>(); - effectiveFlashAndRunCall->setLabelText(tr("Effective flash and run call:")); - effectiveFlashAndRunCall->setDisplayStyle(BaseStringAspect::TextEditDisplay); - effectiveFlashAndRunCall->setReadOnly(true); + auto effectiveFlashAndRunCall = addAspect<BaseStringAspect>(); + effectiveFlashAndRunCall->setLabelText(tr("Effective flash and run call:")); + effectiveFlashAndRunCall->setDisplayStyle(BaseStringAspect::TextEditDisplay); - auto updateConfiguration = [target, effectiveFlashAndRunCall] { - effectiveFlashAndRunCall->setValue(flashAndRunCommand(target).toUserOutput()); - }; + auto updateConfiguration = [target, effectiveFlashAndRunCall] { + effectiveFlashAndRunCall->setValue(flashAndRunCommand(target).toUserOutput()); + }; - updateConfiguration(); + updateConfiguration(); - connect(target->activeBuildConfiguration(), &BuildConfiguration::buildDirectoryChanged, - this, updateConfiguration); - connect(target->project(), &Project::displayNameChanged, - this, updateConfiguration); - } -}; + connect(target->activeBuildConfiguration(), + &BuildConfiguration::buildDirectoryChanged, + this, + updateConfiguration); + connect(target->project(), &Project::displayNameChanged, this, updateConfiguration); +} class FlashAndRunWorker : public SimpleTargetRunner { diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.h b/src/plugins/mcusupport/mcusupportrunconfiguration.h index 2ab9c65380a..b53eea03a4a 100644 --- a/src/plugins/mcusupport/mcusupportrunconfiguration.h +++ b/src/plugins/mcusupport/mcusupportrunconfiguration.h @@ -37,6 +37,14 @@ public: EmrunRunConfigurationFactory(); }; +class FlashAndRunConfiguration : public ProjectExplorer::RunConfiguration +{ + Q_OBJECT + +public: + FlashAndRunConfiguration(ProjectExplorer::Target *target, Core::Id id); +}; + ProjectExplorer::RunWorkerFactory::WorkerCreator makeFlashAndRunWorker(); } // namespace Internal diff --git a/src/plugins/projectexplorer/environmentaspect.cpp b/src/plugins/projectexplorer/environmentaspect.cpp index a3c2cb4b23d..d34b32170fc 100644 --- a/src/plugins/projectexplorer/environmentaspect.cpp +++ b/src/plugins/projectexplorer/environmentaspect.cpp @@ -73,12 +73,20 @@ void EnvironmentAspect::setUserEnvironmentChanges(const Utils::EnvironmentItems Utils::Environment EnvironmentAspect::environment() const { - QTC_ASSERT(m_base >= 0 && m_base < m_baseEnvironments.size(), return Environment()); - Environment env = baseEnvironment(); + Environment env = modifiedBaseEnvironment(); env.modify(m_userChanges); return env; } +Environment EnvironmentAspect::modifiedBaseEnvironment() const +{ + QTC_ASSERT(m_base >= 0 && m_base < m_baseEnvironments.size(), return Environment()); + Environment env = m_baseEnvironments.at(m_base).unmodifiedBaseEnvironment(); + for (const EnvironmentModifier &modifier : m_modifiers) + modifier(env); + return env; +} + const QStringList EnvironmentAspect::displayNames() const { return Utils::transform(m_baseEnvironments, &BaseEnvironment::displayName); @@ -122,15 +130,6 @@ void EnvironmentAspect::toMap(QVariantMap &data) const data.insert(QLatin1String(CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userChanges)); } -Environment EnvironmentAspect::baseEnvironment() const -{ - QTC_ASSERT(m_base >= 0 && m_base < m_baseEnvironments.size(), return Environment()); - Environment env = m_baseEnvironments.at(m_base).unmodifiedBaseEnvironment(); - for (const EnvironmentModifier &modifier : m_modifiers) - modifier(env); - return env; -} - QString EnvironmentAspect::currentDisplayName() const { QTC_ASSERT(m_base >= 0 && m_base < m_baseEnvironments.size(), return {}); diff --git a/src/plugins/projectexplorer/environmentaspect.h b/src/plugins/projectexplorer/environmentaspect.h index 5b73f93e631..f79f9e29738 100644 --- a/src/plugins/projectexplorer/environmentaspect.h +++ b/src/plugins/projectexplorer/environmentaspect.h @@ -46,6 +46,9 @@ public: // The environment including the user's modifications. Utils::Environment environment() const; + // Environment including modifiers, but without explicit user changes. + Utils::Environment modifiedBaseEnvironment() const; + int baseEnvironmentBase() const; void setBaseEnvironmentBase(int base); @@ -57,8 +60,6 @@ public: void addPreferredBaseEnvironment(const QString &displayName, const std::function<Utils::Environment()> &getter); - // The environment the user chose as base for his modifications. - Utils::Environment baseEnvironment() const; QString currentDisplayName() const; const QStringList displayNames() const; diff --git a/src/plugins/projectexplorer/environmentaspectwidget.cpp b/src/plugins/projectexplorer/environmentaspectwidget.cpp index d287f3b771f..280cc5ac9da 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.cpp +++ b/src/plugins/projectexplorer/environmentaspectwidget.cpp @@ -75,7 +75,7 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWid const EnvironmentWidget::Type widgetType = aspect->isLocal() ? EnvironmentWidget::TypeLocal : EnvironmentWidget::TypeRemote; m_environmentWidget = new EnvironmentWidget(this, widgetType, baseEnvironmentWidget); - m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); + m_environmentWidget->setBaseEnvironment(m_aspect->modifiedBaseEnvironment()); m_environmentWidget->setBaseEnvironmentText(m_aspect->currentDisplayName()); m_environmentWidget->setUserChanges(m_aspect->userEnvironmentChanges()); m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -106,7 +106,7 @@ void EnvironmentAspectWidget::baseEnvironmentSelected(int idx) { m_ignoreChange = true; m_aspect->setBaseEnvironmentBase(idx); - m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); + m_environmentWidget->setBaseEnvironment(m_aspect->modifiedBaseEnvironment()); m_environmentWidget->setBaseEnvironmentText(m_aspect->currentDisplayName()); m_ignoreChange = false; } @@ -122,7 +122,7 @@ void EnvironmentAspectWidget::changeBaseEnvironment() m_baseEnvironmentComboBox->setCurrentIndex(i); } m_environmentWidget->setBaseEnvironmentText(m_aspect->currentDisplayName()); - m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); + m_environmentWidget->setBaseEnvironment(m_aspect->modifiedBaseEnvironment()); } void EnvironmentAspectWidget::userChangesEdited() @@ -143,7 +143,7 @@ void EnvironmentAspectWidget::environmentChanged() { if (m_ignoreChange) return; - m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment()); + m_environmentWidget->setBaseEnvironment(m_aspect->modifiedBaseEnvironment()); } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 8d74b3f6484..37e1a97168d 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -499,9 +499,10 @@ public: class TreeView : public QTreeView { public: - TreeView(QWidget *parent) + TreeView(QWidget *parent, const QString &name) : QTreeView(parent) { + setObjectName(name); header()->hide(); setMouseTracking(true); // To enable hover. setIndentation(0); @@ -559,13 +560,13 @@ public: recentProjectsLabel->setFont(sizedFont(16, this)); recentProjectsLabel->setText(ProjectWelcomePage::tr("Projects")); - auto sessionsList = new TreeView(this); + auto sessionsList = new TreeView(this, "Sessions"); sessionsList->setModel(projectWelcomePage->m_sessionModel); sessionsList->header()->setSectionHidden(1, true); // The "last modified" column. sessionsList->setItemDelegate(&m_sessionDelegate); sessionsList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - auto projectsList = new TreeView(this); + auto projectsList = new TreeView(this, "Recent Projects"); projectsList->setUniformRowHeights(true); projectsList->setModel(projectWelcomePage->m_projectModel); projectsList->setItemDelegate(&m_projectDelegate); diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 938b6decc59..f8a0da25e71 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -408,9 +408,13 @@ void Target::addRunConfiguration(RunConfiguration *rc) // Check that we don't have a configuration with the same displayName QString configurationDisplayName = rc->displayName(); - QStringList displayNames = Utils::transform(d->m_runConfigurations, &RunConfiguration::displayName); - configurationDisplayName = Utils::makeUniquelyNumbered(configurationDisplayName, displayNames); - rc->setDisplayName(configurationDisplayName); + if (!configurationDisplayName.isEmpty()) { + QStringList displayNames = Utils::transform(d->m_runConfigurations, + &RunConfiguration::displayName); + configurationDisplayName = Utils::makeUniquelyNumbered(configurationDisplayName, + displayNames); + rc->setDisplayName(configurationDisplayName); + } d->m_runConfigurations.push_back(rc); diff --git a/src/plugins/python/python.qbs b/src/plugins/python/python.qbs index 9fd37a47777..6d14917bc3d 100644 --- a/src/plugins/python/python.qbs +++ b/src/plugins/python/python.qbs @@ -10,6 +10,7 @@ QtcPlugin { Depends { name: "TextEditor" } Depends { name: "ProjectExplorer" } Depends { name: "LanguageClient" } + Depends { name: "LanguageServerProtocol" } Group { name: "General" diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index ab5f024765c..567d7735118 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -62,9 +62,9 @@ public: , m_executable(new Utils::PathChooser()) { auto mainLayout = new QGridLayout(); - mainLayout->addWidget(new QLabel(tr("Name:")), 0, 0); + mainLayout->addWidget(new QLabel(PythonSettings::tr("Name:")), 0, 0); mainLayout->addWidget(m_name, 0, 1); - mainLayout->addWidget(new QLabel(tr("Executable")), 1, 0); + mainLayout->addWidget(new QLabel(PythonSettings::tr("Executable")), 1, 0); mainLayout->addWidget(m_executable, 1, 1); m_executable->setExpectedKind(Utils::PathChooser::ExistingCommand); setLayout(mainLayout); @@ -138,12 +138,12 @@ InterpreterOptionsWidget::InterpreterOptionsWidget(const QList<Interpreter> &int this, &InterpreterOptionsWidget::currentChanged); auto buttonLayout = new QVBoxLayout(); - auto addButton = new QPushButton(InterpreterOptionsWidget::tr("&Add")); + auto addButton = new QPushButton(PythonSettings::tr("&Add")); connect(addButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::addItem); - m_deleteButton = new QPushButton(InterpreterOptionsWidget::tr("&Delete")); + m_deleteButton = new QPushButton(PythonSettings::tr("&Delete")); m_deleteButton->setEnabled(false); connect(m_deleteButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::deleteItem); - m_makeDefaultButton = new QPushButton(InterpreterOptionsWidget::tr("&Make Default")); + m_makeDefaultButton = new QPushButton(PythonSettings::tr("&Make Default")); m_makeDefaultButton->setEnabled(false); connect(m_makeDefaultButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::makeDefault); mainLayout->addLayout(layout); @@ -230,9 +230,9 @@ private: InterpreterOptionsPage::InterpreterOptionsPage() { setId(Constants::C_PYTHONOPTIONS_PAGE_ID); - setDisplayName(tr("Interpreters")); + setDisplayName(PythonSettings::tr("Interpreters")); setCategory(Constants::C_PYTHON_SETTINGS_CATEGORY); - setDisplayCategory(tr("Python")); + setDisplayCategory(PythonSettings::tr("Python")); setCategoryIcon(Utils::Icon({{":/python/images/settingscategory_python.png", Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint)); } @@ -385,7 +385,7 @@ static void addPythonsFromRegistry(QList<Interpreter> &pythons) const FilePath &executable = FilePath::fromUserInput(regVal.toString()); if (executable.exists() && !alreadyRegistered(pythons, executable)) { pythons << Interpreter{QUuid::createUuid().toString(), - name + InterpreterOptionsPage::tr(" (Windowed)"), + name + PythonSettings::tr(" (Windowed)"), FilePath::fromUserInput(regVal.toString())}; } } diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index d0ea258853a..648d4c3e8ee 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -355,7 +355,7 @@ void QbsInstallStepConfigWidget::updateState() m_commandLineTextEdit->setPlainText(command); - setSummaryText(tr("<b>Qbs:</b> %1").arg(command)); + setSummaryText(QbsInstallStep::tr("<b>Qbs:</b> %1").arg(command)); } // -------------------------------------------------------------------- diff --git a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp index 8a935970c04..7cc1d9d7124 100644 --- a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp +++ b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp @@ -84,7 +84,7 @@ protected: bool visit(AST::UiPublicMember *node) override { - if (node->memberType->name == m_typeName){ + if (node->memberType && node->memberType->name == m_typeName){ const ObjectValue * objectValue = m_context->lookupType(m_document.data(), QStringList(m_typeName)); if (objectValue == m_typeValue) m_implemenations.append(node->typeToken); diff --git a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp index d6ef557388c..297e815b956 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp @@ -109,7 +109,7 @@ void AlignDistribute::setModelNodeBackend(const QVariant &modelNodeBackend) // The purpose of this function is to suppress the following warning: // Warning: Property declaration modelNodeBackendProperty has no READ accessor // function or associated MEMBER variable. The property will be invalid. -QVariant AlignDistribute::getModelNodeBackend() const +QVariant AlignDistribute::modelNodeBackend() const { return {}; } diff --git a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.h b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.h index 1b2714f7503..9fbbab4b068 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.h +++ b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.h @@ -44,7 +44,7 @@ class AlignDistribute : public QObject Q_PROPERTY(bool selectionContainsRootItem READ selectionContainsRootItem NOTIFY modelNodeBackendChanged) - Q_PROPERTY(QVariant modelNodeBackendProperty READ getModelNodeBackend WRITE setModelNodeBackend + Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) public: @@ -68,7 +68,6 @@ public: bool selectionContainsRootItem() const; void setModelNodeBackend(const QVariant &modelNodeBackend); - QVariant getModelNodeBackend() const; static void registerDeclarativeType(); @@ -84,6 +83,9 @@ signals: void modelNodeBackendChanged(); private: + QVariant modelNodeBackend() const; + +private: using CompareFunction = std::function<bool(const ModelNode &, const ModelNode &)>; CompareFunction getCompareFunction(Target target) const; diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h index 5a8de860c2f..2e549b52b1e 100644 --- a/src/plugins/qmldesigner/designercore/include/abstractview.h +++ b/src/plugins/qmldesigner/designercore/include/abstractview.h @@ -164,6 +164,7 @@ public: bool hasModelNodeForInternalId(qint32 internalId) const; QList<ModelNode> allModelNodes() const; + QList<ModelNode> allModelNodesOfType(const TypeName &typeName) const; void emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings = QList<DocumentMessage>()); void emitDocumentMessage(const QString &error); diff --git a/src/plugins/qmldesigner/designercore/include/modelnode.h b/src/plugins/qmldesigner/designercore/include/modelnode.h index 9dd636be625..7f943dddd1c 100644 --- a/src/plugins/qmldesigner/designercore/include/modelnode.h +++ b/src/plugins/qmldesigner/designercore/include/modelnode.h @@ -107,6 +107,8 @@ public: bool hasParentProperty() const; const QList<ModelNode> directSubModelNodes() const; + const QList<ModelNode> directSubModelNodesOfType(const TypeName &typeName) const; + const QList<ModelNode> allSubModelNodes() const; const QList<ModelNode> allSubModelNodesAndThisNode() const; bool hasAnySubModelNodes() const; diff --git a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h index 0c6693f5059..c075483c2c8 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h @@ -57,14 +57,7 @@ public: const QPointF &position, QmlItemNode parentQmlItemNode); - static QmlObjectNode createQmlObjectNode(AbstractView *view, - const ItemLibraryEntry &itemLibraryEntry, - const QPointF &position, - QmlItemNode parentQmlItemNode); - static QmlObjectNode createQmlObjectNode(AbstractView *view, - const ItemLibraryEntry &itemLibraryEntry, - const QPointF &position, - NodeAbstractProperty parentproperty); + static QmlItemNode createQmlItemNodeFromImage(AbstractView *view, const QString &imageName, const QPointF &position, diff --git a/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h b/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h index 49785d0398b..3150ad61e23 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h @@ -33,6 +33,7 @@ #include <QStringList> #include <QRectF> #include <QTransform> +#include <QVector3D> namespace QmlDesigner { @@ -44,6 +45,26 @@ class QMLDESIGNERCORE_EXPORT QmlVisualNode : public QmlObjectNode { friend class QmlAnchors; public: + + class Position + { + friend class QmlVisualNode; + public: + Position() {} + Position(const QPointF &position) : + m_2dPos(position) + {} + Position(const QVector3D &position) : + m_3dPos(position) + {} + + QList<QPair<PropertyName, QVariant>> propertyPairList() const; + + private: + QPointF m_2dPos; + QVector3D m_3dPos; + }; + QmlVisualNode() : QmlObjectNode() {} QmlVisualNode(const ModelNode &modelNode) : QmlObjectNode(modelNode) {} bool isValid() const override; @@ -64,7 +85,31 @@ public: void setVisibilityOverride(bool visible); bool visibilityOverride() const; + void initializePosition(const Position &position); + static bool isItemOr3DNode(const ModelNode &modelNode); + + static QmlObjectNode createQmlObjectNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const Position &position, + QmlVisualNode parentQmlItemNode); + + + + + static QmlObjectNode createQmlObjectNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const Position &position, + NodeAbstractProperty parentproperty); + + static QmlVisualNode createQmlVisualNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const QVector3D &position); + + static NodeListProperty findSceneNodeProperty(AbstractView *view); + +private: + void setDoubleProperty(const PropertyName &name, double value); }; QMLDESIGNERCORE_EXPORT uint qHash(const QmlItemNode &node); diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index eb7ed16b9ab..f5e07d9f834 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -39,6 +39,7 @@ #include <coreplugin/helpmanager.h> #include <utils/qtcassert.h> +#include <utils/algorithm.h> #include <QRegExp> @@ -635,6 +636,13 @@ QList<ModelNode> AbstractView::allModelNodes() const return toModelNodeList(model()->d->allNodes()); } +QList<ModelNode> AbstractView::allModelNodesOfType(const TypeName &typeName) const +{ + return Utils::filtered(allModelNodes(), [typeName](const ModelNode &node){ + return node.metaInfo().isValid() && node.metaInfo().isSubclassOf(typeName); + }); +} + void AbstractView::emitDocumentMessage(const QString &error) { emitDocumentMessage({DocumentMessage(error)}); diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 14ca4a67bfe..1fdc29aaa03 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -42,6 +42,8 @@ #include "nodeproperty.h" #include <rewriterview.h> +#include <utils/algorithm.h> + #include <QHash> #include <QRegExp> #include <QSet> @@ -775,6 +777,13 @@ const QList<ModelNode> ModelNode::directSubModelNodes() const return toModelNodeList(internalNode()->allDirectSubNodes(), view()); } +const QList<ModelNode> ModelNode::directSubModelNodesOfType(const TypeName &typeName) const +{ + return Utils::filtered(directSubModelNodes(), [typeName](const ModelNode &node){ + return node.metaInfo().isValid() && node.metaInfo().isSubclassOf(typeName); + }); +} + /*! \brief returns all ModelNodes that are direct or indirect children of this ModelNode diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index 2fc530ff10d..c65a57d34f0 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -93,75 +93,6 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, return QmlItemNode(createQmlObjectNode(view, itemLibraryEntry, position, parentQmlItemNode)); } -QmlObjectNode QmlItemNode::createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentQmlItemNode) -{ - if (!parentQmlItemNode.isValid()) - parentQmlItemNode = QmlItemNode(view->rootModelNode()); - - Q_ASSERT(parentQmlItemNode.isValid()); - - NodeAbstractProperty parentProperty = parentQmlItemNode.defaultNodeAbstractProperty(); - - return QmlItemNode::createQmlObjectNode(view, itemLibraryEntry, position, parentProperty); -} - -QmlObjectNode QmlItemNode::createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, NodeAbstractProperty parentproperty) -{ - QmlObjectNode newQmlObjectNode; - - view->executeInTransaction("QmlItemNode::createQmlItemNode", [=, &newQmlObjectNode, &parentproperty](){ - NodeMetaInfo metaInfo = view->model()->metaInfo(itemLibraryEntry.typeName()); - - int minorVersion = metaInfo.minorVersion(); - int majorVersion = metaInfo.majorVersion(); - - using PropertyBindingEntry = QPair<PropertyName, QString>; - QList<PropertyBindingEntry> propertyBindingList; - QList<PropertyBindingEntry> propertyEnumList; - if (itemLibraryEntry.qmlSource().isEmpty()) { - QList<QPair<PropertyName, QVariant> > propertyPairList; - if (!position.isNull()) { - propertyPairList.append({PropertyName("x"), QVariant(qRound(position.x()))}); - propertyPairList.append({PropertyName("y"), QVariant(qRound(position.y()))}); - } - - for (const auto &property : itemLibraryEntry.properties()) { - if (property.type() == QStringLiteral("binding")) { - propertyBindingList.append(PropertyBindingEntry(property.name(), property.value().toString())); - } else if (property.type() == QStringLiteral("enum")) { - propertyEnumList.append(PropertyBindingEntry(property.name(), property.value().toString())); - } else { - propertyPairList.append({property.name(), property.value()}); - } - } - - newQmlObjectNode = QmlItemNode(view->createModelNode(itemLibraryEntry.typeName(), majorVersion, minorVersion, propertyPairList)); - } else { - newQmlObjectNode = createQmlItemNodeFromSource(view, itemLibraryEntry.qmlSource(), position); - } - - if (parentproperty.isValid()) - parentproperty.reparentHere(newQmlObjectNode); - - if (!newQmlObjectNode.isValid()) - return; - - newQmlObjectNode.setId(view->generateNewId(itemLibraryEntry.name())); - - for (const auto &propertyBindingEntry : propertyBindingList) - newQmlObjectNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second); - - for (const auto &propertyBindingEntry : propertyEnumList) - newQmlObjectNode.modelNode().variantProperty(propertyBindingEntry.first).setEnumeration(propertyBindingEntry.second.toUtf8()); - - Q_ASSERT(newQmlObjectNode.isValid()); - }); - - Q_ASSERT(newQmlObjectNode.isValid()); - - return newQmlObjectNode; -} - QmlItemNode QmlItemNode::createQmlItemNodeFromImage(AbstractView *view, const QString &imageName, const QPointF &position, QmlItemNode parentQmlItemNode) { if (!parentQmlItemNode.isValid()) diff --git a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp index d0598e844ed..e9977d5c98c 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp @@ -39,6 +39,8 @@ #include "modelmerger.h" #include "rewritingexception.h" +#include <utils/qtcassert.h> + #include <QUrl> #include <QPlainTextEdit> #include <QFileInfo> @@ -74,7 +76,6 @@ bool QmlVisualNode::isRootNode() const return modelNode().isValid() && modelNode().isRootNode(); } - QList<QmlVisualNode> QmlVisualNode::children() const { QList<ModelNode> childrenList; @@ -166,6 +167,23 @@ bool QmlVisualNode::visibilityOverride() const return false; } +void QmlVisualNode::setDoubleProperty(const PropertyName &name, double value) +{ + modelNode().variantProperty(name).setValue(value); +} + +void QmlVisualNode::initializePosition(const QmlVisualNode::Position &position) +{ + if (!position.m_2dPos.isNull()) { + setDoubleProperty("x", qRound(position.m_2dPos.x())); + setDoubleProperty("y", qRound(position.m_2dPos.y())); + } else if (!position.m_3dPos.isNull()) { + setDoubleProperty("x", position.m_3dPos.x()); + setDoubleProperty("y", position.m_3dPos.y()); + setDoubleProperty("z", position.m_3dPos.z()); + } +} + QmlModelStateGroup QmlVisualNode::states() const { if (isValid()) @@ -174,6 +192,131 @@ QmlModelStateGroup QmlVisualNode::states() const return QmlModelStateGroup(); } +QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const Position &position, + QmlVisualNode parentQmlItemNode) +{ + if (!parentQmlItemNode.isValid()) + parentQmlItemNode = QmlVisualNode(view->rootModelNode()); + + Q_ASSERT(parentQmlItemNode.isValid()); + + NodeAbstractProperty parentProperty = parentQmlItemNode.defaultNodeAbstractProperty(); + + return QmlItemNode::createQmlObjectNode(view, itemLibraryEntry, position, parentProperty); +} + + +static QmlObjectNode createQmlObjectNodeFromSource(AbstractView *view, + const QString &source, + const QmlVisualNode::Position &position) +{ + QScopedPointer<Model> inputModel(Model::create("QtQuick.Item", 1, 0, view->model())); + inputModel->setFileUrl(view->model()->fileUrl()); + QPlainTextEdit textEdit; + + textEdit.setPlainText(source); + NotIndentingTextEditModifier modifier(&textEdit); + + QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, nullptr)); + rewriterView->setCheckSemanticErrors(false); + rewriterView->setTextModifier(&modifier); + inputModel->setRewriterView(rewriterView.data()); + + if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) { + ModelNode rootModelNode = rewriterView->rootModelNode(); + inputModel->detachView(rewriterView.data()); + QmlVisualNode(rootModelNode).initializePosition(position); + ModelMerger merger(view); + return merger.insertModel(rootModelNode); + } + + return {}; +} + +QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const Position &position, + NodeAbstractProperty parentproperty) +{ + QmlObjectNode newQmlObjectNode; + + view->executeInTransaction("QmlItemNode::createQmlItemNode", [=, &newQmlObjectNode, &parentproperty](){ + NodeMetaInfo metaInfo = view->model()->metaInfo(itemLibraryEntry.typeName()); + + int minorVersion = metaInfo.minorVersion(); + int majorVersion = metaInfo.majorVersion(); + + using PropertyBindingEntry = QPair<PropertyName, QString>; + QList<PropertyBindingEntry> propertyBindingList; + QList<PropertyBindingEntry> propertyEnumList; + if (itemLibraryEntry.qmlSource().isEmpty()) { + QList<QPair<PropertyName, QVariant> > propertyPairList = position.propertyPairList(); + + for (const auto &property : itemLibraryEntry.properties()) { + if (property.type() == "binding") { + propertyBindingList.append(PropertyBindingEntry(property.name(), property.value().toString())); + } else if (property.type() == "enum") { + propertyEnumList.append(PropertyBindingEntry(property.name(), property.value().toString())); + } else { + propertyPairList.append({property.name(), property.value()}); + } + } + + newQmlObjectNode = QmlObjectNode(view->createModelNode(itemLibraryEntry.typeName(), majorVersion, minorVersion, propertyPairList)); + } else { + newQmlObjectNode = createQmlObjectNodeFromSource(view, itemLibraryEntry.qmlSource(), position); + } + + if (parentproperty.isValid()) + parentproperty.reparentHere(newQmlObjectNode); + + if (!newQmlObjectNode.isValid()) + return; + + newQmlObjectNode.setId(view->generateNewId(itemLibraryEntry.name())); + + for (const auto &propertyBindingEntry : propertyBindingList) + newQmlObjectNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second); + + for (const auto &propertyBindingEntry : propertyEnumList) + newQmlObjectNode.modelNode().variantProperty(propertyBindingEntry.first).setEnumeration(propertyBindingEntry.second.toUtf8()); + + Q_ASSERT(newQmlObjectNode.isValid()); + }); + + Q_ASSERT(newQmlObjectNode.isValid()); + + return newQmlObjectNode; +} + +QmlVisualNode QmlVisualNode::createQmlVisualNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const QVector3D &position) +{ + NodeAbstractProperty sceneNodeProperty = findSceneNodeProperty(view); + QTC_ASSERT(sceneNodeProperty.isValid(), return {}); + ModelNode node = createQmlObjectNode(view, itemLibraryEntry, position, sceneNodeProperty).modelNode(); + + return node; +} + +NodeListProperty QmlVisualNode::findSceneNodeProperty(AbstractView *view) +{ + QTC_ASSERT(view, return {}); + + QList<ModelNode> quickViews = view->allModelNodesOfType("QtQuick3D.View3D"); + QTC_ASSERT(!quickViews.isEmpty(), return {}); + const ModelNode quickView = quickViews.first(); + + QList<ModelNode> nodes = quickView.directSubModelNodesOfType("QtQuick3D.Node"); + QTC_ASSERT(!nodes.isEmpty(), return {}); + const ModelNode node = nodes.first(); + + return node.defaultNodeListProperty(); +} + QList<ModelNode> toModelNodeList(const QList<QmlVisualNode> &qmlVisualNodeList) { QList<ModelNode> modelNodeList; @@ -263,4 +406,20 @@ QmlModelState QmlModelStateGroup::state(const QString &name) const return QmlModelState(); } +QList<QPair<PropertyName, QVariant> > QmlVisualNode::Position::propertyPairList() const +{ + QList<QPair<PropertyName, QVariant> > propertyPairList; + + if (!m_2dPos.isNull()) { + propertyPairList.append({"x", QVariant(qRound(m_2dPos.x()))}); + propertyPairList.append({"y", QVariant(qRound(m_2dPos.y()))}); + } else if (!m_3dPos.isNull()) { + propertyPairList.append({"x", QVariant(m_3dPos.x())}); + propertyPairList.append({"y", QVariant(m_3dPos.y())}); + propertyPairList.append({"z", QVariant(m_3dPos.z())}); + } + + return propertyPairList; +} + } //QmlDesigner diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.cpp b/src/plugins/qmlpreview/qmlpreviewplugin.cpp index 876cdb962a5..a5fd38fd2e4 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.cpp +++ b/src/plugins/qmlpreview/qmlpreviewplugin.cpp @@ -200,7 +200,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent) Core::Context projectTreeContext(Constants::C_PROJECT_TREE); menu = Core::ActionManager::actionContainer(Constants::M_FILECONTEXT); - action = new QAction(tr("Preview File"), this); + action = new QAction(QmlPreviewPlugin::tr("Preview File"), this); action->setEnabled(false); connect(q, &QmlPreviewPlugin::runningPreviewsChanged, action, [action](const QmlPreviewRunControlList &previews) { diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h index bcf92ae0a0c..3c992141977 100644 --- a/src/plugins/qnx/qnxanalyzesupport.h +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -32,6 +32,8 @@ namespace Internal { class QnxQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner { + Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxQmlProfilerSupport) + public: explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl); }; diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index 833620ef977..8fda3634e8a 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -195,7 +195,7 @@ void BehaviorSettingsPage::apply() if (s) { s->setValue(QLatin1String(Core::Constants::SETTINGS_DEFAULTTEXTENCODING), - d->m_page->behaviorWidget->assignedCodec()->name()); + d->m_page->behaviorWidget->assignedCodecName()); } } diff --git a/src/plugins/texteditor/behaviorsettingswidget.cpp b/src/plugins/texteditor/behaviorsettingswidget.cpp index e528a23812a..85f9e222810 100644 --- a/src/plugins/texteditor/behaviorsettingswidget.cpp +++ b/src/plugins/texteditor/behaviorsettingswidget.cpp @@ -28,6 +28,9 @@ #include "tabsettingswidget.h" +#include <coreplugin/coreconstants.h> +#include <coreplugin/icore.h> + #include <texteditor/typingsettings.h> #include <texteditor/storagesettings.h> #include <texteditor/behaviorsettings.h> @@ -132,17 +135,30 @@ void BehaviorSettingsWidget::setActive(bool active) void BehaviorSettingsWidget::setAssignedCodec(QTextCodec *codec) { + const QString codecName = Core::ICore::settings()->value( + Core::Constants::SETTINGS_DEFAULTTEXTENCODING).toString(); + + int rememberedSystemPosition = -1; for (int i = 0; i < d->m_codecs.size(); ++i) { if (codec == d->m_codecs.at(i)) { - d->m_ui.encodingBox->setCurrentIndex(i); - break; + if (d->m_ui.encodingBox->itemText(i) == codecName) { + d->m_ui.encodingBox->setCurrentIndex(i); + return; + } else { // we've got System matching encoding - but have explicitly set the codec + rememberedSystemPosition = i; + } } } + if (rememberedSystemPosition != -1) + d->m_ui.encodingBox->setCurrentIndex(rememberedSystemPosition); } -QTextCodec *BehaviorSettingsWidget::assignedCodec() const +QByteArray BehaviorSettingsWidget::assignedCodecName() const { - return d->m_codecs.at(d->m_ui.encodingBox->currentIndex()); + return d->m_ui.encodingBox->currentIndex() == 0 + ? QByteArray("System") // we prepend System to the available codecs + : d->m_codecs.at(d->m_ui.encodingBox->currentIndex())->name(); + } void BehaviorSettingsWidget::setCodeStyle(ICodeStylePreferences *preferences) diff --git a/src/plugins/texteditor/behaviorsettingswidget.h b/src/plugins/texteditor/behaviorsettingswidget.h index 9bdfec5bc18..4cbb7709f34 100644 --- a/src/plugins/texteditor/behaviorsettingswidget.h +++ b/src/plugins/texteditor/behaviorsettingswidget.h @@ -55,7 +55,7 @@ public: void setActive(bool active); void setAssignedCodec(QTextCodec *codec); - QTextCodec *assignedCodec() const; + QByteArray assignedCodecName() const; void setCodeStyle(ICodeStylePreferences *preferences); diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp index 09f9b88ff91..19f0656a152 100644 --- a/src/plugins/texteditor/highlighter.cpp +++ b/src/plugins/texteditor/highlighter.cpp @@ -260,6 +260,7 @@ void Highlighter::downloadDefinitions(std::function<void()> callback) { Core::MessageManager::write(tr("Highlighter updates: done"), Core::MessageManager::ModeSwitch); downloader->deleteLater(); + reload(); if (callback) callback(); }); diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 1cedb6bad95..df51f2bfe21 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3104,10 +3104,7 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions InfoBarEntry::GlobalSuppression::Enabled); info.setCustomButtonInfo(BaseTextEditor::tr("Download Definitions"), [missing, this]() { m_document->infoBar()->removeInfo(missing); - Highlighter::downloadDefinitions([widget = QPointer<TextEditorWidget>(q)]() { - if (widget) - widget->configureGenericHighlighter(); - }); + Highlighter::downloadDefinitions(); }); infoBar->removeInfo(multiple); @@ -4337,7 +4334,7 @@ void TextEditorWidgetPrivate::paintCurrentLineHighlight(const PaintEventData &da QColor color = m_document->fontSettings().toTextCharFormat(C_CURRENT_LINE).background().color(); // set alpha, otherwise we cannot see block highlighting and find scope underneath color.setAlpha(128); - if (!data.isEditable && !data.eventRect.contains(lineRect.toRect())) { + if (!data.eventRect.contains(lineRect.toRect())) { QRect updateRect = data.eventRect; updateRect.setLeft(0); updateRect.setRight(data.viewportRect.width() - int(data.offset.x())); @@ -5643,7 +5640,8 @@ void TextEditorWidget::showDefaultContextMenu(QContextMenuEvent *e, Id menuConte void TextEditorWidget::addHoverHandler(BaseHoverHandler *handler) { - d->m_hoverHandlers.append(handler); + if (!d->m_hoverHandlers.contains(handler)) + d->m_hoverHandlers.append(handler); } void TextEditorWidget::removeHoverHandler(BaseHoverHandler *handler) diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index f4c56630fde..9e0b3185471 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -68,7 +68,7 @@ public: auto webBrowserAspect = addAspect<WebBrowserSelectionAspect>(target); auto effectiveEmrunCall = addAspect<BaseStringAspect>(); - effectiveEmrunCall->setLabelText(tr("Effective emrun call:")); + effectiveEmrunCall->setLabelText(EmrunRunConfigurationFactory::tr("Effective emrun call:")); effectiveEmrunCall->setDisplayStyle(BaseStringAspect::TextEditDisplay); effectiveEmrunCall->setReadOnly(true); @@ -117,7 +117,7 @@ RunWorkerFactory::WorkerCreator makeEmrunWorker() // Factories EmrunRunConfigurationFactory::EmrunRunConfigurationFactory() - : FixedRunConfigurationFactory(EmrunRunConfiguration::tr("Launch with emrun")) + : FixedRunConfigurationFactory(EmrunRunConfigurationFactory::tr("Launch with emrun")) { registerRunConfiguration<EmrunRunConfiguration>(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN); addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE); diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.h b/src/plugins/webassembly/webassemblyrunconfiguration.h index af6af51e816..d58db86d3c9 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.h +++ b/src/plugins/webassembly/webassemblyrunconfiguration.h @@ -33,6 +33,8 @@ namespace Internal { class EmrunRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory { + Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::EmrunRunConfigurationFactory) + public: EmrunRunConfigurationFactory(); }; diff --git a/src/shared/qbs b/src/shared/qbs -Subproject a703c788abc0035bafe53a05370900db0a3ac43 +Subproject 3e5268b08883eb98ab539887d63985f149e0224 diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index d2f43adc1b3..46a82eeecee 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -109,6 +109,7 @@ extend_qtc_executable(qml2puppet SOURCES cameracontrolhelper.cpp cameracontrolhelper.h mousearea3d.cpp mousearea3d.h + camerageometry.cpp camerageometry.h ) extend_qtc_executable(qml2puppet diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index 5bf57a534c7..540a2a3c08c 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -199,6 +199,8 @@ QtcTool { "editor3d/cameracontrolhelper.h", "editor3d/mousearea3d.cpp", "editor3d/mousearea3d.h", + "editor3d/camerageometry.cpp", + "editor3d/camerageometry.h", "qml2puppetmain.cpp", ] } diff --git a/tests/system/objects.map b/tests/system/objects.map index 407acfb5cd8..1c9db182075 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -134,6 +134,7 @@ :Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Timeline_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='QmlProfiler.Timeline.DockDockWidget' type='QDockWidget' visible='1'} :Qt Creator.Timeline_QTabBar {aboveWidget=':Qt Creator.Timeline_QDockWidget' container=':Qt Creator.DebugModeWidget_QSplitter' type='QTabBar' unnamed='1' visible='1'} +:Qt Creator.WelcomeScreenStackedWidget {name='WelcomeScreenStackedWidget' type='QStackedWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.scrollArea_QScrollArea {type='ProjectExplorer::PanelsWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.splitter_QSplitter {name='splitter' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 193ef324af7..4ad7889cb7e 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -31,9 +31,9 @@ def openQbsProject(projectPath): def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWelcome=False): cleanUpUserFiles(projectPath) if fromWelcome: - wsButtonFrame, wsButtonLabel = getWelcomeScreenMainButton('Open Project') + wsButtonFrame, wsButtonLabel = getWelcomeScreenMainButton('Open') if not all((wsButtonFrame, wsButtonLabel)): - test.fatal("Could not find 'Open Project' button on Welcome Page.") + test.fatal("Could not find 'Open' button on Welcome Page.") return [] mouseClick(wsButtonLabel) else: @@ -79,9 +79,9 @@ def openCmakeProject(projectPath, buildDir): # this list can be used in __chooseTargets__() def __createProjectOrFileSelectType__(category, template, fromWelcome = False, isProject=True): if fromWelcome: - wsButtonFrame, wsButtonLabel = getWelcomeScreenMainButton("New Project") + wsButtonFrame, wsButtonLabel = getWelcomeScreenMainButton("New") if not all((wsButtonFrame, wsButtonLabel)): - test.fatal("Could not find 'New Project' button on Welcome Page") + test.fatal("Could not find 'New' button on Welcome Page") return [] mouseClick(wsButtonLabel) else: diff --git a/tests/system/shared/welcome.py b/tests/system/shared/welcome.py index f6338a91fa5..86f773e275a 100644 --- a/tests/system/shared/welcome.py +++ b/tests/system/shared/welcome.py @@ -46,16 +46,14 @@ def getWelcomeScreenSideBarButton(buttonLabel, isUrlButton = False): return __getWelcomeScreenButtonHelper__(buttonLabel, sideBar, isUrlButton) def getWelcomeScreenMainButton(buttonLabel): - stackedWidget = waitForObject("{type='QStackedWidget' name='WelcomeScreenStackedWidget' " - "window=':Qt Creator_Core::Internal::MainWindow'}") + stackedWidget = waitForObject(":Qt Creator.WelcomeScreenStackedWidget") currentStackWidget = stackedWidget.currentWidget() return __getWelcomeScreenButtonHelper__(buttonLabel, currentStackWidget) def getWelcomeTreeView(treeViewLabel): try: - return waitForObject("{aboveWidget={text='%s' type='QLabel' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'} " - "type='QTreeView' unnamed='1' visible='1'}" % treeViewLabel) + return waitForObjectExists("{container=':Qt Creator.WelcomeScreenStackedWidget' " + "name='%s' type='QTreeView' visible='1'}" % treeViewLabel) except: return None |