aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2014-10-25 15:34:06 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-11-13 11:38:19 -0500
commitca7c509ae0396be0b15c268b1b2e0600e796e322 (patch)
treea8458ee422ca0803bacba0831f3de0ef44c4c2f7 /src/nvim/regexp.c
parent44635add18f7ef49f8d598123ec1d4ec61563e73 (diff)
downloadrneovim-ca7c509ae0396be0b15c268b1b2e0600e796e322.tar.gz
rneovim-ca7c509ae0396be0b15c268b1b2e0600e796e322.tar.bz2
rneovim-ca7c509ae0396be0b15c268b1b2e0600e796e322.zip
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
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c15
1 files changed, 15 insertions, 0 deletions
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".