2
2
" Language: Rust
3
3
" Maintainer: Patrick Walton <[email protected] >
4
4
" Maintainer: Ben Blum <[email protected] >
5
- " Last Change: 2013 Jun 14
5
+ " Maintainer: Chris Morgan <[email protected] >
6
+ " Last Change: 2013 Jul 10
6
7
7
8
if version < 600
8
9
syntax clear
13
14
syn keyword rustConditional match if else
14
15
syn keyword rustOperator as
15
16
16
- syn match rustAssert " \< assert\(\w\) *!"
17
- syn match rustFail " \< fail\(\w\) *!"
17
+ syn match rustAssert " \< assert\(\w\) *!" contained
18
+ syn match rustFail " \< fail\(\w\) *!" contained
18
19
syn keyword rustKeyword break copy do extern
19
20
syn keyword rustKeyword for if impl let log
20
21
syn keyword rustKeyword copy do extern
@@ -90,7 +91,7 @@ syn match rustFormat display "%%" contained
90
91
syn region rustString start =+ L\= "+ skip =+ \\\\\|\\ "+ end =+ "+ contains =rustTodo,rustFormat
91
92
92
93
syn region rustAttribute start =" #\[ " end =" \] " contains =rustString,rustDeriving
93
- syn region rustDeriving start =" deriving(" end =" )" contains =rustTrait
94
+ syn region rustDeriving start =" deriving(" end =" )" contained contains =rustTrait
94
95
95
96
" Number literals
96
97
syn match rustNumber display " \< [0-9][0-9_]*\> "
@@ -116,13 +117,18 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9
116
117
syn match rustLifetime display " \'\% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *"
117
118
syn match rustCharacter " '\( [^'\\ ]\|\\\( ['nrt\\\" ]\| x\x\{ 2}\| u\x\{ 4}\| U\x\{ 8}\)\) '"
118
119
119
- syn region rustCommentDoc start =" /\* [\* !]" end =" \* /"
120
- syn region rustCommentDoc start =" //[/!]" skip =" \\ $" end =" $" keepend
121
- syn match rustComment " /\*\* /"
122
- syn region rustComment start =" /\*\( [^\* !]\| $\) " end =" \* /" contains =rustTodo
123
- syn region rustComment start =" //\( [^/!]\| $\) " skip =" \\ $" end =" $" contains =rustTodo keepend
120
+ syn region rustComment start =" /\* " end =" \* /" contains =rustTodo
121
+ syn region rustComment start =" //" skip =" \\ $" end =" $" contains =rustTodo keepend
122
+ syn region rustCommentDoc start =" /\*\% (!\|\* /\@ !\) " end =" \* /" contains =rustTodo
123
+ syn region rustCommentDoc start =" //[/!]" skip =" \\ $" end =" $" contains =rustTodo keepend
124
124
125
- syn keyword rustTodo contained TODO FIXME XXX NB
125
+ syn keyword rustTodo contained TODO FIXME XXX NB NOTE
126
+
127
+ " Trivial folding rules to begin with.
128
+ " TODO: use the AST to make really good folding
129
+ syn region rustFoldBraces start =" {" end =" }" transparent fold
130
+ " If you wish to enable this, setlocal foldmethod=syntax
131
+ " It's not enabled by default as it would drive some people mad.
126
132
127
133
hi def link rustHexNumber rustNumber
128
134
hi def link rustBinNumber rustNumber
@@ -142,10 +148,13 @@ hi def link rustKeyword Keyword
142
148
hi def link rustConditional Conditional
143
149
hi def link rustIdentifier Identifier
144
150
hi def link rustModPath Include
151
+ hi def link rustModPathSep Delimiter
145
152
hi def link rustFuncName Function
146
153
hi def link rustFuncCall Function
147
154
hi def link rustCommentDoc SpecialComment
148
155
hi def link rustComment Comment
156
+ hi def link rustAssert PreCondit
157
+ hi def link rustFail PreCondit
149
158
hi def link rustMacro Macro
150
159
hi def link rustType Type
151
160
hi def link rustTodo Todo
@@ -160,7 +169,6 @@ hi def link rustLifetime Special
160
169
" hi rustAssert ctermfg=yellow
161
170
" hi rustFail ctermfg=red
162
171
" hi rustMacro ctermfg=magenta
163
- " hi rustModPathSep ctermfg=grey
164
172
165
173
syn sync minlines =200
166
174
syn sync maxlines =500
0 commit comments