Commit: runtime(vim): Update base-syntax, improve :let-heredoc highlighting

2 views
Skip to first unread message

Christian Brabandt

unread,
Aug 16, 2024, 3:15:21 PM8/16/24
to vim...@googlegroups.com
runtime(vim): Update base-syntax, improve :let-heredoc highlighting

Commit: https://github.com/vim/vim/commit/d164f2a521f8e52e587727657fb1c19e9a25f32a
Author: Doug Kearns <dougk...@gmail.com>
Date: Fri Aug 16 21:07:15 2024 +0200

runtime(vim): Update base-syntax, improve :let-heredoc highlighting

The end marker must appear on line of its own without any trailing
whitespace.

Whitespace is incorrectly allowed before all end markers. Limiting this
only to heredocs where "trim" was specified, and with the correct
indent, is currently an intractable problem given that contained syntax
groups (in this case :let) cannot be limited to start patterns.

Highlight interpolated expressions when "eval" is specified.

cloess: #15511

Signed-off-by: Doug Kearns <dougk...@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 4666d7158..883056bf3 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 <dougk...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Jul 18
+" Last Change: 2024 Aug 16
" Former Maintainer: Charles E. Campbell

" DO NOT CHANGE DIRECTLY.
@@ -525,7 +525,13 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
syn region vimUnletVars contained start="$\I\|\h" skip="
\s*\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber

-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend
+" Note: This incorrectly matches end markers with leading whitespace even if
+" "trim" was not specified. Matching :let indent for "trim" indented
+" end markers would require a contained :let that cannot be restricted
+" to the start pattern. A common internal testing use of heredocs is to
+" specify code blocks where :let commonly appears in the heredoc text.
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=eval\s\+\|eval\s\+\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' contains=vimStringInterpolationExpr,vimStringInterpolationBrace extend

Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList
Vim9 syn keyword vim9Final final skipwhite nextgroup=vim9Variable,vim9VariableList
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
index 5511d0dd7..88ca3558d 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
@@ -17,4 +17,4 @@
@75
|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@74
-@57|1|4|3|,|0|-|1| @6|7|3|%|
+@57|1|4|3|,|0|-|1| @6|7|4|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
index 8925be9f8..a2f73a0de 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
@@ -14,7 +14,7 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@74
-|++0#0000e05#a8a8a8255|-@1| @1|6| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@56|1|8|0|,|1| @8|9|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
index 393afe7e9..7a93653cc 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
@@ -17,4 +17,4 @@
|~| @73
|~| @73
|~| @73
-| +0#0000000&@56|2@1|0|,|0|-|1| @6|B|o|t|
+| +0#0000000&@56|2|1|9|,|0|-|1| @6|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump
new file mode 100644
index 000000000..2e3d0e658
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>"+0&#ffffff0| |V|i|m| |:|l|e|t| |h|e|r|e|d|o|c| |c|o|m@1|a|n|d| +0#0000000&@46
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|h|"| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| |f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|1| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@55
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|1| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|1| +0#0000000&@65
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|2| +0#0000000&@65
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump
new file mode 100644
index 000000000..6e38ae755
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|1| +0#0000000&@65
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|2| +0#0000000&@65
+||+0#0000e05#a8a8a8255| >E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|1| +0#0000000&@63
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|2| +0#0000000&@63
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |i|n|t|e|r|p|o|l|a|t|i|o|n| +0#0000000&@57
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+@57|1|9|,|1| @9|1|3|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump
new file mode 100644
index 000000000..3613d1005
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@61
+||+0#0000e05#a8a8a8255| >E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@47
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@45
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |n|o| |i|n|t|e|r|p|o|l|a|t|i|o|n| |(|e|s|c|a|p|e|d| |{| |a|n|d| |}|)| +0#0000000&@36
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|3|7|,|1| @9|3|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump
new file mode 100644
index 000000000..de3f8feb3
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@47
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@57
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@45
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@55
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@55
+@57|5@1|,|0|-|1| @7|5|0|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump
new file mode 100644
index 000000000..c6d1b4d05
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@55
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |n|o| |i|n|t|e|r|p|o|l|a|t|i|o|n| +0#0000000&@54
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |0|}| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |1|}| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@55
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |0|}| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |1|}| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |0|}| +0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |1|}| +0#0000000&@59
+@57|7|3|,|0|-|1| @7|6|9|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump
new file mode 100644
index 000000000..e66d1ccc7
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |1|}| +0#0000000&@59
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{|1| |+| |0|}| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3>l|i|n|e|{|1| |+| |1|}| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|n|d| |m|a|r|k|e|r| |m|u|s|t| |n|o|t| |b|e| |f|o|l@1|o|w|e|d| |b|y| |w|h|i|t|e|s|p|a|c|e| +0#0000000&@25
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
+||+0#0000e05#a8a8a8255| |E+0#e000002#ffffff0|N|D| | +0#0000000&@68
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"| |E|N|D| |"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0|E|N|D| | +0#0000000&@67
+@57|9|1|,|5| @9|8|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump
new file mode 100644
index 000000000..e3c4ca465
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0|E|N|D| | +0#0000000&@67
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1>E|N|D| | +0#0000000&@66
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|E|N|D| | +0#0000000&@64
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|0|9|,|3| @8|B|o|t|
diff --git a/runtime/syntax/testdir/input/vim_ex_def_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
index d85f27352..60b115170 100644
--- a/runtime/syntax/testdir/input/vim_ex_def_fold.vim
+++ b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
@@ -120,7 +120,7 @@ def Foo()
enddef

