mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.3.1092
Problem: Can't build with regexp debugging. NFA debug output shows wrong pattern. Solution: Fix debugging code for recent changes. Add the pattern to the program.
This commit is contained in:
@@ -86,12 +86,14 @@ typedef struct
|
|||||||
regengine_T *engine;
|
regengine_T *engine;
|
||||||
unsigned regflags;
|
unsigned regflags;
|
||||||
|
|
||||||
regprog_T regprog;
|
nfa_state_T *start; /* points into state[] */
|
||||||
nfa_state_T *start;
|
|
||||||
int has_zend; /* pattern contains \ze */
|
int has_zend; /* pattern contains \ze */
|
||||||
int has_backref; /* pattern contains \1 .. \9 */
|
int has_backref; /* pattern contains \1 .. \9 */
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
int reghasz;
|
int reghasz;
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
char_u *pattern;
|
||||||
#endif
|
#endif
|
||||||
int nsubexp; /* number of () */
|
int nsubexp; /* number of () */
|
||||||
int nstate;
|
int nstate;
|
||||||
|
@@ -3133,12 +3133,12 @@ skip_add:
|
|||||||
{
|
{
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (thread->sub.in_use <= 0)
|
if (thread->subs.norm.in_use <= 0)
|
||||||
col = -1;
|
col = -1;
|
||||||
else if (REG_MULTI)
|
else if (REG_MULTI)
|
||||||
col = thread->sub.list.multi[0].start.col;
|
col = thread->subs.norm.list.multi[0].start.col;
|
||||||
else
|
else
|
||||||
col = (int)(thread->sub.list.line[0].start - regline);
|
col = (int)(thread->subs.norm.list.line[0].start - regline);
|
||||||
nfa_set_code(state->c);
|
nfa_set_code(state->c);
|
||||||
fprintf(log_fd, "> Adding state %d to list %d. char %d: %s (start col %d)\n",
|
fprintf(log_fd, "> Adding state %d to list %d. char %d: %s (start col %d)\n",
|
||||||
abs(state->id), l->id, state->c, code, col);
|
abs(state->id), l->id, state->c, code, col);
|
||||||
@@ -3152,12 +3152,12 @@ skip_add:
|
|||||||
{
|
{
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (sub->in_use <= 0)
|
if (subs->norm.in_use <= 0)
|
||||||
col = -1;
|
col = -1;
|
||||||
else if (REG_MULTI)
|
else if (REG_MULTI)
|
||||||
col = sub->list.multi[0].start.col;
|
col = subs->norm.list.multi[0].start.col;
|
||||||
else
|
else
|
||||||
col = (int)(sub->list.line[0].start - regline);
|
col = (int)(subs->norm.list.line[0].start - regline);
|
||||||
nfa_set_code(state->c);
|
nfa_set_code(state->c);
|
||||||
fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start col %d)\n",
|
fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start col %d)\n",
|
||||||
abs(state->id), l->id, state->c, code, col);
|
abs(state->id), l->id, state->c, code, col);
|
||||||
@@ -3836,12 +3836,12 @@ nfa_regmatch(start, submatch, m, endp)
|
|||||||
{
|
{
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (t->sub.in_use <= 0)
|
if (t->subs.norm.in_use <= 0)
|
||||||
col = -1;
|
col = -1;
|
||||||
else if (REG_MULTI)
|
else if (REG_MULTI)
|
||||||
col = t->sub.list.multi[0].start.col;
|
col = t->subs.norm.list.multi[0].start.col;
|
||||||
else
|
else
|
||||||
col = (int)(t->sub.list.line[0].start - regline);
|
col = (int)(t->subs.norm.list.line[0].start - regline);
|
||||||
nfa_set_code(t->state->c);
|
nfa_set_code(t->state->c);
|
||||||
fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
|
fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
|
||||||
abs(t->state->id), (int)t->state->c, code, col);
|
abs(t->state->id), (int)t->state->c, code, col);
|
||||||
@@ -4818,6 +4818,9 @@ nfa_regexec_both(line, col)
|
|||||||
nfa_has_zend = prog->has_zend;
|
nfa_has_zend = prog->has_zend;
|
||||||
nfa_has_backref = prog->has_backref;
|
nfa_has_backref = prog->has_backref;
|
||||||
nfa_nsubexpr = prog->nsubexp;
|
nfa_nsubexpr = prog->nsubexp;
|
||||||
|
#ifdef DEBUG
|
||||||
|
nfa_regengine.expr = prog->pattern;
|
||||||
|
#endif
|
||||||
|
|
||||||
nstate = prog->nstate;
|
nstate = prog->nstate;
|
||||||
for (i = 0; i < nstate; ++i)
|
for (i = 0; i < nstate; ++i)
|
||||||
@@ -4828,6 +4831,10 @@ nfa_regexec_both(line, col)
|
|||||||
|
|
||||||
retval = nfa_regtry(prog, col);
|
retval = nfa_regtry(prog, col);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
nfa_regengine.expr = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
theend:
|
theend:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -4921,6 +4928,10 @@ nfa_regcomp(expr, re_flags)
|
|||||||
/* Remember whether this pattern has any \z specials in it. */
|
/* Remember whether this pattern has any \z specials in it. */
|
||||||
prog->reghasz = re_has_z;
|
prog->reghasz = re_has_z;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
prog->pattern = vim_strsave(expr); /* memory will leak */
|
||||||
|
nfa_regengine.expr = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
out:
|
out:
|
||||||
vim_free(post_start);
|
vim_free(post_start);
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1092,
|
||||||
/**/
|
/**/
|
||||||
1091,
|
1091,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user