Skip to content

Commit 567e85f

Browse files
committed
Sync upstream
1 parent f5f7956 commit 567e85f

File tree

2 files changed

+60
-39
lines changed

2 files changed

+60
-39
lines changed

syntax/c.vim

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim syntax file
22
" Language: C
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last Change: 2016 Nov 18
4+
" Last Change: 2019 Nov 29
55

66
" Quit when a (custom) syntax file was already loaded
77
if exists("b:current_syntax")
@@ -13,6 +13,14 @@ set cpo&vim
1313

1414
let s:ft = matchstr(&ft, '^\([^.]\)\+')
1515

16+
" Optional embedded Autodoc parsing
17+
" To enable it add: let g:c_autodoc = 1
18+
" to your .vimrc
19+
if exists("c_autodoc")
20+
syn include @cAutodoc <sfile>:p:h/autodoc.vim
21+
unlet b:current_syntax
22+
endif
23+
1624
" A bunch of useful C keywords
1725
syn keyword cStatement goto break return continue asm
1826
syn keyword cLabel case default
@@ -129,7 +137,7 @@ if exists("c_no_curly_error")
129137
syn match cParenError display ")"
130138
syn match cErrInParen display contained "^^<%\|^%>"
131139
else
132-
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
140+
syn region cParen transparent start='(' end=')' contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
133141
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
134142
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
135143
syn match cParenError display ")"
@@ -212,7 +220,7 @@ if exists("c_comment_strings")
212220
syn match cCommentSkip contained "^\s*\*\($\|\s\+\)"
213221
syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
214222
syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
215-
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
223+
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,cWrongComTail,@Spell
216224
if exists("c_no_comment_fold")
217225
" Use "extend" here to have preprocessor lines not terminate halfway a
218226
" comment.
@@ -231,6 +239,7 @@ endif
231239
" keep a // comment separately, it terminates a preproc. conditional
232240
syn match cCommentError display "\*/"
233241
syn match cCommentStartError display "/\*"me=e-1 contained
242+
syn match cWrongComTail display "\*/"
234243

235244
syn keyword cOperator sizeof
236245
if exists("c_gnu")
@@ -280,6 +289,22 @@ if !exists("c_no_c11")
280289
syn keyword cOperator _Static_assert static_assert
281290
syn keyword cStorageClass _Thread_local thread_local
282291
syn keyword cType char16_t char32_t
292+
" C11 atomics (take down the shield wall!)
293+
syn keyword cType atomic_bool atomic_char atomic_schar atomic_uchar
294+
syn keyword Ctype atomic_short atomic_ushort atomic_int atomic_uint
295+
syn keyword cType atomic_long atomic_ulong atomic_llong atomic_ullong
296+
syn keyword cType atomic_char16_t atomic_char32_t atomic_wchar_t
297+
syn keyword cType atomic_int_least8_t atomic_uint_least8_t
298+
syn keyword cType atomic_int_least16_t atomic_uint_least16_t
299+
syn keyword cType atomic_int_least32_t atomic_uint_least32_t
300+
syn keyword cType atomic_int_least64_t atomic_uint_least64_t
301+
syn keyword cType atomic_int_fast8_t atomic_uint_fast8_t
302+
syn keyword cType atomic_int_fast16_t atomic_uint_fast16_t
303+
syn keyword cType atomic_int_fast32_t atomic_uint_fast32_t
304+
syn keyword cType atomic_int_fast64_t atomic_uint_fast64_t
305+
syn keyword cType atomic_intptr_t atomic_uintptr_t
306+
syn keyword cType atomic_size_t atomic_ptrdiff_t
307+
syn keyword cType atomic_intmax_t atomic_uintmax_t
283308
endif
284309

