Raw string literals highlighting is broken
dkearns opened this issue · 5 comments
G'day,
I just noticed that raw string literal highlighting is broken.
Single line raw strings are highlighted as cppString and multiline raw string highlighting is broken. It would appear that the cppRawString syntax group needs to have higher priority than the cppString group.
foo = R"--( ... )--";
bar = R"--(
...
)--";Thanks,
Doug
Could you please try this patch?
diff --git a/syntax/cpp.vim b/syntax/cpp.vim
index 3ad79d5..5c74597 100644
--- a/syntax/cpp.vim
+++ b/syntax/cpp.vim
@@ -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\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"\(sv\|s\|_\i*\)\=+ contains=cSpecial,cFormat,@Spell
endif
" C++ 17 extensions@mattn, I just experience the same issue and your patched fixed the problem for me.
Sorry @mattn, I missed the initial notification for your comment.
Your patch removes the error but the strings are still matched as cppString and not cppRawString (unless cpp_no_cpp14 is set), and the delimiters are not matched as a separate group, i.e., cppRawStringDelimiter.
Could you please make patch?
Sure, but I probably won't get to it until next week.
