Mercurial > vim
annotate runtime/syntax/cpp.vim @ 24666:f6fb4d9f7c05
Added tag v8.2.2871 for changeset 661d15592d3ca675c7d3fb10e383617f5c3df72a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 18 May 2021 22:00:05 +0200 |
parents | 96206643bd9f |
children | e69e7133c9cf |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: C++ | |
6663 | 3 " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) |
4229 | 4 " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> |
23666 | 5 " Last Change: 2021 Jan 12 |
7 | 6 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
9464
diff
changeset
|
7 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
9464
diff
changeset
|
8 if exists("b:current_syntax") |
7 | 9 finish |
10 endif | |
11 | |
23666 | 12 " inform C syntax that the file was included from cpp.vim |
13 let b:filetype_in_cpp_family = 1 | |
14 | |
7 | 15 " Read the C syntax to start with |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
9464
diff
changeset
|
16 runtime! syntax/c.vim |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
9464
diff
changeset
|
17 unlet b:current_syntax |
7 | 18 |
4229 | 19 " C++ extensions |
7 | 20 syn keyword cppStatement new delete this friend using |
21 syn keyword cppAccess public protected private | |
7228
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
22 syn keyword cppModifier inline virtual explicit export |
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
23 syn keyword cppType bool wchar_t |
7 | 24 syn keyword cppExceptions throw try catch |
25 syn keyword cppOperator operator typeid | |
26 syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq | |
27 syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 | |
28 syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" | |
29 syn keyword cppStorageClass mutable | |
30 syn keyword cppStructure class typename template namespace | |
31 syn keyword cppBoolean true false | |
6663 | 32 syn keyword cppConstant __cplusplus |
7 | 33 |
4229 | 34 " C++ 11 extensions |
35 if !exists("cpp_no_cpp11") | |
7228
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
36 syn keyword cppModifier override final |
10319
169a62d5bcb9
commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents:
10051
diff
changeset
|
37 syn keyword cppType nullptr_t auto |
4229 | 38 syn keyword cppExceptions noexcept |
6663 | 39 syn keyword cppStorageClass constexpr decltype thread_local |
4229 | 40 syn keyword cppConstant nullptr |
6663 | 41 syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT |
42 syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE | |
43 syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE | |
44 syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE | |
45 syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE | |
46 syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE | |
6823 | 47 syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell |
18928 | 48 syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*<"me=e-1 |
49 syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*$" | |
4229 | 50 endif |
51 | |
7228
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
52 " C++ 14 extensions |
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
53 if !exists("cpp_no_cpp14") |
10319
169a62d5bcb9
commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents:
10051
diff
changeset
|
54 syn case ignore |
169a62d5bcb9
commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents:
10051
diff
changeset
|
55 syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>" |
11473 | 56 syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat |
10319
169a62d5bcb9
commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents:
10051
diff
changeset
|
57 syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>" |
169a62d5bcb9
commit https://github.com/vim/vim/commit/b4ada79aa7d0d1e5da3a659b1a203d7cae9f7f59
Christian Brabandt <cb@256bit.org>
parents:
10051
diff
changeset
|
58 syn case match |
7228
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
59 endif |
873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
60 |
18928 | 61 " C++ 20 extensions |
62 if !exists("cpp_no_cpp20") | |
63 syn keyword cppStatement co_await co_return co_yield requires | |
64 syn keyword cppStorageClass consteval constinit | |
65 syn keyword cppStructure concept | |
66 syn keyword cppType char8_t | |
67 syn keyword cppModule import module export | |
68 endif | |
69 | |
70 " C++ 17 extensions | |
71 if !exists("cpp_no_cpp17") | |
72 syn match cppCast "\<reinterpret_pointer_cast\s*<"me=e-1 | |
73 syn match cppCast "\<reinterpret_pointer_cast\s*$" | |
74 endif | |
75 | |
7 | 76 " The minimum and maximum operators in GNU C++ |
77 syn match cppMinMax "[<>]?" | |
78 | |
79 " Default highlighting | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
80 hi def link cppAccess cppStatement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
81 hi def link cppCast cppStatement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
82 hi def link cppExceptions Exception |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
83 hi def link cppOperator Operator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
84 hi def link cppStatement Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
85 hi def link cppModifier Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
86 hi def link cppType Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
87 hi def link cppStorageClass StorageClass |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
88 hi def link cppStructure Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
89 hi def link cppBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
90 hi def link cppConstant Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
91 hi def link cppRawStringDelimiter Delimiter |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
92 hi def link cppRawString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
93 hi def link cppNumber Number |
18928 | 94 hi def link cppModule Include |
7 | 95 |
96 let b:current_syntax = "cpp" | |
97 | |
98 " vim: ts=8 |