mirror of
https://github.com/vim/vim.git
synced 2025-10-16 07:24:23 -04:00
runtime(vim): Update base syntax, allow Vim9 :echo tail comments
- Match comments after Vim9 :echo and :execute. - Match comments after Vim9 and legacy :eval. closes: #18420 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
38b98bd8e6
commit
f4a6acd86e
@@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Sep 26
|
||||
" Last Change: 2025 Sep 27
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@@ -1281,7 +1281,7 @@ syn region vimEcho
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vim9Comment
|
||||
\ transparent
|
||||
|
||||
syn match vimEchohl "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchohlNone
|
||||
@@ -1298,7 +1298,7 @@ syn region vimExecute
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vim9Comment
|
||||
\ transparent
|
||||
|
||||
syn region vimEval
|
||||
@@ -1308,7 +1308,7 @@ syn region vimEval
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vim9Comment
|
||||
\ transparent
|
||||
|
||||
" Filter: {{{2
|
||||
|
20
runtime/syntax/testdir/dumps/vim9_ex_echo_00.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_ex_echo_00.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
|
||||
|#+0#0000e05&| |V|i|m|9| |:|e|c|h|o| |c|o|m@1|a|n|d|s| +0#0000000&@53
|
||||
|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|V|a|r| |I|d|e|n|t|i|f|i|e|r| +0#0000000&@32
|
||||
@75
|
||||
@75
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&@8|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1|[+0#0000000&|0+0#e000002&|]+0#0000000&| @1|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52
|
||||
@75
|
||||
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&@8|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1|[+0#0000000&|0+0#e000002&|]+0#0000000&| @1|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
|
||||
@75
|
||||
@57|1|,|1| @10|T|o|p|
|
20
runtime/syntax/testdir/dumps/vim9_ex_echo_01.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_ex_echo_01.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
| +0&#ffffff0@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1|[+0#0000000&|0+0#e000002&|]+0#0000000&| @1|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
@2|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@50
|
||||
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
|
||||
> @74
|
||||
@75
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|4|"| +0#0000000&@66
|
||||
@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
|
||||
@2|.+0#af5f00255&@1| +0#0000000&|"+0#e000002&|2|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@56
|
||||
@75
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|4|"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&@63
|
||||
@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
|
||||
@2|"+0#e000002&|2|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
|
||||
@75
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|4|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@56
|
||||
@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
|
||||
@2|.+0#af5f00255&@1| +0#0000000&|"+0#e000002&|2|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@56
|
||||
@75
|
||||
@57|1|9|,|0|-|1| @7|7|6|%|
|
20
runtime/syntax/testdir/dumps/vim9_ex_echo_02.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_ex_echo_02.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
| +0&#ffffff0@74
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|4|"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
|
||||
@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
|
||||
@2|"+0#e000002&|2|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
|
||||
> @74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|3|6|,|0|-|1| @7|B|o|t|
|
@@ -6,7 +6,7 @@
|
||||
@6>\+0#e000e06&| +0#0000000&|=+0#0000001#ffff4012|>| +0#0000000#ffffff0|v+0#00e0e07&| +0#0000000&|>+0#af5f00255&| +0#0000000&|0+0#e000002&|)+0#e000e06&| +0#0000000&@57
|
||||
@75
|
||||
|v+0#af5f00255&|a|r| +0#0000000&|C+0#00e0e07&|a|l@1|b|a|c|k| +0#0000000&|=+0#af5f00255&| +0#0000000&|(+0#0000001#ffff4012|.+0#0000000#ffffff0@2|_+0#00e0e07&|)+0#0000001#ffff4012| +0#0000000#ffffff0|=+0#0000001#ffff4012|>| +0#0000000#ffffff0|'+0#e000002&|a|n|y|t|h|i|n|g|'| +0#0000000&@39
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|C|a|l@1|b|a|c|k|(+0#e000e06&|1+0#e000002&|,+0#0000000&| |2+0#e000002&|,+0#0000000&| |3+0#e000002&|)+0#e000e06&| +0#0000000&@1|#| |d+0#00e0e07&|i|s|p|l|a|y|s| +0#0000000&|"+0#e000002&|a|n|y|t|h|i|n|g|"| +0#0000000&@29
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|C|a|l@1|b|a|c|k|(+0#e000e06&|1+0#e000002&|,+0#0000000&| |2+0#e000002&|,+0#0000000&| |3+0#e000002&|)+0#e000e06&| +0#0000000&@1|#+0#0000e05&| |d|i|s|p|l|a|y|s| |"+0#e000002&|a|n|y|t|h|i|n|g|"| +0#0000000&@29
|
||||
@75
|
||||
|v+0#af5f00255&|a|r| +0#0000000&|L+0#00e0e07&|a|m|b|d|a| +0#0000000&|=+0#af5f00255&| +0#0000000&|(+0#0000001#ffff4012|a+0#00e0e07#ffffff0|r|g|)+0#0000001#ffff4012| +0#0000000#ffffff0|=+0#0000001#ffff4012|>| +0#0000000#ffffff0|{+0#e000e06&| +0#0000000&@51
|
||||
@8|g+0#00e0e07&|:|w|a|s|_|c|a|l@1|e|d| +0#0000000&|=+0#af5f00255&| +0#0000000&|'+0#e000002&|y|e|s|'| +0#0000000&@46
|
||||
|
@@ -12,9 +12,9 @@
|
||||
@75
|
||||
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |e+0#af5f00255&|v|a|l| +0#0000000&|"+0#e000002&|F|o@1|"|-+0#af5f00255&|>|a+0#00e0e07&|p@1|e|n|d|(+0#e000e06&|0+0#e000002&|)+0#e000e06&| +0#0000000&@40
|
||||
@75
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
||||
|e+0#af5f00255&|v|a|l| +0#0000000&|"+0#e000002&|F|o@1|"|-+0#af5f00255&|>|a+0#00e0e07&|p@1|e|n|d|(+0#e000e06&|0+0#e000002&|)+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@43
|
||||
@75
|
||||
|d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
|
||||
@2|e+0#af5f00255&|v|a|l| +0#0000000&|"+0#e000002&|F|o@1|"|-+0#af5f00255&|>|a+0#00e0e07&|p@1|e|n|d|(+0#e000e06&|0+0#e000002&|)+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@41
|
||||
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
|
20
runtime/syntax/testdir/dumps/vim_ex_eval_01.dump
Normal file
20
runtime/syntax/testdir/dumps/vim_ex_eval_01.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
| +0&#ffffff0@74
|
||||
|e+0#af5f00255&|v|a|l| +0#0000000&|"+0#e000002&|F|o@1|"|-+0#af5f00255&|>|a+0#00e0e07&|p@1|e|n|d|(+0#e000e06&|0+0#e000002&|)+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@43
|
||||
@75
|
||||
|d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
|
||||
@2|e+0#af5f00255&|v|a|l| +0#0000000&|"+0#e000002&|F|o@1|"|-+0#af5f00255&|>|a+0#00e0e07&|p@1|e|n|d|(+0#e000e06&|0+0#e000002&|)+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@41
|
||||
>e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
|
||||
@75
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|1|9|,|1| @9|B|o|t|
|
@@ -17,4 +17,4 @@
|
||||
|"+0#0000e05&| |i|n|v|a|l|i|d| |e|x|p|r|e|s@1|i|o|n| +0#0000000&@54
|
||||
|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||+0#af5f00255&@1| +0#0000000&@58
|
||||
@75
|
||||
@57|1|9|,|0|-|1| @7|3|2|%|
|
||||
@57|1|9|,|0|-|1| @7|2|8|%|
|
||||
|
@@ -17,4 +17,4 @@
|
||||
|"+0#0000e05&| |:|e|x|e|c|u|t|e| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@49
|
||||
|e+0#af5f00255&|x|e|c|u|t|e||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@55
|
||||
@75
|
||||
@57|3|7|,|7| @9|7@1|%|
|
||||
@57|3|7|,|7| @9|6|8|%|
|
||||
|
@@ -2,8 +2,13 @@
|
||||
|"+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |n|e@1|d|s| ||| +0#0000000&@48
|
||||
|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49
|
||||
@75
|
||||
|d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
|
||||
@2>#+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |a|l@1|o|w|e|d| +0#0000000&@46
|
||||
@2|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49
|
||||
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
|
||||
@75
|
||||
>"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14
|
||||
@75
|
||||
|"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14
|
||||
@75
|
||||
|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|'+0#e000002&|a|r|g|'|:+0#0000000&| |"+0#e000002&|c|a|l@1| |F|o@1|(|)|"|}+0#e000e06&| +0#0000000&@43
|
||||
|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|(+0#e000e06&|f+0#00e0e07&|o@1|.+0#af5f00255&|a+0#00e0e07&|r|g|)+0#e000e06&| +0#0000000&@57
|
||||
@@ -12,9 +17,4 @@
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|5@1|,|1| @9|B|o|t|
|
||||
| +0#0000000&@56|5@1|,|3| @9|B|o|t|
|
||||
|
36
runtime/syntax/testdir/input/vim9_ex_echo.vim
Normal file
36
runtime/syntax/testdir/input/vim9_ex_echo.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
vim9script
|
||||
# Vim9 :echo commands
|
||||
# VIM_TEST_SETUP hi link vimVar Identifier
|
||||
|
||||
|
||||
echo # comment
|
||||
echo "Foo" # comment
|
||||
echo foo[0] # comment
|
||||
echo Foo() # comment
|
||||
echo "Foo" | # comment
|
||||
|
||||
def Foo()
|
||||
echo # comment
|
||||
echo "Foo" # comment
|
||||
echo foo[0] # comment
|
||||
echo Foo() # comment
|
||||
echo "Foo" | # comment
|
||||
enddef
|
||||
|
||||
|
||||
echo "4"
|
||||
# comment
|
||||
.. "2" # comment
|
||||
|
||||
echo "4" ..
|
||||
# comment
|
||||
"2" # comment
|
||||
|
||||
echo "4" # comment
|
||||
# comment
|
||||
.. "2" # comment
|
||||
|
||||
echo "4" .. # comment
|
||||
# comment
|
||||
"2" # comment
|
||||
|
@@ -12,3 +12,9 @@ eval "Foo"->append(0) | echo "Foo"
|
||||
|
||||
echo "Foo" | eval "Foo"->append(0)
|
||||
|
||||
eval "Foo"->append(0) " comment
|
||||
|
||||
def Vim9Context()
|
||||
eval "Foo"->append(0) # comment
|
||||
enddef
|
||||
|
||||
|
@@ -51,6 +51,11 @@ execute| echo "Foo"
|
||||
" trailing comment needs |
|
||||
execute "Foo" | " comment
|
||||
|
||||
def Vim9Context()
|
||||
# trailing comment allowed
|
||||
execute "Foo" # comment
|
||||
enddef
|
||||
|
||||
|
||||
" Issue #9987 (parenthesised argument - not a function call)
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Sep 26
|
||||
" Last Change: 2025 Sep 27
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@@ -1339,7 +1339,7 @@ syn region vimEcho
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vim9Comment
|
||||
\ transparent
|
||||
|
||||
syn match vimEchohl "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchohlNone
|
||||
@@ -1356,7 +1356,7 @@ syn region vimExecute
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vim9Comment
|
||||
\ transparent
|
||||
|
||||
syn region vimEval
|
||||
@@ -1366,7 +1366,7 @@ syn region vimEval
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ contains=@vimContinue,@vimExprList,vimComment,vim9Comment
|
||||
\ transparent
|
||||
|
||||
" Filter: {{{2
|
||||
|
Reference in New Issue
Block a user