www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - compile time regex

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
There is a ctRegex; is there a compile time equivalent for match?
Jun 16 2012
next sibling parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 17.06.2012 0:44, Ellery Newcomer wrote:
 There is a ctRegex; is there a compile time equivalent for match?

No. Since last time I tried to hack through CTFE it failed horribly. Bleh, I'd rather first make sure that most regexes actually _compile_ at CTFE. -- Dmitry Olshansky
Jun 16 2012
prev sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Sat, Jun 16, 2012 at 10:50 PM, Dmitry Olshansky
<dmitry.olsh gmail.com> wrote:
 On 17.06.2012 0:44, Ellery Newcomer wrote:
 There is a ctRegex; is there a compile time equivalent for match?

No. Since last time I tried to hack through CTFE it failed horribly. Bleh, I'd rather first make sure that most regexes actually _compile_ at CTFE.

Ellery, if you really need to match at CT, you can try Pegged: https://github.com/PhilippeSigaud/Pegged/wiki Be warned that while parsing at compile-time, it's not fast and will probably eat RAM like there is no tomorrow :) Youkei is developping CTPG, which is from the same family: https://github.com/youkei/ctpg/wiki/Home-en For both projects, the grammar is a PEG, not a regex, but the syntax is not that different. As PEG are more general, the engines are not optimized like std.regex. Philippe
Jun 16 2012