Re: CT regex in AA at compile time

2020-01-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/7/20 11:00 AM, Taylor Hillegeist wrote: On Tuesday, 7 January 2020 at 15:51:21 UTC, MoonlightSentinel wrote: On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist wrote: but I can't get it to work. it says its an Error: non-constant expression. I imagine this has to do with the c

Re: CT regex in AA at compile time

2020-01-07 Thread Patrick Schluter via Digitalmars-d-learn
On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist wrote: I'm trying to trick the following code snippet into compilation. enum TokenType{ //Terminal Plus, Minus, LPer, RPer, Number, } static auto Regexes =[ TokenType.Plus: ctRegex!

Re: CT regex in AA at compile time

2020-01-07 Thread Taylor Hillegeist via Digitalmars-d-learn
On Tuesday, 7 January 2020 at 15:51:21 UTC, MoonlightSentinel wrote: On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist wrote: but I can't get it to work. it says its an Error: non-constant expression. I imagine this has to do with the ctRegex template or something. maybe there is

Re: CT regex in AA at compile time

2020-01-07 Thread MoonlightSentinel via Digitalmars-d-learn
On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist wrote: but I can't get it to work. it says its an Error: non-constant expression. I imagine this has to do with the ctRegex template or something. maybe there is a better way? Does anyone know? This issue is unrelated to ctRegex,

CT regex in AA at compile time

2020-01-07 Thread Taylor Hillegeist via Digitalmars-d-learn
I'm trying to trick the following code snippet into compilation. enum TokenType{ //Terminal Plus, Minus, LPer, RPer, Number, } static auto Regexes =[ TokenType.Plus: ctRegex!(`^ *\+`), TokenType.Minus: ctRegex!(`^ *\-`), TokenType.LPer: