On Tuesday, 26 January 2016 at 01:34:09 UTC, Manu wrote:
Possible to std.regex in ctfe?
(...)
I have a string import destined for a mixin, and I want to
parse it with regex, but I haven't been able to make it work.
The docs mention nothing about this possibility.
Hi Manu,
a possible solution for that would be to use my Pegged
(https://github.com/PhilippeSigaud/Pegged) project. It's a parser
generator that creates compile-time (and runtime) parsers. It's
not directly compatible with Phobos regexes, but it's quite easy
to extract the matched strings.
Bastiaan Veelo recently added support for left-recursive
grammars, which means we can now generate parsers for many more
grammars (although if your parsing need is covered by regexes,
that probably won't interest you...)
Philippe