To: vim_dev@googlegroups.com Subject: Patch 7.3.1157 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.1157 Problem: New regexp engine fails on "\(\state->out1->out->c; ! /* Do it directly when what follows is possibly end of ! * match (closing paren). ! * Do it directly if there already is a PIM. ! * Postpone when it is \@<= or \@= NFA_MCLOSE && cout <= NFA_MCLOSE9) ! #ifdef FEAT_SYN_HL ! || (cout >= NFA_ZCLOSE && cout <= NFA_ZCLOSE9) #endif ! || t->pim.result != NFA_PIM_UNUSED ! || (t->state->c != NFA_START_INVISIBLE_BEFORE ! && t->state->c != NFA_START_INVISIBLE_BEFORE_NEG ! && failure_chance(t->state->out1->out, 0) ! < failure_chance(t->state->out, 0))) { /* * First try matching the invisible match, then what --- 5097,5142 ---- case NFA_START_INVISIBLE_BEFORE: case NFA_START_INVISIBLE_BEFORE_NEG: { ! int directly = FALSE; ! #ifdef ENABLE_LOG ! fprintf(log_fd, "Failure chance invisible: %d, what follows: %d\n", ! failure_chance(t->state->out, 0), ! failure_chance(t->state->out1->out, 0)); #endif ! /* Do it directly when what follows is possibly the end of ! * the match. ! * Do it directly if there already is a PIM. ! * Postpone when the invisible match is expensive or has a ! * lower chance of failing. */ ! if (match_follows(t->state->out1->out, 0) ! || t->pim.result != NFA_PIM_UNUSED) ! directly = TRUE; ! else ! { ! int ch_invisible = failure_chance(t->state->out, 0); ! int ch_follows = failure_chance(t->state->out1->out, 0); ! ! if (t->state->c == NFA_START_INVISIBLE_BEFORE ! || t->state->c == NFA_START_INVISIBLE_BEFORE_NEG) ! { ! /* "before" matches are very expensive when ! * unbounded, always prefer what follows then, ! * unless what follows will always match. ! * Otherwise strongly prefer what follows. */ ! if (t->state->val <= 0 && ch_follows > 0) ! directly = FALSE; ! else ! directly = ch_follows * 10 < ch_invisible; ! } ! else ! { ! /* normal invisible, first do the one with the ! * highest failure chance */ ! directly = ch_follows < ch_invisible; ! } ! } ! if (directly) { /* * First try matching the invisible match, then what *** ../vim-7.3.1156/src/testdir/test64.in 2013-06-08 18:19:40.000000000 +0200 --- src/testdir/test64.in 2013-06-10 16:19:49.000000000 +0200 *************** *** 392,397 **** --- 392,398 ---- :call add(tl, [2, '\v\C%(', 'foobar']) :call add(tl, [2, '\(foo\)\@<=\>', 'barfoo', '', 'foo']) + :call add(tl, [2, '\(foo\)\@<=.*', 'foobar', 'bar', 'foo']) :" :""""" \@> :call add(tl, [2, '\(a*\)\@>a', 'aaaa']) *** ../vim-7.3.1156/src/testdir/test64.ok 2013-06-08 18:19:40.000000000 +0200 --- src/testdir/test64.ok 2013-06-10 16:21:07.000000000 +0200 *************** *** 890,895 **** --- 890,898 ---- OK 0 - \(foo\)\@<=\> OK 1 - \(foo\)\@<=\> OK 2 - \(foo\)\@<=\> + OK 0 - \(foo\)\@<=.* + OK 1 - \(foo\)\@<=.* + OK 2 - \(foo\)\@<=.* OK 0 - \(a*\)\@>a OK 1 - \(a*\)\@>a OK 2 - \(a*\)\@>a *** ../vim-7.3.1156/src/version.c 2013-06-09 20:50:56.000000000 +0200 --- src/version.c 2013-06-10 16:23:57.000000000 +0200 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 1157, /**/ -- In a world without fences, who needs Gates and Windows? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///