This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Reimplment regex matcher using DFS
- From: Tim Shen <timshen91 at gmail dot com>
- To: stephen dot webb at bregmasoft dot ca
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 23 Jul 2013 22:22:50 +0800
- Subject: Re: [Patch] Reimplment regex matcher using DFS
- References: <CAPrifDnky=cuvwL0HHCKD5zOkLj5EqFbBm9-HXSyEXYjNUKzMg at mail dot gmail dot com> <51EE8DCF dot 3010300 at bregmasoft dot ca>
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