|
Karsten Hopp |
ba1cca |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
ba1cca |
Subject: Patch 7.3.1151
|
|
Karsten Hopp |
ba1cca |
Fcc: outbox
|
|
Karsten Hopp |
ba1cca |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
ba1cca |
Mime-Version: 1.0
|
|
Karsten Hopp |
ba1cca |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
ba1cca |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
ba1cca |
------------
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
Patch 7.3.1151
|
|
Karsten Hopp |
ba1cca |
Problem: New regexp engine: Slow when a look-behind match is followed by a
|
|
Karsten Hopp |
ba1cca |
zero-width match.
|
|
Karsten Hopp |
ba1cca |
Solution: Postpone the look-behind match more often.
|
|
Karsten Hopp |
ba1cca |
Files: src/regexp_nfa.c
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
*** ../vim-7.3.1150/src/regexp_nfa.c 2013-06-08 22:29:59.000000000 +0200
|
|
Karsten Hopp |
ba1cca |
--- src/regexp_nfa.c 2013-06-08 23:11:19.000000000 +0200
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 2794,2799 ****
|
|
Karsten Hopp |
ba1cca |
--- 2794,2800 ----
|
|
Karsten Hopp |
ba1cca |
/* unrecognized */
|
|
Karsten Hopp |
ba1cca |
return -1;
|
|
Karsten Hopp |
ba1cca |
}
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
/*
|
|
Karsten Hopp |
ba1cca |
* Convert a postfix form into its equivalent NFA.
|
|
Karsten Hopp |
ba1cca |
* Return the NFA start state on success, NULL otherwise.
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 3433,3438 ****
|
|
Karsten Hopp |
ba1cca |
--- 3434,3440 ----
|
|
Karsten Hopp |
ba1cca |
static void copy_sub_off __ARGS((regsub_T *to, regsub_T *from));
|
|
Karsten Hopp |
ba1cca |
static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2));
|
|
Karsten Hopp |
ba1cca |
static int has_state_with_pos __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs));
|
|
Karsten Hopp |
ba1cca |
+ static int match_follows __ARGS((nfa_state_T *startstate, int depth));
|
|
Karsten Hopp |
ba1cca |
static int state_in_list __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs));
|
|
Karsten Hopp |
ba1cca |
static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, int off));
|
|
Karsten Hopp |
ba1cca |
static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim, int *ip));
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 3626,3631 ****
|
|
Karsten Hopp |
ba1cca |
--- 3628,3715 ----
|
|
Karsten Hopp |
ba1cca |
}
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
/*
|
|
Karsten Hopp |
ba1cca |
+ * Return TRUE if "state" leads to a NFA_MATCH without advancing the input.
|
|
Karsten Hopp |
ba1cca |
+ */
|
|
Karsten Hopp |
ba1cca |
+ static int
|
|
Karsten Hopp |
ba1cca |
+ match_follows(startstate, depth)
|
|
Karsten Hopp |
ba1cca |
+ nfa_state_T *startstate;
|
|
Karsten Hopp |
ba1cca |
+ int depth;
|
|
Karsten Hopp |
ba1cca |
+ {
|
|
Karsten Hopp |
ba1cca |
+ nfa_state_T *state = startstate;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ /* avoid too much recursion */
|
|
Karsten Hopp |
ba1cca |
+ if (depth > 10)
|
|
Karsten Hopp |
ba1cca |
+ return FALSE;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ for (;;)
|
|
Karsten Hopp |
ba1cca |
+ {
|
|
Karsten Hopp |
ba1cca |
+ switch (state->c)
|
|
Karsten Hopp |
ba1cca |
+ {
|
|
Karsten Hopp |
ba1cca |
+ case NFA_MATCH:
|
|
Karsten Hopp |
ba1cca |
+ return TRUE;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ case NFA_SPLIT:
|
|
Karsten Hopp |
ba1cca |
+ return match_follows(state->out, depth + 1)
|
|
Karsten Hopp |
ba1cca |
+ || match_follows(state->out1, depth + 1);
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_INVISIBLE:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_INVISIBLE_BEFORE:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_INVISIBLE_NEG:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_INVISIBLE_BEFORE_NEG:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_COMPOSING:
|
|
Karsten Hopp |
ba1cca |
+ /* skip ahead to next state */
|
|
Karsten Hopp |
ba1cca |
+ state = state->out1->out;
|
|
Karsten Hopp |
ba1cca |
+ break;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ case NFA_ANY:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_IDENT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_SIDENT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_KWORD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_SKWORD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_FNAME:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_SFNAME:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_PRINT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_SPRINT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_WHITE:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NWHITE:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_DIGIT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NDIGIT:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_HEX:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NHEX:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_OCTAL:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NOCTAL:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_WORD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NWORD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_HEAD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NHEAD:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_ALPHA:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NALPHA:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_LOWER:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NLOWER:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_UPPER:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NUPPER:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_COLL:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_START_NEG_COLL:
|
|
Karsten Hopp |
ba1cca |
+ case NFA_NEWL:
|
|
Karsten Hopp |
ba1cca |
+ /* state will advance input */
|
|
Karsten Hopp |
ba1cca |
+ return FALSE;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ default:
|
|
Karsten Hopp |
ba1cca |
+ if (state->c > 0)
|
|
Karsten Hopp |
ba1cca |
+ /* state will advance input */
|
|
Karsten Hopp |
ba1cca |
+ return FALSE;
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ /* Others: zero-width or possibly zero-width, might still find
|
|
Karsten Hopp |
ba1cca |
+ * a match at the same position, keep looking. */
|
|
Karsten Hopp |
ba1cca |
+ break;
|
|
Karsten Hopp |
ba1cca |
+ }
|
|
Karsten Hopp |
ba1cca |
+ state = state->out;
|
|
Karsten Hopp |
ba1cca |
+ }
|
|
Karsten Hopp |
ba1cca |
+ return FALSE;
|
|
Karsten Hopp |
ba1cca |
+ }
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+
|
|
Karsten Hopp |
ba1cca |
+ /*
|
|
Karsten Hopp |
ba1cca |
* Return TRUE if "state" is already in list "l".
|
|
Karsten Hopp |
ba1cca |
*/
|
|
Karsten Hopp |
ba1cca |
static int
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 5714,5722 ****
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
if (add_state != NULL)
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
! if (t->pim != NULL)
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
- /* postponed invisible match */
|
|
Karsten Hopp |
ba1cca |
if (t->pim->result == NFA_PIM_TODO)
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
ba1cca |
--- 5798,5808 ----
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
if (add_state != NULL)
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
! /* Handle the postponed invisible match before advancing to
|
|
Karsten Hopp |
ba1cca |
! * the next character and for a zero-width match if the match
|
|
Karsten Hopp |
ba1cca |
! * might end without advancing. */
|
|
Karsten Hopp |
ba1cca |
! if (t->pim != NULL && (!add_here || match_follows(add_state, 0)))
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
if (t->pim->result == NFA_PIM_TODO)
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 5773,5779 ****
|
|
Karsten Hopp |
ba1cca |
}
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
if (add_here)
|
|
Karsten Hopp |
ba1cca |
! addstate_here(thislist, add_state, &t->subs, NULL, &listidx);
|
|
Karsten Hopp |
ba1cca |
else
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
addstate(nextlist, add_state, &t->subs, add_off);
|
|
Karsten Hopp |
ba1cca |
--- 5859,5865 ----
|
|
Karsten Hopp |
ba1cca |
}
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
if (add_here)
|
|
Karsten Hopp |
ba1cca |
! addstate_here(thislist, add_state, &t->subs, t->pim, &listidx);
|
|
Karsten Hopp |
ba1cca |
else
|
|
Karsten Hopp |
ba1cca |
{
|
|
Karsten Hopp |
ba1cca |
addstate(nextlist, add_state, &t->subs, add_off);
|
|
Karsten Hopp |
ba1cca |
*** ../vim-7.3.1150/src/version.c 2013-06-08 22:29:59.000000000 +0200
|
|
Karsten Hopp |
ba1cca |
--- src/version.c 2013-06-08 23:23:53.000000000 +0200
|
|
Karsten Hopp |
ba1cca |
***************
|
|
Karsten Hopp |
ba1cca |
*** 730,731 ****
|
|
Karsten Hopp |
ba1cca |
--- 730,733 ----
|
|
Karsten Hopp |
ba1cca |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
ba1cca |
+ /**/
|
|
Karsten Hopp |
ba1cca |
+ 1151,
|
|
Karsten Hopp |
ba1cca |
/**/
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
--
|
|
Karsten Hopp |
ba1cca |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
ba1cca |
117. You are more comfortable typing in html.
|
|
Karsten Hopp |
ba1cca |
|
|
Karsten Hopp |
ba1cca |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
ba1cca |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
ba1cca |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
ba1cca |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|