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