www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is this a std.regex bug?

reply "Andrea Fontana" <nospam example.com> writes:
dmd 2.060 64bit ubuntu:

// Doesn't work:
auto r = 
ctRegex!(r"/api/places/(id|related|search|count)\.(json|xml)", 
"g");
		
// Works:
auto r = 
regex(r"/api/places/(id|related|search|count)\.(json|xml)", "g");
		
Aug 07 2012
next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 07-Aug-12 16:06, Andrea Fontana wrote:
 dmd 2.060 64bit ubuntu:

 // Doesn't work:
 auto r = ctRegex!(r"/api/places/(id|related|search|count)\.(json|xml)",
 "g");

Could be. It is experimental and is known to have bugs. What is the exact problem statement?
 // Works:
 auto r = regex(r"/api/places/(id|related|search|count)\.(json|xml)", "g");

-- Dmitry Olshansky
Aug 07 2012
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 08-Aug-12 11:28, Andrea Fontana wrote:
 import std.regex;
 void main() {
      auto r = ctRegex!(r"/a/b/(c|d|e|f)", "g");
 }

 This simple app fails at compile time.

But it's "been there, seen that". In short:
 assert(this.ir[cast(ulong)orStart].code() == cast(IR)129u) failed

 assert(this.ir[cast(ulong)orStart].code() == cast(IR)129u) failed

A well known problem search Bugzilla with cast(IR)129u and you'd find it. Or just ctRegex. And that's something I need to ping Don about. CTFE is still not 1:1 with normal D.
 Il giorno mar, 07/08/2012 alle 19.53 +0400, Dmitry Olshansky ha scritto:
 On 07-Aug-12 16:06, Andrea Fontana wrote:
 dmd 2.060 64bit ubuntu:

 // Doesn't work:
 auto r = ctRegex!(r"/api/places/(id|related|search|count)\.(json|xml)",
 "g");

Could be. It is experimental and is known to have bugs. What is the exact problem statement?
 // Works:
 auto r = regex(r"/api/places/(id|related|search|count)\.(json|xml)", "g");



-- Dmitry Olshansky
Aug 08 2012
prev sibling parent Andrea Fontana <nospam example.com> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


import std.regex;
void main() {
    auto r =3D ctRegex!(r"/a/b/(c|d|e|f)", "g");
}

This simple app fails at compile time.

Online compiler says:

/usr/local/include/dmd2/std/regex.d(1150): Error:
assert(this.ir[cast(ulong)orStart].code() =3D=3D cast(IR)129u) failed
/usr/local/include/dmd2/std/regex.d(876):        called from here:
this.parseRegex()
/usr/local/include/dmd2/std/regex.d(6428):        called from here:
parser.this(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6412):        called from here:
regexImpl(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6437):        called from here:
regex("/a/b/(c|d|e|f)","g")
/usr/local/include/dmd2/std/regex.d(1150): Error:
assert(this.ir[cast(ulong)orStart].code() =3D=3D cast(IR)129u) failed
/usr/local/include/dmd2/std/regex.d(876):        called from here:
this.parseRegex()
/usr/local/include/dmd2/std/regex.d(6428):        called from here:
parser.this(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6412):        called from here:
regexImpl(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6439):        called from here:
regex("/a/b/(c|d|e|f)","g")
/usr/local/include/dmd2/std/regex.d(6439):        called from here:
ctGenRegExCode(regex("/a/b/(c|d|e|f)","g"))
/usr/local/include/dmd2/std/regex.d(1150): Error:
assert(this.ir[cast(ulong)orStart].code() =3D=3D cast(IR)129u) failed
/usr/local/include/dmd2/std/regex.d(876):        called from here:
this.parseRegex()
/usr/local/include/dmd2/std/regex.d(6428):        called from here:
parser.this(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6412):        called from here:
regexImpl(pattern,flags)
/usr/local/include/dmd2/std/regex.d(6446):        called from here:
regex("/a/b/(c|d|e|f)","g")
/usr/local/include/dmd2/std/regex.d(6446):        called from here:
StaticRegex(null,Regex(null,null,null,0u,0u,0u,0u,0u,null,null,ShiftOr(null=
,0u,0u))).this(regex("/a/b/(c|d|e|f)","g"),& func)
/usr/local/include/dmd2/std/regex.d(6463): Error: template instance
std.regex.ctRegexImpl!("/a/b/(c|d|e|f)","g") error instantiating
822.d(5):        instantiated from here: ctRegex!("/a/b/(c|d|e|f)","g")
822.d(5): Error: template instance std.regex.ctRegex!("/a/b/(c|d|e|
f)","g") error instantiating



Il giorno mar, 07/08/2012 alle 19.53 +0400, Dmitry Olshansky ha scritto:

 On 07-Aug-12 16:06, Andrea Fontana wrote:
 dmd 2.060 64bit ubuntu:

 // Doesn't work:
 auto r =3D ctRegex!(r"/api/places/(id|related|search|count)\.(json|xml)=


 "g");

Could be. It is experimental and is known to have bugs. What is the exact problem statement? =20
 // Works:
 auto r =3D regex(r"/api/places/(id|related|search|count)\.(json|xml)", =



=20

Aug 08 2012