mirror of
https://github.com/vim/vim
synced 2025-03-16 06:47:52 +01:00
runtime(vim): Update base-syntax, match protected constructors
Support for protected constructors was added in commit 7e89800
.
This commit is contained in:
parent
8322923b40
commit
4aa12110ce
6 changed files with 87 additions and 8 deletions
runtime/syntax
|
@ -2,7 +2,7 @@
|
|||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Mar 13
|
||||
" Last Change: 2025 Mar 15
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
|
@ -459,7 +459,7 @@ if s:vim9script
|
|||
\ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,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*\>"
|
||||
|
@ -485,14 +485,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
|
||||
|
|
20
runtime/syntax/testdir/dumps/vim9_constructor_00.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_constructor_00.dump
Normal file
|
@ -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|
|
20
runtime/syntax/testdir/dumps/vim9_constructor_01.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_constructor_01.dump
Normal file
|
@ -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
|
||||
>:|c|a|l@1| |S|c|r|o|l@1|T|o|S|e|c|o|n|d|P|a|g|e|(@1|1|8| |*| |7|5| |+| |1|)|,| |1|9|,| |5|)| ||| |r|e|d|r|a|w|!| @18
|
20
runtime/syntax/testdir/dumps/vim9_constructor_02.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_constructor_02.dump
Normal file
|
@ -0,0 +1,20 @@
|
|||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
|
19
runtime/syntax/testdir/input/vim9_constructor.vim
Normal file
19
runtime/syntax/testdir/input/vim9_constructor.vim
Normal file
|
@ -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
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Mar 13
|
||||
" Last Change: 2025 Mar 15
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
|
@ -509,7 +509,7 @@ if s:vim9script
|
|||
\ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,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*\>"
|
||||
|
@ -535,14 +535,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
|
||||
|
|
Loading…
Add table
Reference in a new issue