3
3
" Maintainer: Patrick Walton <[email protected] >
4
4
" Maintainer: Ben Blum <[email protected] >
5
5
" Maintainer: Chris Morgan <[email protected] >
6
- " Last Change: 2013 Dec 04
6
+ " Last Change: 2013 Dec 10
7
7
8
8
if version < 600
9
9
syntax clear
@@ -19,23 +19,23 @@ syn keyword rustOperator as
19
19
syn match rustAssert " \< assert\(\w\) *!" contained
20
20
syn match rustFail " \< fail\(\w\) *!" contained
21
21
syn keyword rustKeyword break continue do extern
22
- syn keyword rustKeyword in if impl let log
23
- syn keyword rustKeyword for impl let log
24
- syn keyword rustKeyword loop mod once priv pub
22
+ syn keyword rustKeyword for in if impl let
23
+ syn keyword rustKeyword loop once priv pub
25
24
syn keyword rustKeyword return
26
25
syn keyword rustKeyword unsafe while
27
26
syn keyword rustKeyword use nextgroup =rustModPath skipwhite
28
27
" FIXME: Scoped impl's name is also fallen in this category
29
28
syn keyword rustKeyword mod trait struct enum type nextgroup =rustIdentifier skipwhite
30
29
syn keyword rustKeyword fn nextgroup =rustFuncName skipwhite
31
30
syn keyword rustKeyword proc
32
- syn keyword rustStorage const mut ref static
31
+ syn keyword rustStorage mut ref static
32
+ syn keyword rustObsoleteStorage const
33
33
34
34
syn match rustIdentifier contains =rustIdentifierPrime " \% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *" display contained
35
35
syn match rustFuncName " \% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *" display contained
36
36
37
37
" Reserved (but not yet used) keywords {{{2
38
- syn keyword rustKeyword alignof be offsetof pure sizeof typeof yield
38
+ syn keyword rustReservedKeyword alignof be offsetof pure sizeof typeof yield
39
39
40
40
" Built-in types {{{2
41
41
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
@@ -160,14 +160,15 @@ syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64
160
160
syn match rustOctNumber display " \< 0o[0-7_]\+\% ([iu]\% (8\| 16\| 32\| 64\)\=\)\= "
161
161
syn match rustBinNumber display " \< 0b[01_]\+\% ([iu]\% (8\| 16\| 32\| 64\)\=\)\= "
162
162
163
- " To mark it as a float, it must have at least one of the three things integral values don't have:
163
+ " Special case for numbers of the form "1." which are float literals, unless followed by
164
+ " an identifier, which makes them integer literals with a method call or field access.
165
+ " (This must go first so the others take precedence.)
166
+ syn match rustFloat display " \< [0-9][0-9_]*\.\% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\@ !"
167
+ " To mark a number as a normal float, it must have at least one of the three things integral values don't have:
164
168
" a decimal point and more numbers; an exponent; and a type suffix.
165
169
syn match rustFloat display " \< [0-9][0-9_]*\% (\. [0-9][0-9_]*\)\% ([eE][+-]\= [0-9_]\+\)\=\( f32\| f64\)\= "
166
170
syn match rustFloat display " \< [0-9][0-9_]*\% (\. [0-9][0-9_]*\)\=\% ([eE][+-]\= [0-9_]\+\)\( f32\| f64\)\= "
167
171
syn match rustFloat display " \< [0-9][0-9_]*\% (\. [0-9][0-9_]*\)\=\% ([eE][+-]\= [0-9_]\+\)\=\( f32\| f64\) "
168
- " Special case for numbers of the form "1." which are float literals, unless followed by
169
- " an identifier, which makes them integer literals with a method call or field access.
170
- syn match rustFloat display " \< [0-9][0-9_]*\.\% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\@ !"
171
172
172
173
" For the benefit of delimitMate
173
174
syn region rustLifetimeCandidate display start =/ &'\% (\( [^'\\ ]\|\\\( ['nrt0\\\" ]\| x\x\{ 2}\| u\x\{ 4}\| U\x\{ 8}\)\) '\)\@ !/ end =/ [[:cntrl:][:space:][:punct:]]\@ =\| $/ contains =rustSigil,rustLifetime
@@ -227,6 +228,7 @@ hi def link rustSelf Constant
227
228
hi def link rustFloat Float
228
229
hi def link rustOperator Operator
229
230
hi def link rustKeyword Keyword
231
+ hi def link rustReservedKeyword Error
230
232
hi def link rustConditional Conditional
231
233
hi def link rustIdentifier Identifier
232
234
hi def link rustCapsIdent rustIdentifier
@@ -247,6 +249,7 @@ hi def link rustTodo Todo
247
249
hi def link rustAttribute PreProc
248
250
hi def link rustDeriving PreProc
249
251
hi def link rustStorage StorageClass
252
+ hi def link rustObsoleteStorage Error
250
253
hi def link rustLifetime Special
251
254
252
255
" Other Suggestions:
0 commit comments