To: [email protected]
Subject: Patch 7.4a.039
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4a.039
Problem:    New regexp engine doesn't match pattern. (Ingo Karkat)
Solution:   When adding a state also check for different PIM if the list of
           states has any state with a PIM.
Files:      src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok


*** ../vim-7.4a.038/src/regexp_nfa.c    2013-07-21 17:05:54.000000000 +0200
--- src/regexp_nfa.c    2013-07-21 18:54:02.000000000 +0200
***************
*** 3464,3469 ****
--- 3464,3470 ----
     int                   n;          /* nr of states currently in "t" */
     int                   len;        /* max nr of states in "t" */
     int                   id;         /* ID of the list */
+     int                   has_pim;    /* TRUE when any state has a PIM */
 } nfa_list_T;

 #ifdef ENABLE_LOG
***************
*** 3966,3972 ****
               /* This state is already in the list, don't add it again,
                * unless it is an MOPEN that is used for a backreference or
                * when there is a PIM. */
!               if (!nfa_has_backref && pim == NULL)
               {
 skip_add:
 #ifdef ENABLE_LOG
--- 3967,3973 ----
               /* This state is already in the list, don't add it again,
                * unless it is an MOPEN that is used for a backreference or
                * when there is a PIM. */
!               if (!nfa_has_backref && pim == NULL && !l->has_pim)
               {
 skip_add:
 #ifdef ENABLE_LOG
***************
*** 4012,4018 ****
--- 4013,4022 ----
           if (pim == NULL)
               thread->pim.result = NFA_PIM_UNUSED;
           else
+           {
               copy_pim(&thread->pim, pim);
+               l->has_pim = TRUE;
+           }
           copy_sub(&thread->subs.norm, &subs->norm);
 #ifdef FEAT_SYN_HL
           if (nfa_has_zsubexpr)
***************
*** 5060,5067 ****
--- 5064,5073 ----

     thislist = &list[0];
     thislist->n = 0;
+     thislist->has_pim = FALSE;
     nextlist = &list[1];
     nextlist->n = 0;
+     nextlist->has_pim = FALSE;
 #ifdef ENABLE_LOG
     fprintf(log_fd, "(---) STARTSTATE first\n");
 #endif
***************
*** 5120,5125 ****
--- 5126,5132 ----
       thislist = &list[flag];
       nextlist = &list[flag ^= 1];
       nextlist->n = 0;            /* clear nextlist */
+       nextlist->has_pim = FALSE;
       ++nfa_listid;
       thislist->id = nfa_listid;
       nextlist->id = nfa_listid + 1;
*** ../vim-7.4a.038/src/testdir/test64.in       2013-07-21 17:05:54.000000000 +0200
--- src/testdir/test64.in       2013-07-21 18:53:22.000000000 +0200
***************
*** 341,346 ****
--- 341,347 ----
 :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
 :call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:'])
 :call add(tl, [2, 'm\k\+_\@=\%(_\@!\k\)\@<=\k\+e', 'mx__xe', 'mx__xe'])
+ :call add(tl, [2, '\%(\U\@<=S\k*\|S\l\)R', 'SuR', 'SuR'])
 :"
 :"""" Combining different tests and features
 :call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
*** ../vim-7.4a.038/src/testdir/test64.ok       2013-07-21 17:05:54.000000000 +0200
--- src/testdir/test64.ok       2013-07-21 18:55:44.000000000 +0200
***************
*** 779,784 ****
--- 779,787 ----
 OK 0 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e
 OK 1 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e
 OK 2 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e
+ OK 0 - \%(\U\@<=S\k*\|S\l\)R
+ OK 1 - \%(\U\@<=S\k*\|S\l\)R
+ OK 2 - \%(\U\@<=S\k*\|S\l\)R
 OK 0 - [[:alpha:]]\{-2,6}
 OK 1 - [[:alpha:]]\{-2,6}
 OK 2 - [[:alpha:]]\{-2,6}
*** ../vim-7.4a.038/src/version.c       2013-07-21 17:53:54.000000000 +0200
--- src/version.c       2013-07-21 18:56:02.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
 {   /* Add new patch number below this line */
+ /**/
+     39,
 /**/

--
Everybody wants to go to heaven, but nobody wants to die.

/// Bram Moolenaar -- [email protected] -- 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    ///