Patch 8.2.3749

6 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 5, 2021, 4:47:14 PM12/5/21
to vim...@googlegroups.com

Patch 8.2.3749
Problem: Error messages are everywhere.
Solution: Move more error messages to errors.h and adjust the names.
Files: src/errors.h, src/regexp_bt.c, src/regexp.c, src/regexp_nfa.c,
src/globals.h, src/memfile.c, src/tag.c, src/getchar.c,
src/bufwrite.c, src/cmdexpand.c


*** ../vim-8.2.3748/src/errors.h 2021-12-05 19:09:59.799706687 +0000
--- src/errors.h 2021-12-05 21:43:29.565098691 +0000
***************
*** 134,139 ****
--- 134,173 ----
INIT(= N_("E59: invalid character after %s@"));
EXTERN char e_too_many_complex_str_curly[]
INIT(= N_("E60: Too many complex %s{...}s"));
+ EXTERN char e_nested_str[]
+ INIT(= N_("E61: Nested %s*"));
+ EXTERN char e_nested_str_chr[]
+ INIT(= N_("E62: Nested %s%c"));
+ EXTERN char e_invalid_use_of_underscore[]
+ INIT(= N_("E63: invalid use of \\_"));
+ EXTERN char e_str_chr_follows_nothing[]
+ INIT(= N_("E64: %s%c follows nothing"));
+ EXTERN char e_illegal_back_reference[]
+ INIT(= N_("E65: Illegal back reference"));
+ #ifdef FEAT_SYN_HL
+ EXTERN char e_z_not_allowed_here[]
+ INIT(= N_("E66: \\z( not allowed here"));
+ EXTERN char e_z1_z9_not_allowed_here[]
+ INIT(= N_("E67: \\z1 - \\z9 not allowed here"));
+ #endif
+ EXTERN char e_missing_sb_after_str[]
+ INIT(= N_("E69: Missing ] after %s%%["));
+ EXTERN char e_empty_str_brackets[]
+ INIT(= N_("E70: Empty %s%%[]"));
+ EXTERN char e_invalid_character_after_str[]
+ INIT(= N_("E71: Invalid character after %s%%"));
+ EXTERN char e_close_error_on_swap_file[]
+ INIT(= N_("E72: Close error on swap file"));
+ EXTERN char e_tag_stack_empty[]
+ INIT(= N_("E73: tag stack empty"));
+ EXTERN char e_command_too_complex[]
+ INIT(= N_("E74: Command too complex"));
+ EXTERN char e_name_too_long[]
+ INIT(= N_("E75: Name too long"));
+ EXTERN char e_too_many_brackets[]
+ INIT(= N_("E76: Too many ["));
+ EXTERN char e_too_many_file_names[]
+ INIT(= N_("E77: Too many file names"));

#ifdef FEAT_EVAL
EXTERN char e_undefined_variable_str[]
*** ../vim-8.2.3748/src/regexp_bt.c 2021-07-21 21:20:30.066401728 +0100
--- src/regexp_bt.c 2021-12-05 21:39:28.577292136 +0000
***************
*** 1242,1248 ****
break;
if (*p == NUL)
{
! emsg(_("E65: Illegal back reference"));
rc_did_emsg = TRUE;
return FALSE;
}
--- 1242,1248 ----
break;
if (*p == NUL)
{
! emsg(_(e_illegal_back_reference));
rc_did_emsg = TRUE;
return FALSE;
}
***************
*** 1347,1353 ****
case Magic('U'):
p = vim_strchr(classchars, no_Magic(c));
if (p == NULL)
! EMSG_RET_NULL(_("E63: invalid use of \\_"));

// When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here.
--- 1347,1353 ----
case Magic('U'):
p = vim_strchr(classchars, no_Magic(c));
if (p == NULL)
! EMSG_RET_NULL(_(e_invalid_use_of_underscore));

// When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here.
***************
*** 1402,1408 ****
case Magic('{'):
case Magic('*'):
c = no_Magic(c);
! EMSG3_RET_NULL(_("E64: %s%c follows nothing"),
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c);
// NOTREACHED

