aboutsummaryrefslogtreecommitdiffstats
path: root/queries/gdscript/highlights.scm
blob: a65afdc720b3faae457bc5d0e122dbf18bbaa319 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
;; Basic
(identifier) @variable
(name) @variable
(type) @type
(comment) @comment
(get_node) @string
(string) @string
(float) @float
(integer) @number
(null) @constant
(setter) @function
(getter) @function
(static_keyword) @keyword
(tool_statement) @keyword
(breakpoint_statement) @keyword
(inferred_type) @operator
[(true) (false)] @boolean

(class_name_statement
  (name) @type) @keyword

(const_statement
  (name) @constant) @keyword

((identifier) @variable.builtin
  (#eq? @variable.builtin "self"))

;; Identifier naming conventions
((identifier) @type
  (#match? @type "^[A-Z]"))
((identifier) @constant
  (#match? @constant "^[A-Z][A-Z_0-9]*$"))
((identifier) @type
  (#match? @type "^[A-Z][A-Z_0-9]*$") . (_))

;; Functions
(constructor_definition) @constructor

(function_definition
  (name) @function (parameters
    (identifier) @parameter)*)

(typed_parameter
  (identifier) @parameter)

(default_parameter
  (identifier) @parameter)

(call
  (identifier) @function)
(attribute_call
  (identifier) @function)

;; Alternations
["(" ")" "[" "]" "{" "}"] @punctuation.bracket

["," "." ":"] @punctuation.delimiter

["if" "elif" "else" "match"] @conditional

["for" "while" "break" "continue"] @repeat

[
  "~"
  "-"
  "*"
  "/"
  "%"
  "+"
  "-"
  "<<"
  ">>"
  "&"
  "^"
  "|"
  "<"
  ">"
  "=="
  "!="
  ">="
  "<="
  "!"
  "&&"
  "||"
  "="
  "+="
  "-="
  "*="
  "/="
  "%="
  "&="
  "|="
  "->"
] @operator

[
  "and"
  "as"
  "in"
  "is"
  "not"
  "or"
] @keyword.operator

[
  "pass"
  "class"
  "class_name"
  "extends"
  "signal"
  "func"
  "enum"
  "var"
  "onready"
  "export"
  "setget"
  "remote"
  "master"
  "puppet"
  "remotesync"
  "mastersync"
  "puppetsync"
] @keyword

"return" @keyword.return