From: Eric Niebler (eric_at_[hidden])
Date: 2007-08-27 12:33:25
(Sorry for the delay, I just got back from a week-long vacation.)
Andreas Pokorny wrote:
> Hi Eric,
> I recently tried to make recursive/nested regular expressions available for
> the dynamic regex. It would be cool if you could have look at that.
> To achieve that I extended the compiler traits, which now includes a
> lookup for references to other regular expressions. I saw that static
> regular expressions used by reference, store a weak pointer to regex
> the regex impl object. For dynamic regular expressions I had to store
> a pointer to the regular expression, and make the class that groups all
> expressions noncopyable.
> Do you see a nicer solution?
Hi Andreas. I *also* recently made nested regexes work for dynamic
regexes, and I made an announcement about it on this list not too long
ago. See here: http://lists.boost.org/Archives/boost/2007/06/122641.php.
In particular, see "Dynamic Regex Grammars with Named Regexes", which
has the following example:
sregex rx = comp.compile("^bar(?$RE)baz$");
The regex_compiler holds a map from names to regex objects. The first
call to compile() creates a forward reference to a regex object named
"RE" and the second call binds a regex to the name "RE".
Is this the sort of thing you had in mind? (This is only available in
the repository -- no public release has this feature yet.)
-- Eric Niebler Boost Consulting www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk