Skip to content

Update vim syntax for extern crate #12271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/etc/emacs/rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
'("as"
"break"
"continue"
"crate"
"do"
"else" "enum" "extern"
"false" "fn" "for"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<keyword>break</keyword>
<keyword>const</keyword>
<keyword>continue</keyword>
<keyword>crate</keyword>
<keyword>do</keyword>
<keyword>drop</keyword>
<keyword>else</keyword>
Expand Down
1 change: 1 addition & 0 deletions src/etc/kate/rust.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<item> as </item>
<item> break </item>
<item> continue </item>
<item> crate </item>
<item> do </item>
<item> drop </item>
<item> else </item>
Expand Down
13 changes: 10 additions & 3 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: 2014 Jan 4
" Last Change: 2014 Feb 14

if version < 600
syntax clear
Expand All @@ -18,7 +18,8 @@ syn keyword rustOperator as

syn match rustAssert "\<assert\(\w\)*!" contained
syn match rustFail "\<fail\(\w\)*!" contained
syn keyword rustKeyword break continue do extern
syn keyword rustKeyword break continue do
syn keyword rustKeyword extern nextgroup=rustExternCrate skipwhite
syn keyword rustKeyword for in if impl let
syn keyword rustKeyword loop once priv pub
syn keyword rustKeyword return
Expand All @@ -31,6 +32,10 @@ syn keyword rustKeyword proc
syn keyword rustStorage mut ref static
syn keyword rustObsoleteStorage const

syn keyword rustInvalidBareKeyword crate

syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite

syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained

Expand Down Expand Up @@ -81,7 +86,7 @@ syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize

syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
syn keyword rustTrait Bitwise Bounded Integer Fractional Real RealExt
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv
syn keyword rustTrait Orderable Signed Unsigned Round
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
Expand Down Expand Up @@ -245,6 +250,8 @@ hi def link rustDeriving PreProc
hi def link rustStorage StorageClass
hi def link rustObsoleteStorage Error
hi def link rustLifetime Special
hi def link rustInvalidBareKeyword Error
hi def link rustExternCrate rustKeyword

" Other Suggestions:
" hi rustAttribute ctermfg=cyan
Expand Down