]> granicus.if.org Git - vim/commitdiff
updated for version 7.4a.039 v7.4a.039
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Jul 2013 16:59:24 +0000 (18:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Jul 2013 16:59:24 +0000 (18:59 +0200)
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.

src/regexp_nfa.c
src/testdir/test64.in
src/testdir/test64.ok
src/version.c

index 07e2fa1fefc107dd0f9a9e91a3e6988018d32ff5..0b9917fe6e7f11ca649da639198d3afc9aa2e3e9 100644 (file)
@@ -3464,6 +3464,7 @@ typedef struct
     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,7 +3967,7 @@ addstate(l, state, subs_arg, pim, off)
                /* 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)
+               if (!nfa_has_backref && pim == NULL && !l->has_pim)
                {
 skip_add:
 #ifdef ENABLE_LOG
@@ -4012,7 +4013,10 @@ skip_add:
            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,8 +5064,10 @@ nfa_regmatch(prog, start, submatch, m)
 
     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,6 +5126,7 @@ nfa_regmatch(prog, start, submatch, m)
        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;
index a946aa45095a8d275846b7431cf35cc16c60ded7..82669b0479bf11c2e1ed1d6da827ce0c79e6694d 100644 (file)
@@ -341,6 +341,7 @@ STARTTEST
 :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'])
index efcf8dd5088387f0574822e97d51c4445c25fb7a..d08227f2ce112bea67c17ab89d99afb19dbd168e 100644 (file)
@@ -779,6 +779,9 @@ OK 2 - [ ]\@!\p\%([ ]\@!\p\)*:
 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}
index 6b724dacdc414f66fbae55a1780d720f919dcab6..f1d5214a1fe9f80ec87673a2745d857ccd5186ff 100644 (file)
@@ -727,6 +727,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    39,
 /**/
     38,
 /**/