def Foo()
- let x =<< END
+ var x =<< trim END
endfunction
END
enddef
diff --git a/runtime/syntax/testdir/input/vim_ex_function_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_fold.vim
index dd260ca45..fa7edbb7c 100644
--- a/runtime/syntax/testdir/input/vim_ex_function_fold.vim
+++ b/runtime/syntax/testdir/input/vim_ex_function_fold.vim
@@ -193,10 +193,9 @@ function Foo()
endfunction

function Foo()
- let x =<< END
+ let x =<< trim END
endfunction
END
-
endfunction

function Foo()
diff --git a/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim
new file mode 100644
index 000000000..da9adff65
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim
@@ -0,0 +1,116 @@
+" Vim :let heredoc command
+" VIM_TEST_SETUP let g:vimsyn_folding = "h"
+" VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+
+
+let foo =<< END
+line1
+line2
+END
+
+ let foo =<< END
+line1
+line2
+END
+
+let foo =<< trim END
+ line1
+ line2
+END
+
+ let foo =<< trim END
+ line1
+ line2
+ END
+
+
+" interpolation
+
+let foo =<< eval END
+line{1 + 0}
+line{1 + 1}
+END
+
+ let foo =<< eval END
+line{1 + 0}
+line{1 + 1}
+END
+
+let foo =<< trim eval END
+ line{1 + 0}
+ line{1 + 1}
+END
+
+ let foo =<< trim eval END
+ line{1 + 0}
+ line{1 + 1}
+ END
+
+" no interpolation (escaped { and })
+
+let foo =<< eval END
+line{{1 + 0}}
+line{{1 + 1}}
+END
+
+ let foo =<< eval END
+line{{1 + 0}}
+line{{1 + 1}}
+END
+
+let foo =<< trim eval END
+ line{{1 + 0}}
+ line{{1 + 1}}
+END
+
+ let foo =<< trim eval END
+ line{{1 + 0}}
+ line{{1 + 1}}
+ END
+
+
+" no interpolation
+
+let foo =<< END
+line{1 + 0}
+line{1 + 1}
+END
+
+ let foo =<< END
+line{1 + 0}
+line{1 + 1}
+END
+
+let foo =<< trim END
+ line{1 + 0}
+ line{1 + 1}
+END
+
+ let foo =<< trim END
+ line{1 + 0}
+ line{1 + 1}
+ END
+
+
+" end marker must not be followed by whitespace
+
+" assert_equal(foo, ["END "])
+let foo =<< END
+END
+END
+
+" assert_equal(foo, [" END "])
+let foo =<< END
+ END
+END
+
+" assert_equal(foo, ["END "])
+let foo =<< trim END
+ END
+END
+
+" assert_equal(foo, ["END "])
+ let foo =<< trim END
+ END
+ END
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 8492463f5..441f74f8b 100644
--- 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 <dougk...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Jul 23
+" Last Change: 2024 Aug 16
" Former Maintainer: Charles E. Campbell

" DO NOT CHANGE DIRECTLY.
@@ -480,11 +480,12 @@ syn match vimEscape contained "\\o\{1,3}\|\[xX]\x\{1,2}\|\u\x\{1,4}\|\U\x\{1
syn match vimEscape contained "\<" contains=vimNotation
syn match vimEscape contained "\<\*[^>]*>\=>"

-syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr
-syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr
+syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=@vimStringInterpolation
+syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,@vimStringInterpolation
syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList
syn match vimStringInterpolationBrace contained "{{"
syn match vimStringInterpolationBrace contained "}}"
+syn cluster vimStringInterpolation contains=vimStringInterpolationExpr,vimStringInterpolationBrace

