@@ -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,228 @@ 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'
77
74
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'
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'
98
87
99
- '''
100
- call_expression > identifier,
101
- call_expression > field_expression > field_identifier,
102
- function_declarator > identifier
103
- ''' : ' entity.name.function'
88
+ ' "sizeof"' : ' keyword.operator.sizeof'
104
89
105
- ' statement_identifier' : ' constant.variable'
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'
106
97
107
- ' field_identifier' : ' variable.other.member'
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'
108
104
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'
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'
115
116
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'
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'
120
123
121
- ' number_literal' : ' constant.numeric.decimal'
122
- ' null' : ' constant.language.null'
123
- ' true' : ' constant.language.boolean'
124
- ' false' : ' constant.language.boolean'
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'
130
+
131
+ ' "?"' : ' keyword.operator.ternary.symbolic'
132
+ ' conditional_expression > ":"' : ' keyword.operator.ternary.symbolic'
133
+
134
+ # Storage
135
+ ' "typedef"' : ' storage.declaration.datatype'
136
+ ' "struct"' : ' storage.declaration.structure'
137
+ ' "enum"' : ' storage.declaration.enumeration'
138
+ ' "union"' : ' storage.declaration.union'
125
139
126
- ' auto' : ' storage.modifier'
127
140
' "extern"' : ' storage.modifier'
128
- ' "register"' : ' storage.modifier'
129
141
' "static"' : ' storage.modifier'
142
+ ' "register"' : ' storage.modifier'
130
143
' "inline"' : ' storage.modifier'
131
144
' "const"' : ' storage.modifier'
132
145
' "volatile"' : ' storage.modifier'
133
146
' "restrict"' : ' storage.modifier'
134
147
' "_Atomic"' : ' storage.modifier'
148
+ ' auto' : ' storage.modifier'
135
149
' function_specifier' : ' storage.modifier'
136
150
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'
142
- ' 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'
151
+ ' "unsigned"' : ' storage.type.fundamental'
152
+ ' "signed"' : ' storage.type.fundamental'
153
+ ' "short"' : ' storage.type.fundamental'
154
+ ' "long"' : ' storage.type.fundamental'
155
+ ' primitive_type' : ' storage.type.fundamental'
147
156
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'
157
+ # Entity
158
+ ' type_identifier' : ' entity.type'
159
+
160
+ ' identifier' : [
161
+ {
162
+ match : ' ^[A-Z\\ d_]+$' ,
163
+ scopes : ' entity.variable.immutable'
164
+ },
165
+ ' entity.variable'
166
+ ]
167
+
168
+ ' field_identifier' : [
169
+ {
170
+ match : ' ^[A-Z\\ d_]+$' ,
171
+ scopes : ' entity.variable.member.immutable'
172
+ },
173
+ ' entity.variable.member'
174
+ ]
175
+
176
+ ' statement_identifier' : ' entity.label'
177
+
178
+ '''
179
+ preproc_function_def > identifier:nth-child(1),
180
+ function_declarator > identifier
181
+ ''' : ' entity.function'
182
+
183
+ '''
184
+ call_expression > identifier,
185
+ call_expression > field_expression > field_identifier
186
+ ''' : ' entity.function.call'
187
+
188
+ # String
189
+ ' string_literal' : ' string.quoted'
190
+ ' system_lib_string' : ' string.quoted'
191
+
192
+ # Constant
193
+ ' char_literal' : ' constant.character'
194
+ ' escape_sequence' : [
195
+ {
196
+ match : ' ^\\\\ [uUxftvnrabe0-9]' ,
197
+ scopes : ' constant.character.escape.code'
198
+ },
199
+ ' constant.character.escape'
200
+ ]
201
+ ' preproc_include > string_literal > escape_sequence' : ' ' # No escape characters in include directive
202
+
203
+ ' number_literal' : ' constant.numeric.decimal'
204
+
205
+ ' null' : ' constant.language.null'
206
+ ' true' : ' constant.language.boolean.true'
207
+ ' false' : ' constant.language.boolean.false'
208
+
209
+ # Comment
210
+ ' comment' : ' comment.block'
211
+
212
+ # Punctuation
213
+ ' "."' : ' punctuation.accessor.member'
214
+ ' "->"' : ' punctuation.accessor.member'
215
+ ' ";"' : ' punctuation.delimiter.statement'
216
+ ' ":"' : ' punctuation.delimiter'
217
+ ' ","' : ' punctuation.delimiter'
218
+ ' "("' : ' punctuation.delimiter'
219
+ ' ")"' : ' punctuation.delimiter'
220
+ ' "{"' : ' punctuation.delimiter'
221
+ ' "}"' : ' punctuation.delimiter'
222
+ ' "["' : ' punctuation.delimiter'
223
+ ' "]"' : ' punctuation.delimiter'
224
+ ' "..."' : ' punctuation.alteration.variadic'
225
+ ' char_literal > "\' "' : ' punctuation.definition.constant.character.quoted'
226
+ ' string_literal > "\\ ""' : ' punctuation.definition.string.quoted'
227
+
228
+ ' array_declarator > "["' : ' punctuation.delimiter.array.size'
229
+ ' array_declarator > "]"' : ' punctuation.delimiter.array.size'
230
+ ' abstract_array_declarator > "["' : ' punctuation.delimiter.array.size'
231
+ ' abstract_array_declarator > "]"' : ' punctuation.delimiter.array.size'
232
+
233
+ ' subscript_expression > "["' : ' punctuation.accessor.subscript'
234
+ ' subscript_expression > "]"' : ' punctuation.accessor.subscript'
235
+ ' subscript_designator > "["' : ' punctuation.accessor.subscript'
236
+ ' subscript_designator > "]"' : ' punctuation.accessor.subscript'
237
+
238
+ ' initializer_list > "{"' : ' punctuation.definition.collection'
239
+ ' initializer_list > "}"' : ' punctuation.definition.collection'
240
+
241
+ ' compound_statement > "{"' : ' punctuation.delimiter.statement'
242
+ ' compound_statement > "}"' : ' punctuation.delimiter.statement'
243
+
244
+ ' function_definition > compound_statement > "{"' : ' punctuation.delimiter.body.function'
245
+ ' function_definition > compound_statement > "}"' : ' punctuation.delimiter.body.function'
246
+
247
+ ' enumerator_list > "{"' : ' punctuation.delimiter.body.enumeration'
248
+ ' enumerator_list > "}"' : ' punctuation.delimiter.body.enumeration'
249
+
250
+ ' union_specifier > field_declaration_list > "{"' : ' punctuation.delimiter.body.union'
251
+ ' union_specifier > field_declaration_list > "}"' : ' punctuation.delimiter.body.union'
252
+
253
+ ' struct_specifier > field_declaration_list > "{"' : ' punctuation.delimiter.body.structure'
254
+ ' struct_specifier > field_declaration_list > "}"' : ' punctuation.delimiter.body.structure'
255
+
256
+ ' preproc_params > "("' : ' punctuation.delimiter.parameters'
257
+ ' preproc_params > ")"' : ' punctuation.delimiter.parameters'
258
+
259
+ ' parameter_list > "("' : ' punctuation.delimiter.parameters'
260
+ ' parameter_list > ")"' : ' punctuation.delimiter.parameters'
261
+ ' argument_list > "("' : ' punctuation.delimiter.arguments'
262
+ ' argument_list > ")"' : ' punctuation.delimiter.arguments'
263
+
264
+ ' sizeof_expression > "("' : ' punctuation.delimiter.arguments'
265
+ ' sizeof_expression > ")"' : ' punctuation.delimiter.arguments'
266
+ ' sizeof_expression > parenthesized_expression > "("' : ' punctuation.delimiter.arguments'
267
+ ' sizeof_expression > parenthesized_expression > ")"' : ' punctuation.delimiter.arguments'
268
+
269
+ ' attribute_specifier > "("' : ' punctuation.delimiter.arguments'
270
+ ' attribute_specifier > ")"' : ' punctuation.delimiter.arguments'
271
+
272
+ ' cast_expression > "("' : ' punctuation.delimiter.cast'
273
+ ' cast_expression > ")"' : ' punctuation.delimiter.cast'
274
+
275
+ ' compound_literal_expression > "("' : ' punctuation.delimiter.expression'
276
+ ' compound_literal_expression > ")"' : ' punctuation.delimiter.expression'
277
+
278
+ ' parenthesized_expression > "("' : ' punctuation.delimiter.expression'
279
+ ' parenthesized_expression > ")"' : ' punctuation.delimiter.expression'
280
+
281
+ ' for_statement > "("' : ' punctuation.delimiter.expression'
282
+ ' for_statement > ")"' : ' punctuation.delimiter.expression'
283
+
284
+ ' ERROR > "."' : ' punctuation.accessor.member.invalid.illegal'
285
+ ' ERROR > "->"' : ' punctuation.accessor.member.invalid.illegal'
286
+ ' ERROR > ";"' : ' punctuation.delimiter.statement.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.delimiter.invalid.illegal'
295
+ ' ERROR > "..."' : ' punctuation.alteration.variadic.invalid.illegal'
296
+ ' ERROR > "\' "' : ' punctuation.definition.constant.character.quoted.invalid.illegal'
297
+ ' ERROR > "\\ ""' : ' punctuation.definition.string.quoted.invalid.illegal'
0 commit comments