0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2021-01-02 17:43:49 +01:00
parent 9281c6cae4
commit 66c50c5653
4 changed files with 73 additions and 3 deletions

View File

@@ -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);
}
}