Re: Compile time regex matching

2014-07-15 Thread Philippe Sigaud via Digitalmars-d-learn
> I did, and I got it to work. Unfortunately, the code used to in the CTFE is > left in the final executable even though it is not used at runtime. So now > the question is, is there away to get rid of the excess baggage? Not that I know of. Once code is injected, it's compiled into the executable

Re: Compile time regex matching

2014-07-15 Thread Jason den Dulk via Digitalmars-d-learn
On Monday, 14 July 2014 at 11:43:01 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: You can try Pegged, a parser generator that works at compile-time (both the generator and the generated parser). I did, and I got it to work. Unfortunately, the code used to in the CTFE is left in the fi

Re: Compile time regex matching

2014-07-14 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Jul 14, 2014 at 3:19 PM, Artur Skawina via Digitalmars-d-learn wrote: > On 07/14/14 13:42, Philippe Sigaud via Digitalmars-d-learn wrote: >> asserts get an entire copy of the parse tree. It's a bit wasteful, but >> using 'immutable' directly does not work here, but this is OK: >> >> en

Re: Compile time regex matching

2014-07-14 Thread Artur Skawina via Digitalmars-d-learn
On 07/14/14 13:42, Philippe Sigaud via Digitalmars-d-learn wrote: > asserts get an entire copy of the parse tree. It's a bit wasteful, but > using 'immutable' directly does not work here, but this is OK: > > enum res = MyRegex("abcabcdefFOOBAR"); // compile-time parsing > immutable result

Re: Compile time regex matching

2014-07-14 Thread Philippe Sigaud via Digitalmars-d-learn
> I am trying to write some code that uses and matches to regular expressions > at compile time, but the compiler won't let me because matchFirst and > matchAll make use of malloc(). > > Is there an alternative that I can use that can be run at compile time? You can try Pegged, a parser generator