summaryrefslogtreecommitdiffstats
path: root/syntax/rust.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-07-01 16:25:37 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-07-01 16:25:37 +0200
commit140430ffb73d5e0851ba2df2abd29106b1677687 (patch)
tree686fc28a75cbcdddbfad4a2e93f0433614d182bc /syntax/rust.vim
parentd52700284984ada048ce325404dfa25237271ba1 (diff)
downloadvim-polyglot-140430ffb73d5e0851ba2df2abd29106b1677687.tar.gz
vim-polyglot-140430ffb73d5e0851ba2df2abd29106b1677687.zip
Update
Diffstat (limited to 'syntax/rust.vim')
-rw-r--r--syntax/rust.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/syntax/rust.vim b/syntax/rust.vim
index 6f653014..a4fff5c2 100644
--- a/syntax/rust.vim
+++ b/syntax/rust.vim
@@ -153,7 +153,16 @@ syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustE
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
-syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError
+" Match attributes with either arbitrary syntax or special highlighting for
+" derives. We still highlight strings and comments inside of the attribute.
+syn region rustAttribute start="#!\?\[" end="\]" contains=@rustAttributeContents,rustAttributeParenthesizedParens,rustAttributeParenthesizedCurly,rustAttributeParenthesizedBrackets,rustDerive
+syn region rustAttributeParenthesizedParens matchgroup=rustAttribute start="\w\%(\w\)*("rs=e end=")"re=s transparent contained contains=rustAttributeBalancedParens,@rustAttributeContents
+syn region rustAttributeParenthesizedCurly matchgroup=rustAttribute start="\w\%(\w\)*{"rs=e end="}"re=s transparent contained contains=rustAttributeBalancedCurly,@rustAttributeContents
+syn region rustAttributeParenthesizedBrackets matchgroup=rustAttribute start="\w\%(\w\)*\["rs=e end="\]"re=s transparent contained contains=rustAttributeBalancedBrackets,@rustAttributeContents
+syn region rustAttributeBalancedParens matchgroup=rustAttribute start="("rs=e end=")"re=s transparent contained contains=rustAttributeBalancedParens,@rustAttributeContents
+syn region rustAttributeBalancedCurly matchgroup=rustAttribute start="{"rs=e end="}"re=s transparent contained contains=rustAttributeBalancedCurly,@rustAttributeContents
+syn region rustAttributeBalancedBrackets matchgroup=rustAttribute start="\["rs=e end="\]"re=s transparent contained contains=rustAttributeBalancedBrackets,@rustAttributeContents
+syn cluster rustAttributeContents contains=rustString,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError
syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait
" This list comes from src/libsyntax/ext/deriving/mod.rs
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).