On Mi, 18 Sep 2013, Christian Brabandt wrote:

> On Mi, 18 Sep 2013, Christ van Willegen wrote:
> 
> > I accidentally searched the following
> > 
> > /\(
> > 
> > This gives me the error message
> > 
> > E54: Unmatched \(
> > E54: Unmatched \(
> > 
> > twice.
> 
> This happens, because your 're' setting is 0. That means, if the 
> backtracking engine fails to compile the regular expression, vim will 
> automatically retry with the old engine. Therefore you get the error for 
> each tried regexp engine.
> 
> I think, this patch prevents this:
> diff --git a/src/regexp.c b/src/regexp.c
> --- a/src/regexp.c
> +++ b/src/regexp.c
> @@ -8022,6 +8022,8 @@
>          */
>         if (regexp_engine == AUTOMATIC_ENGINE)
>             prog = bt_regengine.regcomp(expr, re_flags);
> +       if (emsg_off)
> +           emsg_off--;
>      }
>  
>      return prog;
> diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
> --- a/src/regexp_nfa.c
> +++ b/src/regexp_nfa.c
> @@ -6644,6 +6644,8 @@
>         /* TODO: only give this error for debugging? */
>         if (post_ptr >= post_end)
>             EMSGN("Internal error: estimated max number of states 
> insufficient: %ld", post_end - post_star
> +       if (p_re == 0)
> +           emsg_off++; /* prevent double errors */
>         goto fail;          /* Cascaded (syntax?) error */
>      }
> 
> 
> > 
> > When I search for
> > 
> > /()
> > 
> > I get
> > 
> > E486: Pattern not found: ()
> > 
> > (once)

And this happens, because this error does not come from the 're' engine 
but from the search function.

regards,
Christian
-- 
Ein Mensch in einer fremden Stadt fragt:
  "Wissen Sie, wo es zum Bahnhof geht?"
Moderator: "Welche Lösungswege haben Sie schon angedacht? Schreiben
    Sie alles hier auf diese Kärtchen."

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui