runtime(vim): Update base-syntax, improve Vim9 block start pattern

The opening curly brace must be followed by whitespace, comment or
trailing bar.

closes: #17454

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index fa76c3c..b381be6 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
 " Language:	   Vim script
 " Maintainer:	   Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "	   Doug Kearns <dougkearns@gmail.com>
-" Last Change:	   2025 Jun 02
+" Last Change:	   2025 Jun 05
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -674,7 +674,12 @@
 
 " Blocks: {{{2
 " ======
-Vim9 syn region	vim9Block	matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
+Vim9 syn region	vim9Block
+      \ matchgroup=vimSep
+      \ start="{\ze\s*\%($\|[#|]\)"
+      \ end="^\s*\zs}"
+      \ skipwhite nextgroup=vim9Comment,vimCmdSep
+      \ contains=@vimDefBodyList
 
 " Keymaps: {{{2
 " =======
diff --git a/runtime/syntax/testdir/dumps/vim9_block_00.dump b/runtime/syntax/testdir/dumps/vim9_block_00.dump
index 6f4122a..dfabed4 100644
--- a/runtime/syntax/testdir/dumps/vim9_block_00.dump
+++ b/runtime/syntax/testdir/dumps/vim9_block_00.dump
@@ -1,12 +1,14 @@
 >v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
-@75
 |#+0#0000e05&| |V|i|m|9| |b|l|o|c|k|s| +0#0000000&@61
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|S|E|T|U|P| |s|e|t| |l|i|s|t| |l|i|s|t|c|h|a|r|s|=|t|a|b|:|>| |,|t|r|a|i|l|:|-|,|e|x|t|e|n|d|s|:|>|,|p|r|e|c|e|d|e|s|:|<|,|n|b|s|p
+|:|+| +0#0000000&@72
 @75
 @75
 |{+0#e000e06&| +0#0000000&@73
 @2|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
 |}+0#e000e06&| +0#0000000&@73
 @75
+@75
 |{+0#e000e06&| +0#0000000&@73
 @2|{+0#e000e06&| +0#0000000&@71
 @4|{+0#e000e06&| +0#0000000&@69
@@ -15,6 +17,4 @@
 @6|}+0#e000e06&| +0#0000000&@67
 @6|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@56
 @4|}+0#e000e06&| +0#0000000&@69
-@4|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@58
-@2|}+0#e000e06&| +0#0000000&@71
 @57|1|,|1| @10|T|o|p| 
diff --git a/runtime/syntax/testdir/dumps/vim9_block_01.dump b/runtime/syntax/testdir/dumps/vim9_block_01.dump
index ab9c996..533eb91 100644
--- a/runtime/syntax/testdir/dumps/vim9_block_01.dump
+++ b/runtime/syntax/testdir/dumps/vim9_block_01.dump
@@ -1,12 +1,15 @@
-| +0&#ffffff0@7|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@54
+| +0&#ffffff0@3|{+0#e000e06&| +0#0000000&@69
+@6|{+0#e000e06&| +0#0000000&@67
+@8|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@54
 @6|}+0#e000e06&| +0#0000000&@67
 @6|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@56
-@4|}+0#e000e06&| +0#0000000&@69
+@4>}+0#e000e06&| +0#0000000&@69
 @4|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@58
-@2>}+0#e000e06&| +0#0000000&@71
+@2|}+0#e000e06&| +0#0000000&@71
 @2|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
 |}+0#e000e06&| +0#0000000&@73
 @75
+@75
 |d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
 @2|{+0#e000e06&| +0#0000000&@71
 @4|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@58
@@ -14,7 +17,4 @@
 @2|}+0#e000e06&| +0#0000000&@71
 |e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
 @75
-|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o@1|"| +0#0000000&||| |{+0#e000e06&| +0#0000000&@60
-@2|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
-|}+0#e000e06&| +0#0000000&@73
-@57|1|9|,|3| @9|9|2|%| 
+@57|1|8|,|5| @9|4|0|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_block_02.dump b/runtime/syntax/testdir/dumps/vim9_block_02.dump
index 32a4881..c91074a 100644
--- a/runtime/syntax/testdir/dumps/vim9_block_02.dump
+++ b/runtime/syntax/testdir/dumps/vim9_block_02.dump
@@ -1,20 +1,20 @@
-|}+0#e000e06#ffffff0| +0#0000000&@73
-> @74
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-| +0#0000000&@56|3@1|,|0|-|1| @7|B|o|t| 
+| +0&#ffffff0@74
+@75
+|#+0#0000e05&| |s|t|a|r|t|/|e|n|d| |p|a|t@1|e|r|n|s| +0#0000000&@54
+@75
+|{+0#e000e06&| +0#0000000&@73
+@2>v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
+|}+0#e000e06&| +0#0000000&@73
+@75
+|{+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
+@2|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
+|}+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63
+@75
+|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |{+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|B|a|r|"| +0#0000000&@47
+@2|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|4+0#e000002&|2| +0#0000000&@60
+|}+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|B|a|z|"| +0#0000000&@60
+@75
+|#+0#0000e05&| |d|i|c|t|i|o|n|a|r|y| +0#0000000&@62
+|{+0#e000e06&|}|-+0#af5f00255&|>|i+0#00e0e07&|t|e|m|s|(+0#e000e06&|)| +0#0000000&@63
+@75
+@57|3|6|,|3| @9|B|o|t| 
diff --git a/runtime/syntax/testdir/input/vim9_block.vim b/runtime/syntax/testdir/input/vim9_block.vim
index 3880f97..ddc6657 100644
--- a/runtime/syntax/testdir/input/vim9_block.vim
+++ b/runtime/syntax/testdir/input/vim9_block.vim
@@ -1,17 +1,18 @@
 vim9script
-
 # Vim9 blocks
+# VIM_TESTSETUP set list listchars=tab:> ,trail:-,extends:>,precedes:<,nbsp:+
 
 
 {
   var foo = 42
 }
 
+
 {
   {
     {
       {
-	var foo = 42
+        var foo = 42
       }
       var foo = 42
     }
@@ -20,6 +21,7 @@
   var foo = 42
 }
 
+
 def Foo()
   {
     var foo = 42
@@ -27,7 +29,21 @@
   }
 enddef
 
-echo "foo" | {
+
+# start/end patterns
+
+{             
   var foo = 42
-}
+}             
+
+{ # comment
+  var foo = 42
+} # comment
+
+echo "Foo" | { | echo "Bar"
+  var foo = 42
+} | echo "Baz"
+
+# dictionary
+{}->items()
 
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 6afcb04..18c5e9e 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
 " Language:	   Vim script
 " Maintainer:	   Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "	   Doug Kearns <dougkearns@gmail.com>
-" Last Change:	   2025 Jun 02
+" Last Change:	   2025 Jun 05
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -727,7 +727,12 @@
 
 " Blocks: {{{2
 " ======
-Vim9 syn region	vim9Block	matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
+Vim9 syn region	vim9Block
+      \ matchgroup=vimSep
+      \ start="{\ze\s*\%($\|[#|]\)"
+      \ end="^\s*\zs}"
+      \ skipwhite nextgroup=vim9Comment,vimCmdSep
+      \ contains=@vimDefBodyList
 
 " Keymaps: {{{2
 " =======