To: vim_dev@googlegroups.com Subject: Patch 8.2.2480 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2480 Problem: Vim9: some errors for white space do not show context. Solution: Include the text at the error. Files: src/errors.h, src/dict.c, src/list.c, src/userfunc.c, src/vim9compile.c, src/vim9script.c, src/vim9type.c *** ../vim-8.2.2479/src/errors.h 2021-02-07 12:12:39.377215418 +0100 --- src/errors.h 2021-02-07 15:19:18.314059559 +0100 *************** *** 175,182 **** 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_white_space_required_after_str[] ! INIT(= N_("E1069: White space required after '%s'")); EXTERN char e_missing_from[] INIT(= N_("E1070: Missing \"from\"")); EXTERN char e_invalid_string_after_from[] --- 175,182 ---- 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_white_space_required_after_str_str[] ! INIT(= N_("E1069: White space required after '%s': %s")); EXTERN char e_missing_from[] INIT(= N_("E1070: Missing \"from\"")); EXTERN char e_invalid_string_after_from[] *** ../vim-8.2.2479/src/dict.c 2021-02-03 17:41:19.924245848 +0100 --- src/dict.c 2021-02-07 15:22:16.709543284 +0100 *************** *** 970,976 **** } if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1])) { ! semsg(_(e_white_space_required_after_str), ":"); clear_tv(&tvkey); goto failret; } --- 970,976 ---- } if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1])) { ! semsg(_(e_white_space_required_after_str_str), ":", *arg); clear_tv(&tvkey); goto failret; } *************** *** 1012,1018 **** { if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1])) { ! semsg(_(e_white_space_required_after_str), ","); goto failret; } *arg = skipwhite(*arg + 1); --- 1012,1018 ---- { if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1])) { ! semsg(_(e_white_space_required_after_str_str), ",", *arg); goto failret; } *arg = skipwhite(*arg + 1); *** ../vim-8.2.2479/src/list.c 2021-02-01 20:14:44.566705066 +0100 --- src/list.c 2021-02-07 15:22:28.521508779 +0100 *************** *** 1311,1317 **** { if (vim9script && !IS_WHITE_OR_NUL((*arg)[1]) && (*arg)[1] != ']') { ! semsg(_(e_white_space_required_after_str), ","); goto failret; } *arg = skipwhite(*arg + 1); --- 1311,1317 ---- { if (vim9script && !IS_WHITE_OR_NUL((*arg)[1]) && (*arg)[1] != ']') { ! semsg(_(e_white_space_required_after_str_str), ",", *arg); goto failret; } *arg = skipwhite(*arg + 1); *** ../vim-8.2.2479/src/userfunc.c 2021-02-03 19:31:25.387275171 +0100 --- src/userfunc.c 2021-02-07 15:23:15.249371707 +0100 *************** *** 126,132 **** ++p; if (!skip && !VIM_ISWHITE(*p)) { ! semsg(_(e_white_space_required_after_str), ":"); return arg; } type = skipwhite(p); --- 126,132 ---- ++p; if (!skip && !VIM_ISWHITE(*p)) { ! semsg(_(e_white_space_required_after_str_str), ":", p - 1); return arg; } type = skipwhite(p); *************** *** 297,303 **** if (!skip && in_vim9script() && !IS_WHITE_OR_NUL(*p) && *p != endchar) { ! semsg(_(e_white_space_required_after_str), ","); goto err_ret; } } --- 297,303 ---- if (!skip && in_vim9script() && !IS_WHITE_OR_NUL(*p) && *p != endchar) { ! semsg(_(e_white_space_required_after_str_str), ",", p - 1); goto err_ret; } } *************** *** 487,493 **** if (white_error != NULL && !VIM_ISWHITE(s[1])) { *white_error = TRUE; ! semsg(_(e_white_space_required_after_str), ":"); return NULL; } s = skipwhite(s + 1); --- 487,493 ---- if (white_error != NULL && !VIM_ISWHITE(s[1])) { *white_error = TRUE; ! semsg(_(e_white_space_required_after_str_str), ":", s); return NULL; } s = skipwhite(s + 1); *************** *** 884,890 **** break; if (vim9script && !IS_WHITE_OR_NUL(argp[1])) { ! semsg(_(e_white_space_required_after_str), ","); ret = FAIL; break; } --- 884,890 ---- break; if (vim9script && !IS_WHITE_OR_NUL(argp[1])) { ! semsg(_(e_white_space_required_after_str_str), ",", argp); ret = FAIL; break; } *** ../vim-8.2.2479/src/vim9compile.c 2021-02-03 19:56:56.538375336 +0100 --- src/vim9compile.c 2021-02-07 15:24:40.877119097 +0100 *************** *** 2807,2813 **** { ++p; if (*p != NUL && !VIM_ISWHITE(*p)) ! semsg(_(e_white_space_required_after_str), ","); } else must_end = TRUE; --- 2807,2813 ---- { ++p; if (*p != NUL && !VIM_ISWHITE(*p)) ! semsg(_(e_white_space_required_after_str_str), ",", p - 1); } else must_end = TRUE; *************** *** 3073,3079 **** ++p; if (*p != ']' && !IS_WHITE_OR_NUL(*p)) { ! semsg(_(e_white_space_required_after_str), ","); return FAIL; } } --- 3073,3079 ---- ++p; if (*p != ']' && !IS_WHITE_OR_NUL(*p)) { ! semsg(_(e_white_space_required_after_str_str), ",", p - 1); return FAIL; } } *************** *** 3242,3248 **** whitep = *arg + 1; if (!IS_WHITE_OR_NUL(*whitep)) { ! semsg(_(e_white_space_required_after_str), ":"); return FAIL; } --- 3242,3248 ---- whitep = *arg + 1; if (!IS_WHITE_OR_NUL(*whitep)) { ! semsg(_(e_white_space_required_after_str_str), ":", *arg); return FAIL; } *************** *** 3279,3288 **** whitep = *arg + 1; if (!IS_WHITE_OR_NUL(*whitep)) { ! semsg(_(e_white_space_required_after_str), ","); return FAIL; } ! *arg = skipwhite(*arg + 1); } *arg = *arg + 1; --- 3279,3288 ---- whitep = *arg + 1; if (!IS_WHITE_OR_NUL(*whitep)) { ! semsg(_(e_white_space_required_after_str_str), ",", *arg); return FAIL; } ! *arg = skipwhite(whitep); } *arg = *arg + 1; *************** *** 5711,5717 **** // parse optional type: "let var: type = expr" if (!VIM_ISWHITE(var_end[1])) { ! semsg(_(e_white_space_required_after_str), ":"); return FAIL; } p = skipwhite(var_end + 1); --- 5711,5717 ---- // parse optional type: "let var: type = expr" if (!VIM_ISWHITE(var_end[1])) { ! semsg(_(e_white_space_required_after_str_str), ":", var_end); return FAIL; } p = skipwhite(var_end + 1); *** ../vim-8.2.2479/src/vim9script.c 2021-01-11 21:20:05.669652000 +0100 --- src/vim9script.c 2021-02-07 15:24:51.461087720 +0100 *************** *** 629,635 **** } if (!VIM_ISWHITE(p[1])) { ! semsg(_(e_white_space_required_after_str), ":"); return arg + STRLEN(arg); } name = vim_strnsave(arg, p - arg); --- 629,635 ---- } if (!VIM_ISWHITE(p[1])) { ! semsg(_(e_white_space_required_after_str_str), ":", p); return arg + STRLEN(arg); } name = vim_strnsave(arg, p - arg); *** ../vim-8.2.2479/src/vim9type.c 2021-01-24 12:53:30.780247041 +0100 --- src/vim9type.c 2021-02-07 15:25:32.996964530 +0100 *************** *** 788,794 **** if (!VIM_ISWHITE(*p)) { if (give_error) ! semsg(_(e_white_space_required_after_str), ","); return NULL; } } --- 788,795 ---- if (!VIM_ISWHITE(*p)) { if (give_error) ! semsg(_(e_white_space_required_after_str_str), ! ",", p - 1); return NULL; } } *************** *** 815,821 **** // parse return type ++*arg; if (!VIM_ISWHITE(**arg) && give_error) ! semsg(_(e_white_space_required_after_str), ":"); *arg = skipwhite(*arg); ret_type = parse_type(arg, type_gap, give_error); if (ret_type == NULL) --- 816,823 ---- // parse return type ++*arg; if (!VIM_ISWHITE(**arg) && give_error) ! semsg(_(e_white_space_required_after_str_str), ! ":", *arg - 1); *arg = skipwhite(*arg); ret_type = parse_type(arg, type_gap, give_error); if (ret_type == NULL) *** ../vim-8.2.2479/src/version.c 2021-02-07 14:31:02.963000750 +0100 --- src/version.c 2021-02-07 15:22:04.217579758 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2480, /**/ -- Nothing is impossible for the man who doesn't have to do it. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///