comparison src/regexp_bt.c @ 26436:ef0c07cbf53f v8.2.3749

patch 8.2.3749: error messages are everywhere Commit: https://github.com/vim/vim/commit/12f3c1b77fb39dc338304d5484cdbc99da27389a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 5 21:46:34 2021 +0000 patch 8.2.3749: error messages are everywhere Problem: Error messages are everywhere. Solution: Move more error messages to errors.h and adjust the names.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Dec 2021 23:00:06 +0100
parents 1e6da8364a02
children d66ba549f68a
comparison
equal deleted inserted replaced
26435:8860c02d96a8 26436:ef0c07cbf53f
1240 for (p = regparse; *p != NUL; ++p) 1240 for (p = regparse; *p != NUL; ++p)
1241 if (p[0] == '@' && p[1] == '<' && (p[2] == '!' || p[2] == '=')) 1241 if (p[0] == '@' && p[1] == '<' && (p[2] == '!' || p[2] == '='))
1242 break; 1242 break;
1243 if (*p == NUL) 1243 if (*p == NUL)
1244 { 1244 {
1245 emsg(_("E65: Illegal back reference")); 1245 emsg(_(e_illegal_back_reference));
1246 rc_did_emsg = TRUE; 1246 rc_did_emsg = TRUE;
1247 return FALSE; 1247 return FALSE;
1248 } 1248 }
1249 } 1249 }
1250 return TRUE; 1250 return TRUE;
1345 case Magic('L'): 1345 case Magic('L'):
1346 case Magic('u'): 1346 case Magic('u'):
1347 case Magic('U'): 1347 case Magic('U'):
1348 p = vim_strchr(classchars, no_Magic(c)); 1348 p = vim_strchr(classchars, no_Magic(c));
1349 if (p == NULL) 1349 if (p == NULL)
1350 EMSG_RET_NULL(_("E63: invalid use of \\_")); 1350 EMSG_RET_NULL(_(e_invalid_use_of_underscore));
1351 1351
1352 // When '.' is followed by a composing char ignore the dot, so that 1352 // When '.' is followed by a composing char ignore the dot, so that
1353 // the composing char is matched here. 1353 // the composing char is matched here.
1354 if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr())) 1354 if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
1355 { 1355 {
1400 case Magic('+'): 1400 case Magic('+'):
1401 case Magic('@'): 1401 case Magic('@'):
1402 case Magic('{'): 1402 case Magic('{'):
1403 case Magic('*'): 1403 case Magic('*'):
1404 c = no_Magic(c); 1404 c = no_Magic(c);
1405 EMSG3_RET_NULL(_("E64: %s%c follows nothing"), 1405 EMSG3_RET_NULL(_(e_str_chr_follows_nothing),
1406 (c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c); 1406 (c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c);
1407 // NOTREACHED 1407 // NOTREACHED
1408 1408
1409 case Magic('~'): // previous substitute pattern 1409 case Magic('~'): // previous substitute pattern
1410 if (reg_prev_sub != NULL) 1410 if (reg_prev_sub != NULL)
1451 c = no_Magic(getchr()); 1451 c = no_Magic(getchr());
1452 switch (c) 1452 switch (c)
1453 { 1453 {
1454 #ifdef FEAT_SYN_HL 1454 #ifdef FEAT_SYN_HL
1455 case '(': if ((reg_do_extmatch & REX_SET) == 0) 1455 case '(': if ((reg_do_extmatch & REX_SET) == 0)
1456 EMSG_RET_NULL(_(e_z_not_allowed)); 1456 EMSG_RET_NULL(_(e_z_not_allowed_here));
1457 if (one_exactly) 1457 if (one_exactly)
1458 EMSG_ONE_RET_NULL; 1458 EMSG_ONE_RET_NULL;
1459 ret = reg(REG_ZPAREN, &flags); 1459 ret = reg(REG_ZPAREN, &flags);
1460 if (ret == NULL) 1460 if (ret == NULL)
1461 return NULL; 1461 return NULL;
1470 case '5': 1470 case '5':
1471 case '6': 1471 case '6':
1472 case '7': 1472 case '7':
1473 case '8': 1473 case '8':
1474 case '9': if ((reg_do_extmatch & REX_USE) == 0) 1474 case '9': if ((reg_do_extmatch & REX_USE) == 0)
1475 EMSG_RET_NULL(_(e_z1_not_allowed)); 1475 EMSG_RET_NULL(_(e_z1_z9_not_allowed_here));
1476 ret = regnode(ZREF + c - '0'); 1476 ret = regnode(ZREF + c - '0');
1477 re_has_z = REX_USE; 1477 re_has_z = REX_USE;
1478 break; 1478 break;
1479 #endif 1479 #endif
1480 1480
1542 1542
1543 ret = NULL; 1543 ret = NULL;
1544 while ((c = getchr()) != ']') 1544 while ((c = getchr()) != ']')
1545 { 1545 {
1546 if (c == NUL) 1546 if (c == NUL)
1547 EMSG2_RET_NULL(_(e_missing_sb), 1547 EMSG2_RET_NULL(_(e_missing_sb_after_str),
1548 reg_magic == MAGIC_ALL); 1548 reg_magic == MAGIC_ALL);
1549 br = regnode(BRANCH); 1549 br = regnode(BRANCH);
1550 if (ret == NULL) 1550 if (ret == NULL)
1551 ret = br; 1551 ret = br;
1552 else 1552 else
1562 one_exactly = FALSE; 1562 one_exactly = FALSE;
1563 if (lastnode == NULL) 1563 if (lastnode == NULL)
1564 return NULL; 1564 return NULL;
1565 } 1565 }
1566 if (ret == NULL) 1566 if (ret == NULL)
1567 EMSG2_RET_NULL(_(e_empty_sb), 1567 EMSG2_RET_NULL(_(e_empty_str_brackets),
1568 reg_magic == MAGIC_ALL); 1568 reg_magic == MAGIC_ALL);
1569 lastbranch = regnode(BRANCH); 1569 lastbranch = regnode(BRANCH);
1570 br = regnode(NOTHING); 1570 br = regnode(NOTHING);
1571 if (ret != JUST_CALC_SIZE) 1571 if (ret != JUST_CALC_SIZE)
1572 { 1572 {
1710 } 1710 }
1711 break; 1711 break;
1712 } 1712 }
1713 } 1713 }
1714 1714
1715 EMSG2_RET_NULL(_("E71: Invalid character after %s%%"), 1715 EMSG2_RET_NULL(_(e_invalid_character_after_str),
1716 reg_magic == MAGIC_ALL); 1716 reg_magic == MAGIC_ALL);
1717 } 1717 }
1718 } 1718 }
1719 break; 1719 break;
1720 1720
1999 } 1999 }
2000 } 2000 }
2001 regc(NUL); 2001 regc(NUL);
2002 prevchr_len = 1; // last char was the ']' 2002 prevchr_len = 1; // last char was the ']'
2003 if (*regparse != ']') 2003 if (*regparse != ']')
2004 EMSG_RET_NULL(_(e_toomsbra)); // Cannot happen? 2004 EMSG_RET_NULL(_(e_too_many_brackets)); // Cannot happen?
2005 skipchr(); // let's be friends with the lexer again 2005 skipchr(); // let's be friends with the lexer again
2006 *flagp |= HASWIDTH | SIMPLE; 2006 *flagp |= HASWIDTH | SIMPLE;
2007 break; 2007 break;
2008 } 2008 }
2009 else if (reg_strict) 2009 else if (reg_strict)
2213 } 2213 }
2214 if (re_multi_type(peekchr()) != NOT_MULTI) 2214 if (re_multi_type(peekchr()) != NOT_MULTI)
2215 { 2215 {
2216 // Can't have a multi follow a multi. 2216 // Can't have a multi follow a multi.
2217 if (peekchr() == Magic('*')) 2217 if (peekchr() == Magic('*'))
2218 EMSG2_RET_NULL(_("E61: Nested %s*"), reg_magic >= MAGIC_ON); 2218 EMSG2_RET_NULL(_(e_nested_str), reg_magic >= MAGIC_ON);
2219 EMSG3_RET_NULL(_("E62: Nested %s%c"), reg_magic == MAGIC_ALL, 2219 EMSG3_RET_NULL(_(e_nested_str_chr), reg_magic == MAGIC_ALL,
2220 no_Magic(peekchr())); 2220 no_Magic(peekchr()));
2221 } 2221 }
2222 2222
2223 return ret; 2223 return ret;
2224 } 2224 }