--- 1402,1408 ----
case Magic('{'):
case Magic('*'):
c = no_Magic(c);
! EMSG3_RET_NULL(_(e_str_chr_follows_nothing),
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c);
// NOTREACHED

***************
*** 1453,1459 ****
{
#ifdef FEAT_SYN_HL
case '(': if ((reg_do_extmatch & REX_SET) == 0)
! EMSG_RET_NULL(_(e_z_not_allowed));
if (one_exactly)
EMSG_ONE_RET_NULL;
ret = reg(REG_ZPAREN, &flags);
--- 1453,1459 ----
{
#ifdef FEAT_SYN_HL
case '(': if ((reg_do_extmatch & REX_SET) == 0)
! EMSG_RET_NULL(_(e_z_not_allowed_here));
if (one_exactly)
EMSG_ONE_RET_NULL;
ret = reg(REG_ZPAREN, &flags);
***************
*** 1472,1478 ****
case '7':
case '8':
case '9': if ((reg_do_extmatch & REX_USE) == 0)
! EMSG_RET_NULL(_(e_z1_not_allowed));
ret = regnode(ZREF + c - '0');
re_has_z = REX_USE;
break;
--- 1472,1478 ----
case '7':
case '8':
case '9': if ((reg_do_extmatch & REX_USE) == 0)
! EMSG_RET_NULL(_(e_z1_z9_not_allowed_here));
ret = regnode(ZREF + c - '0');
re_has_z = REX_USE;
break;
***************
*** 1544,1550 ****
while ((c = getchr()) != ']')
{
if (c == NUL)
! EMSG2_RET_NULL(_(e_missing_sb),
reg_magic == MAGIC_ALL);
br = regnode(BRANCH);
if (ret == NULL)
--- 1544,1550 ----
while ((c = getchr()) != ']')
{
if (c == NUL)
! EMSG2_RET_NULL(_(e_missing_sb_after_str),
reg_magic == MAGIC_ALL);
br = regnode(BRANCH);
if (ret == NULL)
***************
*** 1564,1570 ****
return NULL;
}
if (ret == NULL)
! EMSG2_RET_NULL(_(e_empty_sb),
reg_magic == MAGIC_ALL);
lastbranch = regnode(BRANCH);
br = regnode(NOTHING);
--- 1564,1570 ----
return NULL;
}
if (ret == NULL)
! EMSG2_RET_NULL(_(e_empty_str_brackets),
reg_magic == MAGIC_ALL);
lastbranch = regnode(BRANCH);
br = regnode(NOTHING);
***************
*** 1712,1718 ****
}
}

! EMSG2_RET_NULL(_("E71: Invalid character after %s%%"),
reg_magic == MAGIC_ALL);
}
}
--- 1712,1718 ----
}
}

! EMSG2_RET_NULL(_(e_invalid_character_after_str),
reg_magic == MAGIC_ALL);
}
}
***************
*** 2001,2007 ****
regc(NUL);
prevchr_len = 1; // last char was the ']'
if (*regparse != ']')
! EMSG_RET_NULL(_(e_toomsbra)); // Cannot happen?
skipchr(); // let's be friends with the lexer again
*flagp |= HASWIDTH | SIMPLE;
break;
--- 2001,2007 ----
regc(NUL);
prevchr_len = 1; // last char was the ']'
if (*regparse != ']')
! EMSG_RET_NULL(_(e_too_many_brackets)); // Cannot happen?
skipchr(); // let's be friends with the lexer again
*flagp |= HASWIDTH | SIMPLE;
break;
***************
*** 2215,2222 ****
{
// Can't have a multi follow a multi.
if (peekchr() == Magic('*'))
! EMSG2_RET_NULL(_("E61: Nested %s*"), reg_magic >= MAGIC_ON);
! EMSG3_RET_NULL(_("E62: Nested %s%c"), reg_magic == MAGIC_ALL,
no_Magic(peekchr()));
}

