Skip to content

Commit 1a748ce

Browse files
committed
Move C++14 numbers to vim.cpp
1 parent 3592605 commit 1a748ce

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

syntax/c.vim

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumbe
182182
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
183183
"hex number
184184
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
185-
if s:ft ==# 'cpp' && !exists("cpp_no_cpp14")
186-
syn match cNumber display contained "\d\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
187-
syn match cNumber display contained "0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
188-
syn match cNumber display contained "0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
189-
endif
190185
" Flag the first zero of an octal number as something special
191186
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
192187
syn match cOctalZero display contained "\<0"

syntax/cpp.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ if !exists("cpp_no_cpp11")
5151
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
5252
endif
5353

54+
" C++ 14 extensions
55+
if !exists("cpp_no_cpp14")
56+
syn case ignore
57+
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
58+
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
59+
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
60+
syn case match
61+
endif
62+
5463
" The minimum and maximum operators in GNU C++
5564
syn match cppMinMax "[<>]?"
5665

@@ -75,6 +84,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
7584
HiLink cppConstant Constant
7685
HiLink cppRawStringDelimiter Delimiter
7786
HiLink cppRawString String
87+
HiLink cppNumber Number
7888
delcommand HiLink
7989
endif
8090

0 commit comments

Comments
 (0)