@@ -59,12 +59,8 @@ comments:
59
59
60
60
scopes :
61
61
' translation_unit' : ' source.c'
62
- ' comment' : ' comment.block'
63
-
64
- ' identifier' : [
65
- {match : ' ^[A-Z\\ d_]+$' , scopes : ' constant.other' }
66
- ]
67
62
63
+ # Keyword
68
64
' "#if"' : ' keyword.control.directive'
69
65
' "#ifdef"' : ' keyword.control.directive'
70
66
' "#ifndef"' : ' keyword.control.directive'
@@ -74,112 +70,227 @@ scopes:
74
70
' "#define"' : ' keyword.control.directive'
75
71
' "#include"' : ' keyword.control.directive'
76
72
' preproc_directive' : ' keyword.control.directive'
73
+ ' "__attribute__"' : ' keyword.control.directive'
74
+
75
+ ' "if"' : ' keyword.control.condition'
76
+ ' "else"' : ' keyword.control.condition'
77
+ ' "switch"' : ' keyword.control.condition'
78
+ ' "case"' : ' keyword.control.condition'
79
+ ' "default"' : ' keyword.control.condition'
80
+ ' "do"' : ' keyword.control.loop'
81
+ ' "for"' : ' keyword.control.loop'
82
+ ' "while"' : ' keyword.control.loop'
83
+ ' "break"' : ' keyword.control.jump'
84
+ ' "continue"' : ' keyword.control.jump'
85
+ ' "return"' : ' keyword.control.jump'
86
+ ' "goto"' : ' keyword.control.jump'
87
+
88
+ ' "sizeof"' : ' keyword.operator.sizeof'
89
+
90
+ ' "+"' : ' keyword.operator.arithmetic.symbolic'
91
+ ' "-"' : ' keyword.operator.arithmetic.symbolic'
92
+ ' binary_expression > "*"' : ' keyword.operator.arithmetic.symbolic'
93
+ ' "/"' : ' keyword.operator.arithmetic.symbolic'
94
+ ' "%"' : ' keyword.operator.arithmetic.symbolic'
95
+ ' "++"' : ' keyword.operator.arithmetic.symbolic'
96
+ ' "--"' : ' keyword.operator.arithmetic.symbolic'
97
+
98
+ ' binary_expression > "&"' : ' keyword.operator.bitwise.symbolic'
99
+ ' "|"' : ' keyword.operator.bitwise.symbolic'
100
+ ' "^"' : ' keyword.operator.bitwise.symbolic'
101
+ ' "~"' : ' keyword.operator.bitwise.symbolic'
102
+ ' "<<"' : ' keyword.operator.bitwise.shift.symbolic'
103
+ ' ">>"' : ' keyword.operator.bitwise.shift.symbolic'
104
+
105
+ ' "="' : ' keyword.operator.assignment.symbolic'
106
+ ' "+="' : ' keyword.operator.assignment.compound.symbolic'
107
+ ' "-="' : ' keyword.operator.assignment.compound.symbolic'
108
+ ' "*="' : ' keyword.operator.assignment.compound.symbolic'
109
+ ' "/="' : ' keyword.operator.assignment.compound.symbolic'
110
+ ' "%="' : ' keyword.operator.assignment.compound.symbolic'
111
+ ' "<<="' : ' keyword.operator.assignment.compound.symbolic'
112
+ ' ">>="' : ' keyword.operator.assignment.compound.symbolic'
113
+ ' "&="' : ' keyword.operator.assignment.compound.symbolic'
114
+ ' "|="' : ' keyword.operator.assignment.compound.symbolic'
115
+ ' "^="' : ' keyword.operator.assignment.compound.symbolic'
116
+
117
+ ' "=="' : ' keyword.operator.comparison.symbolic'
118
+ ' "!="' : ' keyword.operator.comparison.symbolic'
119
+ ' "<"' : ' keyword.operator.comparison.symbolic'
120
+ ' ">"' : ' keyword.operator.comparison.symbolic'
121
+ ' "<="' : ' keyword.operator.comparison.symbolic'
122
+ ' ">="' : ' keyword.operator.comparison.symbolic'
123
+
124
+ ' "!"' : ' keyword.operator.logical.symbolic'
125
+ ' "&&"' : ' keyword.operator.logical.symbolic'
126
+ ' "||"' : ' keyword.operator.logical.symbolic'
127
+
128
+ ' "&"' : ' keyword.operator.pointer.reference.symbolic'
129
+ ' "*"' : ' keyword.operator.pointer.dereference.symbolic'
77
130
78
- ' "if"' : ' keyword.control'
79
- ' "else"' : ' keyword.control'
80
- ' "do"' : ' keyword.control'
81
- ' "for"' : ' keyword.control'
82
- ' "while"' : ' keyword.control'
83
- ' "break"' : ' keyword.control'
84
- ' "continue"' : ' keyword.control'
85
- ' "return"' : ' keyword.control'
86
- ' "switch"' : ' keyword.control'
87
- ' "case"' : ' keyword.control'
88
- ' "default"' : ' keyword.control'
89
- ' "goto"' : ' keyword.control'
90
-
91
- ' "struct"' : ' keyword.control'
92
- ' "enum"' : ' keyword.control'
93
- ' "union"' : ' keyword.control'
94
- ' "typedef"' : ' keyword.control'
95
-
96
- ' preproc_function_def > identifier:nth-child(1)' : ' entity.name.function.preprocessor'
97
- ' preproc_arg' : ' meta.preprocessor.macro'
131
+ ' "?"' : ' keyword.operator.ternary.symbolic'
132
+ ' conditional_expression > ":"' : ' keyword.operator.ternary.symbolic'
133
+
134
+ ' "unsigned"' : ' keyword.type.fundamental'
135
+ ' "signed"' : ' keyword.type.fundamental'
136
+ ' "short"' : ' keyword.type.fundamental'
137
+ ' "long"' : ' keyword.type.fundamental'
138
+ ' primitive_type' : ' keyword.type.fundamental'
139
+
140
+ ' "typedef"' : ' keyword.storage.declaration'
141
+ ' "struct"' : ' keyword.storage.declaration'
142
+ ' "enum"' : ' keyword.storage.declaration'
143
+ ' "union"' : ' keyword.storage.declaration'
144
+
145
+ ' "extern"' : ' keyword.storage.modifier'
146
+ ' "static"' : ' keyword.storage.modifier'
147
+ ' "register"' : ' keyword.storage.modifier'
148
+ ' "inline"' : ' keyword.storage.modifier'
149
+ ' "const"' : ' keyword.storage.modifier'
150
+ ' "volatile"' : ' keyword.storage.modifier'
151
+ ' "restrict"' : ' keyword.storage.modifier'
152
+ ' "_Atomic"' : ' keyword.storage.modifier'
153
+ ' "auto"' : ' keyword.storage.modifier'
154
+ ' function_specifier' : ' keyword.storage.modifier'
155
+
156
+ # Entity
157
+ ' type_identifier' : ' entity.type'
158
+
159
+ ' identifier' : [
160
+ {
161
+ match : ' ^[A-Z\\ d_]+$' ,
162
+ scopes : ' entity.variable.immutable'
163
+ },
164
+ ' entity.variable'
165
+ ]
166
+
167
+ ' field_identifier' : [
168
+ {
169
+ match : ' ^[A-Z\\ d_]+$' ,
170
+ scopes : ' entity.variable.member.immutable'
171
+ },
172
+ ' entity.variable.member'
173
+ ]
174
+
175
+ ' statement_identifier' : ' entity.label'
98
176
99
177
'''
100
- call_expression > identifier,
101
- call_expression > field_expression > field_identifier,
178
+ preproc_function_def > identifier:nth-child(1),
102
179
function_declarator > identifier
103
- ''' : ' entity.name.function'
104
-
105
- ' statement_identifier' : ' constant.variable'
180
+ ''' : ' entity.function'
106
181
107
- ' field_identifier' : ' variable.other.member'
182
+ '''
183
+ call_expression > identifier,
184
+ call_expression > field_expression > field_identifier
185
+ ''' : ' entity.function.call'
108
186
109
- ' type_identifier' : ' support.storage.type'
110
- ' primitive_type' : ' support.storage.type'
111
- ' "signed"' : ' support.storage.type'
112
- ' "unsigned"' : ' support.storage.type'
113
- ' "short"' : ' support.storage.type'
114
- ' "long"' : ' support.storage.type'
187
+ # String
188
+ ' string_literal' : ' string.quoted'
189
+ ' system_lib_string' : ' string.quoted'
115
190
116
- ' char_literal' : ' string.quoted.single'
117
- ' string_literal' : ' string.quoted.double'
118
- ' system_lib_string' : ' string.quoted.other'
119
- ' escape_sequence' : ' constant.character.escape'
191
+ # Constant
192
+ ' char_literal' : ' constant.character'
193
+ ' escape_sequence' : [
194
+ {
195
+ match : ' ^\\\\ [uUxftvnrabe0-9]' ,
196
+ scopes : ' constant.character.escape.code'
197
+ },
198
+ ' constant.character.escape'
199
+ ]
200
+ ' preproc_include > string_literal > escape_sequence' : ' ' # No escape characters in include directive
120
201
121
202
' number_literal' : ' constant.numeric.decimal'
203
+
122
204
' null' : ' constant.language.null'
123
- ' true' : ' constant.language.boolean'
124
- ' false' : ' constant.language.boolean'
125
-
126
- ' auto' : ' storage.modifier'
127
- ' "extern"' : ' storage.modifier'
128
- ' "register"' : ' storage.modifier'
129
- ' "static"' : ' storage.modifier'
130
- ' "inline"' : ' storage.modifier'
131
- ' "const"' : ' storage.modifier'
132
- ' "volatile"' : ' storage.modifier'
133
- ' "restrict"' : ' storage.modifier'
134
- ' "_Atomic"' : ' storage.modifier'
135
- ' function_specifier' : ' storage.modifier'
136
-
137
- ' ";"' : ' punctuation.terminator.statement'
138
- ' "["' : ' punctuation.definition.begin.bracket.square'
139
- ' "]"' : ' punctuation.definition.end.bracket.square'
140
- ' ","' : ' punctuation.separator.delimiter'
141
- ' char_literal > "\' "' : ' punctuation.definition.string'
205
+ ' true' : ' constant.language.boolean.true'
206
+ ' false' : ' constant.language.boolean.false'
207
+
208
+ # Comment
209
+ ' comment' : ' comment.block'
210
+
211
+ # Punctuation
212
+ ' "."' : ' punctuation.accessor.member'
213
+ ' "->"' : ' punctuation.accessor.member'
214
+ ' ";"' : ' punctuation.delimiter.statement'
215
+ ' ":"' : ' punctuation.delimiter'
216
+ ' ","' : ' punctuation.delimiter'
217
+ ' "("' : ' punctuation.delimiter'
218
+ ' ")"' : ' punctuation.delimiter'
219
+ ' "{"' : ' punctuation.delimiter'
220
+ ' "}"' : ' punctuation.delimiter'
221
+ ' "["' : ' punctuation.delimiter'
222
+ ' "]"' : ' punctuation.delimiter'
223
+ ' "..."' : ' punctuation.alteration.variadic'
224
+ ' char_literal > "\' "' : ' punctuation.definition.constant.character'
142
225
' string_literal > "\\ ""' : ' punctuation.definition.string'
143
- ' "{"' : ' punctuation.section.block.begin.bracket.curly'
144
- ' "}"' : ' punctuation.section.block.end.bracket.curly'
145
- ' "("' : ' punctuation.section.parens.begin.bracket.round'
146
- ' ")"' : ' punctuation.section.parens.end.bracket.round'
147
226
148
- ' "sizeof"' : ' keyword.operator.sizeof'
149
- ' "."' : ' keyword.operator.member'
150
- ' "->"' : ' keyword.operator.member'
151
- ' "*"' : ' keyword.operator'
152
- ' "-"' : ' keyword.operator'
153
- ' "+"' : ' keyword.operator'
154
- ' "/"' : ' keyword.operator'
155
- ' "%"' : ' keyword.operator'
156
- ' "++"' : ' keyword.operator'
157
- ' "--"' : ' keyword.operator'
158
- ' "=="' : ' keyword.operator'
159
- ' "!"' : ' keyword.operator'
160
- ' "!="' : ' keyword.operator'
161
- ' "<"' : ' keyword.operator'
162
- ' ">"' : ' keyword.operator'
163
- ' ">="' : ' keyword.operator'
164
- ' "<="' : ' keyword.operator'
165
- ' "&&"' : ' keyword.operator'
166
- ' "||"' : ' keyword.operator'
167
- ' "&"' : ' keyword.operator'
168
- ' "|"' : ' keyword.operator'
169
- ' "^"' : ' keyword.operator'
170
- ' "~"' : ' keyword.operator'
171
- ' "<<"' : ' keyword.operator'
172
- ' ">>"' : ' keyword.operator'
173
- ' "="' : ' keyword.operator'
174
- ' "+="' : ' keyword.operator'
175
- ' "-="' : ' keyword.operator'
176
- ' "*="' : ' keyword.operator'
177
- ' "/="' : ' keyword.operator'
178
- ' "%="' : ' keyword.operator'
179
- ' "<<="' : ' keyword.operator'
180
- ' ">>="' : ' keyword.operator'
181
- ' "&="' : ' keyword.operator'
182
- ' "^="' : ' keyword.operator'
183
- ' "|="' : ' keyword.operator'
184
- ' "?"' : ' keyword.operator'
185
- ' ":"' : ' keyword.operator'
227
+ ' array_declarator > "["' : ' punctuation.delimiter.array.size'
228
+ ' array_declarator > "]"' : ' punctuation.delimiter.array.size'
229
+ ' abstract_array_declarator > "["' : ' punctuation.delimiter.array.size'
230
+ ' abstract_array_declarator > "]"' : ' punctuation.delimiter.array.size'
231
+
232
+ ' subscript_expression > "["' : ' punctuation.accessor.subscript'
233
+ ' subscript_expression > "]"' : ' punctuation.accessor.subscript'
234
+ ' subscript_designator > "["' : ' punctuation.accessor.subscript'
235
+ ' subscript_designator > "]"' : ' punctuation.accessor.subscript'
236
+
237
+ ' initializer_list > "{"' : ' punctuation.definition.collection'
238
+ ' initializer_list > "}"' : ' punctuation.definition.collection'
239
+
240
+ ' compound_statement > "{"' : ' punctuation.delimiter.statement'
241
+ ' compound_statement > "}"' : ' punctuation.delimiter.statement'
242
+
243
+ ' function_definition > compound_statement > "{"' : ' punctuation.delimiter.body.function'
244
+ ' function_definition > compound_statement > "}"' : ' punctuation.delimiter.body.function'
245
+
246
+ ' enumerator_list > "{"' : ' punctuation.delimiter.body.enumeration'
247
+ ' enumerator_list > "}"' : ' punctuation.delimiter.body.enumeration'
248
+
249
+ ' union_specifier > field_declaration_list > "{"' : ' punctuation.delimiter.body.union'
250
+ ' union_specifier > field_declaration_list > "}"' : ' punctuation.delimiter.body.union'
251
+
252
+ ' struct_specifier > field_declaration_list > "{"' : ' punctuation.delimiter.body.structure'
253
+ ' struct_specifier > field_declaration_list > "}"' : ' punctuation.delimiter.body.structure'
254
+
255
+ ' preproc_params > "("' : ' punctuation.delimiter.parameters'
256
+ ' preproc_params > ")"' : ' punctuation.delimiter.parameters'
257
+
258
+ ' parameter_list > "("' : ' punctuation.delimiter.parameters'
259
+ ' parameter_list > ")"' : ' punctuation.delimiter.parameters'
260
+ ' argument_list > "("' : ' punctuation.delimiter.arguments'
261
+ ' argument_list > ")"' : ' punctuation.delimiter.arguments'
262
+
263
+ ' sizeof_expression > "("' : ' punctuation.delimiter.arguments'
264
+ ' sizeof_expression > ")"' : ' punctuation.delimiter.arguments'
265
+ ' sizeof_expression > parenthesized_expression > "("' : ' punctuation.delimiter.arguments'
266
+ ' sizeof_expression > parenthesized_expression > ")"' : ' punctuation.delimiter.arguments'
267
+
268
+ ' attribute_specifier > "("' : ' punctuation.delimiter.arguments'
269
+ ' attribute_specifier > ")"' : ' punctuation.delimiter.arguments'
270
+
271
+ ' cast_expression > "("' : ' punctuation.delimiter.cast'
272
+ ' cast_expression > ")"' : ' punctuation.delimiter.cast'
273
+
274
+ ' compound_literal_expression > "("' : ' punctuation.delimiter.expression'
275
+ ' compound_literal_expression > ")"' : ' punctuation.delimiter.expression'
276
+
277
+ ' parenthesized_expression > "("' : ' punctuation.delimiter.expression'
278
+ ' parenthesized_expression > ")"' : ' punctuation.delimiter.expression'
279
+
280
+ ' for_statement > "("' : ' punctuation.delimiter.expression'
281
+ ' for_statement > ")"' : ' punctuation.delimiter.expression'
282
+
283
+ ' ERROR > "."' : ' punctuation.accessor.member.invalid.illegal'
284
+ ' ERROR > "->"' : ' punctuation.accessor.member.invalid.illegal'
285
+ ' ERROR > ";"' : ' punctuation.delimiter.statement.invalid.illegal'
286
+ ' ERROR > ":"' : ' punctuation.delimiter.invalid.illegal'
287
+ ' ERROR > ","' : ' punctuation.delimiter.invalid.illegal'
288
+ ' ERROR > "("' : ' punctuation.delimiter.invalid.illegal'
289
+ ' ERROR > ")"' : ' punctuation.delimiter.invalid.illegal'
290
+ ' ERROR > "{"' : ' punctuation.delimiter.invalid.illegal'
291
+ ' ERROR > "}"' : ' punctuation.delimiter.invalid.illegal'
292
+ ' ERROR > "["' : ' punctuation.delimiter.invalid.illegal'
293
+ ' ERROR > "]"' : ' punctuation.delimiter.invalid.illegal'
294
+ ' ERROR > "..."' : ' punctuation.alteration.variadic.invalid.illegal'
295
+ ' ERROR > "\' "' : ' punctuation.definition.constant.character.invalid.illegal'
296
+ ' ERROR > "\\ ""' : ' punctuation.definition.string.invalid.illegal'
0 commit comments