This commit is contained in:
Access 2022-07-07 22:33:47 +08:00 committed by GitHub
parent d4f0c46e0f
commit 4b5966c81a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 143 additions and 1 deletions

View file

@ -239,6 +239,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [pug](https://github.com/zealot128/tree-sitter-pug) (maintained by @zealot128)
- [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta)
- [x] [ql](https://github.com/tree-sitter/tree-sitter-ql) (maintained by @pwntester)
- [x] [qmljs](https://github.com/yuja/tree-sitter-qmljs) (maintained by @yuja)
- [x] [Tree-sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @jimhester)
- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte)

View file

@ -43,7 +43,15 @@ local list = setmetatable({}, {
filetype_to_parsername[parserconfig.filetype or parsername] = parsername
end,
})
list.qmljs = {
install_info = {
url = "https://github.com/yuja/tree-sitter-qmljs",
branch = "master",
files = { "src/parser.c", "src/scanner.c" },
},
filetype = "qmljs",
maintainers = { "@yuja" },
}
list.scheme = {
install_info = {
url = "https://github.com/6cdh/tree-sitter-scheme",

View file

@ -0,0 +1,133 @@
; inherits: ecma
;;; Annotations
(ui_annotation
"@" @operator
type_name: [
(identifier) @attribute
(nested_identifier (identifier) @attribute)
])
;; type
(ui_property
type: (type_identifier) @type)
;;; Properties
(ui_object_definition_binding
name: [
(identifier) @property
(nested_identifier (identifier) @property)
])
(ui_binding
name: [
(identifier) @property
(nested_identifier (identifier) @property)
])
;; locals query appears not working unless id: <ref> isn't a parameter.
(ui_binding
name: (identifier) @property
(#eq? @property "id")
value: (expression_statement (identifier) @variable))
(ui_property
name: (identifier) @property)
(ui_required
name: (identifier) @property)
(ui_list_property_type
["<" ">"] @punctuation.bracket)
;;; Signals
(ui_signal
name: (identifier) @function)
(ui_signal_parameter
(identifier) @variable)
;;; ui_object_definition
(ui_object_definition
type_name: (identifier) @type)
(ui_object_definition
type_name: (nested_identifier) @type)
;;; js
; Properties
;-----------
(property_identifier) @property
; Literals
;---------
[
(true)
(false)
(null)
(undefined)
] @constant.builtin
(comment) @comment
[
(string)
(template_string)
] @string
(regex) @string.special
(number) @number
; Tokens
;-------
;;; keywrod in qml
[
"required"
"property"
"signal"
] @keyword
; from typescript
(type_identifier) @type
(predefined_type) @type.builtin
((identifier) @type
(#match? @type "^[A-Z]"))
(type_arguments
"<" @punctuation.bracket
">" @punctuation.bracket)
; Variables
(required_parameter (identifier) @variable)
(optional_parameter (identifier) @variable)
; Keywords
[ "abstract"
"declare"
"enum"
"export"
"implements"
"interface"
"keyof"
"namespace"
"private"
"protected"
"public"
"type"
"readonly"
"override"
] @keyword