|
1 | | -;; Keywords |
2 | | - |
| 1 | +; Keywords |
3 | 2 | "return" @keyword.return |
4 | 3 |
|
5 | 4 | [ |
6 | | - "goto" |
7 | | - "in" |
8 | | - "local" |
| 5 | + "goto" |
| 6 | + "in" |
| 7 | + "local" |
9 | 8 | ] @keyword |
10 | 9 |
|
11 | 10 | (label_statement) @label |
12 | 11 |
|
13 | 12 | (break_statement) @keyword |
14 | 13 |
|
15 | 14 | (do_statement |
16 | | -[ |
17 | | - "do" |
18 | | - "end" |
19 | | -] @keyword) |
| 15 | + [ |
| 16 | + "do" |
| 17 | + "end" |
| 18 | + ] @keyword) |
20 | 19 |
|
21 | 20 | (while_statement |
22 | | -[ |
23 | | - "while" |
24 | | - "do" |
25 | | - "end" |
26 | | -] @repeat) |
| 21 | + [ |
| 22 | + "while" |
| 23 | + "do" |
| 24 | + "end" |
| 25 | + ] @repeat) |
27 | 26 |
|
28 | 27 | (repeat_statement |
29 | | -[ |
30 | | - "repeat" |
31 | | - "until" |
32 | | -] @repeat) |
| 28 | + [ |
| 29 | + "repeat" |
| 30 | + "until" |
| 31 | + ] @repeat) |
33 | 32 |
|
34 | 33 | (if_statement |
35 | | -[ |
36 | | - "if" |
37 | | - "elseif" |
38 | | - "else" |
39 | | - "then" |
40 | | - "end" |
41 | | -] @conditional) |
| 34 | + [ |
| 35 | + "if" |
| 36 | + "elseif" |
| 37 | + "else" |
| 38 | + "then" |
| 39 | + "end" |
| 40 | + ] @conditional) |
42 | 41 |
|
43 | 42 | (elseif_statement |
44 | | -[ |
45 | | - "elseif" |
46 | | - "then" |
47 | | - "end" |
48 | | -] @conditional) |
| 43 | + [ |
| 44 | + "elseif" |
| 45 | + "then" |
| 46 | + "end" |
| 47 | + ] @conditional) |
49 | 48 |
|
50 | 49 | (else_statement |
51 | | -[ |
52 | | - "else" |
53 | | - "end" |
54 | | -] @conditional) |
| 50 | + [ |
| 51 | + "else" |
| 52 | + "end" |
| 53 | + ] @conditional) |
55 | 54 |
|
56 | 55 | (for_statement |
57 | | -[ |
58 | | - "for" |
59 | | - "do" |
60 | | - "end" |
61 | | -] @repeat) |
| 56 | + [ |
| 57 | + "for" |
| 58 | + "do" |
| 59 | + "end" |
| 60 | + ] @repeat) |
62 | 61 |
|
63 | 62 | (function_declaration |
64 | | -[ |
65 | | - "function" |
66 | | - "end" |
67 | | -] @keyword.function) |
| 63 | + [ |
| 64 | + "function" |
| 65 | + "end" |
| 66 | + ] @keyword.function) |
68 | 67 |
|
69 | 68 | (function_definition |
70 | | -[ |
71 | | - "function" |
72 | | - "end" |
73 | | -] @keyword.function) |
74 | | - |
75 | | -;; Operators |
| 69 | + [ |
| 70 | + "function" |
| 71 | + "end" |
| 72 | + ] @keyword.function) |
76 | 73 |
|
77 | | -(binary_expression operator: _ @operator) |
| 74 | +; Operators |
| 75 | +(binary_expression |
| 76 | + operator: _ @operator) |
78 | 77 |
|
79 | | -(unary_expression operator: _ @operator) |
| 78 | +(unary_expression |
| 79 | + operator: _ @operator) |
80 | 80 |
|
81 | 81 | [ |
82 | | - "and" |
83 | | - "not" |
84 | | - "or" |
| 82 | + "and" |
| 83 | + "not" |
| 84 | + "or" |
85 | 85 | ] @keyword.operator |
86 | 86 |
|
87 | | -;; Punctuations |
88 | | - |
| 87 | +; Punctuations |
89 | 88 | [ |
90 | 89 | ";" |
91 | 90 | ":" |
92 | 91 | "," |
93 | 92 | "." |
94 | 93 | ] @punctuation.delimiter |
95 | 94 |
|
96 | | -;; Brackets |
97 | | - |
| 95 | +; Brackets |
98 | 96 | [ |
99 | | - "(" |
100 | | - ")" |
101 | | - "[" |
102 | | - "]" |
103 | | - "{" |
104 | | - "}" |
| 97 | + "(" |
| 98 | + ")" |
| 99 | + "[" |
| 100 | + "]" |
| 101 | + "{" |
| 102 | + "}" |
105 | 103 | ] @punctuation.bracket |
106 | 104 |
|
107 | | -;; Variables |
108 | | - |
| 105 | +; Variables |
109 | 106 | (identifier) @variable |
110 | 107 |
|
111 | 108 | ((identifier) @variable.builtin |
112 | | - (#eq? @variable.builtin "self")) |
| 109 | + (#eq? @variable.builtin "self")) |
113 | 110 |
|
114 | 111 | (variable_list |
115 | 112 | (attribute |
116 | 113 | "<" @punctuation.bracket |
117 | 114 | (identifier) @attribute |
118 | 115 | ">" @punctuation.bracket)) |
119 | 116 |
|
120 | | -;; Constants |
121 | | - |
| 117 | +; Constants |
122 | 118 | ((identifier) @constant |
123 | | - (#match? @constant "^[A-Z][A-Z_0-9]*$")) |
| 119 | + (#match? @constant "^[A-Z][A-Z_0-9]*$")) |
124 | 120 |
|
125 | 121 | (vararg_expression) @constant |
126 | 122 |
|
|
131 | 127 | (true) |
132 | 128 | ] @boolean |
133 | 129 |
|
134 | | -;; Tables |
135 | | - |
136 | | -(field name: (identifier) @field) |
| 130 | +; Tables |
| 131 | +(field |
| 132 | + name: (identifier) @field) |
137 | 133 |
|
138 | | -(dot_index_expression field: (identifier) @field) |
| 134 | +(dot_index_expression |
| 135 | + field: (identifier) @field) |
139 | 136 |
|
140 | 137 | (table_constructor |
141 | | -[ |
142 | | - "{" |
143 | | - "}" |
144 | | -] @constructor) |
| 138 | + [ |
| 139 | + "{" |
| 140 | + "}" |
| 141 | + ] @constructor) |
145 | 142 |
|
146 | | -;; Functions |
147 | | - |
148 | | -(parameters (identifier) @parameter) |
| 143 | +; Functions |
| 144 | +(parameters |
| 145 | + (identifier) @parameter) |
149 | 146 |
|
150 | 147 | (function_declaration |
151 | 148 | name: [ |
|
159 | 156 | method: (identifier) @method)) |
160 | 157 |
|
161 | 158 | (assignment_statement |
162 | | - (variable_list . |
| 159 | + (variable_list |
| 160 | + . |
163 | 161 | name: [ |
164 | 162 | (identifier) @function |
165 | 163 | (dot_index_expression |
166 | 164 | field: (identifier) @function) |
167 | 165 | ]) |
168 | | - (expression_list . |
| 166 | + (expression_list |
| 167 | + . |
169 | 168 | value: (function_definition))) |
170 | 169 |
|
171 | 170 | (table_constructor |
|
185 | 184 | (function_call |
186 | 185 | (identifier) @function.builtin |
187 | 186 | (#any-of? @function.builtin |
188 | | - ;; built-in functions in Lua 5.1 |
189 | | - "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" |
190 | | - "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" |
191 | | - "rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable" |
192 | | - "tonumber" "tostring" "type" "unpack" "xpcall")) |
193 | | - |
194 | | -;; Others |
| 187 | + ; built-in functions in Lua 5.1 |
| 188 | + "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile" |
| 189 | + "loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawset" "require" |
| 190 | + "select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall")) |
195 | 191 |
|
| 192 | +; Others |
196 | 193 | (comment) @comment |
197 | 194 |
|
198 | 195 | (hash_bang_line) @preproc |
|
0 commit comments