1
0
forked from aniani/vim

patch 8.2.2250: Vim9: sublist is ambiguous

Problem:    Vim9: sublist is ambiguous.
Solution:   Require white space around the colon. (closes #7409)
This commit is contained in:
Bram Moolenaar
2020-12-30 20:39:21 +01:00
parent 2a5c61a019
commit de4f95b041
5 changed files with 111 additions and 72 deletions

View File

@@ -3695,19 +3695,33 @@ compile_subscript(
if (may_get_next_line_error(p, arg, cctx) == FAIL)
return FAIL;
if (**arg == ':')
{
// missing first index is equal to zero
generate_PUSHNR(cctx, 0);
}
else
{
if (compile_expr0(arg, cctx) == FAIL)
return FAIL;
if (**arg == ':')
{
semsg(_(e_white_space_required_before_and_after_str), ":");
return FAIL;
}
if (may_get_next_line_error(p, arg, cctx) == FAIL)
return FAIL;
*arg = skipwhite(*arg);
}
if (**arg == ':')
{
*arg = skipwhite(*arg + 1);
is_slice = TRUE;
++*arg;
if (!IS_WHITE_OR_NUL(**arg) && **arg != ']')
{
semsg(_(e_white_space_required_before_and_after_str), ":");
return FAIL;
}
*arg = skipwhite(*arg);
if (may_get_next_line_error(p, arg, cctx) == FAIL)
return FAIL;
if (**arg == ']')
@@ -3721,7 +3735,6 @@ compile_subscript(
return FAIL;
*arg = skipwhite(*arg);
}
is_slice = TRUE;
}
if (**arg != ']')