Patch 9.0.0869

5 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 12, 2022, 6:13:36 PM11/12/22
to vim...@googlegroups.com

Patch 9.0.0869
Problem: Bogus error when string used after :elseif.
Solution: Do not consider a double quote the start of a comment.
(closes #11534)
Files: src/ex_eval.c, src/testdir/test_vimscript.vim


*** ../vim-9.0.0868/src/ex_eval.c 2022-10-01 19:43:48.606494048 +0100
--- src/ex_eval.c 2022-11-12 23:06:03.516816495 +0000
***************
*** 1173,1179 ****
{
// When skipping we ignore most errors, but a missing expression is
// wrong, perhaps it should have been "else".
! if (skip && ends_excmd(*eap->arg))
semsg(_(e_invalid_expression_str), eap->arg);
else
result = eval_to_bool(eap->arg, &error, eap, skip, FALSE);
--- 1173,1180 ----
{
// When skipping we ignore most errors, but a missing expression is
// wrong, perhaps it should have been "else".
! // A double quote here is the start of a string, not a comment.
! if (skip && *eap->arg != '"' && ends_excmd(*eap->arg))
semsg(_(e_invalid_expression_str), eap->arg);
else
result = eval_to_bool(eap->arg, &error, eap, skip, FALSE);
*** ../vim-9.0.0868/src/testdir/test_vimscript.vim 2022-11-02 13:30:37.546314580 +0000
--- src/testdir/test_vimscript.vim 2022-11-12 23:04:55.952792079 +0000
***************
*** 192,197 ****
--- 192,207 ----
call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath)
endfunc

+ " Check double quote after skipped "elseif" does not give error E15
+ func Test_skipped_elseif()
+ if "foo" ==? "foo"
+ let result = "first"
+ elseif "foo" ==? "foo"
+ let result = "second"
+ endif
+ call assert_equal('first', result)
+ endfunc
+
"-------------------------------------------------------------------------------
" Test 4: :return {{{1
"-------------------------------------------------------------------------------
*** ../vim-9.0.0868/src/version.c 2022-11-12 18:45:59.818782978 +0000
--- src/version.c 2022-11-12 23:01:47.736727143 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 869,
/**/

--
hundred-and-one symptoms of being an internet addict:
51. You put a pillow case over your laptop so your lover doesn't see it while
you are pretending to catch your breath.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages