2023-03-10 20:32:45 +04:00
|
|
|
; Errors
|
|
|
|
|
2023-02-21 02:42:54 +04:00
|
|
|
(ERROR) @error
|
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Comments
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(comment) @comment
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Operators
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
[
|
|
|
|
"+"
|
|
|
|
"-"
|
|
|
|
"*"
|
|
|
|
"/"
|
|
|
|
"%"
|
|
|
|
"||"
|
|
|
|
"&&"
|
|
|
|
"=="
|
|
|
|
"!="
|
|
|
|
"=~"
|
|
|
|
">"
|
|
|
|
"<"
|
|
|
|
">="
|
|
|
|
"<="
|
|
|
|
"!"
|
|
|
|
"?."
|
|
|
|
"?:"
|
|
|
|
] @operator
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(ternary_expression
|
|
|
|
["?" ":"] @operator)
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Punctuation
|
|
|
|
|
|
|
|
[ ":" "." "," ] @punctuation.delimiter
|
|
|
|
|
|
|
|
[ "{" "}" "[" "]" "(" ")" ] @punctuation.bracket
|
|
|
|
|
|
|
|
; Literals
|
|
|
|
|
|
|
|
(number (float)) @constant.numeric.float
|
|
|
|
|
|
|
|
(number (integer)) @constant.numeric.integer
|
|
|
|
|
|
|
|
(boolean) @constant.builtin.boolean
|
|
|
|
|
|
|
|
; Strings
|
2023-02-21 02:42:54 +04:00
|
|
|
|
|
|
|
(escape_sequence) @constant.character.escape
|
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(string_interpolation
|
|
|
|
"${" @punctuation.special
|
|
|
|
"}" @punctuation.special)
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
[ (string_fragment) "\"" "'" "`" ] @string
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Attributes & Fields
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(keyword) @attribute
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Functions
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(function_call
|
|
|
|
name: (ident) @function)
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
; Variables
|
2023-02-21 02:42:54 +04:00
|
|
|
|
2023-03-10 20:32:45 +04:00
|
|
|
(ident) @variable
|
|
|
|
|
|
|
|
(array
|
|
|
|
(symbol) @variable)
|
|
|
|
|
|
|
|
; Builtin widgets
|
|
|
|
|
|
|
|
(list .
|
|
|
|
((symbol) @tag.builtin
|
|
|
|
(#match? @tag.builtin "^(box|button|calendar|centerbox|checkbox|circular-progress|color-button|color-chooser|combo-box-text|eventbox|expander|graph|image|input|label|literal|overlay|progress|revealer|scale|scroll|transform)$")))
|
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
|
|
|
; I think there's a bug in tree-sitter the anchor doesn't seem to be working, see
|
|
|
|
; https://github.com/tree-sitter/tree-sitter/pull/2107
|
|
|
|
(list .
|
|
|
|
((symbol) @keyword
|
|
|
|
(#match? @keyword "^(defwindow|defwidget|defvar|defpoll|deflisten|geometry|children|struts)$")))
|
|
|
|
|
|
|
|
(list .
|
|
|
|
((symbol) @keyword.control.import
|
|
|
|
(#eq? @keyword.control.import "include")))
|
|
|
|
|
|
|
|
; Loop
|
|
|
|
|
|
|
|
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
|
|
|
|
|
|
|
|
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator)
|
|
|
|
|
|
|
|
; Tags
|
|
|
|
|
|
|
|
; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list
|
|
|
|
(list
|
|
|
|
(symbol) @tag)
|
|
|
|
|
|
|
|
; Other stuff that has not been catched by the previous queries yet
|
2023-02-21 02:42:54 +04:00
|
|
|
|
|
|
|
(ident) @variable
|
2023-03-10 20:32:45 +04:00
|
|
|
(index) @variable
|