diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2017-09-27 19:57:29 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2017-09-27 19:57:29 +0200 |
commit | 8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8 (patch) | |
tree | 125734ac66307a962eeda16283355dde0d0fbd2e /syntax/rust.vim | |
parent | 9bfde7574aa89a91b80ed9c993fc000cfc11aae7 (diff) | |
download | vim-polyglot-8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8.tar.gz vim-polyglot-8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8.zip |
Update
Diffstat (limited to 'syntax/rust.vim')
-rw-r--r-- | syntax/rust.vim | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/syntax/rust.vim b/syntax/rust.vim index 9e280b0d..81abf942 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -6,11 +6,12 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Maintainer: Ben Blum <bblum@cs.cmu.edu> " Maintainer: Chris Morgan <me@chrismorgan.info> " Last Change: Feb 24, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim if version < 600 - syntax clear + syntax clear elseif exists("b:current_syntax") - finish + finish endif " Syntax definitions {{{1 @@ -31,10 +32,13 @@ syn keyword rustKeyword continue 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 macro syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty syn keyword rustKeyword return +syn keyword rustKeyword yield syn keyword rustSuper super -syn keyword rustKeyword unsafe where +syn keyword rustKeyword where +syn keyword rustUnsafeKeyword unsafe syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty " FIXME: Scoped impl's name is also fallen in this category syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipempty @@ -68,7 +72,7 @@ syn match rustMacroRepeatCount ".\?[*+]" contained syn match rustMacroVariable "$\w\+" " Reserved (but not yet used) keywords {{{2 -syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro +syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized abstract virtual final override " Built-in types {{{2 syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32 @@ -139,7 +143,7 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic syn match rustEscapeError display contained /\\./ syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ -syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/ +syn match rustEscapeUnicode display contained /\\u{\%(\x_*\)\{1,6}}/ syn match rustStringContinuation display contained /\\\n\s*/ syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell @@ -169,7 +173,7 @@ syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)" " For the benefit of delimitMate -syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\x\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime +syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\%(\x_*\)\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime @@ -180,7 +184,7 @@ 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'/ syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode -syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid +syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\%(\x_*\)\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid syn match rustShebang /\%^#![^[].*/ syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell @@ -248,6 +252,7 @@ hi def link rustUnion rustStructure hi def link rustPubScopeDelim Delimiter hi def link rustPubScopeCrate rustKeyword hi def link rustSuper rustKeyword +hi def link rustUnsafeKeyword Exception hi def link rustReservedKeyword Error hi def link rustRepeat Conditional hi def link rustConditional Conditional |