summaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-02 17:43:49 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-02 17:43:49 +0100
commit66c50c565321d4d49d8d5620912e5e8fe4825644 (patch)
tree73c2ddf3479db220eaf11cb9608df66825844612 /src/regexp.c
parent9281c6cae4e1cec2c661487d761d407bad7c6ad6 (diff)
downloadvim-git-66c50c565321d4d49d8d5620912e5e8fe4825644.tar.gz
patch 8.2.2278: falling back to old regexp engine can some patternsv8.2.2278
Problem: Falling back to old regexp engine can some patterns. Solution: Do not fall back once [[:lower:]] or [[:upper:]] is used. (Christian Brabandt, closes #7572)
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c
index f7f04ea87..0fd6de61e 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -294,6 +294,7 @@ init_class_tab(void)
static char_u *regparse; // Input-scan pointer.
static int regnpar; // () count.
+static int wants_nfa; // regex should use NFA engine
#ifdef FEAT_SYN_HL
static int regnzpar; // \z() count.
static int re_has_z; // \z item detected
@@ -381,6 +382,9 @@ static int cstrncmp(char_u *s1, char_u *s2, int *n);
static char_u *cstrchr(char_u *, int);
static int re_mult_next(char *what);
static int reg_iswordc(int);
+#ifdef FEAT_EVAL
+static void report_re_switch(char_u *pat);
+#endif
static regengine_T bt_regengine;
static regengine_T nfa_regengine;
@@ -2662,7 +2666,7 @@ vim_regcomp(char_u *expr_arg, int re_flags)
if (prog == NULL)
{
#ifdef BT_REGEXP_DEBUG_LOG
- if (regexp_engine != BACKTRACKING_ENGINE) // debugging log for NFA
+ if (regexp_engine == BACKTRACKING_ENGINE) // debugging log for BT engine
{
FILE *f;
f = fopen(BT_REGEXP_DEBUG_LOG_NAME, "a");
@@ -2686,6 +2690,9 @@ vim_regcomp(char_u *expr_arg, int re_flags)
&& called_emsg == called_emsg_before)
{
regexp_engine = BACKTRACKING_ENGINE;
+#ifdef FEAT_EVAL
+ report_re_switch(expr);
+#endif
prog = bt_regengine.regcomp(expr, re_flags);
}
}