On 10.08.2011 15:16, Vladimir Panteleev wrote:
On Wed, 10 Aug 2011 13:42:25 +0300, Dmitry Olshansky <[email protected]> wrote:

and to get CTFE features working add if(!__ctfe) listed in the next diff

Hi, does this rewrite cover compile-time regex compilation?

E.g. regex!`^a` compiling to s.length&&s[0]=='a' or something like that.


Yes, I've dubbed it static regex. In fact it will be something similar to this, though it will do a heap allocation for backtracking points, on first call to match. Heap allocations are definetly going away in final release.
You can pass -version=fred_ct -debug to dmd to see generated programs.
At the moment it's more prof of concept then speed devil, something I might see about to change once CTFE bugs worked out. Anyway when it doesn't crush the compiler, it's pretty fast :)

--
Dmitry Olshansky

Reply via email to