]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vim): Update base syntax, allow Vim9 :echo tail comments
authorDoug Kearns <dougkearns@gmail.com>
Sun, 28 Sep 2025 17:56:01 +0000 (17:56 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 28 Sep 2025 17:56:01 +0000 (17:56 +0000)
- 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>
14 files changed:
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim9_ex_echo_00.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/vim9_ex_echo_01.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/vim9_ex_echo_02.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/vim9_lambdas_07.dump
runtime/syntax/testdir/dumps/vim_ex_eval_00.dump
runtime/syntax/testdir/dumps/vim_ex_eval_01.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/vim_ex_execute_01.dump
runtime/syntax/testdir/dumps/vim_ex_execute_02.dump
runtime/syntax/testdir/dumps/vim_ex_execute_03.dump
runtime/syntax/testdir/input/vim9_ex_echo.vim [new file with mode: 0644]
runtime/syntax/testdir/input/vim_ex_eval.vim
runtime/syntax/testdir/input/vim_ex_execute.vim
runtime/syntax/vim.vim

index 7ea8d2a30126d334d6d946a5f623db6e823ef456..e7b24dfbb3471bcd3c60be7733727981679caa90 100644 (file)
@@ -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
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_echo_00.dump b/runtime/syntax/testdir/dumps/vim9_ex_echo_00.dump
new file mode 100644 (file)
index 0000000..c900d82
--- /dev/null
@@ -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| 
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_echo_01.dump b/runtime/syntax/testdir/dumps/vim9_ex_echo_01.dump
new file mode 100644 (file)
index 0000000..15c6e39
--- /dev/null
@@ -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|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_echo_02.dump b/runtime/syntax/testdir/dumps/vim9_ex_echo_02.dump
new file mode 100644 (file)
index 0000000..9d46396
--- /dev/null
@@ -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| 
index 6b6e43d7d3f403db2f5310be8d29e15b316a9e69..831c23bd23e7c377d3514edc3a56d3dc79ec67d9 100644 (file)
@@ -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
index fe01008451ab43898d13b144d72a4574d53e8511..ba9907670a59510e9d9513ca5908635f9e70adcd 100644 (file)
@@ -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
diff --git a/runtime/syntax/testdir/dumps/vim_ex_eval_01.dump b/runtime/syntax/testdir/dumps/vim_ex_eval_01.dump
new file mode 100644 (file)
index 0000000..292a190
--- /dev/null
@@ -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| 
index 8e9af8ec722587916d0484c115d2a0605b99b4db..685addd961ff2e75614b053c2cd3d13716233d23 100644 (file)
@@ -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|%| 
index f93db78945fbe9464073cc31c786e76a44b7defe..f5f892e62b1b7820dd6cfbc83f06d9a2a677e198 100644 (file)
@@ -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|%| 
index a34123028f130cb02aff71fdbab7a9a36feb879b..7f52581b96ccf9f2be2ecae079aba1e466ca33f0 100644 (file)
@@ -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| 
diff --git a/runtime/syntax/testdir/input/vim9_ex_echo.vim b/runtime/syntax/testdir/input/vim9_ex_echo.vim
new file mode 100644 (file)
index 0000000..e09dd04
--- /dev/null
@@ -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
+
index ea9d314b49b1f32735f7661a914ab5b253d3258a..e4f629337d22f72ba956385a160e243346e923c5 100644 (file)
@@ -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
+
index a88e1f4645d19fb856193842a52c917317b8d7ff..5f4b7d47e76197437ca6857c0de330ed4b420d90 100644 (file)
@@ -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)
 
index c618afe53396638846d073d489fe9fb7a5e04728..b5c1673fbd0b1bc364adc4b117145f173a619d92 100644 (file)
@@ -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