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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221112231323.F1AC21C0473%40moolenaar.net.