@@ -146,40 +146,7 @@ contexts:
146
146
- include : strings
147
147
- include : chars
148
148
149
- # macros which take format specs as the only parameter
150
- - match : ' \b((?:format(?:_args)?|e?print(?:ln)?|panic|unreachable|unimplemented)!)\s*(\()'
151
- captures :
152
- 1 : support.macro.rust
153
- 2 : meta.group.rust punctuation.section.group.begin.rust
154
- push :
155
- - meta_content_scope : meta.group.rust
156
- - include : comments
157
- - include : format-string
158
- - include : format-raw-string
159
- - match : ' (?=\S)'
160
- set : group-tail
161
-
162
- # macros which take format specs as the second parameter
163
- - match : ' \b((?:write(?:ln)?|(?:debug_)?assert)!)\s*(\()'
164
- captures :
165
- 1 : support.macro.rust
166
- 2 : meta.group.rust punctuation.section.group.begin.rust
167
- push :
168
- - meta_scope : meta.group.rust
169
- - include : comments
170
- - match : ' ,'
171
- set :
172
- - meta_content_scope : meta.group.rust
173
- - include : format-string
174
- - include : format-raw-string
175
- - match : ' (?=\S)'
176
- set : group-tail
177
- - include : group-tail
178
-
179
- # macros which take format specs as the third parameter
180
- # - match: '\b((?:assert_eq|assert_ne|debug_assert_eq|debug_assert_ne)!)\s*(\()'
181
- # is more performant as the below
182
- # - match: '\b((?:debug_)?assert_(?:eq|ne)!)\s*(\()'
149
+ - include : macros
183
150
184
151
- match : ' \b{{identifier}}!(?=\s*(\(|\{|\[))'
185
152
scope : support.macro.rust
@@ -1232,6 +1199,47 @@ contexts:
1232
1199
- include : char
1233
1200
- include : byte
1234
1201
1202
+ macros :
1203
+ - include : macros-fmt-only
1204
+ - include : macros-fmt-second
1205
+
1206
+ macros-fmt-only :
1207
+ # macros which take format specs as the only parameter
1208
+ - match : ' \b((?:format(?:_args)?|e?print(?:ln)?|panic|unreachable|unimplemented)!)\s*(\()'
1209
+ captures :
1210
+ 1 : support.macro.rust
1211
+ 2 : meta.group.rust punctuation.section.group.begin.rust
1212
+ push :
1213
+ - meta_content_scope : meta.group.rust
1214
+ - include : comments
1215
+ - include : format-string
1216
+ - include : format-raw-string
1217
+ - match : ' (?=\S)'
1218
+ set : group-tail
1219
+
1220
+ macros-fmt-second :
1221
+ # macros which take format specs as the second parameter
1222
+ - match : ' \b((?:write(?:ln)?|(?:debug_)?assert)!)\s*(\()'
1223
+ captures :
1224
+ 1 : support.macro.rust
1225
+ 2 : meta.group.rust punctuation.section.group.begin.rust
1226
+ push :
1227
+ - meta_scope : meta.group.rust
1228
+ - include : comments
1229
+ - match : ' ,'
1230
+ set :
1231
+ - meta_content_scope : meta.group.rust
1232
+ - include : format-string
1233
+ - include : format-raw-string
1234
+ - match : ' (?=\S)'
1235
+ set : group-tail
1236
+ - include : group-tail
1237
+
1238
+ # macros which take format specs as the third parameter
1239
+ # - match: '\b((?:assert_eq|assert_ne|debug_assert_eq|debug_assert_ne)!)\s*(\()'
1240
+ # is more performant as the below
1241
+ # - match: '\b((?:debug_)?assert_(?:eq|ne)!)\s*(\()'
1242
+
1235
1243
byte :
1236
1244
- match : " (b)(')"
1237
1245
captures :
0 commit comments