Skip to content

Commit df860dd

Browse files
committed
move macros to separate groups for easier override
1 parent aba5b4e commit df860dd

File tree

1 file changed

+42
-34
lines changed

1 file changed

+42
-34
lines changed

RustEnhanced.sublime-syntax

+42-34
Original file line numberDiff line numberDiff line change
@@ -146,40 +146,7 @@ contexts:
146146
- include: strings
147147
- include: chars
148148

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
183150

184151
- match: '\b{{identifier}}!(?=\s*(\(|\{|\[))'
185152
scope: support.macro.rust
@@ -1232,6 +1199,47 @@ contexts:
12321199
- include: char
12331200
- include: byte
12341201

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+
12351243
byte:
12361244
- match: "(b)(')"
12371245
captures:

0 commit comments

Comments
 (0)