--- 2215,2222 ----
{
// Can't have a multi follow a multi.
if (peekchr() == Magic('*'))
! EMSG2_RET_NULL(_(e_nested_str), reg_magic >= MAGIC_ON);
! EMSG3_RET_NULL(_(e_nested_str_chr), reg_magic == MAGIC_ALL,
no_Magic(peekchr()));
}

*** ../vim-8.2.3748/src/regexp.c 2021-11-29 20:39:06.682101619 +0000
--- src/regexp.c 2021-12-05 21:27:46.790306561 +0000
***************
*** 74,85 ****
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
static char_u e_large_class[] = N_("E945: Range too large in character class");
- #ifdef FEAT_SYN_HL
- static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
- static char_u e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
- #endif
- static char_u e_missing_sb[] = N_("E69: Missing ] after %s%%[");
- static char_u e_empty_sb[] = N_("E70: Empty %s%%[]");
static char_u e_recursive[] = N_("E956: Cannot use pattern recursively");

#define NOT_MULTI 0
--- 74,79 ----
*** ../vim-8.2.3748/src/regexp_nfa.c 2021-11-17 18:22:52.980044225 +0000
--- src/regexp_nfa.c 2021-12-05 21:32:52.725586798 +0000
***************
*** 1586,1592 ****
case '9':
// \z1...\z9
if ((reg_do_extmatch & REX_USE) == 0)
! EMSG_RET_FAIL(_(e_z1_not_allowed));
EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
// No need to set rex.nfa_has_backref, the sub-matches don't
// change when \z1 .. \z9 matches or not.
--- 1586,1592 ----
case '9':
// \z1...\z9
if ((reg_do_extmatch & REX_USE) == 0)
! EMSG_RET_FAIL(_(e_z1_z9_not_allowed_here));
EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
// No need to set rex.nfa_has_backref, the sub-matches don't
// change when \z1 .. \z9 matches or not.
***************
*** 1595,1601 ****
case '(':
// \z(
if ((reg_do_extmatch & REX_SET) == 0)
! EMSG_RET_FAIL(_(e_z_not_allowed));
if (nfa_reg(REG_ZPAREN) == FAIL)
return FAIL; // cascaded error
re_has_z = REX_SET;
--- 1595,1601 ----
case '(':
// \z(
if ((reg_do_extmatch & REX_SET) == 0)
! EMSG_RET_FAIL(_(e_z_not_allowed_here));
if (nfa_reg(REG_ZPAREN) == FAIL)
return FAIL; // cascaded error
re_has_z = REX_SET;
***************
*** 1677,1683 ****
for (n = 0; (c = peekchr()) != ']'; ++n)
{
if (c == NUL)
! EMSG2_RET_FAIL(_(e_missing_sb),
reg_magic == MAGIC_ALL);
// recursive call!
if (nfa_regatom() == FAIL)
--- 1677,1683 ----
for (n = 0; (c = peekchr()) != ']'; ++n)
{
if (c == NUL)
! EMSG2_RET_FAIL(_(e_missing_sb_after_str),
reg_magic == MAGIC_ALL);
// recursive call!
if (nfa_regatom() == FAIL)
***************
*** 1685,1691 ****
}
getchr(); // get the ]
if (n == 0)
! EMSG2_RET_FAIL(_(e_empty_sb),
reg_magic == MAGIC_ALL);
EMIT(NFA_OPT_CHARS);
EMIT(n);
--- 1685,1691 ----
}
getchr(); // get the ]
if (n == 0)
! EMSG2_RET_FAIL(_(e_empty_str_brackets),
reg_magic == MAGIC_ALL);
EMIT(NFA_OPT_CHARS);
EMIT(n);
*** ../vim-8.2.3748/src/globals.h 2021-11-29 20:39:06.682101619 +0000
--- src/globals.h 2021-12-05 21:34:56.061332461 +0000
***************
*** 1715,1726 ****
#if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK)
EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
#endif
- EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
- EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty"));
- EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex"));
- EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
- EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
- EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));
--- 1715,1720 ----
*** ../vim-8.2.3748/src/memfile.c 2020-11-25 16:00:39.953495676 +0000
--- src/memfile.c 2021-12-05 21:36:43.537345583 +0000
***************
*** 242,248 ****
if (mfp->mf_fd >= 0)
{
if (close(mfp->mf_fd) < 0)
! emsg(_(e_swapclose));
}
if (del_file && mfp->mf_fname != NULL)
mch_remove(mfp->mf_fname);
--- 242,248 ----
if (mfp->mf_fd >= 0)
{
if (close(mfp->mf_fd) < 0)
! emsg(_(e_close_error_on_swap_file));
}
if (del_file && mfp->mf_fname != NULL)
mch_remove(mfp->mf_fname);
***************
*** 288,294 ****
}

