patch 8.2.2278: falling back to old regexp engine can some patterns
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)
diff --git a/src/regexp.c b/src/regexp.c
index f7f04ea..0fd6de6 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -294,6 +294,7 @@
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 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 @@
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 @@
&& called_emsg == called_emsg_before)
{
regexp_engine = BACKTRACKING_ENGINE;
+#ifdef FEAT_EVAL
+ report_re_switch(expr);
+#endif
prog = bt_regengine.regcomp(expr, re_flags);
}
}