diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-09-27 19:47:32 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-09-27 19:47:32 +0200 |
commit | f95026252c5a31242903a98c741887696dfbb11f (patch) | |
tree | cd697cdc96c20a44f03ff3aacc67f78fdcc6ece5 /syntax/rust.vim | |
parent | 4f3df59be709bf0d5c5c67dc804fde49abdc2700 (diff) | |
download | vim-polyglot-f95026252c5a31242903a98c741887696dfbb11f.tar.gz vim-polyglot-f95026252c5a31242903a98c741887696dfbb11f.zip |
Update everything, closes #435
Diffstat (limited to 'syntax/rust.vim')
-rw-r--r-- | syntax/rust.vim | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/syntax/rust.vim b/syntax/rust.vim index 18e804c1..e9f41d19 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -17,7 +17,13 @@ endif " Syntax definitions {{{1 " Basic keywords {{{2 syn keyword rustConditional match if else -syn keyword rustRepeat for loop while +syn keyword rustRepeat loop while +" `:syn match` must be used to prioritize highlighting `for` keyword. +syn match rustRepeat /\<for\>/ +" Highlight `for` keyword in `impl ... for ... {}` statement. This line must +" be put after previous `syn match` line to overwrite it. +syn match rustKeyword /\%(\<impl\>.\+\)\@<=\<for\>/ +syn keyword rustRepeat in syn keyword rustTypedef type nextgroup=rustIdentifier skipwhite skipempty syn keyword rustStructure struct enum nextgroup=rustIdentifier skipwhite skipempty syn keyword rustUnion union nextgroup=rustIdentifier skipwhite skipempty contained @@ -35,7 +41,7 @@ syn keyword rustKeyword continue syn keyword rustKeyword crate syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty -syn keyword rustKeyword in impl let +syn keyword rustKeyword impl let syn keyword rustKeyword macro syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty syn keyword rustKeyword return @@ -202,6 +208,7 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[ "rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustLabel display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*:" +syn match rustLabel display "\%(\<\%(break\|continue\)\s*\)\@<=\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ " The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ |