mirror of
https://github.com/vim/vim.git
synced 2025-08-23 19:34:27 -04:00
updated for version 7.3.1082
Problem: New regexp engine: Problem with \@= matching. Solution: Save and restore nfa_match.
This commit is contained in:
parent
99dc19d1cc
commit
14f55c6f67
@ -3332,11 +3332,8 @@ nfa_regmatch(start, submatch, m)
|
|||||||
int result;
|
int result;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
int old_reglnum = -1;
|
|
||||||
int go_to_nextline = FALSE;
|
int go_to_nextline = FALSE;
|
||||||
nfa_thread_T *t;
|
nfa_thread_T *t;
|
||||||
char_u *old_reginput = NULL;
|
|
||||||
char_u *old_regline = NULL;
|
|
||||||
nfa_list_T list[3];
|
nfa_list_T list[3];
|
||||||
nfa_list_T *listtbl[2][2];
|
nfa_list_T *listtbl[2][2];
|
||||||
nfa_list_T *ll;
|
nfa_list_T *ll;
|
||||||
@ -3560,12 +3557,15 @@ nfa_regmatch(start, submatch, m)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NFA_START_INVISIBLE:
|
case NFA_START_INVISIBLE:
|
||||||
/* Save global variables, and call nfa_regmatch() to check if
|
{
|
||||||
* the current concat matches at this position. The concat
|
char_u *save_reginput = reginput;
|
||||||
* ends with the node NFA_END_INVISIBLE */
|
char_u *save_regline = regline;
|
||||||
old_reginput = reginput;
|
int save_reglnum = reglnum;
|
||||||
old_regline = regline;
|
int save_nfa_match = nfa_match;
|
||||||
old_reglnum = reglnum;
|
|
||||||
|
/* Call nfa_regmatch() to check if the current concat matches
|
||||||
|
* at this position. The concat ends with the node
|
||||||
|
* NFA_END_INVISIBLE */
|
||||||
if (listids == NULL)
|
if (listids == NULL)
|
||||||
{
|
{
|
||||||
listids = (int *)lalloc(sizeof(int) * nstate, TRUE);
|
listids = (int *)lalloc(sizeof(int) * nstate, TRUE);
|
||||||
@ -3588,7 +3588,12 @@ nfa_regmatch(start, submatch, m)
|
|||||||
result = nfa_regmatch(t->state->out, submatch, m);
|
result = nfa_regmatch(t->state->out, submatch, m);
|
||||||
nfa_set_neg_listids(start);
|
nfa_set_neg_listids(start);
|
||||||
nfa_restore_listids(start, listids);
|
nfa_restore_listids(start, listids);
|
||||||
nfa_match = FALSE;
|
|
||||||
|
/* restore position in input text */
|
||||||
|
reginput = save_reginput;
|
||||||
|
regline = save_regline;
|
||||||
|
reglnum = save_reglnum;
|
||||||
|
nfa_match = save_nfa_match;
|
||||||
|
|
||||||
#ifdef ENABLE_LOG
|
#ifdef ENABLE_LOG
|
||||||
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
|
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
|
||||||
@ -3610,10 +3615,6 @@ nfa_regmatch(start, submatch, m)
|
|||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
/* Restore position in input text */
|
|
||||||
reginput = old_reginput;
|
|
||||||
regline = old_regline;
|
|
||||||
reglnum = old_reglnum;
|
|
||||||
/* Copy submatch info from the recursive call */
|
/* Copy submatch info from the recursive call */
|
||||||
if (REG_MULTI)
|
if (REG_MULTI)
|
||||||
for (j = 1; j < m->in_use; j++)
|
for (j = 1; j < m->in_use; j++)
|
||||||
@ -3635,12 +3636,8 @@ nfa_regmatch(start, submatch, m)
|
|||||||
addstate_here(thislist, t->state->out1->out, &t->sub,
|
addstate_here(thislist, t->state->out1->out, &t->sub,
|
||||||
&listidx);
|
&listidx);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* continue with next input char */
|
|
||||||
reginput = old_reginput;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case NFA_BOL:
|
case NFA_BOL:
|
||||||
if (reginput == regline)
|
if (reginput == regline)
|
||||||
|
@ -305,6 +305,7 @@ STARTTEST
|
|||||||
:call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
|
:call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
|
||||||
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
|
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
|
||||||
:call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
|
:call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
|
||||||
|
:call add(tl, [2, '\<\S\+\())\)\@=', '$((i=i+1))', 'i=i+1', '))'])
|
||||||
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
|
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
|
||||||
:call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
|
:call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
|
||||||
:call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
|
:call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
|
||||||
|
@ -669,6 +669,9 @@ OK 2 - \(.*John\)\@=.*Bob
|
|||||||
OK 0 - \(John.*\)\@=.*Bob
|
OK 0 - \(John.*\)\@=.*Bob
|
||||||
OK 1 - \(John.*\)\@=.*Bob
|
OK 1 - \(John.*\)\@=.*Bob
|
||||||
OK 2 - \(John.*\)\@=.*Bob
|
OK 2 - \(John.*\)\@=.*Bob
|
||||||
|
OK 0 - \<\S\+\())\)\@=
|
||||||
|
OK 1 - \<\S\+\())\)\@=
|
||||||
|
OK 2 - \<\S\+\())\)\@=
|
||||||
OK 0 - .*John\&.*Bob
|
OK 0 - .*John\&.*Bob
|
||||||
OK 1 - .*John\&.*Bob
|
OK 1 - .*John\&.*Bob
|
||||||
OK 2 - .*John\&.*Bob
|
OK 2 - .*John\&.*Bob
|
||||||
|
@ -728,6 +728,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 */
|
||||||
|
/**/
|
||||||
|
1082,
|
||||||
/**/
|
/**/
|
||||||
1081,
|
1081,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user