3
3
" Maintainer: Patrick Walton <[email protected] >
4
4
" Maintainer: Ben Blum <[email protected] >
5
5
" Maintainer: Chris Morgan <[email protected] >
6
- " Last Change: January 5 , 2015
6
+ " Last Change: January 29 , 2015
7
7
8
8
if version < 600
9
9
syntax clear
@@ -62,7 +62,7 @@ syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof
62
62
syn keyword rustType isize usize float char bool u8 u16 u32 u64 f32
63
63
syn keyword rustType f64 i8 i16 i32 i64 str Self
64
64
65
- " Things from the prelude (src/libstd/prelude.rs) {{{2
65
+ " Things from the libstd v1 prelude (src/libstd/prelude/v1 .rs) {{{2
66
66
" This section is just straight transformation of the contents of the prelude,
67
67
" to make it easy to update.
68
68
@@ -71,7 +71,10 @@ syn keyword rustTrait Copy Send Sized Sync
71
71
syn keyword rustTrait Drop Fn FnMut FnOnce
72
72
73
73
" Reexported functions {{{3
74
- syn keyword rustFunction drop
74
+ " There’s no point in highlighting these; when one writes drop( or drop::< it
75
+ " gets the same highlighting anyway, and if someone writes `let drop = …;` we
76
+ " don’t really want *that* drop to be highlighted.
77
+ " syn keyword rustFunction drop
75
78
76
79
" Reexported types and traits {{{3
77
80
syn keyword rustTrait Box
@@ -120,6 +123,7 @@ syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
120
123
" This isn't actually correct; a closure with no arguments can be `|| { }`.
121
124
" Last, because the & in && isn't a sigil
122
125
syn match rustOperator display " &&\| ||"
126
+ syn match rustArrow display " ->"
123
127
124
128
syn match rustMacro ' \w\(\w\) *!' contains =rustAssert,rustPanic
125
129
syn match rustMacro ' #\w\(\w\) *' contains =rustAssert,rustPanic
@@ -134,7 +138,10 @@ syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEs
134
138
syn region rustString start =' b\? r\z (#*\) "' end =' "\z 1' contains =@Spell
135
139
136
140
syn region rustAttribute start =" #!\?\[ " end =" \] " contains =rustString,rustDerive
137
- syn region rustDerive start =" derive(" end =" )" contained contains =rustTrait
141
+ syn region rustDerive start =" derive(" end =" )" contained contains =rustDeriveTrait
142
+ " This list comes from src/libsyntax/ext/deriving/mod.rs
143
+ " Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
144
+ syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
138
145
139
146
" Number literals
140
147
syn match rustDecNumber display " \< [0-9][0-9_]*\% ([iu]\% (s\| 8\| 16\| 32\| 64\)\)\= "
@@ -198,6 +205,7 @@ hi def link rustOctNumber rustNumber
198
205
hi def link rustBinNumber rustNumber
199
206
hi def link rustIdentifierPrime rustIdentifier
200
207
hi def link rustTrait rustType
208
+ hi def link rustDeriveTrait rustTrait
201
209
202
210
hi def link rustMacroRepeatCount rustMacroRepeatDelimiters
203
211
hi def link rustMacroRepeatDelimiters Macro
@@ -218,6 +226,7 @@ hi def link rustEnumVariant rustConstant
218
226
hi def link rustConstant Constant
219
227
hi def link rustSelf Constant
220
228
hi def link rustFloat Float
229
+ hi def link rustArrow rustOperator
221
230
hi def link rustOperator Operator
222
231
hi def link rustKeyword Keyword
223
232
hi def link rustReservedKeyword Error
0 commit comments