On Mon, Mar 31, 2008 at 8:08 AM, Ian Young <[EMAIL PROTECTED]> wrote:
>
>  Here's another problem with changing behavior in the new engine: we
>  would have to modify the backtracking engine as well to prevent it
>  from using ordered alternation.  Since our new engine can't handle
>  certain things and falls back to the old one, they must behave the
>  same. For example, we can't have aa\|aab and \(a\)\1\|aab match
>  different things - the horror!
>
>  Where is Russ' code that solves this problem?  I believe at one point
>  we discussed using a simplified type of "tagged nfa" to get around
>  this, but I can't find that conversation anywhere.

Russ' code:
http://swtch.com/~rsc/regexp/nfa-perl.y.txt


>  On Fri, Mar 28, 2008 at 9:53 AM,  <[EMAIL PROTECTED]> wrote:
>  >
>  >  If the new engine is supposed to have Posix-compatible behaviour,
>
>  It's not, but I think this is a relevant issue.  What about the idea
>  of having a flag to change regexp behavior from Vim style to POSIX
>  style (or at least a close approximation)?  Would this be useful?

I agree.

>  Let me throw a couple different ideas out:
>
>  It's possible someone could rewrite the current engines to behave
>  differently depending on the desired behavior.  However, I don't know
>  how much work that would be.  The type of greediness should be easy to
>  manipulate in the new engine, but I can't speak to changing the old
>  engine, or to the other things that Vim does differently from POSIX.


>  Alternatively, the changes we made to Vim code make it fairly easy to
>  plug in different regexp engines at will

I don't think so! It's easy to have a different regexp engines and
Vim will crash. Much much more work need to be done to ensure
that it behaves correct.

Having one new, fast and robust regexp engine is enough, I think.

>  I got part of the way on a
>  PCRE-driven Vim, although I don't believe I got certain features like
>  multiline matching working.  It should be doable, though, and it's
>  possible that a PCRE (or another regexp engine) dependency could be
>  included at compile time or released as an unofficial patch or
>  something.  Again, runtime behavior could be specified with a flag.
>

PCRE suffers from the same performance penalty as Vim does.


Xiaozhou

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui