Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

syntax file is out of sync #70

@e-kwsm

Description

@e-kwsm
--- https://github.com/vim/vim/blob/6625ba359e33f8223d146f3ae87a880c446b5470/runtime/syntax/cpp.vim
+++ https://github.com/vim-jp/vim-cpp/blob/36eb76a54a62024bd63fc01f225d43133e4c792d/syntax/cpp.vim
@@ -2,8 +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: 2024 May 04
-"   2024 May 04 by Vim Project (fix digit separator in octals and floats)
+" Last Change: 2021 May 04

 " quit when a syntax file was already loaded
 if exists("b:current_syntax")
@@ -16,7 +15,6 @@
 " Read the C syntax to start with
 runtime! syntax/c.vim
 unlet b:current_syntax
-unlet b:filetype_in_cpp_family

 " C++ extensions
 syn keyword cppStatement       new delete this friend using
@@ -56,12 +54,12 @@
   syn match cppNumbers         display transparent "\<\d\|\.\d" contains=cppNumber,cppFloat
   syn match cppNumber          display contained "\<0\([Uu]\=\([Ll]\|LL\|ll\)\|\([Ll]\|LL\|ll\)\=[Uu]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
   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*\)\=\>"
-  syn match cppNumber          display contained "\<0\('\=\o\+\)\+\([Uu]\=\([Ll]\|LL\|ll\)\|\([Ll]\|LL\|ll\)\=[Uu]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
-  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*\)\=\>"
-  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*\)\=\>"
-  syn match cppFloat           display contained "\<\d\('\=\d\+\)*\.\(\d\('\=\d\+\)*\)\=\(e[-+]\=\d\+\)\=\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
-  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 cppNumber          display contained "\<0\o\+\([Uu]\=\([Ll]\|LL\|ll\)\|\([Ll]\|LL\|ll\)\=[Uu]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppNumber          display contained "\<0[bB][01]\('\=[01]\+\)*\([Uu]\=\([Ll]\|LL\|ll\)\|\([Ll]\|LL\|ll\)\=[Uu]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppNumber          display contained "\<0[xX]\x\('\=\x\+\)*\([Uu]\=\([Ll]\|LL\|ll\)\|\([Ll]\|LL\|ll\)\=[Uu]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppFloat           display contained "\<\d\+\.\d*\([eE][-+]\=\d\+\)\=\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppFloat           display contained "\<\.\d\+\([eE][-+]\=\d\+\)\=\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppFloat           display contained "\<\d\+[eE][-+]\=\d\+\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
   syn region cppString         start=+\(L\|u\|u8\|U\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"\(sv\|s\|_\i*\)\=+ end='$' contains=cSpecial,cFormat,@Spell
 endif
 
@@ -69,8 +67,8 @@
 if !exists("cpp_no_cpp17")
   syn match cppCast            "\<reinterpret_pointer_cast\s*<"me=e-1
   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*\)\=\>"
+  syn match cppFloat           display contained "\<0[xX]\x*\.\x\+p[-+]\=\d\+\([FfLl]\|i[fl]\=\|h\|min\|s\|ms\|us\|ns\|_\i*\)\=\>"
+  syn match cppFloat           display contained "\<0[xX]\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'[^\\]'"
@@ -84,7 +82,6 @@
   endif
   syn match cppSpecialCharacter display "u8'\\\o\{1,3}'"
   syn match cppSpecialCharacter display "u8'\\x\x\+'"
-
 endif

 " C++ 20 extensions
@@ -92,8 +89,8 @@
   syn match cppNumber          display contained "\<0\(y\|d\)\>"
   syn match cppNumber          display contained "\<[1-9]\('\=\d\+\)*\(y\|d\)\>"
   syn match cppNumber          display contained "\<0\o\+\(y\|d\)\>"
-  syn match cppNumber          display contained "\<0b[01]\('\=[01]\+\)*\(y\|d\)\>"
-  syn match cppNumber          display contained "\<0x\x\('\=\x\+\)*\(y\|d\)\>"
+  syn match cppNumber          display contained "\<0[bB][01]\('\=[01]\+\)*\(y\|d\)\>"
+  syn match cppNumber          display contained "\<0[xX]\x\('\=\x\+\)*\(y\|d\)\>"
   syn keyword cppStatement     co_await co_return co_yield requires
   syn keyword cppStorageClass  consteval constinit
   syn keyword cppStructure     concept
@@ -105,26 +102,26 @@
 syn match cppMinMax "[<>]?"

 " Default highlighting
-hi def link cppAccess          cppStatement
-hi def link cppCast            cppStatement
+hi def link cppAccess                  cppStatement
+hi def link cppCast                    cppStatement
 hi def link cppExceptions              Exception
-hi def link cppOperator                Operator
+hi def link cppOperator                        Operator
 hi def link cppStatement               Statement
-hi def link cppModifier                Type
-hi def link cppType            Type
-hi def link cppStorageClass    StorageClass
+hi def link cppModifier                        Type
+hi def link cppType                    Type
+hi def link cppStorageClass            StorageClass
 hi def link cppStructure               Structure
-hi def link cppBoolean         Boolean
+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 cppConstant                        Constant
 hi def link cppRawStringDelimiter      Delimiter
 hi def link cppRawString               String
-hi def link cppString          String
-hi def link cppNumber          Number
-hi def link cppFloat           Number
-hi def link cppModule          Include
+hi def link cppString                  String
+hi def link cppNumber                  Number
+hi def link cppFloat                   Number
+hi def link cppModule                  Include

 let b:current_syntax = "cpp"
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions