On Sun, 2007-03-18 at 15:07 +0100, Bram Moolenaar wrote: > 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).
Thanks, that eased a lot of pain, I thought my brain was lagging behind. :) > > 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. > - Asiri