changeset 34590:4cad34137ea0

runtime(vim): Update base-syntax, disallow '.' at start of menu item names (#14232) Commit: https://github.com/vim/vim/commit/ec21bafc135a1e78d40e4fc9118e022bbab958e8 Author: dkearns <dougkearns@gmail.com> Date: Wed Mar 20 04:04:42 2024 +1100 runtime(vim): Update base-syntax, disallow '.' at start of menu item names (https://github.com/vim/vim/issues/14232) Disallow '.' at the start of a menu item name. This is the menu path separator character and should be escaped with a '\' in this case. Partially fixes #14230. "popup" is still incorrectly matched as the Ex command. Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Mar 2024 18:15:05 +0100
parents ce88329d5230
children 19caff944d87
files runtime/syntax/generator/vim.vim.base runtime/syntax/testdir/dumps/vim_ex_menu_01.dump runtime/syntax/testdir/dumps/vim_ex_menu_02.dump runtime/syntax/testdir/dumps/vim_ex_menu_03.dump runtime/syntax/testdir/dumps/vim_ex_menu_04.dump runtime/syntax/testdir/dumps/vim_ex_menu_99.dump runtime/syntax/testdir/input/vim_ex_menu.vim runtime/syntax/vim.vim
diffstat 8 files changed, 59 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -3,7 +3,7 @@
 " Maintainer:	Hirohito Higashi <h.east.727 ATMARK gmail.com>
 " 	Doug Kearns <dougkearns@gmail.com>
 " URL:	https://github.com/vim-jp/syntax-vim-ex
-" Last Change:	2024 Mar 18
+" Last Change:	2024 Mar 19
 " Former Maintainer: Charles E. Campbell
 " Base File URL:     http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
 " Base File Version: 9.0-25
@@ -498,8 +498,8 @@ syn case match
 syn keyword vimMenu popu[p] skipwhite nextgroup=vimMenuBang,vimMenuName
 syn region	vimMenuRhs	 contained contains=@vimContinue,vimNotation start="|\@!\S"            skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
 syn region	vimMenuRhsContinue contained contains=@vimContinue,vimNotation start=+^\s*\%(\\\|"\\ \)+ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
-syn match	vimMenuName	"\%(\\\s\|\S\)\+"        contained contains=vimMenuNotation,vimNotation skipwhite        nextgroup=vimCmdSep,vimMenuRhs
-syn match	vimMenuName	"\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
+syn match	vimMenuName	"\.\@!\%(\\\s\|\S\)\+"        contained contains=vimMenuNotation,vimNotation skipwhite        nextgroup=vimCmdSep,vimMenuRhs
+syn match	vimMenuName	"\.\@!\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
 syn match	vimMenuNotation	"&\a\|&&\|\\\s\|\\\." contained
 syn match	vimMenuPriority	"\<\d\+\%(\.\d\+\)*\>" contained skipwhite nextgroup=vimMenuName
 syn match	vimMenuMod	"\c<\%(script\|silent\|special\)>" contained skipwhite nextgroup=vimMenuName,vimMenuPriority,vimMenuMod contains=vimMapModKey,vimMapModErr
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump
@@ -17,4 +17,4 @@
 @75
 |"+0#0000e05&| +0#0000000&|E+0#e000e06&|x|a|m|p|l|e|:| +0#0000e05&|r|u|n|t|i|m|e|/|m|e|n|u|.|v|i|m| |(|m|o|d|i|f|i|e|d|)| +0#0000000&@36
 |a+0#af5f00255&|n| +0#0000000&|<+0#e000e06&|s|i|l|e|n|t|>| +0#0000000&|1+0#e000002&|0|.|3@1|0| +0#0000000&|&+0#e000e06&|F|i|l|e|.|&|C|l|o|s|e|<|T|a|b|>|:|c|l|o|s|e| +0#0000000&|:|c|o|n|f|i|r|m| |c|l|o|s|e|<+0#e000e06&|C|R|>| +0#0000000&@13
-@57|1|9|,|1| @9|2|4|%| 
+@57|1|9|,|1| @9|1|9|%| 
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump
@@ -17,4 +17,4 @@
 @8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
 @8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
 @8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@57|3|7|,|2|-|9| @7|5|7|%| 
+@57|3|7|,|2|-|9| @7|4|5|%| 
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump
@@ -17,4 +17,4 @@
 @8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
 @8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
 @8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@57|5@1|,|2|-|9| @7|8|9|%| 
+@57|5@1|,|2|-|9| @7|7|1|%| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_04.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+@75
+|"+0#0000e05&| |p|o|p|u|p| |m|e|n|u|s| +0#0000000&@61
+|p+0#af5f00255&|o|p|u|p| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+|p+0#af5f00255&|o|p|u|p|!| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+> @74
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|4|2|3|0| +0#0000000&@60
+@75
+|"+0#0000e05&| |a| |m|e|n|u| |i|t|e|m| |n|a|m|e| |c|a|n@1|o|t| |s|t|a|r|t| |w|i|t|h| |'|.|'| +0#0000000&@34
+@75
+|e+0#af5f00255&|x|p|o|r|t| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|H|i|s|t|o|r|y|J|u|m|p|M|e|n|u|(+0#e000e06&|)| +0#0000000&@46
+@4|p+0#af5f00255&|o|p|u|p|.|F+0#0000000&|i|l|t|e|r|M|e|n|u|(+0#e000e06&|"+0#e000002&|J|u|m|p| |h|i|s|t|o|r|y|"|,+0#0000000&| |d+0#00e0e07&|i|r|_|h|i|s|t|,+0#0000000&| @28
+@8|(+0#e000e06&|r+0#00e0e07&|e|s|,+0#0000000&| |_+0#00e0e07&|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@53
+@12|H|i|s|t|o|r|y|J|u|m|p|(+0#e000e06&|r+0#00e0e07&|e|s|.+0#af5f00255&|t+0#00e0e07&|e|x|t|)+0#e000e06&| +0#0000000&@41
+@8|}+0#e000e06&|)| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|p+0#af5f00255&|o|p|u|p|\+0#e000e06&|.|F|i|l|t|e|r|M|e|n|u|<|T|a|b|>|F|i|l|t|e|r|(|)|<|C|R|>| +0#0000000&@40
+@57|7|3|,|0|-|1| @7|9|8|%| 
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump
@@ -1,20 +1,20 @@
-| +0&#ffffff0@7|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
-@8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@75
-|a+0#af5f00255&|n| +0#0000000&|<+0#e000e06&|s|i|l|e|n|t|>| +0#0000000&|1+0#e000002&|0|.|3@1|0| +0#0000000&|&+0#e000e06&|F|i|l|e|.|&|C|l|o|s|e|<|T|a|b|>|:|c|l|o|s|e| +0#0000000&|:|i|f| |w|i|n|h|e|i|g|h|t|(|2|)| |<| |0| |&@1| |t|a|b|p|a|g|e|w
-|i|n@1|r|(|2|)| |=@1| |0| |<+0#e000e06&|B|a|r|>| +0#0000000&@56
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |e|n|e|w| |<+0#e000e06&|B|a|r|>| +0#0000000&@44
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&|e|l|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@54
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@75
-@75
+| +0&#ffffff0@74
 |"+0#0000e05&| |p|o|p|u|p| |m|e|n|u|s| +0#0000000&@61
 |p+0#af5f00255&|o|p|u|p| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
 |p+0#af5f00255&|o|p|u|p|!| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+@75
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|4|2|3|0| +0#0000000&@60
+@75
+|"+0#0000e05&| |a| |m|e|n|u| |i|t|e|m| |n|a|m|e| |c|a|n@1|o|t| |s|t|a|r|t| |w|i|t|h| |'|.|'| +0#0000000&@34
+@75
+|e+0#af5f00255&|x|p|o|r|t| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|H|i|s|t|o|r|y|J|u|m|p|M|e|n|u|(+0#e000e06&|)| +0#0000000&@46
+@4|p+0#af5f00255&|o|p|u|p|.|F+0#0000000&|i|l|t|e|r|M|e|n|u|(+0#e000e06&|"+0#e000002&|J|u|m|p| |h|i|s|t|o|r|y|"|,+0#0000000&| |d+0#00e0e07&|i|r|_|h|i|s|t|,+0#0000000&| @28
+@8|(+0#e000e06&|r+0#00e0e07&|e|s|,+0#0000000&| |_+0#00e0e07&|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@53
+@12|H|i|s|t|o|r|y|J|u|m|p|(+0#e000e06&|r+0#00e0e07&|e|s|.+0#af5f00255&|t+0#00e0e07&|e|x|t|)+0#e000e06&| +0#0000000&@41
+@8|}+0#e000e06&|)| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|p+0#af5f00255&|o|p|u|p|\+0#e000e06&|.|F|i|l|t|e|r|M|e|n|u|<|T|a|b|>|F|i|l|t|e|r|(|)|<|C|R|>| +0#0000000&@40
 > @74
-@57|7|3|,|0|-|1| @7|B|o|t| 
+@57|8|7|,|0|-|1| @7|B|o|t| 
--- a/runtime/syntax/testdir/input/vim_ex_menu.vim
+++ b/runtime/syntax/testdir/input/vim_ex_menu.vim
@@ -71,3 +71,17 @@ an <silent> 10.330 &File.&Close<Tab>:clo
 popup &Foo  | echo "Foo"
 popup! &Foo | echo "Foo"
 
+
+" Issue #14230
+
+" a menu item name cannot start with '.'
+
+export def HistoryJumpMenu()
+    popup.FilterMenu("Jump history", dir_hist,
+        (res, _) => {
+            HistoryJump(res.text)
+        })
+enddef
+
+popup\.FilterMenu<Tab>Filter()<CR>
+
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -3,7 +3,7 @@
 " Maintainer:	Hirohito Higashi <h.east.727 ATMARK gmail.com>
 " 	Doug Kearns <dougkearns@gmail.com>
 " URL:	https://github.com/vim-jp/syntax-vim-ex
-" Last Change:	2024 Mar 18
+" Last Change:	2024 Mar 19
 " Former Maintainer: Charles E. Campbell
 " Base File URL:     http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
 " Base File Version: 9.0-25
@@ -542,8 +542,8 @@ syn keyword vimMenu am[enu] an[oremenu] 
 syn keyword vimMenu popu[p] skipwhite nextgroup=vimMenuBang,vimMenuName
 syn region	vimMenuRhs	 contained contains=@vimContinue,vimNotation start="|\@!\S"            skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
 syn region	vimMenuRhsContinue contained contains=@vimContinue,vimNotation start=+^\s*\%(\\\|"\\ \)+ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
-syn match	vimMenuName	"\%(\\\s\|\S\)\+"        contained contains=vimMenuNotation,vimNotation skipwhite        nextgroup=vimCmdSep,vimMenuRhs
-syn match	vimMenuName	"\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
+syn match	vimMenuName	"\.\@!\%(\\\s\|\S\)\+"        contained contains=vimMenuNotation,vimNotation skipwhite        nextgroup=vimCmdSep,vimMenuRhs
+syn match	vimMenuName	"\.\@!\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
 syn match	vimMenuNotation	"&\a\|&&\|\\\s\|\\\." contained
 syn match	vimMenuPriority	"\<\d\+\%(\.\d\+\)*\>" contained skipwhite nextgroup=vimMenuName
 syn match	vimMenuMod	"\c<\%(script\|silent\|special\)>" contained skipwhite nextgroup=vimMenuName,vimMenuPriority,vimMenuMod contains=vimMapModKey,vimMapModErr