8000 sync upstream · ChaiScript/vim-cpp@c1f408a · GitHub
[go: up one dir, main page]

Skip to content

Commit c1f408a

Browse files
committed
sync upstream
1 parent 993b0fd commit c1f408a

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

syntax/c.vim

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim syntax file
22
" Language: C
33
" Maintainer: Bram Moolenaar <Bram@vim.org>
4-
" Last Change: 2014 Nov 13
4+
" Last Change: 2015 Mar 05
55

66
" Quit when a (custom) syntax file was already loaded
77
if exists("b:current_syntax")
@@ -47,16 +47,17 @@ if !exists("c_no_cformat")
4747
endif
4848

4949
" cCppString: same as cString, but ends at end of line
50-
if s:ft ==# "cpp" && !exists("cpp_no_cpp11")
50+
if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
5151
" ISO C++11
5252
syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
5353
syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
54-
elseif s:ft ==# "c" && !exists("c_no_c11")
54+
elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat")
5555
" ISO C99
5656
syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
5757
syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
5858
else
5959
" older C or C++
60+
syn match cFormat display "%%" contained
6061
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
6162
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
6263
endif
@@ -80,7 +81,11 @@ syn match cSpecialCharacter display "L'\\x\x\+'"
8081

8182
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11"))
8283
" ISO C11 or ISO C++ 11
83-
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
84+
if exists("c_no_cformat")
85+
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend
86+
else
87+
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
88+
endif
8489
syn match cCharacter "[Uu]'[^\\]'"
8590
syn match cCharacter "[Uu]'[^']*'" contains=cSpecial
8691
if exists("c_gnu")
@@ -330,6 +335,8 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
330335
" POSIX 2001
331336
syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG
332337
syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ
338+
" non-POSIX signals
339+
syn keyword cConstant SIGWINCH SIGINFO
333340
" Add POSIX errors as well
334341
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
335342
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
@@ -387,8 +394,13 @@ endif
387394
syn cluster cLabelGroup contains=cUserLabel
388395
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
389396
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
390-
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
391-
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
397+
if s:ft ==# 'cpp'
398+
syn match cUserCont display "^\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
399+
syn match cUserCont display ";\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
400+
else
401+
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
402+
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
403+
endif
392404

393405
syn match cUserLabel display "\I\i*" contained
394406

syntax/cpp.vim

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
" Vim syntax file
22
" Language: C++
3-
" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim)
3+
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
44
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
5-
" Last Change: 2014 May 14
5+
" Last Change: 2015 Mar 1
66

77
" For version 5.x: Clear all syntax items
88
" For version 6.x: Quit when a syntax file was already loaded
@@ -32,14 +32,21 @@ syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
3232
syn keyword cppStorageClass mutable
3333
syn keyword cppStructure class typename template namespace
3434
syn keyword cppBoolean true false
35+
syn keyword cppConstant __cplusplus
3536

3637
" C++ 11 extensions
3738
if !exists("cpp_no_cpp11")
3839
syn keyword cppType override final
3940
syn keyword cppExceptions noexcept
40-
syn keyword cppStorageClass constexpr decltype
41+
syn keyword cppStorageClass constexpr decltype thread_local
4142
syn keyword cppConstant nullptr
42-
syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
43+
syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT
44+
syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE
45+
syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE
46+
syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
47+
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
48+
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
49+
syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
4350
endif
4451

4552
" The minimum and maximum operators in GNU C++

0 commit comments

Comments
 (0)
0