Skip to content

Commit b8d8f35

Browse files
committed
feat(syntax): add support for range operator
The range operator was picked up as noise. Now it is properly detected.
1 parent eda330a commit b8d8f35

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

syntax/rust.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif
1414

1515
" Syntax definitions {{{1
1616
" Basic keywords {{{2
17-
syn match rustNoise "[,\.\[\]()]" display nextgroup=rustNoise,rustKeyword,rustStorage,@rustLiterals,@rustIdentifiers skipempty skipwhite
17+
syn match rustNoise "[,\.\[\]()]" display nextgroup=rustRange,rustNoise,rustKeyword,rustStorage,@rustLiterals,@rustIdentifiers skipempty skipwhite
1818
syn match rustNoise ";" display
1919
syn match rustBounds ":" display nextgroup=rustKeyword,rustStorage,@rustIdentifiers skipempty skipwhite
2020
syn keyword rustConditional match if else nextgroup=rustConditional,@rustIdentifiers skipempty skipwhite
@@ -132,6 +132,7 @@ syn region rustFoldModPath matchgroup=rustNoise start="\(::\s*\n*\)\@<={" end
132132
"syn match rustCapsIdent display "[A-Z]\w\(\w\)*"
133133

134134
syn match rustOperator "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\| [<>]\|%\)=\?" display nextgroup=@rustLiterals,@rustIdentifiers skipempty skipwhite
135+
syn match rustRange "\.\." display nextgroup=rustNoise,@rustLiterals,@rustIdentifiers skipempty skipwhite
135136
syn region rustGenericRegion matchgroup=rustNoise start="\(\s\+\|=\)\@<!<" end="\(=\|-\)\@<!>" contains=rustNoise,rustBounds,rustGenericRegion,@rustIdentifiers
136137
" This one isn't *quite* right, as we could have binary-& with a reference
137138
syn match rustSigil /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1 nextgroup=rustStorage,@rustIdentifiers skipempty skipwhite
@@ -325,6 +326,7 @@ hi def link rustSelf Constant
325326
hi def link rustFloat Float
326327
hi def link rustArrowCharacter rustOperator
327328
hi def link rustOperator Operator
329+
hi def link rustRange rustOperator
328330
hi def link rustBounds rustOperator
329331
hi def link rustKeyword Keyword
330332
hi def link rustDynKeyword rustKeyword

0 commit comments

Comments
 (0)