]> granicus.if.org Git - vim/commitdiff
patch 8.2.2486: Vim9: some errors for white space do not show context v8.2.2486
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Feb 2021 17:06:29 +0000 (18:06 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Feb 2021 17:06:29 +0000 (18:06 +0100)
Problem:    Vim9: some errors for white space do not show context.
Solution:   Include the text at the error.

src/dict.c
src/errors.h
src/list.c
src/userfunc.c
src/version.c
src/vim9compile.c
src/vim9type.c

index b40aaef0daf7f38296f21d82e39e3360f8ebea72..b36b2bf6ddb16351980d1233b92704864d0044fa 100644 (file)
@@ -945,7 +945,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
        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, evalarg_T *evalarg, int literal)
        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;
index 921b9df5cc36df9f07a09d3b2e836356c305716b..9b9a7827537c2b7c5032c4f4a9ac700d87731b24 100644 (file)
@@ -173,8 +173,8 @@ EXTERN char e_cannot_declare_a_register_str[]
        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[]
index c93a66d81b4d8947e31e6ff338c81f290db9eaf2..4d33aa6e082048f58c96c30f3f87d8894a8795fb 100644 (file)
@@ -1328,7 +1328,8 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
            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);
            }
index 82df0bb960a48fab761a0d42c7acd8071dfa43af..c9b15fd638a0c677d66e19a1b6b418456d182a04 100644 (file)
@@ -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 *name_arg)
 
     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;
     }
 
index ca79c64dd888034e71e942e25079fc6e949e93fd..e203038df71a3450362fadd4e2d57b80352b3cdb 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2486,
 /**/
     2485,
 /**/
index 7a220a851f726e18cfd31699d0e2fc33f797484a..512f7246c20a1ea0b5ed193ab26b741f33b7074f 100644 (file)
@@ -2800,7 +2800,7 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount)
 
        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, ppconst_T *ppconst)
        }
        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, ppconst_T *ppconst)
        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, ppconst_T *ppconst)
        }
        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 *cctx, ppconst_T *ppconst)
        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;
index dbe7db92cfc7cf06237602386fe8f5896e2d518b..1a20ef57961ec73b49c6c8959dcdfac6f1f8c713 100644 (file)
@@ -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_gap, int give_error)
                        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 == ',')