summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpylipp <beth.aleph@yahoo.de>2020-04-29 20:57:55 +0200
committerDavid Peter <sharkdp@users.noreply.github.com>2020-04-30 09:59:14 +0200
commit74ec390770229ee70a3c484b1f534986836b94ad (patch)
tree780a6809d8d6c11493548bdd8f32c4c985e66ecc
parent9014ffcfd84570d6d740076dc9ca6ff80cd65ceb (diff)
Add QML syntax
QML.sublime-syntax file generated from Support/QML.tmLanguage using Sublime's built-in converter. Fix sharkdp/bat#962
-rw-r--r--.gitmodules3
-rw-r--r--CHANGELOG.md1
-rw-r--r--assets/syntaxes/02_Extra/QML.sublime-syntax103
3 files changed, 107 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index 23a957a2..27199255 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -185,3 +185,6 @@
[submodule "assets/syntaxes/02_Extra/Email"]
path = assets/syntaxes/02_Extra/Email
url = https://github.com/mariozaizar/email.sublime-syntax.git
+[submodule "assets/syntaxes/02_Extra/QML"]
+ path = assets/syntaxes/02_Extra/QML
+ url = https://github.com/skozlovf/Sublime-QML
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b17ca56..9d7d793d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
- Fortran, see #957
- Email (@mariozaizar)
+- QML, see #962 (@pylipp)
## New themes
## `bat` as a library
diff --git a/assets/syntaxes/02_Extra/QML.sublime-syntax b/assets/syntaxes/02_Extra/QML.sublime-syntax
new file mode 100644
index 00000000..b6023df1
--- /dev/null
+++ b/assets/syntaxes/02_Extra/QML.sublime-syntax
@@ -0,0 +1,103 @@
+%YAML 1.2
+---
+# http://www.sublimetext.com/docs/3/syntax.html
+name: QML
+file_extensions:
+ - qml
+ - qmlproject
+scope: source.qml
+contexts:
+ main:
+ - match: /\*(?!/)
+ comment: Block comment.
+ push:
+ - meta_scope: comment.block.documentation.qml
+ - match: \*/
+ pop: true
+ - match: //.*$
+ comment: Line comment.
+ scope: comment.line.double-slash.qml
+ - match: \b(import)\s+
+ comment: import statement.
+ captures:
+ 1: keyword.other.import.qml
+ push:
+ - meta_scope: meta.import.qml
+ - match: $
+ pop: true
+ - match: '([\w\d\.]+)\s+(\d+\.\d+)(?:\s+(as)\s+([A-Z][\w\d]*))?'
+ comment: "import Namespace VersionMajor.VersionMinor [as SingletonTypeIdentifier]"
+ scope: meta.import.namespace.qml
+ captures:
+ 1: entity.name.class.qml
+ 2: constant.numeric.qml
+ 3: keyword.other.import.qml
+ 4: entity.name.class.qml
+ - match: '(\"[^\"]+\")(?:\s+(as)\s+([A-Z][\w\d]*))?'
+ comment: "import <string> [as Script]"
+ scope: meta.import.dirjs.qml
+ captures:
+ 1: string.quoted.double.qml
+ 2: keyword.other.import.qml
+ 3: entity.name.class.qml
+ - match: '\b[A-Z]\w*\b'
+ comment: Capitalized word (class or enum).
+ scope: support.class.qml
+ - match: '(((^|\{)\s*)|\b)on[A-Z]\w*\b'
+ comment: onSomething - handler.
+ scope: support.class.qml
+ - match: '(?:^|\{)\s*(id)\s*\:\s*([^;\s]+)\b'
+ comment: "id: <something>"
+ scope: meta.id.qml
+ captures:
+ 1: keyword.other.qml
+ 2: storage.modifier.qml
+ - match: '^\s*(?:(default|readonly)\s+)?(property)\s+(?:(alias)|([\w\<\>]+))\s+(\w+)'
+ comment: property definition.
+ scope: meta.propertydef.qml
+ captures:
+ 1: keyword.other.qml
+ 2: keyword.other.qml
+ 3: keyword.other.qml
+ 4: storage.type.qml
+ 5: entity.other.attribute-name.qml
+ - match: \b(signal)\s+(\w+)\s*
+ comment: "signal <signalName>[([<type> <parameter>[, ...]])]"
+ captures:
+ 1: keyword.other.qml
+ 2: support.function.qml
+ push:
+ - meta_scope: meta.signal.qml
+ - match: ;|(?=/)|$
+ pop: true
+ - match: (\w+)\s+(\w+)
+ scope: meta.signal.parameters.qml
+ captures:
+ 1: storage.type.qml
+ 2: variable.parameter.qml
+ - match: (?:\b|\s+)(?:(true|false|null|undefined)|(var|void)|(on|as|enum|connect|break|case|catch|continue|debugger|default|delete|do|else|finally|for|if|in|instanceof|new|return|switch|this|throw|try|typeof|while|with))\b
+ comment: js keywords.
+ scope: meta.keyword.qml
+ captures:
+ 1: constant.language.qml
+ 2: storage.type.qml
+ 3: keyword.control.qml
+ - match: '\b(function)\s+([\w_]+)\s*(?=\()'
+ comment: function definition.
+ scope: meta.function.qml
+ captures:
+ 1: storage.type.qml
+ 2: entity.name.function.untitled
+ - match: '\b[\w_]+\s*(?=\()'
+ comment: function call.
+ scope: support.function.qml
+ - match: '(?:^|\{|;)\s*[a-z][\w\.]*\s*(?=\:)'
+ comment: "property (property: <something>)."
+ scope: entity.other.attribute-name.qml
+ - match: (?<=\.)\b\w*
+ comment: property of the variable (name.property).
+ scope: entity.other.attribute-name.qml
+ - match: '\b([a-z_]\w*)\b'
+ comment: All non colored words are assumed to be variables.
+ scope: variable.parameter
+ - include: scope:source.js