if (close(mfp->mf_fd) < 0) // close the file
! emsg(_(e_swapclose));
mfp->mf_fd = -1;

if (mfp->mf_fname != NULL)
--- 288,294 ----
}

if (close(mfp->mf_fd) < 0) // close the file
! emsg(_(e_close_error_on_swap_file));
mfp->mf_fd = -1;

if (mfp->mf_fname != NULL)
*** ../vim-8.2.3748/src/tag.c 2021-12-03 11:08:34.260842706 +0000
--- src/tag.c 2021-12-05 21:37:07.465342888 +0000
***************
*** 350,356 ****
tagstacklen == 0)
{
// empty stack
! emsg(_(e_tagstack));
goto end_do_tag;
}

--- 350,356 ----
tagstacklen == 0)
{
// empty stack
! emsg(_(e_tag_stack_empty));
goto end_do_tag;
}

*** ../vim-8.2.3748/src/getchar.c 2021-11-22 12:47:36.319593278 +0000
--- src/getchar.c 2021-12-05 21:37:45.197334904 +0000
***************
*** 1010,1016 ****
if (typebuf.tb_len > 2147483647 - extra)
{
// string is getting too long for a 32 bit int
! emsg(_(e_toocompl)); // also calls flush_buffers
setcursor();
return FAIL;
}
--- 1010,1016 ----
if (typebuf.tb_len > 2147483647 - extra)
{
// string is getting too long for a 32 bit int
! emsg(_(e_command_too_complex)); // also calls flush_buffers
setcursor();
return FAIL;
}
*** ../vim-8.2.3748/src/bufwrite.c 2021-11-29 20:39:06.670101630 +0000
--- src/bufwrite.c 2021-12-05 21:38:19.689323914 +0000
***************
*** 713,719 ****
// Avoid a crash for a long name.
if (STRLEN(fname) >= MAXPATHL)
{
! emsg(_(e_longname));
return FAIL;
}

--- 713,719 ----
// Avoid a crash for a long name.
if (STRLEN(fname) >= MAXPATHL)
{
! emsg(_(e_name_too_long));
return FAIL;
}

*** ../vim-8.2.3748/src/cmdexpand.c 2021-11-21 12:13:53.112683595 +0000
--- src/cmdexpand.c 2021-12-05 21:39:55.501276453 +0000
***************
*** 406,412 ****
// together. Don't really want to wait for this message
// (and possibly have to hit return to continue!).
if (!(options & WILD_SILENT))
! emsg(_(e_toomany));
else if (!(options & WILD_NO_BEEP))
beep_flush();
}
--- 406,412 ----
// together. Don't really want to wait for this message
// (and possibly have to hit return to continue!).
if (!(options & WILD_SILENT))
! emsg(_(e_too_many_file_names));
else if (!(options & WILD_NO_BEEP))
beep_flush();
}
*** ../vim-8.2.3748/src/version.c 2021-12-05 19:09:59.799706687 +0000
--- src/version.c 2021-12-05 21:44:38.953024444 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3749,
/**/

--
No engineer can take a shower without wondering if some sort of Teflon coating
would make showering unnecessary.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages