runtime(vim): Update base-syntax, match continued strings and tail comments
Continued strings are currently only matched after operators, in
parenthesised expressions and in function call argument lists.
closes: #14975
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/input/vim9_comment.vim b/runtime/syntax/testdir/input/vim9_comment.vim
index fd6a5d2..7d22f46 100644
--- a/runtime/syntax/testdir/input/vim9_comment.vim
+++ b/runtime/syntax/testdir/input/vim9_comment.vim
@@ -34,6 +34,10 @@
\ continuing comment
\ continuing comment
+var foo = 42 # commment
+ \ continuing comment
+ \ continuing comment
+
# :Foo
\ arg1
#\ comment
diff --git a/runtime/syntax/testdir/input/vim_comment.vim b/runtime/syntax/testdir/input/vim_comment.vim
index f382f8d..2ca6787 100644
--- a/runtime/syntax/testdir/input/vim_comment.vim
+++ b/runtime/syntax/testdir/input/vim_comment.vim
@@ -31,6 +31,10 @@
\ continuing comment
\ continuing comment
+let foo = 42 " commment
+ \ continuing comment
+ \ continuing comment
+
" :Foo
\ arg1
"\ comment
diff --git a/runtime/syntax/testdir/input/vim_ex_augroup.vim b/runtime/syntax/testdir/input/vim_ex_augroup.vim
index aa13d97..7f7f346 100644
--- a/runtime/syntax/testdir/input/vim_ex_augroup.vim
+++ b/runtime/syntax/testdir/input/vim_ex_augroup.vim
@@ -40,10 +40,17 @@
augroup \"\| | autocmd! | augroup END
augroup! \"\|
-" FIXME: required comment prefix
-augroup foo"comment " start bad fold
+
+augroup foo"comment
+ au!
+ au BufRead * echo "Foo"
+augroup END"comment
+
augroup foo|echo "Foo"
-augroup END " terminate bad fold
+ au!
+ au BufRead * echo "Foo"
+augroup END|echo "Foo"
+
augroup! foo"comment
augroup! foo|echo "Foo"
diff --git a/runtime/syntax/testdir/input/vim_ex_substitute.vim b/runtime/syntax/testdir/input/vim_ex_substitute.vim
index 021060a..7ffd16d 100644
--- a/runtime/syntax/testdir/input/vim_ex_substitute.vim
+++ b/runtime/syntax/testdir/input/vim_ex_substitute.vim
@@ -124,7 +124,6 @@
" Trailing comment and bar
-" FIXME: trailing comment, no whitespace
s" comment
s| echo "Foo"
diff --git a/runtime/syntax/testdir/input/vim_expr.vim b/runtime/syntax/testdir/input/vim_expr.vim
index bb7366d..e58450e 100644
--- a/runtime/syntax/testdir/input/vim_expr.vim
+++ b/runtime/syntax/testdir/input/vim_expr.vim
@@ -4,6 +4,15 @@
echo 'tab: \t, new line: \n, backslash: \\'
echo "tab: \t, new line: \n, backslash: \\"
+" string starts immediately after line continuation character - tests a
+" comment/string distinguishing implementation quirk
+echo "foo"
+ \"bar"
+ \ "baz"
+echo 'foo'
+ \'bar'
+ \ 'baz'
+
" String escape sequences
echo "\316 - \31 - \3 - \x1f - \xf - \X1F - \XF - \u02a4 - \U000002a4 - \b - \e - \f - \n - \r - \t - \\ - \" - \<C-W>"
@@ -21,6 +30,13 @@
echo "\<C->>>"
echo "\<*C->>>"
+echo ""
+echo "\""
+echo "foo\""
+echo "\"foo"
+echo "foo\"bar"
+
+echo ''
echo ''''
echo '''foo'
echo 'foo'''
@@ -30,6 +46,7 @@
" https://github.com/tpope/vim-unimpaired/blob/6d44a6dc2ec34607c41ec78acf81657248580bf1/plugin/unimpaired.vim#L232
let cmd = 'put!=repeat(nr2char(10), v:count1)|silent '']+'
+
" String interpolation
echo 'Don''t highlight interpolation: {{ {1 + 2} }}'
@@ -39,10 +56,61 @@
echo $"Highlight interpolation:\t{{ { string({"foo": "bar"}) } }}"
echo $"Highlight interpolation:\t{{ { $"nested: {{ {1 + 2} }}" } }}"
-echo $''''
-echo $'''foo'
-echo $'foo'''
-echo $'foo''bar'
+
+" Continued string
+
+let s = "
+ "\ comment
+ \ part 1
+ "\ comment
+ \ part 2
+ "\ comment
+ \" " tail comment
+
+let s = "\"
+ \\" part 1 \"
+ "\ escape sequence
+ \ \"part 2\"
+ \\"" " tail comment
+
+let s = '
+ "\ comment
+ \ part 1
+ "\ comment
+ \ part 2
+ "\ comment
+ \' " tail comment
+
+let s = '''
+ \'' part 1 ''
+ "\ escape sequence
+ \ ''part 2''
+ \''' " tail comment
+
+let s = $"
+ "\ comment
+ \ part 1
+ "\ comment
+ \ part 2
+ "\ comment
+ \" " tail comment
+
+let s = $'
+ "\ comment
+ \ part 1
+ "\ comment
+ \ part 2
+ "\ comment
+ \' " tail comment
+
+call strlen("part 1
+ "\ comment
+ \ part 2")
+
+call append(0, "part 1
+ "\ comment
+ \ part 2")
+
" Number
@@ -301,12 +369,17 @@
\ bar +
\ "baz"
+let foo = foo +
+ "\ "comment string"
+ \ bar
+
" Function calls
call Foo(v:true, v:false, v:null)
" Issue #16221 (vimString becomes vimVar when preceded by !)
+
let bar = !'g:bar'->exists()