0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2486: Vim9: some errors for white space do not show context

Problem:    Vim9: some errors for white space do not show context.
Solution:   Include the text at the error.
This commit is contained in:
Bram Moolenaar
2021-02-07 18:06:29 +01:00
parent 0123cc1e14
commit ba98fb54ae
7 changed files with 18 additions and 14 deletions

View File

@@ -945,7 +945,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
if (**arg != ':') if (**arg != ':')
{ {
if (*skipwhite(*arg) == ':') if (*skipwhite(*arg) == ':')
semsg(_(e_no_white_space_allowed_before_str), ":"); semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
else else
semsg(_(e_missing_dict_colon), *arg); semsg(_(e_missing_dict_colon), *arg);
clear_tv(&tvkey); clear_tv(&tvkey);
@@ -1025,7 +1025,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
if (!had_comma) if (!had_comma)
{ {
if (**arg == ',') if (**arg == ',')
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
else else
semsg(_(e_missing_dict_comma), *arg); semsg(_(e_missing_dict_comma), *arg);
goto failret; goto failret;

View File

@@ -173,8 +173,8 @@ EXTERN char e_cannot_declare_a_register_str[]
INIT(= N_("E1066: Cannot declare a register: %s")); INIT(= N_("E1066: Cannot declare a register: %s"));
EXTERN char e_separator_mismatch_str[] EXTERN char e_separator_mismatch_str[]
INIT(= N_("E1067: Separator mismatch: %s")); INIT(= N_("E1067: Separator mismatch: %s"));
EXTERN char e_no_white_space_allowed_before_str[] EXTERN char e_no_white_space_allowed_before_str_str[]
INIT(= N_("E1068: No white space allowed before '%s'")); INIT(= N_("E1068: No white space allowed before '%s': %s"));
EXTERN char e_white_space_required_after_str_str[] EXTERN char e_white_space_required_after_str_str[]
INIT(= N_("E1069: White space required after '%s': %s")); INIT(= N_("E1069: White space required after '%s': %s"));
EXTERN char e_missing_from[] EXTERN char e_missing_from[]

View File

@@ -1328,7 +1328,8 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
if (do_error) if (do_error)
{ {
if (**arg == ',') if (**arg == ',')
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str),
",", *arg);
else else
semsg(_("E696: Missing comma in List: %s"), *arg); semsg(_("E696: Missing comma in List: %s"), *arg);
} }

View File

@@ -878,7 +878,7 @@ get_func_tv(
{ {
if (*argp != ',' && *skipwhite(argp) == ',') if (*argp != ',' && *skipwhite(argp) == ',')
{ {
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str), ",", argp);
ret = FAIL; ret = FAIL;
break; break;
} }
@@ -3214,7 +3214,7 @@ define_function(exarg_T *eap, char_u *name_arg)
if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1])) if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1]))
{ {
semsg(_(e_no_white_space_allowed_before_str), "("); semsg(_(e_no_white_space_allowed_before_str_str), "(", p - 1);
goto ret_free; goto ret_free;
} }

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2486,
/**/ /**/
2485, 2485,
/**/ /**/

View File

@@ -2800,7 +2800,7 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount)
if (*p != ',' && *skipwhite(p) == ',') if (*p != ',' && *skipwhite(p) == ',')
{ {
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
p = skipwhite(p); p = skipwhite(p);
} }
if (*p == ',') if (*p == ',')
@@ -3055,7 +3055,7 @@ compile_list(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
} }
if (*p == ',') if (*p == ',')
{ {
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
return FAIL; return FAIL;
} }
if (*p == ']') if (*p == ']')
@@ -3234,7 +3234,7 @@ compile_dict(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
if (**arg != ':') if (**arg != ':')
{ {
if (*skipwhite(*arg) == ':') if (*skipwhite(*arg) == ':')
semsg(_(e_no_white_space_allowed_before_str), ":"); semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
else else
semsg(_(e_missing_dict_colon), *arg); semsg(_(e_missing_dict_colon), *arg);
return FAIL; return FAIL;
@@ -3273,7 +3273,7 @@ compile_dict(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
} }
if (IS_WHITE_OR_NUL(*whitep)) if (IS_WHITE_OR_NUL(*whitep))
{ {
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str), ",", whitep);
return FAIL; return FAIL;
} }
whitep = *arg + 1; whitep = *arg + 1;
@@ -4270,7 +4270,7 @@ compile_expr7t(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
if (**arg != '>') if (**arg != '>')
{ {
if (*skipwhite(*arg) == '>') if (*skipwhite(*arg) == '>')
semsg(_(e_no_white_space_allowed_before_str), ">"); semsg(_(e_no_white_space_allowed_before_str_str), ">", *arg);
else else
emsg(_(e_missing_gt)); emsg(_(e_missing_gt));
return FAIL; return FAIL;

View File

@@ -638,7 +638,7 @@ parse_type_member(
if (give_error) if (give_error)
{ {
if (*skipwhite(*arg) == '<') if (*skipwhite(*arg) == '<')
semsg(_(e_no_white_space_allowed_before_str), "<"); semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg);
else else
emsg(_(e_missing_type)); emsg(_(e_missing_type));
} }
@@ -779,7 +779,8 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error)
if (*p != ',' && *skipwhite(p) == ',') if (*p != ',' && *skipwhite(p) == ',')
{ {
if (give_error) if (give_error)
semsg(_(e_no_white_space_allowed_before_str), ","); semsg(_(e_no_white_space_allowed_before_str_str),
",", p);
return NULL; return NULL;
} }
if (*p == ',') if (*p == ',')