2
2
" Language: C++
3
3
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
4
4
" Previous Maintainer: Ken Shan <[email protected] >
5
- " Last Change: 2021 Jan 12
5
+ " Last Change: 2021 May 04
6
6
7
7
" quit when a syntax file was already loaded
8
8
if exists (" b:current_syntax" )
@@ -44,35 +44,47 @@ if !exists("cpp_no_cpp11")
44
44
syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
45
45
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
46
46
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
47
- syn region cppRawString matchgroup =cppRawStringDelimiter start =+ \% (u8\| [uLU]\)\= R"\z ([[:alnum:]_{}[\] #<>%:;.?*\+\- /\^ &|~!=,"']\{ ,16}\) (+ end=+)\z 1"+ contains=@Spell
47
+ syn region cppRawString matchgroup =cppRawStringDelimiter start =+ \% (u8\| [uLU]\)\= R"\z ([[:alnum:]_{}[\] #<>%:;.?*\+\- /\^ &|~!=,"']\{ ,16}\) (+ end=+)\z 1"\( sv \| s \| _[_a-zA-Z][_a-zA-Z0-9]* \)\= + contains=@Spell
48
48
syn match cppCast " \<\( const\| static\| dynamic\) _pointer_cast\s *<" me =e - 1
49
49
syn match cppCast " \<\( const\| static\| dynamic\) _pointer_cast\s *$"
50
50
endif
51
51
52
52
" C++ 14 extensions
53
53
if ! exists (" cpp_no_cpp14" )
54
- syn case ignore
55
- syn match cppNumber display " \< 0b[01]\( '\= [01]\+\) *\( u\= l\{ 0,2}\| ll\= u\)\> "
56
- syn match cppNumber display " \< [1-9]\( '\=\d\+\) *\( u\= l\{ 0,2}\| ll\= u\)\> " contains =cFloat
57
- syn match cppNumber display " \< 0x\x\( '\=\x\+\) *\( u\= l\{ 0,2}\| ll\= u\)\> "
58
- syn case match
54
+ syn match cppNumbers display transparent " \<\d\|\.\d " contains =cppNumber,cppFloat
55
+ syn match cppNumber display contained " \< 0\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
56
+ syn match cppNumber display contained " \< [1-9]\( '\=\d\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
57
+ syn match cppNumber display contained " \< 0\o\+\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
58
+ syn match cppNumber display contained " \< 0b[01]\( '\= [01]\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
59
+ syn match cppNumber display contained " \< 0x\x\( '\=\x\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
60
+ syn match cppFloat display contained " \<\d\+\.\d *\( e[-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
61
+ syn match cppFloat display contained " \<\.\d\+\( e[-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
62
+ syn match cppFloat display contained " \<\d\+ e[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
63
+ syn region cppString start =+ \( L\| u\| u8\| U\| R\| LR\| u8R\| uR\| UR\)\= "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "\( sv\| s\| _\i *\)\= + end =' $' contains =cSpecial,cFormat,@Spell
64
+ endif
65
+
66
+ " C++ 17 extensions
67
+ if ! exists (" cpp_no_cpp17" )
68
+ syn match cppCast " \< reinterpret_pointer_cast\s *<" me =e - 1
69
+ syn match cppCast " \< reinterpret_pointer_cast\s *$"
70
+ syn match cppFloat display contained " \< 0x\x *\.\x\+ p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
71
+ syn match cppFloat display contained " \< 0x\x\+\.\= p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
59
72
endif
60
73
61
74
" C++ 20 extensions
62
75
if ! exists (" cpp_no_cpp20" )
76
+ syn match cppNumber display contained " \< 0\( y\| d\)\> "
77
+ syn match cppNumber display contained " \< [1-9]\( '\=\d\+\) *\( y\| d\)\> "
78
+ syn match cppNumber display contained " \< 0\o\+\( y\| d\)\> "
79
+ syn match cppNumber display contained " \< 0b[01]\( '\= [01]\+\) *\( y\| d\)\> "
80
+ syn match cppNumber display contained " \< 0x\x\( '\=\x\+\) *\( y\| d\)\> "
63
81
syn keyword cppStatement co_await co_return co_yield requires
64
82
syn keyword cppStorageClass consteval constinit
65
83
syn keyword cppStructure concept
66
84
syn keyword cppType char8_t
67
85
syn keyword cppModule import module export
68
86
endif
69
87
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
-
76
88
" The minimum and maximum operators in GNU C++
77
89
syn match cppMinMax " [<>]?"
78
90
@@ -90,7 +102,9 @@ hi def link cppBoolean Boolean
90
102
hi def link cppConstant Constant
91
103
hi def link cppRawStringDelimiter Delimiter
92
104
hi def link cppRawString String
105
+ hi def link cppString String
93
106
hi def link cppNumber Number
107
+ hi def link cppFloat Number
94
108
hi def link cppModule Include
95
109
96
110
let b: current_syntax = " cpp"
0 commit comments