Skip to content

Commit d17d6ac

Browse files
committed
---
yaml --- r: 69629 b: refs/heads/auto c: 44cb1c3 h: refs/heads/master i: 69627: d6c1b16 v: v3
1 parent 244c8c8 commit d17d6ac

File tree

9 files changed

+940
-940
lines changed

9 files changed

+940
-940
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 2001cc043b7c20af1f72b9c39e61070fd1c639f6
17+
refs/heads/auto: 44cb1c3adba18ae36441649f7264ecb834ea2502
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
55
" Maintainer: Chris Morgan <[email protected]>
6-
" Last Change: 2013 Jul 10
6+
" Last Change: 2013 Aug 1
77

88
if version < 600
99
syntax clear
@@ -17,7 +17,7 @@ syn keyword rustOperator as
1717
syn match rustAssert "\<assert\(\w\)*!" contained
1818
syn match rustFail "\<fail\(\w\)*!" contained
1919
syn keyword rustKeyword break copy do extern
20-
syn keyword rustKeyword for if impl let log
20+
syn keyword rustKeyword foreach in if impl let log
2121
syn keyword rustKeyword copy do extern
2222
syn keyword rustKeyword for impl let log
2323
syn keyword rustKeyword loop mod once priv pub
@@ -83,12 +83,26 @@ syn match rustModPathSep "::"
8383
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
8484
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
8585

86+
" This is merely a convention; note also the use of [A-Z], restricting it to
87+
" latin identifiers rather than the full Unicode uppercase. I have not used
88+
" [:upper:] as it depends upon 'noignorecase'
89+
"syn match rustCapsIdent display "[A-Z]\w\(\w\)*"
90+
91+
syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?"
92+
" This one isn't *quite* right, as we could have binary-& with a reference
93+
syn match rustSigil display /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1
94+
syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
95+
" This isn't actually correct; a closure with no arguments can be `|| { }`.
96+
" Last, because the & in && isn't a sigil
97+
syn match rustOperator display "&&\|||"
98+
8699
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
87100
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
88101

89102
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
90103
syn match rustFormat display "%%" contained
91-
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat
104+
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
105+
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial
92106

93107
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
94108
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
@@ -114,13 +128,13 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9
114128
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
115129

116130
" For the benefit of delimitMate
117-
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustLifetime
131+
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
118132
syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
119-
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustLifetime
133+
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
120134

121135
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
122136
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
123-
syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"
137+
syn match rustCharacter /'\([^'\\]\|\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
124138

125139
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
126140
syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend
@@ -140,7 +154,9 @@ hi def link rustBinNumber rustNumber
140154
hi def link rustIdentifierPrime rustIdentifier
141155
hi def link rustTrait rustType
142156

157+
hi def link rustSigil StorageClass
143158
hi def link rustFormat Special
159+
hi def link rustSpecial Special
144160
hi def link rustString String
145161
hi def link rustCharacter Character
146162
hi def link rustNumber Number
@@ -152,6 +168,7 @@ hi def link rustOperator Operator
152168
hi def link rustKeyword Keyword
153169
hi def link rustConditional Conditional
154170
hi def link rustIdentifier Identifier
171+
hi def link rustCapsIdent rustIdentifier
155172
hi def link rustModPath Include
156173
hi def link rustModPathSep Delimiter
157174
hi def link rustFuncName Function

0 commit comments

Comments
 (0)