Regex in ctfe?
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jan 27 12:25:33 PST 2016
On Wed, Jan 27, 2016 at 07:54:21PM +0000, Era Scarecrow via Digitalmars-d wrote:
> On Wednesday, 27 January 2016 at 19:05:01 UTC, H. S. Teoh wrote:
> >An alternative would be to use `if (_ctfe)` branches in the code to
> >switch to a different matching engine when in CTFE, and leaving the
> >runtime code untouched.
>
> Hmmm... As I recall there's 2 major engines that run Regex (DFA &
> NFA). If you don't need the more complex engine (which has
> forward/back referencing, named capturing, etc) then maybe the
> simpler engine would work.
>
> But it would seem easier/simpler if the compiler just hooks in the
> Regex that's compiled into it instead and passes the data back and
> forth. It does mean you can't test Regex changes during the CTFE
> stage (assuming your actively changing/building it) but it wouldn't
> have the performance hit either.
Currently, AFAIK, (d)dmd does not use anything from Phobos. I'm not sure
if this is a temporary situation, or there's a strong reason for it.
T
--
Those who don't understand D are condemned to reinvent it, poorly. -- Daniel N
More information about the Digitalmars-d
mailing list