" Substitutions: {{{2
" =============
@@ -564,7 +565,13 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
syn region vimUnletVars contained start="$\I\|\h" skip="
\s*\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber

-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend
+" Note: This incorrectly matches end markers with leading whitespace even if
+" "trim" was not specified. Matching :let indent for "trim" indented
+" end markers would require a contained :let that cannot be restricted
+" to the start pattern. A common internal testing use of heredocs is to
+" specify code blocks where :let commonly appears in the heredoc text.
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(\%(trim\s\+\)\=eval\s\+\|eval\s\+\%(trim\s\+\)\=\)\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' contains=@vimStringInterpolation extend

Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList
Vim9 syn keyword vim9Final final skipwhite nextgroup=vim9Variable,vim9VariableList

Christian Brabandt

unread,
Aug 23, 2024, 12:15:20 PM8/23/24
to vim...@googlegroups.com
runtime(vim): Update base-syntax, improve :let-heredoc highlighting

Commit: https://github.com/vim/vim/commit/7884cc74188caea6e42b1456ed90c8a7189dda7c
Author: Doug Kearns <dougk...@gmail.com>
Date: Fri Aug 23 18:01:35 2024 +0200

runtime(vim): Update base-syntax, improve :let-heredoc highlighting

The end marker is not required to match the indent of :let when "trim"
is specified, it may also appear without leading whitespace as normal.

closes: #15564

Signed-off-by: Doug Kearns <dougk...@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 169fe20f6..4c91df416 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 <dougk...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Aug 21
+" Last Change: 2024 Aug 23
" Former Maintainer: Charles E. Campbell

" DO NOT CHANGE DIRECTLY.
@@ -526,9 +526,9 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
syn region vimUnletVars contained start="$\I\|\h" skip="
\s*\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber

