]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vim): Update base-syntax, improve Vim9 block start pattern
authorDoug Kearns <dougkearns@gmail.com>
Thu, 5 Jun 2025 18:23:07 +0000 (20:23 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 5 Jun 2025 18:23:07 +0000 (20:23 +0200)
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>
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim9_block_00.dump
runtime/syntax/testdir/dumps/vim9_block_01.dump
runtime/syntax/testdir/dumps/vim9_block_02.dump
runtime/syntax/testdir/input/vim9_block.vim
runtime/syntax/vim.vim

index fa76c3ce90919157d749010822a88fe58e249ea3..b381be67f5a5988e9f2ce30981a162bad0639b1d 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 Jun 02
+" Last Change:    2025 Jun 05
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -674,7 +674,12 @@ endif
 
 " 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
 " =======
index 6f4122a419632e3ef1b3a062b674d60b36ef590a..dfabed45ab63a746848b316e3f0461612475caf7 100644 (file)
@@ -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| 
index ab9c996559207e98945a01acb199d339776c6a9e..533eb912033c583c98e622dca51e7bc953f28a48 100644 (file)
@@ -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|%| 
index 32a4881d2395fb3c0ddafb46ab3394770b1d3813..c91074ada1120e4edb2c90ae4d8fa6f69b3c7117 100644 (file)
@@ -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| 
index 3880f97acabf7b8b65a19cfb6c3f9a5efccdb471..ddc6657ff0882e941ac2dc3566ba5bcc0977ad19 100644 (file)
@@ -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 @@ vim9script
   var foo = 42
 }
 
+
 def Foo()
   {
     var foo = 42
@@ -27,7 +29,21 @@ def Foo()
   }
 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()
 
index 6afcb0492c830bf9d5ca84b2ff5fc77fd5f3872d..18c5e9eb60e6b4dabf1e073bd0336584b4c33cb3 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 Jun 02
+" Last Change:    2025 Jun 05
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -727,7 +727,12 @@ endif
 
 " 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
 " =======