forked from aniani/vim
patch 8.2.4693: new regexp does not accept pattern "\%>0v"
Problem: new regexp does not accept pattern "\%>0v". Solution: Do accept digit zero.
This commit is contained in:
@@ -1617,6 +1617,7 @@ regatom(int *flagp)
|
|||||||
long_u n = 0;
|
long_u n = 0;
|
||||||
int cmp;
|
int cmp;
|
||||||
int cur = FALSE;
|
int cur = FALSE;
|
||||||
|
int got_digit = FALSE;
|
||||||
|
|
||||||
cmp = c;
|
cmp = c;
|
||||||
if (cmp == '<' || cmp == '>')
|
if (cmp == '<' || cmp == '>')
|
||||||
@@ -1628,6 +1629,7 @@ regatom(int *flagp)
|
|||||||
}
|
}
|
||||||
while (VIM_ISDIGIT(c))
|
while (VIM_ISDIGIT(c))
|
||||||
{
|
{
|
||||||
|
got_digit = TRUE;
|
||||||
n = n * 10 + (c - '0');
|
n = n * 10 + (c - '0');
|
||||||
c = getchr();
|
c = getchr();
|
||||||
}
|
}
|
||||||
@@ -1645,7 +1647,8 @@ regatom(int *flagp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (c == 'l' || c == 'c' || c == 'v')
|
else if ((c == 'l' || c == 'c' || c == 'v')
|
||||||
|
&& (cur || got_digit))
|
||||||
{
|
{
|
||||||
if (cur && n)
|
if (cur && n)
|
||||||
{
|
{
|
||||||
|
@@ -1640,6 +1640,7 @@ nfa_regatom(void)
|
|||||||
long_u n = 0;
|
long_u n = 0;
|
||||||
int cmp = c;
|
int cmp = c;
|
||||||
int cur = FALSE;
|
int cur = FALSE;
|
||||||
|
int got_digit = FALSE;
|
||||||
|
|
||||||
if (c == '<' || c == '>')
|
if (c == '<' || c == '>')
|
||||||
c = getchr();
|
c = getchr();
|
||||||
@@ -1668,12 +1669,13 @@ nfa_regatom(void)
|
|||||||
}
|
}
|
||||||
n = tmp;
|
n = tmp;
|
||||||
c = getchr();
|
c = getchr();
|
||||||
|
got_digit = TRUE;
|
||||||
}
|
}
|
||||||
if (c == 'l' || c == 'c' || c == 'v')
|
if (c == 'l' || c == 'c' || c == 'v')
|
||||||
{
|
{
|
||||||
long_u limit = INT_MAX;
|
long_u limit = INT_MAX;
|
||||||
|
|
||||||
if (!cur && n == 0)
|
if (!cur && !got_digit)
|
||||||
{
|
{
|
||||||
semsg(_(e_nfa_regexp_missing_value_in_chr),
|
semsg(_(e_nfa_regexp_missing_value_in_chr),
|
||||||
no_Magic(c));
|
no_Magic(c));
|
||||||
|
@@ -91,16 +91,29 @@ func Test_multi_failure()
|
|||||||
set re=0
|
set re=0
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_column_failure()
|
func Test_column_success_failure()
|
||||||
|
new
|
||||||
|
call setline(1, 'xbar')
|
||||||
|
|
||||||
set re=1
|
set re=1
|
||||||
|
%s/\%>0v./A/
|
||||||
|
call assert_equal('Abar', getline(1))
|
||||||
call assert_fails('/\%v', 'E71:')
|
call assert_fails('/\%v', 'E71:')
|
||||||
|
call assert_fails('/\%>v', 'E71:')
|
||||||
call assert_fails('/\%c', 'E71:')
|
call assert_fails('/\%c', 'E71:')
|
||||||
|
call assert_fails('/\%<c', 'E71:')
|
||||||
call assert_fails('/\%l', 'E71:')
|
call assert_fails('/\%l', 'E71:')
|
||||||
set re=2
|
set re=2
|
||||||
|
%s/\%>0v./B/
|
||||||
|
call assert_equal('Bbar', getline(1))
|
||||||
call assert_fails('/\%v', 'E1273:')
|
call assert_fails('/\%v', 'E1273:')
|
||||||
|
call assert_fails('/\%>v', 'E1273:')
|
||||||
call assert_fails('/\%c', 'E1273:')
|
call assert_fails('/\%c', 'E1273:')
|
||||||
|
call assert_fails('/\%<c', 'E1273:')
|
||||||
call assert_fails('/\%l', 'E1273:')
|
call assert_fails('/\%l', 'E1273:')
|
||||||
|
|
||||||
set re=0
|
set re=0
|
||||||
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_recursive_addstate()
|
func Test_recursive_addstate()
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4693,
|
||||||
/**/
|
/**/
|
||||||
4692,
|
4692,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user