-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*trim\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\z2$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*trim\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' extend
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\%(\s*\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' extend
-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*\%(trim\s\+eval\|eval\s\+trim\)\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\z2$' contains=@vimStringInterpolation extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*\%(trim\s\+eval\|eval\s\+trim\)\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' contains=@vimStringInterpolation extend
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*eval\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' contains=@vimStringInterpolation extend

Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump
index 2e3d0e658..d7bfb6b15 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_00.dump
@@ -13,8 +13,8 @@
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |t|r|i|m| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|1| +0#0000000&@65
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|2| +0#0000000&@65
-||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump
index 6e38ae755..623dc27aa 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_01.dump
@@ -1,9 +1,12 @@
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |t|r|i|m| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| >l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|1| +0#0000000&@65
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|2| +0#0000000&@65
-||+0#0000e05#a8a8a8255| >E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|1| +0#0000000&@63
@@ -14,7 +17,4 @@
| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |i|n|t|e|r|p|o|l|a|t|i|o|n| +0#0000000&@57
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@52
-||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@61
-||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@61
-||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
-@57|1|9|,|1| @9|1|3|%|
+@57|1|9|,|1| @10|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump
index 3613d1005..913566685 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_02.dump
@@ -1,9 +1,12 @@
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@61
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@61
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@50
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1>l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@50
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@61
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@61
-||+0#0000e05#a8a8a8255| >E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@47
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@59
@@ -14,7 +17,4 @@
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|}+0#e000e06&| +0#0000000&@57
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|1+0#e000002&|}+0#e000e06&| +0#0000000&@57
||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
-| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |n|o| |i|n|t|e|r|p|o|l|a|t|i|o|n| |(|e|s|c|a|p|e|d| |{| |a|n|d| |}|)| +0#0000000&@36
-| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-@57|3|7|,|1| @9|3|1|%|
+@57|3|7|,|3| @9|1|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump
index de3f8feb3..4bd285758 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_03.dump
@@ -1,9 +1,12 @@
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |n|o| |i|n|t|e|r|p|o|l|a|t|i|o|n| |(|e|s|c|a|p|e|d| |{| |a|n|d| |}|)| +0#0000000&@36
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@52
-||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@59
+||+0#0000e05#a8a8a8255| >l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@59
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@59
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
-| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |e|v|a|l| |E|N|D| +0#0000000&@50
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@59
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@59
@@ -14,7 +17,4 @@
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@57
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@45
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@55
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@55
-@57|5@1|,|0|-|1| @7|5|0|%|
+@57|5@1|,|1| @9|2|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump
index c6d1b4d05..b763e642f 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_04.dump
@@ -1,9 +1,12 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |e|v|a|l| |E|N|D| +0#0000000&@45
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |0|}+0#e000e06&@1| +0#0000000&@55
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{+0#e000e06&@1|1+0#e000002&| |+| |1|}+0#e000e06&@1| +0#0000000&@55
||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
-| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |n|o| |i|n|t|e|r|p|o|l|a|t|i|o|n| +0#0000000&@54
-| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |0|}| +0#0000000&@61
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |1|}| +0#0000000&@61
@@ -14,7 +17,4 @@
||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|{|1| |+| |1|}| +0#0000000&@61
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |0|}| +0#0000000&@59
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |1|}| +0#0000000&@59
-@57|7|3|,|0|-|1| @7|6|9|%|
+@57|7|3|,|0|-|1| @7|3|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump
index e66d1ccc7..e7b8a550a 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_05.dump
@@ -1,9 +1,12 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |0|}| +0#0000000&@59
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|l|i|n|e|{|1| |+| |1|}| +0#0000000&@59
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
-| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{|1| |+| |0|}| +0#0000000&@57
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3>l|i|n|e|{|1| |+| |1|}| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|l|i|n|e|{|1| |+| |1|}| +0#0000000&@57
||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
@@ -14,7 +17,4 @@
||+0#0000e05#a8a8a8255| |E+0#e000002#ffffff0|N|D| | +0#0000000&@68
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"| |E|N|D| |"|]|)| +0#0000000&@42
-|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0|E|N|D| | +0#0000000&@67
-@57|9|1|,|5| @9|8|7|%|
+@57|9|1|,|0|-|1| @7|4|8|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump
index e3c4ca465..6ed3eb501 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_06.dump
@@ -1,9 +1,12 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"| |E|N|D| |"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |E|N|D| +0#0000000&@57
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0|E|N|D| | +0#0000000&@67
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
-| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
-||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1>E|N|D| | +0#0000000&@66
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1|E|N|D| | +0#0000000&@66
||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
@@ -11,10 +14,7 @@
||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|E|N|D| | +0#0000000&@64
||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-| +0#0000000&@56|1|0|9|,|3| @8|B|o|t|
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|n|d| |m|a|r|k|e|r| |m|u|s|t| |b|e| |v|e|r|t|i|c|a|l@1|y| |a|l|i|g|n|e|d| |w|i|t|h| |:|l|e|t| |(|i|f| |p|r|e|c|e|d|e|d| |b|y| |w|h|i|t|e|s|p
+| +0&#a8a8a8255@1|a+0&#ffffff0|c|e|)| +0#0000000&@68
+@57|1|0|9|,|0|-|1| @6|5|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_07.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_07.dump
new file mode 100644
index 000000000..85bb2f327
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_07.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|n|d| |m|a|r|k|e|r| |m|u|s|t| |b|e| |v|e|r|t|i|c|a|l@1|y| |a|l|i|g|n|e|d| |w|i|t|h| |:|l|e|t| |(|i|f| |p|r|e|c|e|d|e|d| |b|y| |w|h|i|t|e|s|p
+| +0&#a8a8a8255@1|a+0&#ffffff0|c|e|)| +0#0000000&@68
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@44
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@1>E|N|D| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|E|N|D| +0#0000000&@65
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@43
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@52
+||+0#0000e05#a8a8a8255| |E+0#e000002#ffffff0|N|D| | +0#0000000&@68
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+@57|1|2|5|,|3| @8|6|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_08.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_08.dump
new file mode 100644
index 000000000..16149fede
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_08.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|E|N|D| +0#0000000&@65
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1>"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@41
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@3|E|N|D| | +0#0000000&@64
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@4|E|N|D| +0#0000000&@64
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@41
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@4|E|N|D| | +0#0000000&@63
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+@57|1|4|3|,|3| @8|7@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_09.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_09.dump
new file mode 100644
index 000000000..fbb7d9df9
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_09.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#e000e06#ffffff0@1|E|N|D| +0#0000000&@67
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D| |"|]|)| +0#0000000&@41
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| |E+0#e000002#ffffff0|N|D| | +0#0000000&@68
+||+0#0000e05#a8a8a8255| >E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0|E|N|D| +0#0000000&@68
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|"+0#0000e05&| |a|s@1|e|r|t|_|e|q|u|a|l|(|f|o@1|,| |[|"|E|N|D|"|]|)| +0#0000000&@42
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |t|r|i|m| |E|N|D| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | +0#e000002#ffffff0@2|E|N|D| +0#0000000&@66
+||+0#0000e05#a8a8a8255| |E+0#e000e06#ffffff0|N|D| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|n|d| |m|a|r|k|e|r|s| +0#0000000&@59
+@57|1|6|1|,|1| @8|8|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_10.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_10.dump
new file mode 100644
index 000000000..93db58763
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_10.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|n|d| |m|a|r|k|e|r|s| +0#0000000&@59
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |!|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@48
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|1| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
+||+0#0000e05#a8a8a8255| >!+0#e000e06#ffffff0|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@60
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |0|!|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@47
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|1| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |0+0#e000e06#ffffff0|!|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@59
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#e000e06&|<@1| |A|!|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@47
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|1| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |l+0#e000002#ffffff0|i|n|e|2| +0#0000000&@67
+||+0#0000e05#a8a8a8255| |A+0#e000e06#ffffff0|!|@|#|$|%|^|&|*|(|)|_|+| +0#0000000&@59
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|"+0&#ffffff0| |e|r@1|o|r| |-| |l|e|a|d|i|n|g| |l|o|w|e|r|c|a|s|e| |c|h|a|r|a|c|t|e|r| +0#0000000&@35
+| +0#0000e05#a8a8a8255@1|l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&|<@1| +0#0000000&|a+0#af5f00255&|!|@+0#0000000&|#|$|%+0#af5f00255&|^+0#0000000&|&|*+0#af5f00255&|(+0#e000e06&|)|_+0#0000000&|++0#af5f00255&| +0#0000000&@47
+@57|1|7|9|,|1| @8|9|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_11.dump b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_11.dump
new file mode 100644
index 000000000..f63b3b60c
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_let_heredoc_11.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|l+0#af5f00255#ffffff0|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&|<@1| +0#0000000&|a+0#af5f00255&|!|@+0#0000000&|#|$|%+0#af5f00255&|^+0#0000000&|&|*+0#af5f00255&|(+0#e000e06&|)|_+0#0000000&|++0#af5f00255&| +0#0000000&@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e|1| @67
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e|2| @67
+| +0#0000e05#a8a8a8255@1|a+0#af5f00255#ffffff0|!|@+0#0000000&|#|$|%+0#af5f00255&|^+0#0000000&|&|*+0#af5f00255&|(+0#e000e06&|)|_+0#0000000&|++0#af5f00255&| +0#0000000&@59
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|6|,|0|-|1| @6|B|o|t|
diff --git a/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim
index da9adff65..2f88f938e 100644
--- a/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim
+++ b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim
@@ -13,6 +13,9 @@ line1
line2
END

+
+" trim
+
let foo =<< trim END
line1
line2
@@ -114,3 +117,80 @@ END
END
END

+
+" end marker must be vertically aligned with :let (if preceded by whitespace)
+
+" assert_equal(foo, ["END"])
+let foo =<< trim END
+ END
+END
+
+ " assert_equal(foo, ["END"])
+ let foo =<< trim END
+ END
+ END
+
+" assert_equal(foo, ["END "])
+let foo =<< trim END
+END
+END
+
+ " assert_equal(foo, ["END"])
+ let foo =<< trim END
+ END
+ END
+
+ " assert_equal(foo, ["END "])
+ let foo =<< trim END
+ END
+ END
+
+ " assert_equal(foo, ["END"])
+ let foo =<< trim END
+ END
+ END
+
+ " assert_equal(foo, ["END "])
+ let foo =<< trim END
+ END
+ END
+
+ " assert_equal(foo, ["END "])
+ let foo =<< trim END
+END
+END
+
+ " assert_equal(foo, ["END"])
+ let foo =<< trim END
+ END
+END
+
+ " assert_equal(foo, ["END"])
+ let foo =<< trim END
+ END
+END
+
+
+" end markers
+
+let foo =<< !@#$%^&*()_+
+line1
+line2
+!@#$%^&*()_+
+
+let foo =<< 0!@#$%^&*()_+
+line1
+line2
+0!@#$%^&*()_+
+
+let foo =<< A!@#$%^&*()_+
+line1
+line2
+A!@#$%^&*()_+
+
+" error - leading lowercase character
+let foo =<< a!@#$%^&*()_+
+line1
+line2
+a!@#$%^&*()_+
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 1ae39cf33..323aa7c59 100644
--- 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 <dougk...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Aug 21
+" Last Change: 2024 Aug 23
" Former Maintainer: Charles E. Campbell

" DO NOT CHANGE DIRECTLY.
@@ -565,9 +565,9 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
syn region vimUnletVars contained start="$\I\|\h" skip="
\s*\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber

-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*trim\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\z2$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*trim\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' extend
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\%(\s*\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' extend
-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*\%(trim\s\+eval\|eval\s\+trim\)\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\z2$' contains=@vimStringInterpolation extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*\%(trim\s\+eval\|eval\s\+trim\)\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' contains=@vimStringInterpolation extend
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*eval\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' contains=@vimStringInterpolation extend
Reply all
Reply to author
Forward
0 new messages