vim-patch:9.0.0869: bogus error when string used after :elseif

Problem:    Bogus error when string used after :elseif.
Solution:   Do not consider a double quote the start of a comment.
            (closes vim/vim#11534)

28c56d5013

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-11-13 07:24:44 +08:00
parent bc1dbebe1f
commit b251972580
2 changed files with 12 additions and 1 deletions

View File

@@ -901,7 +901,8 @@ void ex_else(exarg_T *eap)
bool error;
// When skipping we ignore most errors, but a missing expression is
// wrong, perhaps it should have been "else".
if (skip && ends_excmd(*eap->arg)) {
// A double quote here is the start of a string, not a comment.
if (skip && *eap->arg != '"' && ends_excmd(*eap->arg)) {
semsg(_(e_invexpr2), eap->arg);
} else {
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);