|
Karsten Hopp |
9d1a51 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
9d1a51 |
Subject: Patch 7.3.1139
|
|
Karsten Hopp |
9d1a51 |
Fcc: outbox
|
|
Karsten Hopp |
9d1a51 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
9d1a51 |
Mime-Version: 1.0
|
|
Karsten Hopp |
9d1a51 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
9d1a51 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
9d1a51 |
------------
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
Patch 7.3.1139
|
|
Karsten Hopp |
9d1a51 |
Problem: New regexp engine: negated flag is hardly used.
|
|
Karsten Hopp |
9d1a51 |
Solution: Add separate _NEG states, remove negated flag.
|
|
Karsten Hopp |
9d1a51 |
Files: src/regexp_nfa.c, src/regexp.h
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
*** ../vim-7.3.1138/src/regexp_nfa.c 2013-06-07 14:59:14.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
--- src/regexp_nfa.c 2013-06-07 16:31:29.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 64,72 ****
|
|
Karsten Hopp |
9d1a51 |
--- 64,75 ----
|
|
Karsten Hopp |
9d1a51 |
NFA_NOPEN, /* Start of subexpression marked with \%( */
|
|
Karsten Hopp |
9d1a51 |
NFA_NCLOSE, /* End of subexpr. marked with \%( ... \) */
|
|
Karsten Hopp |
9d1a51 |
NFA_START_INVISIBLE,
|
|
Karsten Hopp |
9d1a51 |
+ NFA_START_INVISIBLE_NEG,
|
|
Karsten Hopp |
9d1a51 |
NFA_START_INVISIBLE_BEFORE,
|
|
Karsten Hopp |
9d1a51 |
+ NFA_START_INVISIBLE_BEFORE_NEG,
|
|
Karsten Hopp |
9d1a51 |
NFA_START_PATTERN,
|
|
Karsten Hopp |
9d1a51 |
NFA_END_INVISIBLE,
|
|
Karsten Hopp |
9d1a51 |
+ NFA_END_INVISIBLE_NEG,
|
|
Karsten Hopp |
9d1a51 |
NFA_END_PATTERN,
|
|
Karsten Hopp |
9d1a51 |
NFA_COMPOSING, /* Next nodes in NFA are part of the
|
|
Karsten Hopp |
9d1a51 |
composing multibyte char */
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 481,487 ****
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
default:
|
|
Karsten Hopp |
9d1a51 |
! if (p->c > 0 && !p->negated)
|
|
Karsten Hopp |
9d1a51 |
return p->c; /* yes! */
|
|
Karsten Hopp |
9d1a51 |
return 0;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
--- 484,490 ----
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
default:
|
|
Karsten Hopp |
9d1a51 |
! if (p->c > 0)
|
|
Karsten Hopp |
9d1a51 |
return p->c; /* yes! */
|
|
Karsten Hopp |
9d1a51 |
return 0;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 1991,2000 ****
|
|
Karsten Hopp |
9d1a51 |
--- 1994,2008 ----
|
|
Karsten Hopp |
9d1a51 |
case NFA_NOPEN: STRCPY(code, "NFA_NOPEN"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_NCLOSE: STRCPY(code, "NFA_NCLOSE"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_START_INVISIBLE_NEG:
|
|
Karsten Hopp |
9d1a51 |
+ STRCPY(code, "NFA_START_INVISIBLE_NEG"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_INVISIBLE_BEFORE:
|
|
Karsten Hopp |
9d1a51 |
STRCPY(code, "NFA_START_INVISIBLE_BEFORE"); break;
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_START_INVISIBLE_BEFORE_NEG:
|
|
Karsten Hopp |
9d1a51 |
+ STRCPY(code, "NFA_START_INVISIBLE_BEFORE_NEG"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_PATTERN: STRCPY(code, "NFA_START_PATTERN"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_END_INVISIBLE_NEG: STRCPY(code, "NFA_END_INVISIBLE_NEG"); break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_END_PATTERN: STRCPY(code, "NFA_END_PATTERN"); break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 2227,2234 ****
|
|
Karsten Hopp |
9d1a51 |
fprintf(debugf, " %s", p);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
nfa_set_code(state->c);
|
|
Karsten Hopp |
9d1a51 |
! fprintf(debugf, "%s%s (%d) (id=%d) val=%d\n",
|
|
Karsten Hopp |
9d1a51 |
! state->negated ? "NOT " : "",
|
|
Karsten Hopp |
9d1a51 |
code,
|
|
Karsten Hopp |
9d1a51 |
state->c,
|
|
Karsten Hopp |
9d1a51 |
abs(state->id),
|
|
Karsten Hopp |
9d1a51 |
--- 2235,2241 ----
|
|
Karsten Hopp |
9d1a51 |
fprintf(debugf, " %s", p);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
nfa_set_code(state->c);
|
|
Karsten Hopp |
9d1a51 |
! fprintf(debugf, "%s (%d) (id=%d) val=%d\n",
|
|
Karsten Hopp |
9d1a51 |
code,
|
|
Karsten Hopp |
9d1a51 |
state->c,
|
|
Karsten Hopp |
9d1a51 |
abs(state->id),
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 2330,2336 ****
|
|
Karsten Hopp |
9d1a51 |
s->id = istate;
|
|
Karsten Hopp |
9d1a51 |
s->lastlist[0] = 0;
|
|
Karsten Hopp |
9d1a51 |
s->lastlist[1] = 0;
|
|
Karsten Hopp |
9d1a51 |
- s->negated = FALSE;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
return s;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
--- 2337,2342 ----
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 2741,2763 ****
|
|
Karsten Hopp |
9d1a51 |
case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9d1a51 |
case NFA_PREV_ATOM_LIKE_PATTERN:
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
- int neg = (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
|
|
Karsten Hopp |
9d1a51 |
- || *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9d1a51 |
int before = (*p == NFA_PREV_ATOM_JUST_BEFORE
|
|
Karsten Hopp |
9d1a51 |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9d1a51 |
int pattern = (*p == NFA_PREV_ATOM_LIKE_PATTERN);
|
|
Karsten Hopp |
9d1a51 |
! int start_state = NFA_START_INVISIBLE;
|
|
Karsten Hopp |
9d1a51 |
! int end_state = NFA_END_INVISIBLE;
|
|
Karsten Hopp |
9d1a51 |
int n = 0;
|
|
Karsten Hopp |
9d1a51 |
nfa_state_T *zend;
|
|
Karsten Hopp |
9d1a51 |
nfa_state_T *skip;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! if (before)
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_INVISIBLE_BEFORE;
|
|
Karsten Hopp |
9d1a51 |
! else if (pattern)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_PATTERN;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_PATTERN;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (before)
|
|
Karsten Hopp |
9d1a51 |
--- 2747,2783 ----
|
|
Karsten Hopp |
9d1a51 |
case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9d1a51 |
case NFA_PREV_ATOM_LIKE_PATTERN:
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
int before = (*p == NFA_PREV_ATOM_JUST_BEFORE
|
|
Karsten Hopp |
9d1a51 |
|| *p == NFA_PREV_ATOM_JUST_BEFORE_NEG);
|
|
Karsten Hopp |
9d1a51 |
int pattern = (*p == NFA_PREV_ATOM_LIKE_PATTERN);
|
|
Karsten Hopp |
9d1a51 |
! int start_state;
|
|
Karsten Hopp |
9d1a51 |
! int end_state;
|
|
Karsten Hopp |
9d1a51 |
int n = 0;
|
|
Karsten Hopp |
9d1a51 |
nfa_state_T *zend;
|
|
Karsten Hopp |
9d1a51 |
nfa_state_T *skip;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! switch (*p)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
! case NFA_PREV_ATOM_NO_WIDTH:
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_INVISIBLE;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_INVISIBLE;
|
|
Karsten Hopp |
9d1a51 |
! break;
|
|
Karsten Hopp |
9d1a51 |
! case NFA_PREV_ATOM_NO_WIDTH_NEG:
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_INVISIBLE_NEG;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_INVISIBLE_NEG;
|
|
Karsten Hopp |
9d1a51 |
! break;
|
|
Karsten Hopp |
9d1a51 |
! case NFA_PREV_ATOM_JUST_BEFORE:
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_INVISIBLE_BEFORE;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_INVISIBLE;
|
|
Karsten Hopp |
9d1a51 |
! break;
|
|
Karsten Hopp |
9d1a51 |
! case NFA_PREV_ATOM_JUST_BEFORE_NEG:
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_INVISIBLE_BEFORE_NEG;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_INVISIBLE_NEG;
|
|
Karsten Hopp |
9d1a51 |
! break;
|
|
Karsten Hopp |
9d1a51 |
! case NFA_PREV_ATOM_LIKE_PATTERN:
|
|
Karsten Hopp |
9d1a51 |
! start_state = NFA_START_PATTERN;
|
|
Karsten Hopp |
9d1a51 |
! end_state = NFA_END_PATTERN;
|
|
Karsten Hopp |
9d1a51 |
! break;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (before)
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 2783,2793 ****
|
|
Karsten Hopp |
9d1a51 |
s = alloc_state(start_state, e.start, s1);
|
|
Karsten Hopp |
9d1a51 |
if (s == NULL)
|
|
Karsten Hopp |
9d1a51 |
goto theend;
|
|
Karsten Hopp |
9d1a51 |
- if (neg)
|
|
Karsten Hopp |
9d1a51 |
- {
|
|
Karsten Hopp |
9d1a51 |
- s->negated = TRUE;
|
|
Karsten Hopp |
9d1a51 |
- s1->negated = TRUE;
|
|
Karsten Hopp |
9d1a51 |
- }
|
|
Karsten Hopp |
9d1a51 |
if (before)
|
|
Karsten Hopp |
9d1a51 |
s->val = n; /* store the count */
|
|
Karsten Hopp |
9d1a51 |
if (pattern)
|
|
Karsten Hopp |
9d1a51 |
--- 2803,2808 ----
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 3009,3015 ****
|
|
Karsten Hopp |
9d1a51 |
matchstate = &state_ptr[istate++]; /* the match state */
|
|
Karsten Hopp |
9d1a51 |
matchstate->c = NFA_MATCH;
|
|
Karsten Hopp |
9d1a51 |
matchstate->out = matchstate->out1 = NULL;
|
|
Karsten Hopp |
9d1a51 |
- matchstate->negated = FALSE;
|
|
Karsten Hopp |
9d1a51 |
matchstate->id = 0;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
patch(e.out, matchstate);
|
|
Karsten Hopp |
9d1a51 |
--- 3024,3029 ----
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 3772,3778 ****
|
|
Karsten Hopp |
9d1a51 |
return OK;
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_CLASS_SPACE:
|
|
Karsten Hopp |
9d1a51 |
! if ((c >=9 && c <= 13) || (c == ' '))
|
|
Karsten Hopp |
9d1a51 |
return OK;
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_CLASS_UPPER:
|
|
Karsten Hopp |
9d1a51 |
--- 3786,3792 ----
|
|
Karsten Hopp |
9d1a51 |
return OK;
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_CLASS_SPACE:
|
|
Karsten Hopp |
9d1a51 |
! if ((c >= 9 && c <= 13) || (c == ' '))
|
|
Karsten Hopp |
9d1a51 |
return OK;
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
case NFA_CLASS_UPPER:
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 3971,3977 ****
|
|
Karsten Hopp |
9d1a51 |
int result;
|
|
Karsten Hopp |
9d1a51 |
int need_restore = FALSE;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! if (state->c == NFA_START_INVISIBLE_BEFORE)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* The recursive match must end at the current position. */
|
|
Karsten Hopp |
9d1a51 |
endposp = &endpos;
|
|
Karsten Hopp |
9d1a51 |
--- 3985,3992 ----
|
|
Karsten Hopp |
9d1a51 |
int result;
|
|
Karsten Hopp |
9d1a51 |
int need_restore = FALSE;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! if (state->c == NFA_START_INVISIBLE_BEFORE
|
|
Karsten Hopp |
9d1a51 |
! || state->c == NFA_START_INVISIBLE_BEFORE_NEG)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* The recursive match must end at the current position. */
|
|
Karsten Hopp |
9d1a51 |
endposp = &endpos;
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4452,4457 ****
|
|
Karsten Hopp |
9d1a51 |
--- 4467,4473 ----
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_END_INVISIBLE:
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_END_INVISIBLE_NEG:
|
|
Karsten Hopp |
9d1a51 |
case NFA_END_PATTERN:
|
|
Karsten Hopp |
9d1a51 |
/*
|
|
Karsten Hopp |
9d1a51 |
* This is only encountered after a NFA_START_INVISIBLE or
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4489,4495 ****
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
/* do not set submatches for \@! */
|
|
Karsten Hopp |
9d1a51 |
! if (!t->state->negated)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
copy_sub(&m->norm, &t->subs.norm);
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
9d1a51 |
--- 4505,4511 ----
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
/* do not set submatches for \@! */
|
|
Karsten Hopp |
9d1a51 |
! if (t->state->c != NFA_END_INVISIBLE_NEG)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
copy_sub(&m->norm, &t->subs.norm);
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4505,4511 ****
|
|
Karsten Hopp |
9d1a51 |
--- 4521,4529 ----
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_INVISIBLE:
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_START_INVISIBLE_NEG:
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_INVISIBLE_BEFORE:
|
|
Karsten Hopp |
9d1a51 |
+ case NFA_START_INVISIBLE_BEFORE_NEG:
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
nfa_pim_T *pim;
|
|
Karsten Hopp |
9d1a51 |
int cout = t->state->out1->out->c;
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4524,4529 ****
|
|
Karsten Hopp |
9d1a51 |
--- 4542,4548 ----
|
|
Karsten Hopp |
9d1a51 |
|| cout == NFA_NCLOSE
|
|
Karsten Hopp |
9d1a51 |
|| t->pim != NULL
|
|
Karsten Hopp |
9d1a51 |
|| (t->state->c != NFA_START_INVISIBLE_BEFORE
|
|
Karsten Hopp |
9d1a51 |
+ && t->state->c != NFA_START_INVISIBLE_BEFORE_NEG
|
|
Karsten Hopp |
9d1a51 |
&& failure_chance(t->state->out1->out, 0)
|
|
Karsten Hopp |
9d1a51 |
< failure_chance(t->state->out, 0)))
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4534,4541 ****
|
|
Karsten Hopp |
9d1a51 |
result = recursive_regmatch(t->state, prog,
|
|
Karsten Hopp |
9d1a51 |
submatch, m, &listids);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! it is a match when result is FALSE */
|
|
Karsten Hopp |
9d1a51 |
! if (result != t->state->negated)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->subs.norm, &m->norm);
|
|
Karsten Hopp |
9d1a51 |
--- 4553,4563 ----
|
|
Karsten Hopp |
9d1a51 |
result = recursive_regmatch(t->state, prog,
|
|
Karsten Hopp |
9d1a51 |
submatch, m, &listids);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! and \@
|
|
Karsten Hopp |
9d1a51 |
! * FALSE */
|
|
Karsten Hopp |
9d1a51 |
! if (result != (t->state->c == NFA_START_INVISIBLE_NEG
|
|
Karsten Hopp |
9d1a51 |
! || t->state->c
|
|
Karsten Hopp |
9d1a51 |
! == NFA_START_INVISIBLE_BEFORE_NEG))
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->subs.norm, &m->norm);
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4646,4656 ****
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_BOW:
|
|
Karsten Hopp |
9d1a51 |
! {
|
|
Karsten Hopp |
9d1a51 |
! int bow = TRUE;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (curc == NUL)
|
|
Karsten Hopp |
9d1a51 |
! bow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
9d1a51 |
else if (has_mbyte)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
--- 4668,4677 ----
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_BOW:
|
|
Karsten Hopp |
9d1a51 |
! result = TRUE;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (curc == NUL)
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
9d1a51 |
else if (has_mbyte)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4659,4685 ****
|
|
Karsten Hopp |
9d1a51 |
/* Get class of current and previous char (if it exists). */
|
|
Karsten Hopp |
9d1a51 |
this_class = mb_get_class_buf(reginput, reg_buf);
|
|
Karsten Hopp |
9d1a51 |
if (this_class <= 1)
|
|
Karsten Hopp |
9d1a51 |
! bow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
else if (reg_prev_class() == this_class)
|
|
Karsten Hopp |
9d1a51 |
! bow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
else if (!vim_iswordc_buf(curc, reg_buf)
|
|
Karsten Hopp |
9d1a51 |
|| (reginput > regline
|
|
Karsten Hopp |
9d1a51 |
&& vim_iswordc_buf(reginput[-1], reg_buf)))
|
|
Karsten Hopp |
9d1a51 |
! bow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
! if (bow)
|
|
Karsten Hopp |
9d1a51 |
addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
9d1a51 |
t->pim, &listidx);
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
- }
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_EOW:
|
|
Karsten Hopp |
9d1a51 |
! {
|
|
Karsten Hopp |
9d1a51 |
! int eow = TRUE;
|
|
Karsten Hopp |
9d1a51 |
!
|
|
Karsten Hopp |
9d1a51 |
if (reginput == regline)
|
|
Karsten Hopp |
9d1a51 |
! eow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
9d1a51 |
else if (has_mbyte)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
--- 4680,4703 ----
|
|
Karsten Hopp |
9d1a51 |
/* Get class of current and previous char (if it exists). */
|
|
Karsten Hopp |
9d1a51 |
this_class = mb_get_class_buf(reginput, reg_buf);
|
|
Karsten Hopp |
9d1a51 |
if (this_class <= 1)
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
else if (reg_prev_class() == this_class)
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
else if (!vim_iswordc_buf(curc, reg_buf)
|
|
Karsten Hopp |
9d1a51 |
|| (reginput > regline
|
|
Karsten Hopp |
9d1a51 |
&& vim_iswordc_buf(reginput[-1], reg_buf)))
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
! if (result)
|
|
Karsten Hopp |
9d1a51 |
addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
9d1a51 |
t->pim, &listidx);
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_EOW:
|
|
Karsten Hopp |
9d1a51 |
! result = TRUE;
|
|
Karsten Hopp |
9d1a51 |
if (reginput == regline)
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
9d1a51 |
else if (has_mbyte)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4690,4707 ****
|
|
Karsten Hopp |
9d1a51 |
prev_class = reg_prev_class();
|
|
Karsten Hopp |
9d1a51 |
if (this_class == prev_class
|
|
Karsten Hopp |
9d1a51 |
|| prev_class == 0 || prev_class == 1)
|
|
Karsten Hopp |
9d1a51 |
! eow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
else if (!vim_iswordc_buf(reginput[-1], reg_buf)
|
|
Karsten Hopp |
9d1a51 |
|| (reginput[0] != NUL
|
|
Karsten Hopp |
9d1a51 |
&& vim_iswordc_buf(curc, reg_buf)))
|
|
Karsten Hopp |
9d1a51 |
! eow = FALSE;
|
|
Karsten Hopp |
9d1a51 |
! if (eow)
|
|
Karsten Hopp |
9d1a51 |
addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
9d1a51 |
t->pim, &listidx);
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
- }
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_BOF:
|
|
Karsten Hopp |
9d1a51 |
if (reglnum == 0 && reginput == regline
|
|
Karsten Hopp |
9d1a51 |
--- 4708,4724 ----
|
|
Karsten Hopp |
9d1a51 |
prev_class = reg_prev_class();
|
|
Karsten Hopp |
9d1a51 |
if (this_class == prev_class
|
|
Karsten Hopp |
9d1a51 |
|| prev_class == 0 || prev_class == 1)
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
else if (!vim_iswordc_buf(reginput[-1], reg_buf)
|
|
Karsten Hopp |
9d1a51 |
|| (reginput[0] != NUL
|
|
Karsten Hopp |
9d1a51 |
&& vim_iswordc_buf(curc, reg_buf)))
|
|
Karsten Hopp |
9d1a51 |
! result = FALSE;
|
|
Karsten Hopp |
9d1a51 |
! if (result)
|
|
Karsten Hopp |
9d1a51 |
addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
9d1a51 |
t->pim, &listidx);
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
case NFA_BOF:
|
|
Karsten Hopp |
9d1a51 |
if (reglnum == 0 && reginput == regline
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4740,4746 ****
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* If \Z was present, then ignore composing characters.
|
|
Karsten Hopp |
9d1a51 |
* When ignoring the base character this always matches. */
|
|
Karsten Hopp |
9d1a51 |
- /* TODO: How about negated? */
|
|
Karsten Hopp |
9d1a51 |
if (len == 0 && sta->c != curc)
|
|
Karsten Hopp |
9d1a51 |
result = FAIL;
|
|
Karsten Hopp |
9d1a51 |
else
|
|
Karsten Hopp |
9d1a51 |
--- 4757,4762 ----
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 4813,4838 ****
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
break;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_ALNUM:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_ALPHA:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_BLANK:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_CNTRL:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_DIGIT:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_GRAPH:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_LOWER:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_PRINT:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_PUNCT:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_SPACE:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_UPPER:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_XDIGIT:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_TAB:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_RETURN:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_BACKSPACE:
|
|
Karsten Hopp |
9d1a51 |
- case NFA_CLASS_ESCAPE:
|
|
Karsten Hopp |
9d1a51 |
- result = check_char_class(t->state->c, curc);
|
|
Karsten Hopp |
9d1a51 |
- ADD_STATE_IF_MATCH(t->state);
|
|
Karsten Hopp |
9d1a51 |
- break;
|
|
Karsten Hopp |
9d1a51 |
-
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_COLL:
|
|
Karsten Hopp |
9d1a51 |
case NFA_START_NEG_COLL:
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
--- 4829,4834 ----
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 5212,5221 ****
|
|
Karsten Hopp |
9d1a51 |
int c = t->state->c;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
/* TODO: put this in #ifdef later */
|
|
Karsten Hopp |
9d1a51 |
! if (c < -256)
|
|
Karsten Hopp |
9d1a51 |
EMSGN("INTERNAL: Negative state char: %ld", c);
|
|
Karsten Hopp |
9d1a51 |
- if (is_Magic(c))
|
|
Karsten Hopp |
9d1a51 |
- c = un_Magic(c);
|
|
Karsten Hopp |
9d1a51 |
result = (c == curc);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (!result && ireg_ic)
|
|
Karsten Hopp |
9d1a51 |
--- 5208,5215 ----
|
|
Karsten Hopp |
9d1a51 |
int c = t->state->c;
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
/* TODO: put this in #ifdef later */
|
|
Karsten Hopp |
9d1a51 |
! if (c < 0)
|
|
Karsten Hopp |
9d1a51 |
EMSGN("INTERNAL: Negative state char: %ld", c);
|
|
Karsten Hopp |
9d1a51 |
result = (c == curc);
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
if (!result && ireg_ic)
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 5252,5259 ****
|
|
Karsten Hopp |
9d1a51 |
prog, submatch, m, &listids);
|
|
Karsten Hopp |
9d1a51 |
t->pim->result = result ? NFA_PIM_MATCH
|
|
Karsten Hopp |
9d1a51 |
: NFA_PIM_NOMATCH;
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! it is a match when result is FALSE */
|
|
Karsten Hopp |
9d1a51 |
! if (result != t->pim->state->negated)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->pim->subs.norm, &m->norm);
|
|
Karsten Hopp |
9d1a51 |
--- 5246,5257 ----
|
|
Karsten Hopp |
9d1a51 |
prog, submatch, m, &listids);
|
|
Karsten Hopp |
9d1a51 |
t->pim->result = result ? NFA_PIM_MATCH
|
|
Karsten Hopp |
9d1a51 |
: NFA_PIM_NOMATCH;
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! and \@
|
|
Karsten Hopp |
9d1a51 |
! * FALSE */
|
|
Karsten Hopp |
9d1a51 |
! if (result != (t->pim->state->c
|
|
Karsten Hopp |
9d1a51 |
! == NFA_START_INVISIBLE_NEG
|
|
Karsten Hopp |
9d1a51 |
! || t->pim->state->c
|
|
Karsten Hopp |
9d1a51 |
! == NFA_START_INVISIBLE_BEFORE_NEG))
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->pim->subs.norm, &m->norm);
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 5274,5281 ****
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! it is a match when result is FALSE */
|
|
Karsten Hopp |
9d1a51 |
! if (result != t->pim->state->negated)
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->subs.norm, &t->pim->subs.norm);
|
|
Karsten Hopp |
9d1a51 |
--- 5272,5281 ----
|
|
Karsten Hopp |
9d1a51 |
#endif
|
|
Karsten Hopp |
9d1a51 |
}
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
! /* for \@! and \@
|
|
Karsten Hopp |
9d1a51 |
! if (result != (t->pim->state->c == NFA_START_INVISIBLE_NEG
|
|
Karsten Hopp |
9d1a51 |
! || t->pim->state->c
|
|
Karsten Hopp |
9d1a51 |
! == NFA_START_INVISIBLE_BEFORE_NEG))
|
|
Karsten Hopp |
9d1a51 |
{
|
|
Karsten Hopp |
9d1a51 |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
9d1a51 |
copy_sub_off(&t->subs.norm, &t->pim->subs.norm);
|
|
Karsten Hopp |
9d1a51 |
*** ../vim-7.3.1138/src/regexp.h 2013-06-06 18:46:00.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
--- src/regexp.h 2013-06-07 16:11:12.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 73,79 ****
|
|
Karsten Hopp |
9d1a51 |
nfa_state_T *out1;
|
|
Karsten Hopp |
9d1a51 |
int id;
|
|
Karsten Hopp |
9d1a51 |
int lastlist[2]; /* 0: normal, 1: recursive */
|
|
Karsten Hopp |
9d1a51 |
- int negated;
|
|
Karsten Hopp |
9d1a51 |
int val;
|
|
Karsten Hopp |
9d1a51 |
};
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
--- 73,78 ----
|
|
Karsten Hopp |
9d1a51 |
*** ../vim-7.3.1138/src/version.c 2013-06-07 14:59:14.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
--- src/version.c 2013-06-07 16:11:59.000000000 +0200
|
|
Karsten Hopp |
9d1a51 |
***************
|
|
Karsten Hopp |
9d1a51 |
*** 730,731 ****
|
|
Karsten Hopp |
9d1a51 |
--- 730,733 ----
|
|
Karsten Hopp |
9d1a51 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
9d1a51 |
+ /**/
|
|
Karsten Hopp |
9d1a51 |
+ 1139,
|
|
Karsten Hopp |
9d1a51 |
/**/
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
--
|
|
Karsten Hopp |
9d1a51 |
Common sense is what tells you that the world is flat.
|
|
Karsten Hopp |
9d1a51 |
|
|
Karsten Hopp |
9d1a51 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
9d1a51 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
9d1a51 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
9d1a51 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|