summaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-02 21:13:25 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-02 21:13:25 +0200
commite8c4abbbd711af8fd3ed85ea69e9ac3d63a0d879 (patch)
tree0101dc0b69343972a82db39af16612334fbc0a8d /src/regexp.c
parent2c869deeb7658b6b02e525ff9412fc4a0c968688 (diff)
downloadvim-git-e8c4abbbd711af8fd3ed85ea69e9ac3d63a0d879.tar.gz
patch 8.2.0502: Vim9: some code is not testedv8.2.0502
Problem: Vim9: some code is not tested. Solution: Add more tests. Fix uncovered problems.
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 4e21d44cc..b4fb59598 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -537,16 +537,30 @@ skip_anyof(char_u *p)
* Stop at end of "startp" or where "dirc" is found ('/', '?', etc).
* Take care of characters with a backslash in front of it.
* Skip strings inside [ and ].
+ */
+ char_u *
+skip_regexp(
+ char_u *startp,
+ int dirc,
+ int magic)
+{
+ return skip_regexp_ex(startp, dirc, magic, NULL, NULL);
+}
+
+/*
+ * skip_regexp() with extra arguments:
* When "newp" is not NULL and "dirc" is '?', make an allocated copy of the
* expression and change "\?" to "?". If "*newp" is not NULL the expression
* is changed in-place.
+ * If a "\?" is changed to "?" then "dropped" is incremented, unless NULL.
*/
char_u *
-skip_regexp(
+skip_regexp_ex(
char_u *startp,
int dirc,
int magic,
- char_u **newp)
+ char_u **newp,
+ int *dropped)
{
int mymagic;
char_u *p = startp;
@@ -579,6 +593,8 @@ skip_regexp(
if (*newp != NULL)
p = *newp + (p - startp);
}
+ if (dropped != NULL)
+ ++*dropped;
if (*newp != NULL)
STRMOVE(p, p + 1);
else