From 3493c67804fcc8a5cedb9b6117a483148774c92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:09:34 +0100 Subject: [PATCH 01/13] add nullptr constant & nullptr_t type --- syntax/cpp11.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 4089135..e10f948 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -28,7 +28,7 @@ endif " C++ extentions syn keyword cppStatement new delete this friend using constexpr syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t +syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq @@ -36,7 +36,7 @@ syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 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 cppNumber NPOS nullptr syn keyword cppBoolean true false " The minimum and maximum operators in GNU C++ From 18a3f04568d724a9a688c86bf286a4af8f2c183f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:16:39 +0100 Subject: [PATCH 02/13] add 'thread_local' storage class --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index e10f948..f5473e8 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -34,7 +34,7 @@ syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" -syn keyword cppStorageClass mutable +syn keyword cppStorageClass mutable thread_local syn keyword cppStructure class typename template namespace syn keyword cppNumber NPOS nullptr syn keyword cppBoolean true false From c765ad2e2d6ea1d3c77f4671710209be6fc4daa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:21:36 +0100 Subject: [PATCH 03/13] add static_assert keyword --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index f5473e8..c91385f 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -26,7 +26,7 @@ else endif " C++ extentions -syn keyword cppStatement new delete this friend using constexpr +syn keyword cppStatement new delete this friend using constexpr static_assert syn keyword cppAccess public protected private syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t syn keyword cppExceptions throw try catch From fc7556fbb92641c78e27063a3d6a304346114bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:23:36 +0100 Subject: [PATCH 04/13] add 'decltype' keyword --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index c91385f..3b0cb1b 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -26,7 +26,7 @@ else endif " C++ extentions -syn keyword cppStatement new delete this friend using constexpr static_assert +syn keyword cppStatement new delete this friend using constexpr static_assert decltype syn keyword cppAccess public protected private syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t syn keyword cppExceptions throw try catch From 583face70d3c0242cd0b58a9c45e2cac5b3ecc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:26:30 +0100 Subject: [PATCH 05/13] add 'override' & 'final' identifiers --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 3b0cb1b..65d27c3 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -28,7 +28,7 @@ endif " C++ extentions syn keyword cppStatement new delete this friend using constexpr static_assert decltype syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t +syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq From b1a91015a52026b7960d08e5cebb76149a19a3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:28:35 +0100 Subject: [PATCH 06/13] add 'tuple' type --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 65d27c3..8359bc3 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -28,7 +28,7 @@ endif " C++ extentions syn keyword cppStatement new delete this friend using constexpr static_assert decltype syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final +syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final tuple syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq From 51352cc765894d973870e39bb3080f1fb63b14c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 14 Dec 2011 12:35:48 +0100 Subject: [PATCH 07/13] update README with new keywords added --- README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index 8a68e88..212c14a 100644 --- a/README +++ b/README @@ -3,6 +3,7 @@ This is a mirror of http://www.vim.org/scripts/script.php?script_id=3797 Modified existing c.vim and cpp.vim (into cpp11.vim and cpp11_cbase.vim) to add support for new language features found in C++11. * Initialiser lists and lambdas no longer cause curly error highlighting ({} allowed within parentheses). -* constexpr keyword added. +* constexpr, nullptr_t, nullptr, static_assert, decltype, override, final & tuple keyword added. + I'm adding features as I hit them - if something is bugging you and not yet added, let me know. From 85ecadedd9b736597d9583e56f1c7497923efe89 Mon Sep 17 00:00:00 2001 From: Francisco Lopes Date: Thu, 17 Jan 2013 16:47:35 -0200 Subject: [PATCH 08/13] Support for new unicode and raw string literals --- syntax/cpp11_cbase.vim | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/syntax/cpp11_cbase.vim b/syntax/cpp11_cbase.vim index 6b5d0ef..e3d62ff 100644 --- a/syntax/cpp11_cbase.vim +++ b/syntax/cpp11_cbase.vim @@ -39,7 +39,8 @@ endif if exists("c_no_cformat") syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell " cCppString: same as cString, but ends at end of line - syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell + syn region cCppString start=+L\=\%(u8\|[uU]\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell + syn region cCppRawString start=+L\=\%(u8\|[uU]\)\=R"\z([^\()[:space:][:cntrl:]]\{,16}\)(+ skip=+\\\\\|\\$+ excludenl end=+)\z1"+ end='$' contains=cSpecial,@Spell else if !exists("c_no_c99") " ISO C99 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained @@ -49,7 +50,8 @@ else syn match cFormat display "%%" contained syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell " cCppString: same as cString, but ends at end of line - syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell + syn region cCppString start=+L\=\%(u8\|[uU]\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell + syn region cCppRawString start=+L\=\%(u8\|[uU]\)\=R"\z([^\()[:space:][:cntrl:]]\{,16}\)(+ skip=+\\\\\|\\$+ excludenl end=+)\z1"+ end='$' contains=cSpecial,cFormat,@Spell endif syn match cCharacter "L\='[^\\]'" @@ -78,7 +80,7 @@ endif " This should be before cErrInParen to avoid problems with #define ({ xxx }) if exists("c_curly_error") syntax match cCurlyError "}" - syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold + syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,cCppRawString,@Spell fold else syntax region cBlock start="{" end="}" transparent fold endif @@ -88,24 +90,24 @@ endif " But avoid matching <::. syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom if exists("c_no_curly_error") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,cCppRawString,@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 "^^<%\|^%>" elseif exists("c_no_bracket_error") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,cCppRawString,@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=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,cCppRawString,@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 + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,cCppRawString,@Spell " 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 "[);{}]\|<%\|%>" @@ -276,7 +278,7 @@ if !exists("c_no_c99") " ISO C99 endif " Accept %: for # (C99) -syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError +syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCppRawString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" if !exists("c_no_if0") if !exists("c_no_if0_fold") @@ -296,7 +298,7 @@ syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end=" syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell " Highlight User Labels -syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString +syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString,cCppRawString syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' syn cluster cLabelGroup contains=cUserLabel @@ -330,6 +332,7 @@ endif " Only used when an item doesn't have highlighting yet hi def link cFormat cSpecial hi def link cCppString cString +hi def link cCppRawString cString hi def link cCommentL cComment hi def link cCommentStart cComment hi def link cLabel Label From 84220d615dba198e9a46358b92d4876246792732 Mon Sep 17 00:00:00 2001 From: Francisco Lopes Date: Thu, 17 Jan 2013 17:40:20 -0200 Subject: [PATCH 09/13] Fix backslash inside raw string literals --- syntax/cpp11_cbase.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/syntax/cpp11_cbase.vim b/syntax/cpp11_cbase.vim index e3d62ff..fafa0d9 100644 --- a/syntax/cpp11_cbase.vim +++ b/syntax/cpp11_cbase.vim @@ -40,7 +40,6 @@ if exists("c_no_cformat") syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\=\%(u8\|[uU]\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell - syn region cCppRawString start=+L\=\%(u8\|[uU]\)\=R"\z([^\()[:space:][:cntrl:]]\{,16}\)(+ skip=+\\\\\|\\$+ excludenl end=+)\z1"+ end='$' contains=cSpecial,@Spell else if !exists("c_no_c99") " ISO C99 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained @@ -51,8 +50,8 @@ else syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\=\%(u8\|[uU]\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - syn region cCppRawString start=+L\=\%(u8\|[uU]\)\=R"\z([^\()[:space:][:cntrl:]]\{,16}\)(+ skip=+\\\\\|\\$+ excludenl end=+)\z1"+ end='$' contains=cSpecial,cFormat,@Spell endif +syn region cCppRawString start=+L\=\%(u8\|[uU]\)\=R"\z([^\()[:space:][:cntrl:]]\{,16}\)(+ skip=+\\$+ excludenl end=+)\z1"+ end='$' contains=@Spell syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial From 1d9945fa6f74fadb5f024467c89d14b141b543cd Mon Sep 17 00:00:00 2001 From: Francisco Lopes Date: Thu, 17 Jan 2013 18:43:29 -0200 Subject: [PATCH 10/13] Update README with new string literals support --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 212c14a..bdffaa9 100644 --- a/README +++ b/README @@ -4,6 +4,7 @@ Modified existing c.vim and cpp.vim (into cpp11.vim and cpp11_cbase.vim) to add * Initialiser lists and lambdas no longer cause curly error highlighting ({} allowed within parentheses). * constexpr, nullptr_t, nullptr, static_assert, decltype, override, final & tuple keyword added. +* New Unicode and raw string literals added. I'm adding features as I hit them - if something is bugging you and not yet added, let me know. From a6a55d2cfa231213dba24229470d438cfdb175e2 Mon Sep 17 00:00:00 2001 From: Francisco Lopes Date: Thu, 17 Jan 2013 20:28:16 -0200 Subject: [PATCH 11/13] Fix tuple which was set as a keyword --- README | 2 +- syntax/cpp11.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index bdffaa9..628a317 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ This is a mirror of http://www.vim.org/scripts/script.php?script_id=3797 Modified existing c.vim and cpp.vim (into cpp11.vim and cpp11_cbase.vim) to add support for new language features found in C++11. * Initialiser lists and lambdas no longer cause curly error highlighting ({} allowed within parentheses). -* constexpr, nullptr_t, nullptr, static_assert, decltype, override, final & tuple keyword added. +* constexpr, nullptr_t, nullptr, static_assert, decltype, override & final keyword added. * New Unicode and raw string literals added. diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 8359bc3..65d27c3 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -28,7 +28,7 @@ endif " C++ extentions syn keyword cppStatement new delete this friend using constexpr static_assert decltype syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final tuple +syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq From 5b59fd4ff3e8dc16e7e18d8811b3e4300a7980c1 Mon Sep 17 00:00:00 2001 From: Francisco Lopes Date: Fri, 1 Mar 2013 00:11:24 -0300 Subject: [PATCH 12/13] Fix nullptr_t which was set as a keyword --- README | 2 +- syntax/cpp11.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 628a317..ce3c997 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ This is a mirror of http://www.vim.org/scripts/script.php?script_id=3797 Modified existing c.vim and cpp.vim (into cpp11.vim and cpp11_cbase.vim) to add support for new language features found in C++11. * Initialiser lists and lambdas no longer cause curly error highlighting ({} allowed within parentheses). -* constexpr, nullptr_t, nullptr, static_assert, decltype, override & final keyword added. +* constexpr, nullptr, static_assert, decltype, override & final keyword added. * New Unicode and raw string literals added. diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 65d27c3..74bf4e5 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -28,7 +28,7 @@ endif " C++ extentions syn keyword cppStatement new delete this friend using constexpr static_assert decltype syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final +syn keyword cppType inline virtual explicit export bool wchar_t override final syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq From be7d311f10333ac26561e8d51eacf5570fb64aae Mon Sep 17 00:00:00 2001 From: Thynson Date: Sun, 28 Jul 2013 10:49:30 +0800 Subject: [PATCH 13/13] Add noexcept Signed-off-by: Thynson --- syntax/cpp11.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/cpp11.vim b/syntax/cpp11.vim index 8359bc3..46fab63 100644 --- a/syntax/cpp11.vim +++ b/syntax/cpp11.vim @@ -26,7 +26,7 @@ else endif " C++ extentions -syn keyword cppStatement new delete this friend using constexpr static_assert decltype +syn keyword cppStatement new delete this friend using constexpr static_assert decltype noexcept syn keyword cppAccess public protected private syn keyword cppType inline virtual explicit export bool wchar_t nullptr_t override final tuple syn keyword cppExceptions throw try catch