changeset 23888:d95403445b6b v8.2.2486

patch 8.2.2486: Vim9: some errors for white space do not show context Commit: https://github.com/vim/vim/commit/ba98fb54aefada4c36390add4c7dd90b93e7e5bb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 7 18:06:29 2021 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Feb 2021 18:15:05 +0100
parents ee748fa7dcf5
children fd2c08bdaa2a
files src/dict.c src/errors.h src/list.c src/userfunc.c src/version.c src/vim9compile.c src/vim9type.c
diffstat 7 files changed, 18 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -945,7 +945,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	if (**arg != ':')
 	{
 	    if (*skipwhite(*arg) == ':')
-		semsg(_(e_no_white_space_allowed_before_str), ":");
+		semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
 	    else
 		semsg(_(e_missing_dict_colon), *arg);
 	    clear_tv(&tvkey);
@@ -1025,7 +1025,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	if (!had_comma)
 	{
 	    if (**arg == ',')
-		semsg(_(e_no_white_space_allowed_before_str), ",");
+		semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
 	    else
 		semsg(_(e_missing_dict_comma), *arg);
 	    goto failret;
--- a/src/errors.h
+++ b/src/errors.h
@@ -173,8 +173,8 @@ EXTERN char e_cannot_declare_a_register_
 	INIT(= N_("E1066: Cannot declare a register: %s"));
 EXTERN char e_separator_mismatch_str[]
 	INIT(= N_("E1067: Separator mismatch: %s"));
-EXTERN char e_no_white_space_allowed_before_str[]
-	INIT(= N_("E1068: No white space allowed before '%s'"));
+EXTERN char e_no_white_space_allowed_before_str_str[]
+	INIT(= N_("E1068: No white space allowed before '%s': %s"));
 EXTERN char e_white_space_required_after_str_str[]
 	INIT(= N_("E1069: White space required after '%s': %s"));
 EXTERN char e_missing_from[]
--- a/src/list.c
+++ b/src/list.c
@@ -1328,7 +1328,8 @@ eval_list(char_u **arg, typval_T *rettv,
 	    if (do_error)
 	    {
 		if (**arg == ',')
-		    semsg(_(e_no_white_space_allowed_before_str), ",");
+		    semsg(_(e_no_white_space_allowed_before_str_str),
+								    ",", *arg);
 		else
 		    semsg(_("E696: Missing comma in List: %s"), *arg);
 	    }
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -878,7 +878,7 @@ get_func_tv(
 	{
 	    if (*argp != ',' && *skipwhite(argp) == ',')
 	    {
-		semsg(_(e_no_white_space_allowed_before_str), ",");
+		semsg(_(e_no_white_space_allowed_before_str_str), ",", argp);
 		ret = FAIL;
 		break;
 	    }
@@ -3214,7 +3214,7 @@ define_function(exarg_T *eap, char_u *na
 
     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;
     }
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2486,
+/**/
     2485,
 /**/
     2484,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2800,7 +2800,7 @@ compile_arguments(char_u **arg, cctx_T *
 
 	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);
 	}
 	if (*p == ',')
@@ -3055,7 +3055,7 @@ compile_list(char_u **arg, cctx_T *cctx,
 	}
 	if (*p == ',')
 	{
-	    semsg(_(e_no_white_space_allowed_before_str), ",");
+	    semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
 	    return FAIL;
 	}
 	if (*p == ']')
@@ -3234,7 +3234,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	if (**arg != ':')
 	{
 	    if (*skipwhite(*arg) == ':')
-		semsg(_(e_no_white_space_allowed_before_str), ":");
+		semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
 	    else
 		semsg(_(e_missing_dict_colon), *arg);
 	    return FAIL;
@@ -3273,7 +3273,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	}
 	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;
 	}
 	whitep = *arg + 1;
@@ -4270,7 +4270,7 @@ compile_expr7t(char_u **arg, cctx_T *cct
 	if (**arg != '>')
 	{
 	    if (*skipwhite(*arg) == '>')
-		semsg(_(e_no_white_space_allowed_before_str), ">");
+		semsg(_(e_no_white_space_allowed_before_str_str), ">", *arg);
 	    else
 		emsg(_(e_missing_gt));
 	    return FAIL;
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -638,7 +638,7 @@ parse_type_member(
 	if (give_error)
 	{
 	    if (*skipwhite(*arg) == '<')
-		semsg(_(e_no_white_space_allowed_before_str), "<");
+		semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg);
 	    else
 		emsg(_(e_missing_type));
 	}
@@ -779,7 +779,8 @@ parse_type(char_u **arg, garray_T *type_
 			if (*p != ',' && *skipwhite(p) == ',')
 			{
 			    if (give_error)
-				semsg(_(e_no_white_space_allowed_before_str), ",");
+				semsg(_(e_no_white_space_allowed_before_str_str),
+								       ",", p);
 			    return NULL;
 			}
 			if (*p == ',')