summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/cpp.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax/cpp.vim')
-rw-r--r--runtime/syntax/cpp.vim21
1 files changed, 19 insertions, 2 deletions
diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim
index 3ad79d5545..5437580a0a 100644
--- a/runtime/syntax/cpp.vim
+++ b/runtime/syntax/cpp.vim
@@ -2,7 +2,7 @@
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
-" Last Change: 2021 May 04
+" Last Change: 2021 Aug 23
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -60,7 +60,7 @@ if !exists("cpp_no_cpp14")
syn match cppFloat display contained "\<\d\+\.\d*\(e[-+]\=\d\+\)\=\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
syn match cppFloat display contained "\<\.\d\+\(e[-+]\=\d\+\)\=\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
syn match cppFloat display contained "\<\d\+e[-+]\=\d\+\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
- syn region cppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"\(sv\|s\|_\i*\)\=+ end='$' contains=cSpecial,cFormat,@Spell
+ syn region cppString start=+\(L\|u\|u8\|U\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"\(sv\|s\|_\i*\)\=+ end='$' contains=cSpecial,cFormat,@Spell
endif
" C++ 17 extensions
@@ -69,6 +69,20 @@ if !exists("cpp_no_cpp17")
syn match cppCast "\<reinterpret_pointer_cast\s*$"
syn match cppFloat display contained "\<0x\x*\.\x\+p[-+]\=\d\+\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
syn match cppFloat display contained "\<0x\x\+\.\=p[-+]\=\d\+\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+
+ " TODO: push this up to c.vim if/when supported in C23
+ syn match cppCharacter "u8'[^\\]'"
+ syn match cppCharacter "u8'[^']*'" contains=cSpecial
+ if exists("c_gnu")
+ syn match cppSpecialError "u8'\\[^'\"?\\abefnrtv]'"
+ syn match cppSpecialCharacter "u8'\\['\"?\\abefnrtv]'"
+ else
+ syn match cppSpecialError "u8'\\[^'\"?\\abfnrtv]'"
+ syn match cppSpecialCharacter "u8'\\['\"?\\abfnrtv]'"
+ endif
+ syn match cppSpecialCharacter display "u8'\\\o\{1,3}'"
+ syn match cppSpecialCharacter display "u8'\\x\x\+'"
+
endif
" C++ 20 extensions
@@ -99,6 +113,9 @@ hi def link cppType Type
hi def link cppStorageClass StorageClass
hi def link cppStructure Structure
hi def link cppBoolean Boolean
+hi def link cppCharacter cCharacter
+hi def link cppSpecialCharacter cSpecialCharacter
+hi def link cppSpecialError cSpecialError
hi def link cppConstant Constant
hi def link cppRawStringDelimiter Delimiter
hi def link cppRawString String