From ca7c509ae0396be0b15c268b1b2e0600e796e322 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sat, 25 Oct 2014 15:34:06 -0400 Subject: vim-patch:7.4.437 Problem: New and old regexp engine are not consistent. Solution: Also give an error for "\ze*" for the old regexp engine. https://code.google.com/p/vim/source/detail?r=v7-4-437 --- src/nvim/regexp.c | 15 +++++++++++++++ src/nvim/regexp_nfa.c | 9 --------- src/nvim/version.c | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index cef2e6d9bf..d57bc889ac 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1983,9 +1983,15 @@ static char_u *regatom(int *flagp) break; case 's': ret = regnode(MOPEN + 0); + if (!re_mult_next("\\zs")) { + return NULL; + } break; case 'e': ret = regnode(MCLOSE + 0); + if (!re_mult_next("\\ze")) { + return NULL; + } break; default: EMSG_RET_NULL(_("E68: Invalid character after \\z")); @@ -2460,6 +2466,15 @@ do_multibyte: return ret; } +/// Used in a place where no * or \+ can follow. +static bool re_mult_next(char *what) +{ + if (re_multi_type(peekchr()) == MULTI_MULT) { + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + } + return true; +} + /* * Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for * character "c". diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index bbe96854ad..9ae1740627 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1747,15 +1747,6 @@ nfa_do_multibyte: return OK; } -/// Used in a place where no * or \+ can follow. -static bool re_mult_next(char *what) -{ - if (re_multi_type(peekchr()) == MULTI_MULT) { - EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); - } - return true; -} - /* * Parse something followed by possible [*+=]. * diff --git a/src/nvim/version.c b/src/nvim/version.c index 76cf667ce5..2bc99fcad4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -228,7 +228,7 @@ static int included_patches[] = { 440, 439, //438, - //437, + 437, 436, //435, //434, -- cgit