|
1 | 1 | ;; Keywords |
2 | 2 |
|
3 | | -"return" @keyword |
| 3 | +"return" @keyword.return |
4 | 4 |
|
5 | 5 | [ |
6 | 6 | "goto" |
7 | 7 | "in" |
8 | 8 | "local" |
9 | 9 | ] @keyword |
10 | 10 |
|
| 11 | +(label_statement) @label |
| 12 | + |
11 | 13 | (break_statement) @keyword |
12 | 14 |
|
13 | 15 | (do_statement |
|
21 | 23 | "while" |
22 | 24 | "do" |
23 | 25 | "end" |
24 | | -] @keyword) |
| 26 | +] @repeat) |
25 | 27 |
|
26 | 28 | (repeat_statement |
27 | 29 | [ |
28 | 30 | "repeat" |
29 | 31 | "until" |
30 | | -] @keyword) |
| 32 | +] @repeat) |
31 | 33 |
|
32 | 34 | (if_statement |
33 | 35 | [ |
|
36 | 38 | "else" |
37 | 39 | "then" |
38 | 40 | "end" |
39 | | -] @keyword) |
| 41 | +] @conditional) |
40 | 42 |
|
41 | 43 | (elseif_statement |
42 | 44 | [ |
43 | 45 | "elseif" |
44 | 46 | "then" |
45 | 47 | "end" |
46 | | -] @keyword) |
| 48 | +] @conditional) |
47 | 49 |
|
48 | 50 | (else_statement |
49 | 51 | [ |
50 | 52 | "else" |
51 | 53 | "end" |
52 | | -] @keyword) |
| 54 | +] @conditional) |
53 | 55 |
|
54 | 56 | (for_statement |
55 | 57 | [ |
56 | 58 | "for" |
57 | 59 | "do" |
58 | 60 | "end" |
59 | | -] @keyword) |
| 61 | +] @repeat) |
60 | 62 |
|
61 | 63 | (function_declaration |
62 | 64 | [ |
63 | 65 | "function" |
64 | 66 | "end" |
65 | | -] @keyword) |
| 67 | +] @keyword.function) |
66 | 68 |
|
67 | 69 | (function_definition |
68 | 70 | [ |
69 | 71 | "function" |
70 | 72 | "end" |
71 | | -] @keyword) |
| 73 | +] @keyword.function) |
72 | 74 |
|
73 | 75 | ;; Operators |
74 | 76 |
|
| 77 | +(binary_expression operator: _ @operator) |
| 78 | + |
| 79 | +(unary_expression operator: _ @operator) |
| 80 | + |
75 | 81 | [ |
76 | 82 | "and" |
77 | 83 | "not" |
78 | 84 | "or" |
79 | | -] @operator |
80 | | - |
81 | | -[ |
82 | | - "+" |
83 | | - "-" |
84 | | - "*" |
85 | | - "/" |
86 | | - "%" |
87 | | - "^" |
88 | | - "#" |
89 | | - "==" |
90 | | - "~=" |
91 | | - "<=" |
92 | | - ">=" |
93 | | - "<" |
94 | | - ">" |
95 | | - "=" |
96 | | - "&" |
97 | | - "~" |
98 | | - "|" |
99 | | - "<<" |
100 | | - ">>" |
101 | | - "//" |
102 | | - ".." |
103 | | -] @operator |
| 85 | +] @keyword.operator |
104 | 86 |
|
105 | 87 | ;; Punctuations |
106 | 88 |
|
|
126 | 108 |
|
127 | 109 | (identifier) @variable |
128 | 110 |
|
129 | | -((identifier) @variable.special |
130 | | - (#eq? @variable.special "self")) |
| 111 | +((identifier) @variable.builtin |
| 112 | + (#eq? @variable.builtin "self")) |
131 | 113 |
|
132 | 114 | (variable_list |
133 | | - attribute: (attribute |
134 | | - (["<" ">"] @punctuation.bracket |
135 | | - (identifier) @attribute))) |
| 115 | + (attribute |
| 116 | + "<" @punctuation.bracket |
| 117 | + (identifier) @attribute |
| 118 | + ">" @punctuation.bracket)) |
136 | 119 |
|
137 | 120 | ;; Constants |
138 | 121 |
|
|
150 | 133 |
|
151 | 134 | ;; Tables |
152 | 135 |
|
153 | | -(field name: (identifier) @property) |
| 136 | +(field name: (identifier) @field) |
154 | 137 |
|
155 | | -(dot_index_expression field: (identifier) @property) |
| 138 | +(dot_index_expression field: (identifier) @field) |
156 | 139 |
|
157 | 140 | (table_constructor |
158 | 141 | [ |
|
164 | 147 |
|
165 | 148 | (parameters (identifier) @parameter) |
166 | 149 |
|
167 | | -(function_call |
| 150 | +(function_declaration |
168 | 151 | name: [ |
169 | 152 | (identifier) @function |
170 | | - (dot_index_expression field: (identifier) @function) |
| 153 | + (dot_index_expression |
| 154 | + field: (identifier) @function) |
171 | 155 | ]) |
172 | 156 |
|
173 | 157 | (function_declaration |
| 158 | + name: (method_index_expression |
| 159 | + method: (identifier) @method)) |
| 160 | + |
| 161 | +(assignment_statement |
| 162 | + (variable_list . |
| 163 | + name: [ |
| 164 | + (identifier) @function |
| 165 | + (dot_index_expression |
| 166 | + field: (identifier) @function) |
| 167 | + ]) |
| 168 | + (expression_list . |
| 169 | + value: (function_definition))) |
| 170 | + |
| 171 | +(table_constructor |
| 172 | + (field |
| 173 | + name: (identifier) @function |
| 174 | + value: (function_definition))) |
| 175 | + |
| 176 | +(function_call |
174 | 177 | name: [ |
175 | | - (identifier) @function.definition |
176 | | - (dot_index_expression field: (identifier) @function.definition) |
| 178 | + (identifier) @function.call |
| 179 | + (dot_index_expression |
| 180 | + field: (identifier) @function.call) |
| 181 | + (method_index_expression |
| 182 | + method: (identifier) @method.call) |
177 | 183 | ]) |
178 | 184 |
|
179 | | -(method_index_expression method: (identifier) @function.method) |
180 | | - |
181 | 185 | (function_call |
182 | 186 | (identifier) @function.builtin |
183 | 187 | (#any-of? @function.builtin |
|
189 | 193 |
|
190 | 194 | ;; Others |
191 | 195 |
|
192 | | -;; Regular comments |
193 | 196 | (comment) @comment |
194 | 197 |
|
195 | 198 | (hash_bang_line) @preproc |
196 | 199 |
|
197 | 200 | (number) @number |
198 | 201 |
|
199 | 202 | (string) @string |
| 203 | + |
200 | 204 | (escape_sequence) @string.escape |
0 commit comments