aboutsummaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c48
1 files changed, 7 insertions, 41 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 35ed1b85f7..b9a111caf1 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3295,53 +3295,28 @@ static lpos_T reg_endzpos[NSUBEXP]; /* idem, end pos */
/* TRUE if using multi-line regexp. */
#define REG_MULTI (reg_match == NULL)
-static int bt_regexec(regmatch_T *rmp, char_u *line, colnr_T col);
+static int bt_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col, bool line_lbr);
/*
* Match a regexp against a string.
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
* Uses curbuf for line count and 'iskeyword'.
+ * If "line_lbr" is true, consider a "\n" in "line" to be a line break.
*
* Return TRUE if there is a match, FALSE if not.
*/
static int
-bt_regexec (
- regmatch_T *rmp,
- char_u *line, /* string to match against */
- colnr_T col /* column to start looking for match */
-)
-{
- reg_match = rmp;
- reg_mmatch = NULL;
- reg_maxline = 0;
- reg_line_lbr = FALSE;
- reg_buf = curbuf;
- reg_win = NULL;
- ireg_ic = rmp->rm_ic;
- ireg_icombine = FALSE;
- ireg_maxcol = 0;
- return bt_regexec_both(line, col, NULL) != 0;
-}
-
-#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
- || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
-
-static int bt_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col);
-
-/*
- * Like vim_regexec(), but consider a "\n" in "line" to be a line break.
- */
-static int
bt_regexec_nl (
regmatch_T *rmp,
char_u *line, /* string to match against */
- colnr_T col /* column to start looking for match */
+ colnr_T col, /* column to start looking for match */
+ bool line_lbr
)
{
reg_match = rmp;
reg_mmatch = NULL;
reg_maxline = 0;
- reg_line_lbr = TRUE;
+ reg_line_lbr = line_lbr;
reg_buf = curbuf;
reg_win = NULL;
ireg_ic = rmp->rm_ic;
@@ -3349,7 +3324,6 @@ bt_regexec_nl (
ireg_maxcol = 0;
return bt_regexec_both(line, col, NULL) != 0;
}
-#endif
static long bt_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf,
linenr_T lnum, colnr_T col,
@@ -6985,11 +6959,7 @@ static regengine_T bt_regengine =
{
bt_regcomp,
bt_regfree,
- bt_regexec,
-#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
- || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
bt_regexec_nl,
-#endif
bt_regexec_multi
#ifdef REGEXP_DEBUG
,(char_u *)""
@@ -7006,11 +6976,7 @@ static regengine_T nfa_regengine =
{
nfa_regcomp,
nfa_regfree,
- nfa_regexec,
-#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
- || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
nfa_regexec_nl,
-#endif
nfa_regexec_multi
#ifdef REGEXP_DEBUG
,(char_u *)""
@@ -7126,7 +7092,7 @@ vim_regexec (
colnr_T col /* column to start looking for match */
)
{
- return rmp->regprog->engine->regexec(rmp, line, col);
+ return rmp->regprog->engine->regexec_nl(rmp, line, col, false);
}
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
@@ -7136,7 +7102,7 @@ vim_regexec (
*/
int vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col)
{
- return rmp->regprog->engine->regexec_nl(rmp, line, col);
+ return rmp->regprog->engine->regexec_nl(rmp, line, col, true);
}
#endif