285310
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
@@ -311,44 +336,32 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
311336
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
312337
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
313338
endif
314-
syn keyword cConstant FLT_RADIX FLT_ROUNDS
315-
syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
316-
syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
317-
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
318-
syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
319-
syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
320-
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
321-
syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
322-
syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
323-
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
324-
syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
325-
syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
326-
syn keyword cConstant LC_NUMERIC LC_TIME
327-
syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
328-
syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
339+
syn keyword cConstant FLT_RADIX FLT_ROUNDS FLT_DIG FLT_MANT_DIG FLT_EPSILON DBL_DIG DBL_MANT_DIG DBL_EPSILON
340+
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP FLT_MIN_10_EXP FLT_MAX_10_EXP
341+
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP DBL_MIN_10_EXP DBL_MAX_10_EXP LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
342+
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP HUGE_VAL CLOCKS_PER_SEC NULL LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
343+
syn keyword cConstant LC_NUMERIC LC_TIME SIG_DFL SIG_ERR SIG_IGN SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
329344
" Add POSIX signals as well...
330-
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
331-
syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
332-
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
333-
syn keyword cConstant SIGUSR1 SIGUSR2
334-
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF
335-
syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
336-
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
337-
syn keyword cConstant TMP_MAX stderr stdin stdout
338-
syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
345+
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
346+
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2
347+
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF FOPEN_MAX FILENAME_MAX L_tmpnam
348+
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET TMP_MAX stderr stdin stdout EXIT_FAILURE EXIT_SUCCESS RAND_MAX
339349
" POSIX 2001
340-
syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG
341-
syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ
350+
syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG SIGVTALRM SIGXCPU SIGXFSZ
342351
" non-POSIX signals
343352
syn keyword cConstant SIGWINCH SIGINFO
344-
" Add POSIX errors as well
345-
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
346-
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
347-
syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
348-
syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
349-
syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
350-
syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
351-
syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
353+
" Add POSIX errors as well. List comes from:
354+
" http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
355+
syn keyword cConstant E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF
356+
syn keyword cConstant EBADMSG EBUSY ECANCELED ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK
357+
syn keyword cConstant EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTUNREACH EIDRM EILSEQ
358+
syn keyword cConstant EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE
359+
syn keyword cConstant EMULTIHOP ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODATA
360+
syn keyword cConstant ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG ENOPROTOOPT ENOSPC ENOSR
361+
syn keyword cConstant ENOSTR ENOSYS ENOTBLK ENOTCONN ENOTDIR ENOTEMPTY ENOTRECOVERABLE ENOTSOCK ENOTSUP
362+
syn keyword cConstant ENOTTY ENXIO EOPNOTSUPP EOVERFLOW EOWNERDEAD EPERM EPIPE EPROTO
363+
syn keyword cConstant EPROTONOSUPPORT EPROTOTYPE ERANGE EROFS ESPIPE ESRCH ESTALE ETIME ETIMEDOUT
364+
syn keyword cConstant ETXTBSY EWOULDBLOCK EXDEV
352365
" math.h
353366
syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
354367
syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
@@ -389,6 +402,13 @@ syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInP
389402
syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
390403
syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
391404

405+
" Optional embedded Autodoc parsing
406+
if exists("c_autodoc")
407+
syn match cAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cAutodoc containedin=cComment,cCommentL
408+
syn cluster cCommentGroup add=cAutodocReal
409+
syn cluster cPreProcGroup add=cAutodocReal
410+
endif
411+
392412
" Highlight User Labels
393413
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
394414
if s:ft ==# 'c' || exists("cpp_no_cpp11")
@@ -450,6 +470,7 @@ hi def link cErrInBracket cError
450470
hi def link cCommentError cError
451471
hi def link cCommentStartError cError
452472
hi def link cSpaceError cError
473+
hi def link cWrongComTail cError
453474
hi def link cSpecialError cError
454475
hi def link cCurlyError cError
455476
hi def link cOperator Operator

syntax/cpp.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: C++
33
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
44
" Previous Maintainer: Ken Shan <[email protected]>
5-
" Last Change: 2016 Oct 28
5+
" Last Change: 2017 Jun 05
66

77
" quit when a syntax file was already loaded
88
if exists("b:current_syntax")
@@ -48,7 +48,7 @@ endif
4848
if !exists("cpp_no_cpp14")
4949
syn case ignore
5050
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
51-
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
51+
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat
5252
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
5353
syn case match
5454
endif

0 commit comments

Comments
 (0)