]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1128 v7.3.1128
authorBram Moolenaar <Bram@vim.org>
Wed, 5 Jun 2013 19:42:53 +0000 (21:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 5 Jun 2013 19:42:53 +0000 (21:42 +0200)
Problem:    Now that the NFA engine handles everything every failure is a
            syntax error.
Solution:   Remove the syntax_error flag.

src/regexp.c
src/regexp_nfa.c
src/version.c

index 432d7b577df36f626fe82b07bb18b9c1ac87dd60..741978e5718054cd9850fb0fe1a33a37a04a85cb 100644 (file)
@@ -7924,7 +7924,6 @@ vim_regcomp(expr_arg, re_flags)
     regprog_T   *prog = NULL;
     char_u     *expr = expr_arg;
 
-    syntax_error = FALSE;
     regexp_engine = p_re;
 
     /* Check for prefix "\%#=", that sets the regexp engine */
@@ -7971,19 +7970,12 @@ vim_regcomp(expr_arg, re_flags)
            f = fopen(BT_REGEXP_DEBUG_LOG_NAME, "a");
            if (f)
            {
-               if (!syntax_error)
-                   fprintf(f, "NFA engine could not handle \"%s\"\n", expr);
-               else
-                   fprintf(f, "Syntax error in \"%s\"\n", expr);
+               fprintf(f, "Syntax error in \"%s\"\n", expr);
                fclose(f);
            }
            else
                EMSG2("(NFA) Could not open \"%s\" to write !!!",
                         BT_REGEXP_DEBUG_LOG_NAME);
-           /*
-           if (syntax_error)
-               EMSG("NFA Regexp: Syntax Error !");
-           */
        }
 #endif
        /*
@@ -7992,11 +7984,8 @@ vim_regcomp(expr_arg, re_flags)
         * NFA engine.
         */
        if (regexp_engine == AUTOMATIC_ENGINE)
-           if (!syntax_error)
-               prog = bt_regengine.regcomp(expr, re_flags);
-
-    }      /* endif prog==NULL */
-
+           prog = bt_regengine.regcomp(expr, re_flags);
+    }
 
     return prog;
 }
index ec5543c466d3f5e4348d30094e5760e4f5fd25e5..712743c26b9cc4bd7c2a68f3733549098217e4db 100644 (file)
@@ -221,23 +221,6 @@ static int nfa_classcodes[] = {
 
 static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
 
-/*
- * NFA errors can be of 3 types:
- * *** NFA runtime errors, when something unknown goes wrong. The NFA fails
- *     silently and revert the to backtracking engine.
- *     syntax_error = FALSE;
- * *** Regexp syntax errors, when the input regexp is not syntactically correct.
- *     The NFA engine displays an error message, and nothing else happens.
- *     syntax_error = TRUE
- * *** Unsupported features, when the input regexp uses an operator that is not
- *     implemented in the NFA. The NFA engine fails silently, and reverts to the
- *     old backtracking engine.
- *     syntax_error = FALSE
- * "The NFA fails" means that "compiling the regexp with the NFA fails":
- * nfa_regcomp() returns FAIL.
- */
-static int syntax_error = FALSE;
-
 /* NFA regexp \ze operator encountered. */
 static int nfa_has_zend;
 
@@ -692,7 +675,6 @@ nfa_regatom()
     switch (c)
     {
        case NUL:
-           syntax_error = TRUE;
            EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
 
        case Magic('^'):
@@ -814,7 +796,6 @@ nfa_regatom()
        case Magic('|'):
        case Magic('&'):
        case Magic(')'):
-           syntax_error = TRUE;
            EMSGN(_(e_misplaced), no_Magic(c));
            return FAIL;
 
@@ -825,7 +806,6 @@ nfa_regatom()
        case Magic('*'):
        case Magic('{'):
            /* these should follow an atom, not form an atom */
-           syntax_error = TRUE;
            EMSGN(_(e_misplaced), no_Magic(c));
            return FAIL;
 
@@ -902,7 +882,6 @@ nfa_regatom()
                    break;
 #endif
                default:
-                   syntax_error = TRUE;
                    EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"),
                                                                 no_Magic(c));
                    return FAIL;
@@ -1023,7 +1002,6 @@ nfa_regatom()
                            break;
                        }
                    }
-                   syntax_error = TRUE;
                    EMSGN(_("E867: (NFA) Unknown operator '\\%%%c'"),
                                                                 no_Magic(c));
                    return FAIL;
@@ -1359,10 +1337,7 @@ collection:
            } /* if exists closing ] */
 
            if (reg_strict)
-           {
-               syntax_error = TRUE;
                EMSG_RET_FAIL(_(e_missingbracket));
-           }
            /* FALLTHROUGH */
 
        default:
@@ -1512,7 +1487,6 @@ nfa_regpiece()
            }
            if (i == 0)
            {
-               syntax_error = TRUE;
                EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op);
                return FAIL;
            }
@@ -1543,10 +1517,8 @@ nfa_regpiece()
                greedy = FALSE;
            }
            if (!read_limits(&minval, &maxval))
-           {
-               syntax_error = TRUE;
                EMSG_RET_FAIL(_("E870: (NFA regexp) Error reading repetition limits"));
-           }
+
            /*  <atom>{0,inf}, <atom>{0,} and <atom>{}  are equivalent to
             *  <atom>*  */
            if (minval == 0 && maxval == MAX_LIMIT)
@@ -1614,11 +1586,8 @@ nfa_regpiece()
     }  /* end switch */
 
     if (re_multi_type(peekchr()) != NOT_MULTI)
-    {
        /* Can't have a multi follow a multi. */
-       syntax_error = TRUE;
        EMSG_RET_FAIL(_("E871: (NFA regexp) Can't have a multi follow a multi !"));
-    }
 
     return OK;
 }
@@ -1767,10 +1736,7 @@ nfa_reg(paren)
     if (paren == REG_PAREN)
     {
        if (regnpar >= NSUBEXP) /* Too many `(' */
-       {
-           syntax_error = TRUE;
            EMSG_RET_FAIL(_("E872: (NFA regexp) Too many '('"));
-       }
        parno = regnpar++;
     }
 #ifdef FEAT_SYN_HL
@@ -1778,10 +1744,7 @@ nfa_reg(paren)
     {
        /* Make a ZOPEN node. */
        if (regnzpar >= NSUBEXP)
-       {
-           syntax_error = TRUE;
            EMSG_RET_FAIL(_("E879: (NFA regexp) Too many \\z("));
-       }
        parno = regnzpar++;
     }
 #endif
@@ -1800,7 +1763,6 @@ nfa_reg(paren)
     /* Check for proper termination. */
     if (paren != REG_NOPAREN && getchr() != Magic(')'))
     {
-       syntax_error = TRUE;
        if (paren == REG_NPAREN)
            EMSG2_RET_FAIL(_(e_unmatchedpp), reg_magic == MAGIC_ALL);
        else
@@ -1808,7 +1770,6 @@ nfa_reg(paren)
     }
     else if (paren == REG_NOPAREN && peekchr() != NUL)
     {
-       syntax_error = TRUE;
        if (peekchr() == Magic(')'))
            EMSG2_RET_FAIL(_(e_unmatchedpar), reg_magic == MAGIC_ALL);
        else
index fe9465a0edc6bd6b6d956f12cfe9fdeb6ce5be4e..e8febd52a5584a72c42d34def33c420d6aed3087 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1128,
 /**/
     1127,
 /**/