mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
runtime(vim): Update base syntax, match enum constructor type args
closes: #17840 Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
72473ce9f8
commit
4de931daae
@@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Jul 23
|
||||
" Last Change: 2025 Jul 24
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@@ -698,12 +698,19 @@ if s:vim9script
|
||||
syn cluster vim9EnumNameContinue contains=vim9EnumNameContinue,vim9EnumNameContinueComment
|
||||
|
||||
" enforce enum value list location
|
||||
syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
|
||||
syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueTypeArgs,vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
|
||||
syn match vim9EnumValueListComma contained "," skipwhite skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
|
||||
syn region vim9EnumValueListCommaComment contained
|
||||
\ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
|
||||
\ skipwhite skipempty nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
|
||||
\ contains=@vimCommentGroup,vimCommentString
|
||||
syn region vim9EnumValueTypeArgs contained
|
||||
\ matchgroup=Delimiter
|
||||
\ start="<\ze\a"
|
||||
\ end=">"
|
||||
\ nextgroup=vim9EnumValueArgList
|
||||
\ contains=@vimType
|
||||
\ oneline
|
||||
syn region vim9EnumValueArgList contained
|
||||
\ matchgroup=vimParenSep start="(" end=")"
|
||||
\ nextgroup=vim9EnumValueListComma
|
||||
|
@@ -0,0 +1,20 @@
|
||||
| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@62
|
||||
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|D|e|f|T|y|p|e|P|a|r|a|m| |T|o|d|o| +0#0000000&@19
|
||||
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|E|n|u|m|V|a|l|u|e| |I|d|e|n|t|i|f|i|e|r| +0#0000000&@16
|
||||
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|e|f|"| +0#0000000&@28
|
||||
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| |f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
|
||||
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| +0#0000000&|S+0#e000e06&|e@1|:| +0#0000e05&|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|7|3|1|3|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|0|3@1|5|3|7|1|2|7| |(|A|l|i
|
||||
| +0&#a8a8a8255@1|a+0&#ffffff0|k|s|e|i| |B|u|d|a|v|e|i|)| +0#0000000&@58
|
||||
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|
||||
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|C|o|m@1|o|n|P|a|i|r| @57
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|H+0#00e0e07&|e|l@1|o|W|o|r|l|d|<+0#e000e06&|s+0#00e0003&|t|r|i|n|g|,+0#0000000&| |s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|(|'+0#e000002&|h|e|l@1|o|'|,+0#0000000&| |'+0#e000002&|w|o|r|l|d|'|)+0#e000e06&|,+0#0000000&| @23
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|B+0#00e0e07&|o@1|l|e|a|n|s|<+0#e000e06&|b+0#00e0003&|o@1|l|,+0#0000000&| |b+0#00e0003&|o@1|l|>+0#e000e06&|(|t+0#e000002&|r|u|e|,+0#0000000&| |f+0#e000002&|a|l|s|e|)+0#e000e06&| +0#0000000&@35
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|_|f|s|t|:| |a+0#00e0003&|n|y| +0#0000000&@53
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|_|s|n|d|:| |a+0#00e0003&|n|y| +0#0000000&@53
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0| |U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|f+0#0000000&|s|t|:| |T|,| |s|n|d|:| |U|)+0#e000e06&| +0#0000000&@39
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t| |=+0#af5f00255&| +0#0000000&|f|s|t| @49
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d| |=+0#af5f00255&| +0#0000000&|s|n|d| @49
|
||||
@57|1|,|1| @10|T|o|p|
|
@@ -0,0 +1,20 @@
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|_|f|s|t|:| |a+0#00e0003&|n|y| +0#0000000&@53
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|_|s|n|d|:| |a+0#00e0003&|n|y| +0#0000000&@53
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0| |U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|f+0#0000000&|s|t|:| |T|,| |s|n|d|:| |U|)+0#e000e06&| +0#0000000&@39
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t| |=+0#af5f00255&| +0#0000000&|f|s|t| @49
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7>t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d| |=+0#af5f00255&| +0#0000000&|s|n|d| @49
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|F|i|r|s|t|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&| |T| @51
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t| @48
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|S|e|c|o|n|d|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&| |T| @50
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d| @48
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
|
||||
||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
|
||||
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|p+0#00e0e07&|r|i|n|t|f|(+0#e000e06&|"+0#e000002&|(|%|s|,| |%|s|)|"|,+0#0000000&| |t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t|,| |t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d|)+0#e000e06&| +0#0000000&@17
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
|
||||
@57|1|8|,|9| @9|7|0|%|
|
@@ -0,0 +1,20 @@
|
||||
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
|
||||
||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
|
||||
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|
||||
| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|C|o|m@1|o|n|P|a|i|r|.+0#af5f00255&|H+0#0000000&|e|l@1|o|W|o|r|l|d| @46
|
||||
| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|C|o|m@1|o|n|P|a|i|r|.+0#af5f00255&|B+0#0000000&|o@1|l|e|a|n|s| @48
|
||||
| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|3|6|,|0|-|1| @7|B|o|t|
|
@@ -0,0 +1,36 @@
|
||||
vim9script
|
||||
# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
|
||||
# VIM_TEST_SETUP highlight link vim9EnumValue Identifier
|
||||
# VIM_TEST_SETUP let g:vimsyn_folding = "ef"
|
||||
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
|
||||
# See: https://github.com/vim/vim/pull/17313#issuecomment-3033537127 (Aliaksei Budavei)
|
||||
|
||||
|
||||
enum CommonPair
|
||||
HelloWorld<string, string>('hello', 'world'),
|
||||
Booleans<bool, bool>(true, false)
|
||||
|
||||
const _fst: any
|
||||
const _snd: any
|
||||
|
||||
def new<T, U>(fst: T, snd: U)
|
||||
this._fst = fst
|
||||
this._snd = snd
|
||||
enddef
|
||||
|
||||
def First<T>(): T
|
||||
return this._fst
|
||||
enddef
|
||||
|
||||
def Second<T>(): T
|
||||
return this._snd
|
||||
enddef
|
||||
|
||||
def string(): string
|
||||
return printf("(%s, %s)", this._fst, this._snd)
|
||||
enddef
|
||||
endenum
|
||||
|
||||
echo CommonPair.HelloWorld
|
||||
echo CommonPair.Booleans
|
||||
|
@@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Jul 23
|
||||
" Last Change: 2025 Jul 24
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@@ -752,12 +752,19 @@ if s:vim9script
|
||||
syn cluster vim9EnumNameContinue contains=vim9EnumNameContinue,vim9EnumNameContinueComment
|
||||
|
||||
" enforce enum value list location
|
||||
syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
|
||||
syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueTypeArgs,vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
|
||||
syn match vim9EnumValueListComma contained "," skipwhite skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
|
||||
syn region vim9EnumValueListCommaComment contained
|
||||
\ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
|
||||
\ skipwhite skipempty nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
|
||||
\ contains=@vimCommentGroup,vimCommentString
|
||||
syn region vim9EnumValueTypeArgs contained
|
||||
\ matchgroup=Delimiter
|
||||
\ start="<\ze\a"
|
||||
\ end=">"
|
||||
\ nextgroup=vim9EnumValueArgList
|
||||
\ contains=@vimType
|
||||
\ oneline
|
||||
syn region vim9EnumValueArgList contained
|
||||
\ matchgroup=vimParenSep start="(" end=")"
|
||||
\ nextgroup=vim9EnumValueListComma
|
||||
|
Reference in New Issue
Block a user