runtime(vim): Update base-syntax, match protected constructors

Commit: 
https://github.com/vim/vim/commit/adb703e1b98b71f2908ecc7b7d4180f586caafb8
Author: Doug Kearns <dougkea...@gmail.com>
Date:   Sun Mar 23 16:14:20 2025 +0100

    runtime(vim): Update base-syntax, match protected constructors
    
    Support for protected constructors was added in commit 7e89800.
    
    closes: 16618
    
    Signed-off-by: Doug Kearns <dougkea...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/generator/vim.vim.base 
b/runtime/syntax/generator/vim.vim.base
index cf732443c..4752c3fbd 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -476,7 +476,7 @@ if s:vim9script
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFuncParamEquals
 
-  syn match    vim9ConstructorDefName  contained       "\<new\w*\>"
+  syn match    vim9ConstructorDefName  contained       "\<_\=new\w*\>"
         \ nextgroup=vim9ConstructorDefParams
         \ contains=@vim9MethodName
   syn match    vim9ConstructorDefParam contained       "\<\%(this\.\)\=\h\w*\>"
@@ -513,14 +513,14 @@ if s:vim9script
   if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror")
     syn match  vim9MethodNameError contained   "\<[a-z0-9]\i\>"
   endif
-  syn match    vim9MethodName  contained       "\<new\w*\>"
+  syn match    vim9MethodName  contained       "\<_\=new\w*\>"
   syn keyword  vim9MethodName  contained       empty len string
 
   syn cluster  vim9MethodName  contains=vim9MethodName,vim9MethodNameError
 
   if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
     syn region vim9MethodDefFold       contained       
start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\i*(" 
end="^\s*:\=enddef\>" contains=vim9MethodDef fold keepend extend transparent
-    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+new\i*("                 end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
+    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+_\=new\i*("                      end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
   endif
 
   syn cluster vim9MethodDef contains=vim9MethodDef,vim9MethodDefFold
diff --git a/runtime/syntax/testdir/dumps/vim9_constructor_00.dump 
b/runtime/syntax/testdir/dumps/vim9_constructor_00.dump
new file mode 100644
index 000000000..1b30c562d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_constructor_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m|9| |c|o|n|s|t|r|u|c|t|o|r| +0#0000000&@56
+@75
+@75
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|A| @67
+@2|s+0#af5f00255&|t|a|t|i|c| +0#0000000&|v+0#af5f00255&|a|r| 
+0#0000000&|_|i|n|s|t|a|n|c|e|:| |A| @49
+@2|v+0#af5f00255&|a|r| +0#0000000&|s|t|r|:| |s+0#00e0003&|t|r|i|n|g| 
+0#0000000&@57
+@2|d+0#af5f00255&|e|f| 
+0#0000000&|_+0#00e0e07&|n|e|w|(+0#e000e06&|s+0#0000000&|t|r|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&@51
+@4|t+0#00e0e07&|h|i|s|.+0#af5f00255&|s+0#0000000&|t|r| |=+0#af5f00255&| 
+0#0000000&|s|t|r| @56
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+@2|s+0#af5f00255&|t|a|t|i|c| +0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|G|e|t|I|n|s|t|a|n|c|e|(+0#e000e06&|s+0#0000000&|t|r|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |A| @34
+@4|i+0#af5f00255&|f| +0#0000000&|_|i|n|s|t|a|n|c|e| |=+0#af5f00255&@1| 
+0#0000000&|n+0#e000002&|u|l@1| +0#0000000&@50
+@6|_|i|n|s|t|a|n|c|e| |=+0#af5f00255&| 
+0#0000000&|A|.|_+0#00e0e07&|n|e|w|(+0#e000e06&|s+0#0000000&|t|r|)+0#e000e06&| 
+0#0000000&@45
+@4|e+0#af5f00255&|n|d|i|f| +0#0000000&@65
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|_|i|n|s|t|a|n|c|e| @54
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+@57|1|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/input/vim9_constructor.vim 
b/runtime/syntax/testdir/input/vim9_constructor.vim
new file mode 100644
index 000000000..71a2ea422
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_constructor.vim
@@ -0,0 +1,19 @@
+vim9script
+
+# Vim9 constructor
+
+
+class A
+  static var _instance: A
+  var str: string
+  def _new(str: string)
+    this.str = str
+  enddef
+  static def GetInstance(str: string): A
+    if _instance == null
+      _instance = A._new(str)
+    endif
+    return _instance
+  enddef
+endclass
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 6a21c5f21..5ce2a90c4 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -526,7 +526,7 @@ if s:vim9script
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFuncParamEquals
 
-  syn match    vim9ConstructorDefName  contained       "\<new\w*\>"
+  syn match    vim9ConstructorDefName  contained       "\<_\=new\w*\>"
         \ nextgroup=vim9ConstructorDefParams
         \ contains=@vim9MethodName
   syn match    vim9ConstructorDefParam contained       "\<\%(this\.\)\=\h\w*\>"
@@ -563,14 +563,14 @@ if s:vim9script
   if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror")
     syn match  vim9MethodNameError contained   "\<[a-z0-9]\i\>"
   endif
-  syn match    vim9MethodName  contained       "\<new\w*\>"
+  syn match    vim9MethodName  contained       "\<_\=new\w*\>"
   syn keyword  vim9MethodName  contained       empty len string
 
   syn cluster  vim9MethodName  contains=vim9MethodName,vim9MethodNameError
 
   if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
     syn region vim9MethodDefFold       contained       
start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\i*(" 
end="^\s*:\=enddef\>" contains=vim9MethodDef fold keepend extend transparent
-    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+new\i*("                 end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
+    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+_\=new\i*("                      end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
   endif
 
   syn cluster vim9MethodDef contains=vim9MethodDef,vim9MethodDefFold

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1twN2W-00ArtL-AD%40256bit.org.

Raspunde prin e-mail lui