Asiri Rathanayake wrote:

> I read several articles on possible NFA implementations ( took some time
> to understand ). But I think implementing an NFA based approach is quite
> possible ( Russ Cox has provided a sample implementation in his
> article ). But I'm having a hard time understanding the existing
> approach taken :'( .
> 
> The current implementation also seem to have a bypass mechanism, the
> vim_regcomp() method is setting variables Regstart and reganch so that
> obvious non matching cases can be avoided. I was thinking if this
> approach can be used to switch between old implementation and the new
> one. Is this possible ?

Everything is possible...

The existing code is hard to understand, since it has been extended a
lot and quite a few bits are optimized for space and speed.  On top of
that I changed it from a recursive to an iterative mechanism (avoids
running out of stack space and crashing).

It would be good if the rest of the Vim code doesn't need to know how
vim_regcomp() and vim_regexec() work.  Adding a flag to regprog_T should
work.

-- 
"It's so simple to be wise.  Just think of something stupid to say
and then don't say it."        -- Sam Levenson

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to