@@ -18,27 +18,38 @@ syn keyword rustOperator as
18
18
19
19
syn match rustAssert " \< assert\(\w\) *!" contained
20
20
syn match rustFail " \< fail\(\w\) *!" contained
21
- syn keyword rustKeyword break box continue
22
- syn keyword rustKeyword extern nextgroup =rustExternCrate,rustObsoleteExternMod skipwhite
21
+ syn keyword rustKeyword break
22
+ syn keyword rustKeyword box nextgroup =rustBoxPlacement skipwhite skipempty
23
+ syn keyword rustKeyword continue
24
+ syn keyword rustKeyword extern nextgroup =rustExternCrate,rustObsoleteExternMod skipwhite skipempty
25
+ syn keyword rustKeyword fn nextgroup =rustFuncName skipwhite skipempty
23
26
syn keyword rustKeyword for in if impl let
24
27
syn keyword rustKeyword loop once proc pub
25
28
syn keyword rustKeyword return super
26
29
syn keyword rustKeyword unsafe virtual while
27
- syn keyword rustKeyword use nextgroup =rustModPath skipwhite
30
+ syn keyword rustKeyword use nextgroup =rustModPath skipwhite skipempty
28
31
" FIXME: Scoped impl's name is also fallen in this category
29
- syn keyword rustKeyword mod trait struct enum type nextgroup =rustIdentifier skipwhite
30
- syn keyword rustKeyword fn nextgroup =rustFuncName skipwhite
32
+ syn keyword rustKeyword mod trait struct enum type nextgroup =rustIdentifier skipwhite skipempty
31
33
syn keyword rustStorage mut ref static
32
34
syn keyword rustObsoleteStorage const
33
35
34
36
syn keyword rustInvalidBareKeyword crate
35
37
36
- syn keyword rustExternCrate crate contained nextgroup =rustIdentifier skipwhite
37
- syn keyword rustObsoleteExternMod mod contained nextgroup =rustIdentifier skipwhite
38
+ syn keyword rustExternCrate crate contained nextgroup =rustIdentifier skipwhite skipempty
39
+ syn keyword rustObsoleteExternMod mod contained nextgroup =rustIdentifier skipwhite skipempty
38
40
39
41
syn match rustIdentifier contains =rustIdentifierPrime " \% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *" display contained
40
42
syn match rustFuncName " \% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *" display contained
41
43
44
+ syn region rustBoxPlacement matchgroup =rustBoxPlacementParens start =" (" end =" )" contains =TOP contained
45
+ syn keyword rustBoxPlacementExpr GC containedin =rustBoxPlacement
46
+ " Ideally we'd have syntax rules set up to match arbitrary expressions. Since
47
+ " we don't, we'll just define temporary contained rules to handle balancing
48
+ " delimiters.
49
+ syn region rustBoxPlacementBalance start =" (" end =" )" containedin =rustBoxPlacement transparent
50
+ syn region rustBoxPlacementBalance start =" \[ " end =" \] " containedin =rustBoxPlacement transparent
51
+ " {} are handled by rustFoldBraces
52
+
42
53
" Reserved (but not yet used) keywords {{{2
43
54
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield
44
55
@@ -244,6 +255,8 @@ hi def link rustLifetime Special
244
255
hi def link rustInvalidBareKeyword Error
245
256
hi def link rustExternCrate rustKeyword
246
257
hi def link rustObsoleteExternMod Error
258
+ hi def link rustBoxPlacementParens Delimiter
259
+ hi def link rustBoxPlacementExpr rustKeyword
247
260
248
261
" Other Suggestions:
249
262
" hi rustAttribute ctermfg=cyan
0 commit comments