From fb031407304b82b49f6f367bfba31f602837fc49 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 17:18:49 +0200 Subject: [PATCH] updated for version 7.4.437 Problem: New and old regexp engine are not consistent. Solution: Also give an error for "\ze*" for the old regexp engine. --- src/regexp.c | 18 ++++++++++++++++++ src/regexp_nfa.c | 13 ------------- src/version.c | 2 ++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/regexp.c b/src/regexp.c index dcb9a3b4e8e07..f19e139710b92 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -358,6 +358,8 @@ static void regdump __ARGS((char_u *, bt_regprog_T *)); static char_u *regprop __ARGS((char_u *)); #endif +static int re_mult_next __ARGS((char *what)); + static char_u e_missingbracket[] = N_("E769: Missing ] after %s["); static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%("); static char_u e_unmatchedp[] = N_("E54: Unmatched %s("); @@ -2166,9 +2168,13 @@ regatom(flagp) #endif case 's': ret = regnode(MOPEN + 0); + if (re_mult_next("\\zs") == FAIL) + return NULL; break; case 'e': ret = regnode(MCLOSE + 0); + if (re_mult_next("\\ze") == FAIL) + return NULL; break; default: EMSG_RET_NULL(_("E68: Invalid character after \\z")); @@ -7005,6 +7011,18 @@ regprop(op) } #endif /* DEBUG */ +/* + * Used in a place where no * or \+ can follow. + */ + static int +re_mult_next(what) + char *what; +{ + if (re_multi_type(peekchr()) == MULTI_MULT) + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + return OK; +} + #ifdef FEAT_MBYTE static void mb_decompose __ARGS((int c, int *c1, int *c2, int *c3)); diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 4ccb05a2b3bda..6531d45fd1e73 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -291,7 +291,6 @@ static int nfa_regpiece __ARGS((void)); static int nfa_regconcat __ARGS((void)); static int nfa_regbranch __ARGS((void)); static int nfa_reg __ARGS((int paren)); -static int re_mult_next __ARGS((char *what)); #ifdef DEBUG static void nfa_set_code __ARGS((int c)); static void nfa_postfix_dump __ARGS((char_u *expr, int retval)); @@ -2281,18 +2280,6 @@ nfa_reg(paren) return OK; } -/* - * Used in a place where no * or \+ can follow. - */ - static int -re_mult_next(what) - char *what; -{ - if (re_multi_type(peekchr()) == MULTI_MULT) - EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); - return OK; -} - #ifdef DEBUG static char_u code[50]; diff --git a/src/version.c b/src/version.c index 521f2d88c9eca..599dd338b39ea 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 437, /**/ 436, /**/