|
2 | 2 | " Language: C++
|
3 | 3 | " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
|
4 | 4 | " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
|
5 |
| -" Last Change: 2021 Jan 12 |
| 5 | +" Last Change: 2021 Apr 12 |
6 | 6 |
|
7 | 7 | " quit when a syntax file was already loaded
|
8 | 8 | if exists("b:current_syntax")
|
@@ -44,22 +44,29 @@ 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=+)\z1"+ contains=@Spell |
| 47 | + syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"\(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 | 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\)\>" |
| 55 | + syn match cppFloat display contained "\<\d\+\.\d*\(e[-+]\=\d\+\)\=\([fl]\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" |
| 56 | + syn match cppFloat display contained "\<\.\d\+\(e[-+]\=\d\+\)\=\([fl]\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" |
| 57 | + syn match cppFloat display contained "\<\d\+e[-+]\=\d\+\([fl]\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" |
| 58 | + syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=ll\=\|ll\=u\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" |
| 59 | + syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=ll\=\|ll\=u\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" contains=cppFloat |
| 60 | + syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=ll\=\|ll\=u\|if\|il\|i\|h\|min\|s\|ms\|us\|ns\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=\>" |
| 61 | + syn region cppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"\(sv\|s\|_[_a-zA-Z][_a-zA-Z0-9]*\)\=+ end='$' contains=cSpecial,cFormat,@Spell |
58 | 62 | syn case match
|
59 | 63 | endif
|
60 | 64 |
|
61 | 65 | " C++ 20 extensions
|
62 | 66 | if !exists("cpp_no_cpp20")
|
| 67 | + syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(y\|d\)\>" |
| 68 | + syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(y\|d\)\>" |
| 69 | + syn match cppNumber display "\<0x\x\('\=\x\+\)*\(y\|d\)\>" |
63 | 70 | syn keyword cppStatement co_await co_return co_yield requires
|
64 | 71 | syn keyword cppStorageClass consteval constinit
|
65 | 72 | syn keyword cppStructure concept
|
@@ -90,7 +97,9 @@ hi def link cppBoolean Boolean
|
90 | 97 | hi def link cppConstant Constant
|
91 | 98 | hi def link cppRawStringDelimiter Delimiter
|
92 | 99 | hi def link cppRawString String
|
| 100 | +hi def link cppString String |
93 | 101 | hi def link cppNumber Number
|
| 102 | +hi def link cppFloat Number |
94 | 103 | hi def link cppModule Include
|
95 | 104 |
|
96 | 105 | let b:current_syntax = "cpp"
|
|
0 commit comments