mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
vim-patch:8.2.4688: new regexp engine does not give an error for "\%v"
Problem: New regexp engine does not give an error for "\%v".
Solution: Check for a value argument. (issue vim/vim#10079)
91ff3d4f52
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -97,20 +97,22 @@ static int toggle_Magic(int x)
|
|||||||
|
|
||||||
#define MAX_LIMIT (32767L << 16L)
|
#define MAX_LIMIT (32767L << 16L)
|
||||||
|
|
||||||
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
|
static char e_missingbracket[] = N_("E769: Missing ] after %s[");
|
||||||
static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
|
static char e_reverse_range[] = N_("E944: Reverse range in character class");
|
||||||
static char_u e_large_class[] = N_("E945: Range too large in character class");
|
static char e_large_class[] = N_("E945: Range too large in character class");
|
||||||
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
|
static char e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
|
||||||
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
|
static char e_unmatchedp[] = N_("E54: Unmatched %s(");
|
||||||
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
|
static char e_unmatchedpar[] = N_("E55: Unmatched %s)");
|
||||||
static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
|
static char e_z_not_allowed[] = N_("E66: \\z( not allowed here");
|
||||||
static char_u e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
|
static char e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
|
||||||
static char_u e_missing_sb[] = N_("E69: Missing ] after %s%%[");
|
static char e_missing_sb[] = N_("E69: Missing ] after %s%%[");
|
||||||
static char_u e_empty_sb[] = N_("E70: Empty %s%%[]");
|
static char e_empty_sb[] = N_("E70: Empty %s%%[]");
|
||||||
static char_u e_recursive[] = N_("E956: Cannot use pattern recursively");
|
static char e_recursive[] = N_("E956: Cannot use pattern recursively");
|
||||||
static char_u e_regexp_number_after_dot_pos_search[]
|
static char e_regexp_number_after_dot_pos_search_chr[]
|
||||||
= N_("E1204: No Number allowed after .: '\\%%%c'");
|
= N_("E1204: No Number allowed after .: '\\%%%c'");
|
||||||
static char_u e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
|
static char e_nfa_regexp_missing_value_in_chr[]
|
||||||
|
= N_("E1273: (NFA regexp) missing value in '\\%%%c'");
|
||||||
|
static char e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
|
||||||
|
|
||||||
#define NOT_MULTI 0
|
#define NOT_MULTI 0
|
||||||
#define MULTI_ONE 1
|
#define MULTI_ONE 1
|
||||||
|
@@ -2117,7 +2117,7 @@ static char_u *regatom(int *flagp)
|
|||||||
break;
|
break;
|
||||||
} else if (c == 'l' || c == 'c' || c == 'v') {
|
} else if (c == 'l' || c == 'c' || c == 'v') {
|
||||||
if (cur && n) {
|
if (cur && n) {
|
||||||
semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c));
|
semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c));
|
||||||
rc_did_emsg = true;
|
rc_did_emsg = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -2151,7 +2151,7 @@ static int nfa_regatom(void)
|
|||||||
}
|
}
|
||||||
while (ascii_isdigit(c)) {
|
while (ascii_isdigit(c)) {
|
||||||
if (cur) {
|
if (cur) {
|
||||||
semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c));
|
semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (n > (INT32_MAX - (c - '0')) / 10) {
|
if (n > (INT32_MAX - (c - '0')) / 10) {
|
||||||
@@ -2165,6 +2165,10 @@ static int nfa_regatom(void)
|
|||||||
if (c == 'l' || c == 'c' || c == 'v') {
|
if (c == 'l' || c == 'c' || c == 'v') {
|
||||||
int32_t limit = INT32_MAX;
|
int32_t limit = INT32_MAX;
|
||||||
|
|
||||||
|
if (!cur && n == 0) {
|
||||||
|
semsg(_(e_nfa_regexp_missing_value_in_chr), no_Magic(c));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
if (c == 'l') {
|
if (c == 'l') {
|
||||||
if (cur) {
|
if (cur) {
|
||||||
n = curwin->w_cursor.lnum;
|
n = curwin->w_cursor.lnum;
|
||||||
|
@@ -105,6 +105,18 @@ func Test_multi_failure()
|
|||||||
set re=0
|
set re=0
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_column_failure()
|
||||||
|
set re=1
|
||||||
|
call assert_fails('/\%v', 'E71:')
|
||||||
|
call assert_fails('/\%c', 'E71:')
|
||||||
|
call assert_fails('/\%l', 'E71:')
|
||||||
|
set re=2
|
||||||
|
call assert_fails('/\%v', 'E1273:')
|
||||||
|
call assert_fails('/\%c', 'E1273:')
|
||||||
|
call assert_fails('/\%l', 'E1273:')
|
||||||
|
set re=0
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_recursive_addstate()
|
func Test_recursive_addstate()
|
||||||
throw 'skipped: TODO: '
|
throw 'skipped: TODO: '
|
||||||
" This will call addstate() recursively until it runs into the limit.
|
" This will call addstate() recursively until it runs into the limit.
|
||||||
|
Reference in New Issue
Block a user