xref: /vim-8.2.3635/runtime/syntax/cpp.vim (revision 73f4439c)
1" Vim syntax file
2" Language:	C++
3" Current Maintainer:	vim-jp (https://github.com/vim-jp/vim-cpp)
4" Previous Maintainer:	Ken Shan <[email protected]>
5" Last Change:	2017 Jun 05
6
7" quit when a syntax file was already loaded
8if exists("b:current_syntax")
9  finish
10endif
11
12" Read the C syntax to start with
13runtime! syntax/c.vim
14unlet b:current_syntax
15
16" C++ extensions
17syn keyword cppStatement	new delete this friend using
18syn keyword cppAccess		public protected private
19syn keyword cppModifier		inline virtual explicit export
20syn keyword cppType		bool wchar_t
21syn keyword cppExceptions	throw try catch
22syn keyword cppOperator		operator typeid
23syn keyword cppOperator		and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
24syn match cppCast		"\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1
25syn match cppCast		"\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
26syn keyword cppStorageClass	mutable
27syn keyword cppStructure	class typename template namespace
28syn keyword cppBoolean		true false
29syn keyword cppConstant		__cplusplus
30
31" C++ 11 extensions
32if !exists("cpp_no_cpp11")
33  syn keyword cppModifier	override final
34  syn keyword cppType		nullptr_t auto
35  syn keyword cppExceptions	noexcept
36  syn keyword cppStorageClass	constexpr decltype thread_local
37  syn keyword cppConstant	nullptr
38  syn keyword cppConstant	ATOMIC_FLAG_INIT ATOMIC_VAR_INIT
39  syn keyword cppConstant	ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE
40  syn keyword cppConstant	ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE
41  syn keyword cppConstant	ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
42  syn keyword cppConstant	ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
43  syn keyword cppConstant	ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
44  syn region cppRawString	matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
45endif
46
47" C++ 14 extensions
48if !exists("cpp_no_cpp14")
49  syn case ignore
50  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\)\>" contains=cFloat
52  syn match cppNumber		display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
53  syn case match
54endif
55
56" The minimum and maximum operators in GNU C++
57syn match cppMinMax "[<>]?"
58
59" Default highlighting
60hi def link cppAccess		cppStatement
61hi def link cppCast		cppStatement
62hi def link cppExceptions		Exception
63hi def link cppOperator		Operator
64hi def link cppStatement		Statement
65hi def link cppModifier		Type
66hi def link cppType		Type
67hi def link cppStorageClass	StorageClass
68hi def link cppStructure		Structure
69hi def link cppBoolean		Boolean
70hi def link cppConstant		Constant
71hi def link cppRawStringDelimiter	Delimiter
72hi def link cppRawString		String
73hi def link cppNumber		Number
74
75let b:current_syntax = "cpp"
76
77" vim: ts=8
78