public
Created

  • Download Gist
syntax-file.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
diff -ur /home/mattn/dev/vim/runtime/syntax/c.vim syntax/c.vim
--- /home/mattn/dev/vim/runtime/syntax/c.vim 2013-03-09 22:50:46.434180219 +0900
+++ syntax/c.vim 2013-03-09 23:20:48.550208870 +0900
@@ -110,30 +110,57 @@
" But avoid matching <::.
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
if exists("c_no_curly_error")
- syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell
- " cCppParen: same as cParen but ends at end-of-line; used in cDefine
- syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
- syn match cParenError display ")"
- syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
+ if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
+ syn match cParenError display ")"
+ syn match cErrInParen display contained "^^<%\|^%>"
+ else
+ syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
+ syn match cParenError display ")"
+ syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
+ end
elseif exists("c_no_bracket_error")
- syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell
- " cCppParen: same as cParen but ends at end-of-line; used in cDefine
- syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
- syn match cParenError display ")"
- syn match cErrInParen display contained "[{}]\|<%\|%>"
+ if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
+ syn match cParenError display ")"
+ syn match cErrInParen display contained "<%\|%>"
+ else
+ syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
+ syn match cParenError display ")"
+ syn match cErrInParen display contained "[{}]\|<%\|%>"
+ end
else
- syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
- " cCppParen: same as cParen but ends at end-of-line; used in cDefine
- syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
- syn match cParenError display "[\])]"
- syn match cErrInParen display contained "[\]{}]\|<%\|%>"
- syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
+ if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
+ syn match cParenError display "[\])]"
+ syn match cErrInParen display contained "<%\|%>"
+ syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
+ else
+ syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
+ syn match cParenError display "[\])]"
+ syn match cErrInParen display contained "[\]{}]\|<%\|%>"
+ syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
+ endif
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
endif
-syntax region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
+if &filetype ==# 'c' || exists("cpp_no_cpp11")
+ syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
+endif
"integer number, or floating point number without a dot and with "f".
syn case ignore
@@ -170,16 +197,16 @@
" need to use a special type of cString: cCommentString, which also ends on
" "*/", and sees a "*" at the start of the line as comment again.
" Unfortunately this doesn't very well work for // type of comments :-(
- syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
- syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
- syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
- syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
+ syn match cCommentSkip contained "^\s*\*\($\|\s\+\)"
+ syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
+ syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
+ syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
if exists("c_no_comment_fold")
" Use "extend" here to have preprocessor lines not terminate halfway a
" comment.
- syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
+ syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
else
- syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
+ syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
endif
else
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
@@ -190,8 +217,8 @@
endif
endif
" keep a // comment separately, it terminates a preproc. conditional
-syntax match cCommentError display "\*/"
-syntax match cCommentStartError display "/\*"me=e-1 contained
+syn match cCommentError display "\*/"
+syn match cCommentStartError display "/\*"me=e-1 contained
syn keyword cOperator sizeof
if exists("c_gnu")
@@ -343,7 +370,9 @@
" Highlight User Labels
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
-syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
+if &filetype ==# 'c' || exists("cpp_no_cpp11")
+ syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
+end
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
syn cluster cLabelGroup contains=cUserLabel
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
diff -ur /home/mattn/dev/vim/runtime/syntax/cpp.vim syntax/cpp.vim
--- /home/mattn/dev/vim/runtime/syntax/cpp.vim 2010-09-07 22:39:02.665446683 +0900
+++ syntax/cpp.vim 2013-03-09 22:55:22.070184599 +0900
@@ -1,7 +1,8 @@
" Vim syntax file
" Language: C++
-" Maintainer: Ken Shan <ccshan@post.harvard.edu>
-" Last Change: 2002 Jul 15
+" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim)
+" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
+" Last Change: 2012 Jun 14
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -19,7 +20,7 @@
unlet b:current_syntax
endif
-" C++ extentions
+" C++ extensions
syn keyword cppStatement new delete this friend using
syn keyword cppAccess public protected private
syn keyword cppType inline virtual explicit export bool wchar_t
@@ -30,9 +31,16 @@
syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
syn keyword cppStorageClass mutable
syn keyword cppStructure class typename template namespace
-syn keyword cppNumber NPOS
syn keyword cppBoolean true false
+" C++ 11 extensions
+if !exists("cpp_no_cpp11")
+ syn keyword cppType override final
+ syn keyword cppExceptions noexcept
+ syn keyword cppStorageClass constexpr decltype
+ syn keyword cppConstant nullptr
+endif
+
" The minimum and maximum operators in GNU C++
syn match cppMinMax "[<>]?"
@@ -52,8 +60,8 @@
HiLink cppType Type
HiLink cppStorageClass StorageClass
HiLink cppStructure Structure
- HiLink cppNumber Number
HiLink cppBoolean Boolean
+ HiLink cppConstant Constant
delcommand HiLink
endif

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.