runtime(vim): Update base-syntax, match shebang lines (#15011)

Commit: 
https://github.com/vim/vim/commit/ae321b51f7531b23545d64c3a98ed991a31dd5ee
Author: dkearns <dougkea...@gmail.com>
Date:   Sat Jun 15 23:06:17 2024 +1000

    runtime(vim): Update base-syntax, match shebang lines 
(https://github.com/vim/vim/issues/15011)
    
    Match shebang lines in Vim9 and legacy script.
    
    Mark these as an error if they appear anywhere other than the first line
    of a legacy-script file.  In Vim9 script these match as normal line
    comments rather than an error.
    
    Signed-off-by: Doug Kearns <dougkea...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/generator/vim.vim.base 
b/runtime/syntax/generator/vim.vim.base
index b1d963e7a..05beac8dc 100644
--- 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 <dougkea...@gmail.com>
 " URL:    https://github.com/vim-jp/syntax-vim-ex
-" Last Change:    2024 Jun 14
+" Last Change:    2024 Jun 15
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -834,6 +834,12 @@ endif
 syn match      vimCommentTitle 
'"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1    contained 
contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
 syn match      vim9CommentTitle        
'#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1    contained 
contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
 
+" allowed anywhere in the file
+if !s:vim9script
+  syn match    vimShebangError "^\s*\zs#!.*" display
+endif
+syn match      vimShebang      "\%^#!.*" display
+
 syn match      vimContinue             "^\s*\zs\"
 syn match         vimContinueComment   '^\s*\zs["#]\ .*'
 syn cluster    vimContinue contains=vimContinue,vimContinueComment
@@ -1060,6 +1066,7 @@ if !exists("skip_vim_syntax_inits")
   hi def link vimHiCtermError  vimError
   hi def link vimHiKeyError    vimError
   hi def link vimMapModErr     vimError
+  hi def link vimShebangError  vimError
   hi def link vimSubstFlagErr  vimError
   hi def link vimSynCaseError  vimError
   hi def link vimSynFoldMethodError    vimError
@@ -1198,6 +1205,7 @@ if !exists("skip_vim_syntax_inits")
  hi def link vimSetSep Statement
  hi def link vimSetString      vimString
  hi def link vim9Vim9Script    vimCommand
+ hi def link vimShebang        PreProc
  hi def link vimSleep  vimCommand
  hi def link vimSleepArg       Constant
  hi def link vimSleepBang      vimBang
diff --git a/runtime/syntax/testdir/dumps/vim9_shebang_00.dump 
b/runtime/syntax/testdir/dumps/vim9_shebang_00.dump
new file mode 100644
index 000000000..3f2818c8e
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_shebang_00.dump
@@ -0,0 +1,20 @@
+>#+0#e000e06#ffffff0|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+|v+0#af5f00255&|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |s|h|e|b|a|n|g| |l|i|n|e| +0#0000000&@56
+@75
+|#+0#0000e05&| |j|u|s|t| |a| |l|i|n|e| |c|o|m@1|e|n|t| +0#0000000&@53
+|#+0#0000e05&|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/dumps/vim9_shebang_99.dump 
b/runtime/syntax/testdir/dumps/vim9_shebang_99.dump
new file mode 100644
index 000000000..71f543e9b
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_shebang_99.dump
@@ -0,0 +1,20 @@
+|#+0#e000e06#ffffff0|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+|v+0#af5f00255&|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |s|h|e|b|a|n|g| |l|i|n|e| +0#0000000&@56
+@75
+|#+0#0000e05&| |j|u|s|t| |a| |l|i|n|e| |c|o|m@1|e|n|t| +0#0000000&@53
+>#+0#0000e05&|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|7|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/dumps/vim_shebang_00.dump 
b/runtime/syntax/testdir/dumps/vim_shebang_00.dump
new file mode 100644
index 000000000..c79da4422
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_shebang_00.dump
@@ -0,0 +1,20 @@
+>#+0#e000e06#ffffff0|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+@75
+|"+0#0000e05&| |V|i|m| |s|h|e|b|a|n|g| |l|i|n|e| +0#0000000&@56
+@75
+|#+0#ffffff16#ff404010|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| 
+0#0000000#ffffff0@53
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/dumps/vim_shebang_99.dump 
b/runtime/syntax/testdir/dumps/vim_shebang_99.dump
new file mode 100644
index 000000000..010241252
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_shebang_99.dump
@@ -0,0 +1,20 @@
+|#+0#e000e06#ffffff0|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| +0#0000000&@53
+@75
+|"+0#0000e05&| |V|i|m| |s|h|e|b|a|n|g| |l|i|n|e| +0#0000000&@56
+@75
+>#+0#ffffff16#ff404010|!|/|u|s|r|/|b|i|n|/|e|n|v| |v|i|m| |-|S| 
+0#0000000#ffffff0@53
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|5|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/input/vim9_shebang.vim 
b/runtime/syntax/testdir/input/vim9_shebang.vim
new file mode 100755
index 000000000..c012fd9fc
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_shebang.vim
@@ -0,0 +1,7 @@
+#!/usr/bin/env vim -S
+vim9script
+
+# Vim shebang line
+
+# just a line comment
+#!/usr/bin/env vim -S
diff --git a/runtime/syntax/testdir/input/vim_shebang.vim 
b/runtime/syntax/testdir/input/vim_shebang.vim
new file mode 100755
index 000000000..47a550cf5
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_shebang.vim
@@ -0,0 +1,5 @@
+#!/usr/bin/env vim -S
+
+" Vim shebang line
+
+#!/usr/bin/env vim -S
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 17283a9fc..033251f63 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -879,6 +879,12 @@ endif
 syn match      vimCommentTitle 
'"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1    contained 
contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
 syn match      vim9CommentTitle        
'#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1    contained 
contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
 
+" allowed anywhere in the file
+if !s:vim9script
+  syn match    vimShebangError "^\s*\zs#!.*" display
+endif
+syn match      vimShebang      "\%^#!.*" display
+
 syn match      vimContinue             "^\s*\zs\"
 syn match         vimContinueComment   '^\s*\zs["#]\ .*'
 syn cluster    vimContinue contains=vimContinue,vimContinueComment
@@ -1105,6 +1111,7 @@ if !exists("skip_vim_syntax_inits")
   hi def link vimHiCtermError  vimError
   hi def link vimHiKeyError    vimError
   hi def link vimMapModErr     vimError
+  hi def link vimShebangError  vimError
   hi def link vimSubstFlagErr  vimError
   hi def link vimSynCaseError  vimError
   hi def link vimSynFoldMethodError    vimError
@@ -1243,6 +1250,7 @@ if !exists("skip_vim_syntax_inits")
  hi def link vimSetSep Statement
  hi def link vimSetString      vimString
  hi def link vim9Vim9Script    vimCommand
+ hi def link vimShebang        PreProc
  hi def link vimSleep  vimCommand
  hi def link vimSleepArg       Constant
  hi def link vimSleepBang      vimBang

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sITFJ-00EU8A-5u%40256bit.org.

Raspunde prin e-mail lui