www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ctRegex! vs regex error

reply "Milvakili" <maliy.kayit gmail.com> writes:
Hi,
I can compile

void main(){
auto myRegx = regex(`(?!test)`);
}

however can not compile this one

void main(){
auto myRegx =  ctRegex!(`(?!test)`);
}

code sample:http://dpaste.dzfl.pl/d38926f4

and get the following error:

/opt/compilers/dmd2/include/std/regex.d(4355): Error: 
"NeglookaheadStart"[0LU..17LU]
/opt/compilers/dmd2/include/std/regex.d(4313):        called from 
here: this.ctGenGroup(ir, result.addr)
/opt/compilers/dmd2/include/std/regex.d(4751):        called from 
here: this.ctGenBlock(re.ir, 0)
/opt/compilers/dmd2/include/std/regex.d(4800):        called from 
here: context.ctGenRegEx(re)
/opt/compilers/dmd2/include/std/regex.d(6487):        called from 
here: ctGenRegExCode(Regex(null, [Bytecode(2566914052u), 
Bytecode(1u), Bytecode(1u), Bytecode(2147483764u), 
Bytecode(2147483749u), Bytecode(2147483763u), 
Bytecode(2147483764u), Bytecode(2583691268u), 
Bytecode(2550136832u)], null, 1u, 0u, 0u, 7u, 0u, null, null, 
ShiftOr([4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u, 4294967295u, 4294967295u, 4294967295u, 
4294967295u, 4294967295u], 4294967295u, 0u)))
/opt/compilers/dmd2/include/std/regex.d(6511): Error: template 
instance std.regex.ctRegexImpl!("(?!test)", []) error 
instantiating
/d53/f251.d(10):        instantiated from here: 
ctRegex!("(?!test)")
/d53/f251.d(10): Error: template instance 
std.regex.ctRegex!("(?!test)") error instantiating
Aug 07 2013
next sibling parent "Anthony Goins" <neontotem gmail.com> writes:
On Wednesday, 7 August 2013 at 22:36:39 UTC, Milvakili wrote:
 Hi,
 I can compile

 void main(){
 auto myRegx = regex(`(?!test)`);
 }

 however can not compile this one

 void main(){
 auto myRegx =  ctRegex!(`(?!test)`);
 }

 code sample:http://dpaste.dzfl.pl/d38926f4

 and get the following error:
...
 std.regex.ctRegex!("(?!test)") error instantiating

Sorry I really can't help you. Except to let you know your code sample link is broken.
Aug 08 2013
prev sibling next sibling parent "Tyler Jameson Little" <beatgammit gmail.com> writes:
On Wednesday, 7 August 2013 at 22:36:39 UTC, Milvakili wrote:
 Hi,
 I can compile

 void main(){
 auto myRegx = regex(`(?!test)`);
 }

 however can not compile this one

 void main(){
 auto myRegx =  ctRegex!(`(?!test)`);
 }

 code sample:http://dpaste.dzfl.pl/d38926f4

 and get the following error:

 snip...

Go ahead and add it to the issue tracker: http://d.puremagic.com/issues/ FWIW, I get the same error, and I get a similar one in LDC: /usr/include/d/std-ldc/std/regex.d(4350): Error: ['N', 'e', 'g', 'l', 'o', 'o', 'k', 'a', 'h', 'e', 'a', 'd', 'S', 't', 'a', 'r', 't'][0LU..17LU] /usr/include/d/std-ldc/std/regex.d(4308): called from here: this.ctGenGroup(ir, result.addr) /usr/include/d/std-ldc/std/regex.d(4746): called from here: this.ctGenBlock(re.ir, 0) /usr/include/d/std-ldc/std/regex.d(4795): called from here: context.ctGenRegEx(re) /usr/include/d/std-ldc/std/regex.d(6482): called from here: ctGenRegExCode(regex("(?!test)", [])) /usr/include/d/std-ldc/std/regex.d(6506): Error: template instance std.regex.ctRegexImpl!("(?!test)", []) error instantiating instantiatied in test.d(10): ctRegex!("(?!test)") test.d(10): Error: template instance std.regex.ctRegex!("(?!test)") error instantiating
Aug 08 2013
prev sibling parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
08-Aug-2013 02:36, Milvakili пишет:
 Hi,
 I can compile

 void main(){
 auto myRegx = regex(`(?!test)`);
 }

 however can not compile this one

 void main(){
 auto myRegx =  ctRegex!(`(?!test)`);
 }

Well, it should have said "sorry, unsupported yet" or something to that extent. It's a bug regardless as it shouldn't spit this much of garbage on the screen. ctRegex is not yet up to the full feature set of the run-time one. The prime things missing are exactly zero-width assertions (look-ahead/look-behind). And certain things will simply make compiler explode... Reasons for not supporting it yet are various but the primary one is that I can't even fully test the current subset yet (!) due to the sorry state of CTFE (still!). Things definitely greatly improved since then but don't get your hopes high it's not something to fix overnight. -- Dmitry Olshansky
Aug 08 2013