[Patch] Reimplment regex matcher using DFS

Tim Shen timshen91@gmail.com
Tue Jul 23 14:22:00 GMT 2013


On Tue, Jul 23, 2013 at 10:06 PM, Stephen M. Webb
<stephen.webb@bregmasoft.ca> wrote:
> Would it be better to prescan the regex to determine which matcher to build?

Yes that's what I exactly intended to do. But I need some time. The
Thompson NFA matcher is buggy(when grouping) and I need to fix it
first, then connect it to the basic_regex constructor.

> Also, in the absence of back references, a DFA can be considerably faster than an NFA or a DFS.  We should consider
> constructing a DFA if a prescan says there are no back references and the regex_constants::optimize flag is set.

That's another important optimization. Again, this could be done
later. But for now features are needed to be implemented.

> Me, I would prefer more comment in the code and the comments be maintained with the code, because (a) you could get hit
> by an asteroid and be unable to finish you work, and regex implementation is complex enough that every little bit helps
> when someone is trying to understand what was written, and (2) you could run out of time.  I don't take the lack of
> comments and documentation throughout the library as an exemplar.  Others may have differing opinions.

I'll add them ASAP.


-- 
Tim Shen



More information about the Libstdc++ mailing list