|
Karsten Hopp |
9ce2db |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
9ce2db |
Subject: Patch 7.3.1122
|
|
Karsten Hopp |
9ce2db |
Fcc: outbox
|
|
Karsten Hopp |
9ce2db |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
9ce2db |
Mime-Version: 1.0
|
|
Karsten Hopp |
9ce2db |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
9ce2db |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
9ce2db |
------------
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
Patch 7.3.1122
|
|
Karsten Hopp |
9ce2db |
Problem: New regexp engine: \@> not supported.
|
|
Karsten Hopp |
9ce2db |
Solution: Implement \@>.
|
|
Karsten Hopp |
9ce2db |
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
*** ../vim-7.3.1121/src/regexp_nfa.c 2013-06-05 16:51:53.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
--- src/regexp_nfa.c 2013-06-05 18:45:57.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 57,63 ****
|
|
Karsten Hopp |
9ce2db |
--- 57,65 ----
|
|
Karsten Hopp |
9ce2db |
NFA_NCLOSE, /* End of subexpr. marked with \%( ... \) */
|
|
Karsten Hopp |
9ce2db |
NFA_START_INVISIBLE,
|
|
Karsten Hopp |
9ce2db |
NFA_START_INVISIBLE_BEFORE,
|
|
Karsten Hopp |
9ce2db |
+ NFA_START_PATTERN,
|
|
Karsten Hopp |
9ce2db |
NFA_END_INVISIBLE,
|
|
Karsten Hopp |
9ce2db |
+ NFA_END_PATTERN,
|
|
Karsten Hopp |
9ce2db |
NFA_COMPOSING, /* Next nodes in NFA are part of the
|
|
Karsten Hopp |
9ce2db |
composing multibyte char */
|
|
Karsten Hopp |
9ce2db |
NFA_END_COMPOSING, /* End of a composing char in the NFA */
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 1505,1513 ****
|
|
Karsten Hopp |
9ce2db |
i = NFA_PREV_ATOM_JUST_BEFORE_NEG;
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
case '>':
|
|
Karsten Hopp |
9ce2db |
! /* \@> Not supported yet */
|
|
Karsten Hopp |
9ce2db |
! /* i = NFA_PREV_ATOM_LIKE_PATTERN; */
|
|
Karsten Hopp |
9ce2db |
! return FAIL;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
if (i == 0)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
--- 1507,1515 ----
|
|
Karsten Hopp |
9ce2db |
i = NFA_PREV_ATOM_JUST_BEFORE_NEG;
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
case '>':
|
|
Karsten Hopp |
9ce2db |
! /* \@> */
|
|
Karsten Hopp |
9ce2db |
! i = NFA_PREV_ATOM_LIKE_PATTERN;
|
|
Karsten Hopp |
9ce2db |
! break;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
if (i == 0)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 1885,1896 ****
|
|
Karsten Hopp |
9ce2db |
--- 1887,1903 ----
|
|
Karsten Hopp |
9ce2db |
STRCPY(code, "NFA_PREV_ATOM_JUST_BEFORE"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9ce2db |
STRCPY(code, "NFA_PREV_ATOM_JUST_BEFORE_NEG"); break;
|
|
Karsten Hopp |
9ce2db |
+ case NFA_PREV_ATOM_LIKE_PATTERN:
|
|
Karsten Hopp |
9ce2db |
+ STRCPY(code, "NFA_PREV_ATOM_LIKE_PATTERN"); break;
|
|
Karsten Hopp |
9ce2db |
+
|
|
Karsten Hopp |
9ce2db |
case NFA_NOPEN: STRCPY(code, "NFA_NOPEN"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_NCLOSE: STRCPY(code, "NFA_NCLOSE"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_START_INVISIBLE_BEFORE:
|
|
Karsten Hopp |
9ce2db |
STRCPY(code, "NFA_START_INVISIBLE_BEFORE"); break;
|
|
Karsten Hopp |
9ce2db |
+ case NFA_START_PATTERN: STRCPY(code, "NFA_START_PATTERN"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
|
|
Karsten Hopp |
9ce2db |
+ case NFA_END_PATTERN: STRCPY(code, "NFA_END_PATTERN"); break;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
|
|
Karsten Hopp |
9ce2db |
case NFA_END_COMPOSING: STRCPY(code, "NFA_END_COMPOSING"); break;
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 2601,2612 ****
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_NO_WIDTH_NEG:
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_JUST_BEFORE:
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
int neg = (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
|
|
Karsten Hopp |
9ce2db |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9ce2db |
int before = (*p == NFA_PREV_ATOM_JUST_BEFORE
|
|
Karsten Hopp |
9ce2db |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9ce2db |
! int n;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
if (before)
|
|
Karsten Hopp |
9ce2db |
n = *++p; /* get the count */
|
|
Karsten Hopp |
9ce2db |
--- 2608,2633 ----
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_NO_WIDTH_NEG:
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_JUST_BEFORE:
|
|
Karsten Hopp |
9ce2db |
case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9ce2db |
+ case NFA_PREV_ATOM_LIKE_PATTERN:
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
int neg = (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
|
|
Karsten Hopp |
9ce2db |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9ce2db |
int before = (*p == NFA_PREV_ATOM_JUST_BEFORE
|
|
Karsten Hopp |
9ce2db |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9ce2db |
! int pattern = (*p == NFA_PREV_ATOM_LIKE_PATTERN);
|
|
Karsten Hopp |
9ce2db |
! int start_state = NFA_START_INVISIBLE;
|
|
Karsten Hopp |
9ce2db |
! int end_state = NFA_END_INVISIBLE;
|
|
Karsten Hopp |
9ce2db |
! int n = 0;
|
|
Karsten Hopp |
9ce2db |
! nfa_state_T *zend;
|
|
Karsten Hopp |
9ce2db |
! nfa_state_T *skip;
|
|
Karsten Hopp |
9ce2db |
!
|
|
Karsten Hopp |
9ce2db |
! if (before)
|
|
Karsten Hopp |
9ce2db |
! start_state = NFA_START_INVISIBLE_BEFORE;
|
|
Karsten Hopp |
9ce2db |
! else if (pattern)
|
|
Karsten Hopp |
9ce2db |
! {
|
|
Karsten Hopp |
9ce2db |
! start_state = NFA_START_PATTERN;
|
|
Karsten Hopp |
9ce2db |
! end_state = NFA_END_PATTERN;
|
|
Karsten Hopp |
9ce2db |
! }
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
if (before)
|
|
Karsten Hopp |
9ce2db |
n = *++p; /* get the count */
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 2620,2635 ****
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
! nstate += 2;
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
e = POP();
|
|
Karsten Hopp |
9ce2db |
! s1 = alloc_state(NFA_END_INVISIBLE, NULL, NULL);
|
|
Karsten Hopp |
9ce2db |
if (s1 == NULL)
|
|
Karsten Hopp |
9ce2db |
goto theend;
|
|
Karsten Hopp |
9ce2db |
- patch(e.out, s1);
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
! s = alloc_state(NFA_START_INVISIBLE, e.start, s1);
|
|
Karsten Hopp |
9ce2db |
if (s == NULL)
|
|
Karsten Hopp |
9ce2db |
goto theend;
|
|
Karsten Hopp |
9ce2db |
if (neg)
|
|
Karsten Hopp |
9ce2db |
--- 2641,2655 ----
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
! nstate += pattern ? 4 : 2;
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
e = POP();
|
|
Karsten Hopp |
9ce2db |
! s1 = alloc_state(end_state, NULL, NULL);
|
|
Karsten Hopp |
9ce2db |
if (s1 == NULL)
|
|
Karsten Hopp |
9ce2db |
goto theend;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
! s = alloc_state(start_state, e.start, s1);
|
|
Karsten Hopp |
9ce2db |
if (s == NULL)
|
|
Karsten Hopp |
9ce2db |
goto theend;
|
|
Karsten Hopp |
9ce2db |
if (neg)
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 2638,2649 ****
|
|
Karsten Hopp |
9ce2db |
s1->negated = TRUE;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
if (before)
|
|
Karsten Hopp |
9ce2db |
- {
|
|
Karsten Hopp |
9ce2db |
s->val = n; /* store the count */
|
|
Karsten Hopp |
9ce2db |
! ++s->c; /* NFA_START_INVISIBLE -> NFA_START_INVISIBLE_BEFORE */
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
-
|
|
Karsten Hopp |
9ce2db |
- PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
--- 2658,2678 ----
|
|
Karsten Hopp |
9ce2db |
s1->negated = TRUE;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
if (before)
|
|
Karsten Hopp |
9ce2db |
s->val = n; /* store the count */
|
|
Karsten Hopp |
9ce2db |
! if (pattern)
|
|
Karsten Hopp |
9ce2db |
! {
|
|
Karsten Hopp |
9ce2db |
! /* NFA_ZEND -> NFA_END_PATTERN -> NFA_SKIP -> what follows. */
|
|
Karsten Hopp |
9ce2db |
! skip = alloc_state(NFA_SKIP, NULL, NULL);
|
|
Karsten Hopp |
9ce2db |
! zend = alloc_state(NFA_ZEND, s1, NULL);
|
|
Karsten Hopp |
9ce2db |
! s1->out= skip;
|
|
Karsten Hopp |
9ce2db |
! patch(e.out, zend);
|
|
Karsten Hopp |
9ce2db |
! PUSH(frag(s, list1(&skip->out)));
|
|
Karsten Hopp |
9ce2db |
! }
|
|
Karsten Hopp |
9ce2db |
! else
|
|
Karsten Hopp |
9ce2db |
! {
|
|
Karsten Hopp |
9ce2db |
! patch(e.out, s1);
|
|
Karsten Hopp |
9ce2db |
! PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 2953,2959 ****
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
for (j = 0; j < sub->in_use; j++)
|
|
Karsten Hopp |
9ce2db |
if (REG_MULTI)
|
|
Karsten Hopp |
9ce2db |
! fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d",
|
|
Karsten Hopp |
9ce2db |
j,
|
|
Karsten Hopp |
9ce2db |
sub->list.multi[j].start.col,
|
|
Karsten Hopp |
9ce2db |
(int)sub->list.multi[j].start.lnum,
|
|
Karsten Hopp |
9ce2db |
--- 2982,2988 ----
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
for (j = 0; j < sub->in_use; j++)
|
|
Karsten Hopp |
9ce2db |
if (REG_MULTI)
|
|
Karsten Hopp |
9ce2db |
! fprintf(log_fd, "*** group %d, start: c=%d, l=%d, end: c=%d, l=%d\n",
|
|
Karsten Hopp |
9ce2db |
j,
|
|
Karsten Hopp |
9ce2db |
sub->list.multi[j].start.col,
|
|
Karsten Hopp |
9ce2db |
(int)sub->list.multi[j].start.lnum,
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 2964,2975 ****
|
|
Karsten Hopp |
9ce2db |
char *s = (char *)sub->list.line[j].start;
|
|
Karsten Hopp |
9ce2db |
char *e = (char *)sub->list.line[j].end;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
! fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"",
|
|
Karsten Hopp |
9ce2db |
j,
|
|
Karsten Hopp |
9ce2db |
s == NULL ? "NULL" : s,
|
|
Karsten Hopp |
9ce2db |
e == NULL ? "NULL" : e);
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
- fprintf(log_fd, "\n");
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
--- 2993,3003 ----
|
|
Karsten Hopp |
9ce2db |
char *s = (char *)sub->list.line[j].start;
|
|
Karsten Hopp |
9ce2db |
char *e = (char *)sub->list.line[j].end;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
! fprintf(log_fd, "*** group %d, start: \"%s\", end: \"%s\"\n",
|
|
Karsten Hopp |
9ce2db |
j,
|
|
Karsten Hopp |
9ce2db |
s == NULL ? "NULL" : s,
|
|
Karsten Hopp |
9ce2db |
e == NULL ? "NULL" : e);
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4317,4322 ****
|
|
Karsten Hopp |
9ce2db |
--- 4345,4351 ----
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
case NFA_END_INVISIBLE:
|
|
Karsten Hopp |
9ce2db |
+ case NFA_END_PATTERN:
|
|
Karsten Hopp |
9ce2db |
/*
|
|
Karsten Hopp |
9ce2db |
* This is only encountered after a NFA_START_INVISIBLE or
|
|
Karsten Hopp |
9ce2db |
* NFA_START_INVISIBLE_BEFORE node.
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4343,4349 ****
|
|
Karsten Hopp |
9ce2db |
(int)(nfa_endp->se_u.ptr - reginput));
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
! /* It's only a match if it ends at "nfa_endp" */
|
|
Karsten Hopp |
9ce2db |
if (nfa_endp != NULL && (REG_MULTI
|
|
Karsten Hopp |
9ce2db |
? (reglnum != nfa_endp->se_u.pos.lnum
|
|
Karsten Hopp |
9ce2db |
|| (int)(reginput - regline)
|
|
Karsten Hopp |
9ce2db |
--- 4372,4379 ----
|
|
Karsten Hopp |
9ce2db |
(int)(nfa_endp->se_u.ptr - reginput));
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
! /* If "nfa_endp" is set it's only a match if it ends at
|
|
Karsten Hopp |
9ce2db |
! * "nfa_endp" */
|
|
Karsten Hopp |
9ce2db |
if (nfa_endp != NULL && (REG_MULTI
|
|
Karsten Hopp |
9ce2db |
? (reglnum != nfa_endp->se_u.pos.lnum
|
|
Karsten Hopp |
9ce2db |
|| (int)(reginput - regline)
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4360,4365 ****
|
|
Karsten Hopp |
9ce2db |
--- 4390,4399 ----
|
|
Karsten Hopp |
9ce2db |
copy_sub(&m->synt, &t->subs.synt);
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
+ #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
+ fprintf(log_fd, "Match found:\n");
|
|
Karsten Hopp |
9ce2db |
+ log_subsexpr(m);
|
|
Karsten Hopp |
9ce2db |
+ #endif
|
|
Karsten Hopp |
9ce2db |
nfa_match = TRUE;
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4435,4440 ****
|
|
Karsten Hopp |
9ce2db |
--- 4469,4531 ----
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
+ case NFA_START_PATTERN:
|
|
Karsten Hopp |
9ce2db |
+ /* First try matching the pattern. */
|
|
Karsten Hopp |
9ce2db |
+ result = recursive_regmatch(t->state, prog,
|
|
Karsten Hopp |
9ce2db |
+ submatch, m, &listids);
|
|
Karsten Hopp |
9ce2db |
+ if (result)
|
|
Karsten Hopp |
9ce2db |
+ {
|
|
Karsten Hopp |
9ce2db |
+ int bytelen;
|
|
Karsten Hopp |
9ce2db |
+
|
|
Karsten Hopp |
9ce2db |
+ #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
+ fprintf(log_fd, "NFA_START_PATTERN matches:\n");
|
|
Karsten Hopp |
9ce2db |
+ log_subsexpr(m);
|
|
Karsten Hopp |
9ce2db |
+ #endif
|
|
Karsten Hopp |
9ce2db |
+ /* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9ce2db |
+ copy_sub_off(&t->subs.norm, &m->norm);
|
|
Karsten Hopp |
9ce2db |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
9ce2db |
+ copy_sub_off(&t->subs.synt, &m->synt);
|
|
Karsten Hopp |
9ce2db |
+ #endif
|
|
Karsten Hopp |
9ce2db |
+ /* Now we need to skip over the matched text and then
|
|
Karsten Hopp |
9ce2db |
+ * continue with what follows. */
|
|
Karsten Hopp |
9ce2db |
+ if (REG_MULTI)
|
|
Karsten Hopp |
9ce2db |
+ /* TODO: multi-line match */
|
|
Karsten Hopp |
9ce2db |
+ bytelen = m->norm.list.multi[0].end.col
|
|
Karsten Hopp |
9ce2db |
+ - (int)(reginput - regline);
|
|
Karsten Hopp |
9ce2db |
+ else
|
|
Karsten Hopp |
9ce2db |
+ bytelen = (int)(m->norm.list.line[0].end - reginput);
|
|
Karsten Hopp |
9ce2db |
+
|
|
Karsten Hopp |
9ce2db |
+ #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
+ fprintf(log_fd, "NFA_START_PATTERN length: %d\n", bytelen);
|
|
Karsten Hopp |
9ce2db |
+ #endif
|
|
Karsten Hopp |
9ce2db |
+ if (bytelen == 0)
|
|
Karsten Hopp |
9ce2db |
+ {
|
|
Karsten Hopp |
9ce2db |
+ /* empty match, output of corresponding
|
|
Karsten Hopp |
9ce2db |
+ * NFA_END_PATTERN/NFA_SKIP to be used at current
|
|
Karsten Hopp |
9ce2db |
+ * position */
|
|
Karsten Hopp |
9ce2db |
+ addstate_here(thislist, t->state->out1->out->out,
|
|
Karsten Hopp |
9ce2db |
+ &t->subs, t->pim, &listidx);
|
|
Karsten Hopp |
9ce2db |
+ }
|
|
Karsten Hopp |
9ce2db |
+ else if (bytelen <= clen)
|
|
Karsten Hopp |
9ce2db |
+ {
|
|
Karsten Hopp |
9ce2db |
+ /* match current character, output of corresponding
|
|
Karsten Hopp |
9ce2db |
+ * NFA_END_PATTERN to be used at next position. */
|
|
Karsten Hopp |
9ce2db |
+ ll = nextlist;
|
|
Karsten Hopp |
9ce2db |
+ add_state = t->state->out1->out->out;
|
|
Karsten Hopp |
9ce2db |
+ add_off = clen;
|
|
Karsten Hopp |
9ce2db |
+ }
|
|
Karsten Hopp |
9ce2db |
+ else
|
|
Karsten Hopp |
9ce2db |
+ {
|
|
Karsten Hopp |
9ce2db |
+ /* skip over the matched characters, set character
|
|
Karsten Hopp |
9ce2db |
+ * count in NFA_SKIP */
|
|
Karsten Hopp |
9ce2db |
+ ll = nextlist;
|
|
Karsten Hopp |
9ce2db |
+ add_state = t->state->out1->out;
|
|
Karsten Hopp |
9ce2db |
+ add_off = bytelen;
|
|
Karsten Hopp |
9ce2db |
+ add_count = bytelen - clen;
|
|
Karsten Hopp |
9ce2db |
+ }
|
|
Karsten Hopp |
9ce2db |
+ }
|
|
Karsten Hopp |
9ce2db |
+ break;
|
|
Karsten Hopp |
9ce2db |
+
|
|
Karsten Hopp |
9ce2db |
case NFA_BOL:
|
|
Karsten Hopp |
9ce2db |
if (reginput == regline)
|
|
Karsten Hopp |
9ce2db |
addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4846,4854 ****
|
|
Karsten Hopp |
9ce2db |
ll = nextlist;
|
|
Karsten Hopp |
9ce2db |
add_state = t->state->out->out;
|
|
Karsten Hopp |
9ce2db |
add_off = clen;
|
|
Karsten Hopp |
9ce2db |
- #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
- log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
9ce2db |
- #endif
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
else
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
--- 4937,4942 ----
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4858,4866 ****
|
|
Karsten Hopp |
9ce2db |
add_state = t->state->out;
|
|
Karsten Hopp |
9ce2db |
add_off = bytelen;
|
|
Karsten Hopp |
9ce2db |
add_count = bytelen - clen;
|
|
Karsten Hopp |
9ce2db |
- #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
- log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
9ce2db |
- #endif
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
--- 4946,4951 ----
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4873,4881 ****
|
|
Karsten Hopp |
9ce2db |
ll = nextlist;
|
|
Karsten Hopp |
9ce2db |
add_state = t->state->out;
|
|
Karsten Hopp |
9ce2db |
add_off = clen;
|
|
Karsten Hopp |
9ce2db |
- #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
- log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
9ce2db |
- #endif
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
else
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
--- 4958,4963 ----
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 4884,4892 ****
|
|
Karsten Hopp |
9ce2db |
add_state = t->state;
|
|
Karsten Hopp |
9ce2db |
add_off = 0;
|
|
Karsten Hopp |
9ce2db |
add_count = t->count - clen;
|
|
Karsten Hopp |
9ce2db |
- #ifdef ENABLE_LOG
|
|
Karsten Hopp |
9ce2db |
- log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
9ce2db |
- #endif
|
|
Karsten Hopp |
9ce2db |
}
|
|
Karsten Hopp |
9ce2db |
break;
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
--- 4966,4971 ----
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 5158,5170 ****
|
|
Karsten Hopp |
9ce2db |
f = fopen(NFA_REGEXP_RUN_LOG, "a");
|
|
Karsten Hopp |
9ce2db |
if (f != NULL)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
! fprintf(f, "\n\n\n\n\n\n\t\t=======================================================\n");
|
|
Karsten Hopp |
9ce2db |
! fprintf(f, " =======================================================\n");
|
|
Karsten Hopp |
9ce2db |
#ifdef DEBUG
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\tRegexp is \"%s\"\n", nfa_regengine.expr);
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\tInput text is \"%s\" \n", reginput);
|
|
Karsten Hopp |
9ce2db |
! fprintf(f, " =======================================================\n\n");
|
|
Karsten Hopp |
9ce2db |
nfa_print_state(f, start);
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\n\n");
|
|
Karsten Hopp |
9ce2db |
fclose(f);
|
|
Karsten Hopp |
9ce2db |
--- 5237,5248 ----
|
|
Karsten Hopp |
9ce2db |
f = fopen(NFA_REGEXP_RUN_LOG, "a");
|
|
Karsten Hopp |
9ce2db |
if (f != NULL)
|
|
Karsten Hopp |
9ce2db |
{
|
|
Karsten Hopp |
9ce2db |
! fprintf(f, "\n\n\t=======================================================\n");
|
|
Karsten Hopp |
9ce2db |
#ifdef DEBUG
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\tRegexp is \"%s\"\n", nfa_regengine.expr);
|
|
Karsten Hopp |
9ce2db |
#endif
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\tInput text is \"%s\" \n", reginput);
|
|
Karsten Hopp |
9ce2db |
! fprintf(f, "\t=======================================================\n\n");
|
|
Karsten Hopp |
9ce2db |
nfa_print_state(f, start);
|
|
Karsten Hopp |
9ce2db |
fprintf(f, "\n\n");
|
|
Karsten Hopp |
9ce2db |
fclose(f);
|
|
Karsten Hopp |
9ce2db |
*** ../vim-7.3.1121/src/testdir/test64.in 2013-06-05 11:05:12.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
--- src/testdir/test64.in 2013-06-05 18:45:28.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 385,390 ****
|
|
Karsten Hopp |
9ce2db |
--- 385,396 ----
|
|
Karsten Hopp |
9ce2db |
:call add(tl, [2, '\(<<\)\@2<=span.', 'xxspanxxxx
|
|
Karsten Hopp |
9ce2db |
:call add(tl, [2, '\(foo\)\@
|
|
Karsten Hopp |
9ce2db |
:"
|
|
Karsten Hopp |
9ce2db |
+ :""""" \@>
|
|
Karsten Hopp |
9ce2db |
+ :call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
|
|
Karsten Hopp |
9ce2db |
+ :call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
|
|
Karsten Hopp |
9ce2db |
+ :" TODO: BT engine does not restore submatch after failure
|
|
Karsten Hopp |
9ce2db |
+ :call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa'])
|
|
Karsten Hopp |
9ce2db |
+ :"
|
|
Karsten Hopp |
9ce2db |
:"""" "\_" prepended negated collection matches EOL
|
|
Karsten Hopp |
9ce2db |
:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
|
|
Karsten Hopp |
9ce2db |
:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 401,407 ****
|
|
Karsten Hopp |
9ce2db |
: let text = t[2]
|
|
Karsten Hopp |
9ce2db |
: let matchidx = 3
|
|
Karsten Hopp |
9ce2db |
: for engine in [0, 1, 2]
|
|
Karsten Hopp |
9ce2db |
! : if engine == 2 && !re
|
|
Karsten Hopp |
9ce2db |
: continue
|
|
Karsten Hopp |
9ce2db |
: endif
|
|
Karsten Hopp |
9ce2db |
: let ®expengine = engine
|
|
Karsten Hopp |
9ce2db |
--- 407,413 ----
|
|
Karsten Hopp |
9ce2db |
: let text = t[2]
|
|
Karsten Hopp |
9ce2db |
: let matchidx = 3
|
|
Karsten Hopp |
9ce2db |
: for engine in [0, 1, 2]
|
|
Karsten Hopp |
9ce2db |
! : if engine == 2 && re == 0 || engine == 1 && re ==1
|
|
Karsten Hopp |
9ce2db |
: continue
|
|
Karsten Hopp |
9ce2db |
: endif
|
|
Karsten Hopp |
9ce2db |
: let ®expengine = engine
|
|
Karsten Hopp |
9ce2db |
*** ../vim-7.3.1121/src/testdir/test64.ok 2013-06-05 11:05:12.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
--- src/testdir/test64.ok 2013-06-05 18:47:54.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 872,877 ****
|
|
Karsten Hopp |
9ce2db |
--- 872,885 ----
|
|
Karsten Hopp |
9ce2db |
OK 0 - \(foo\)\@
|
|
Karsten Hopp |
9ce2db |
OK 1 - \(foo\)\@
|
|
Karsten Hopp |
9ce2db |
OK 2 - \(foo\)\@
|
|
Karsten Hopp |
9ce2db |
+ OK 0 - \(a*\)\@>a
|
|
Karsten Hopp |
9ce2db |
+ OK 1 - \(a*\)\@>a
|
|
Karsten Hopp |
9ce2db |
+ OK 2 - \(a*\)\@>a
|
|
Karsten Hopp |
9ce2db |
+ OK 0 - \(a*\)\@>b
|
|
Karsten Hopp |
9ce2db |
+ OK 1 - \(a*\)\@>b
|
|
Karsten Hopp |
9ce2db |
+ OK 2 - \(a*\)\@>b
|
|
Karsten Hopp |
9ce2db |
+ OK 0 - \(a*\)\@>a\|a\+
|
|
Karsten Hopp |
9ce2db |
+ OK 2 - \(a*\)\@>a\|a\+
|
|
Karsten Hopp |
9ce2db |
OK 0 - \_[^8-9]\+
|
|
Karsten Hopp |
9ce2db |
OK 1 - \_[^8-9]\+
|
|
Karsten Hopp |
9ce2db |
OK 2 - \_[^8-9]\+
|
|
Karsten Hopp |
9ce2db |
*** ../vim-7.3.1121/src/version.c 2013-06-05 16:51:53.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
--- src/version.c 2013-06-05 18:51:35.000000000 +0200
|
|
Karsten Hopp |
9ce2db |
***************
|
|
Karsten Hopp |
9ce2db |
*** 730,731 ****
|
|
Karsten Hopp |
9ce2db |
--- 730,733 ----
|
|
Karsten Hopp |
9ce2db |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
9ce2db |
+ /**/
|
|
Karsten Hopp |
9ce2db |
+ 1122,
|
|
Karsten Hopp |
9ce2db |
/**/
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
--
|
|
Karsten Hopp |
9ce2db |
From "know your smileys":
|
|
Karsten Hopp |
9ce2db |
:q vi user saying, "How do I get out of this damn emacs editor?"
|
|
Karsten Hopp |
9ce2db |
|
|
Karsten Hopp |
9ce2db |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
9ce2db |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
9ce2db |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
9ce2db |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|