|
1 | | -;; Keywords |
2 | | - |
| 1 | +; Keywords |
3 | 2 | [ |
4 | 3 | "do" |
5 | 4 | "else" |
|
19 | 18 | (break_statement) |
20 | 19 | ] @keyword |
21 | 20 |
|
22 | | -;; Operators |
23 | | - |
| 21 | +; Operators |
24 | 22 | [ |
25 | | - "and" |
26 | | - "not" |
27 | | - "or" |
| 23 | + "and" |
| 24 | + "not" |
| 25 | + "or" |
28 | 26 | ] @keyword.operator |
29 | 27 |
|
30 | 28 | [ |
|
51 | 49 | ".." |
52 | 50 | ] @operator |
53 | 51 |
|
54 | | -;; Punctuations |
55 | | - |
| 52 | +; Punctuations |
56 | 53 | [ |
57 | 54 | ";" |
58 | 55 | ":" |
59 | 56 | "," |
60 | 57 | "." |
61 | 58 | ] @punctuation.delimiter |
62 | 59 |
|
63 | | -;; Brackets |
64 | | - |
| 60 | +; Brackets |
65 | 61 | [ |
66 | | - "(" |
67 | | - ")" |
68 | | - "[" |
69 | | - "]" |
70 | | - "{" |
71 | | - "}" |
| 62 | + "(" |
| 63 | + ")" |
| 64 | + "[" |
| 65 | + "]" |
| 66 | + "{" |
| 67 | + "}" |
72 | 68 | ] @punctuation.bracket |
73 | 69 |
|
74 | | -;; Variables |
75 | | - |
| 70 | +; Variables |
76 | 71 | (identifier) @variable |
77 | 72 |
|
78 | 73 | ((identifier) @variable.special |
79 | | - (#eq? @variable.special "self")) |
| 74 | + (#eq? @variable.special "self")) |
80 | 75 |
|
81 | 76 | (variable_list |
82 | | - attribute: (attribute |
83 | | - (["<" ">"] @punctuation.bracket |
| 77 | + attribute: (attribute |
| 78 | + ([ |
| 79 | + "<" |
| 80 | + ">" |
| 81 | + ] @punctuation.bracket |
84 | 82 | (identifier) @attribute))) |
85 | 83 |
|
86 | | -;; Constants |
87 | | - |
| 84 | +; Constants |
88 | 85 | ((identifier) @constant |
89 | | - (#match? @constant "^[A-Z][A-Z_0-9]*$")) |
| 86 | + (#match? @constant "^[A-Z][A-Z_0-9]*$")) |
90 | 87 |
|
91 | 88 | (vararg_expression) @constant |
92 | 89 |
|
|
97 | 94 | (true) |
98 | 95 | ] @boolean |
99 | 96 |
|
100 | | -;; Tables |
| 97 | +; Tables |
| 98 | +(field |
| 99 | + name: (identifier) @property) |
101 | 100 |
|
102 | | -(field name: (identifier) @property) |
103 | | - |
104 | | -(dot_index_expression field: (identifier) @property) |
| 101 | +(dot_index_expression |
| 102 | + field: (identifier) @property) |
105 | 103 |
|
106 | 104 | (table_constructor |
107 | | -[ |
108 | | - "{" |
109 | | - "}" |
110 | | -] @constructor) |
| 105 | + [ |
| 106 | + "{" |
| 107 | + "}" |
| 108 | + ] @constructor) |
111 | 109 |
|
112 | | -;; Functions |
113 | | - |
114 | | -(parameters (identifier) @parameter) |
| 110 | +; Functions |
| 111 | +(parameters |
| 112 | + (identifier) @parameter) |
115 | 113 |
|
116 | 114 | (function_call |
117 | 115 | name: [ |
118 | 116 | (identifier) @function |
119 | | - (dot_index_expression field: (identifier) @function) |
| 117 | + (dot_index_expression |
| 118 | + field: (identifier) @function) |
120 | 119 | ]) |
121 | 120 |
|
122 | 121 | (function_declaration |
123 | 122 | name: [ |
124 | 123 | (identifier) @function.definition |
125 | | - (dot_index_expression field: (identifier) @function.definition) |
| 124 | + (dot_index_expression |
| 125 | + field: (identifier) @function.definition) |
126 | 126 | ]) |
127 | 127 |
|
128 | | -(method_index_expression method: (identifier) @function.method) |
| 128 | +(method_index_expression |
| 129 | + method: (identifier) @function.method) |
129 | 130 |
|
130 | 131 | (function_call |
131 | 132 | (identifier) @function.builtin |
132 | 133 | (#any-of? @function.builtin |
133 | | - ;; built-in functions in Lua 5.1 |
134 | | - "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" |
135 | | - "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" |
136 | | - "rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable" |
137 | | - "tonumber" "tostring" "type" "unpack" "xpcall")) |
138 | | - |
139 | | -;; Others |
| 134 | + ; built-in functions in Lua 5.1 |
| 135 | + "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile" |
| 136 | + "loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawset" "require" |
| 137 | + "select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall")) |
140 | 138 |
|
| 139 | +; Others |
141 | 140 | (comment) @comment |
142 | 141 |
|
143 | 142 | (hash_bang_line) @preproc |
144 | 143 |
|
145 | 144 | (number) @number |
146 | 145 |
|
147 | 146 | (string) @string |
| 147 | + |
148 | 148 | (escape_sequence) @string.escape |
0 commit comments