www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Regex problem

reply "James Blewitt" <jim jblewitt.com> writes:
I am having a problem with regexes.
The following code causes a compilation error, whereas if I 
comment out the regex outside of main and comment in the regex 
inside main, it does compile.

I'm using DMD v2.058.

<code>
import std.regex;

Regex!(char) testRegex = regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b", "i");

void main() {
//	Regex!(char) testRegex = regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b", 
"i");
}
</code>

The error is:

<code>
/usr/include/d/dmd/phobos/std/regex.d(2668): Error: 
assert(re.ir[t.pc].code() == cast(IR)130u) failed
/usr/include/d/dmd/phobos/std/regex.d(2091):        called from 
here: (Kickstart!(char) __ctmp1256 = 0;
  , __ctmp1256).this(this,new uint[](256u))
/usr/include/d/dmd/phobos/std/regex.d(2146):        called from 
here: this.lightPostprocess()
/usr/include/d/dmd/phobos/std/regex.d(1958):        called from 
here: (Regex!(char) __ctmp1221 = 0;
  , __ctmp1221).this(this)
/usr/include/d/dmd/phobos/std/regex.d(6402):        called from 
here: parser.program()
regex_test.d(3):        called from here: 
regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b","i")
</code>
Mar 28 2012
next sibling parent reply simendsjo <simendsjo gmail.com> writes:
On Wed, 28 Mar 2012 11:25:40 +0200, James Blewitt <jim jblewitt.com> wrote:

 I am having a problem with regexes.
 The following code causes a compilation error, whereas if I comment out  
 the regex outside of main and comment in the regex inside main, it does  
 compile.

 I'm using DMD v2.058.

 <code>
 import std.regex;

 Regex!(char) testRegex = regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b", "i");

 void main() {
 //	Regex!(char) testRegex = regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b", "i");
 }
 </code>

 The error is:

 <code>
 /usr/include/d/dmd/phobos/std/regex.d(2668): Error:  
 assert(re.ir[t.pc].code() == cast(IR)130u) failed
 /usr/include/d/dmd/phobos/std/regex.d(2091):        called from here:  
 (Kickstart!(char) __ctmp1256 = 0;
   , __ctmp1256).this(this,new uint[](256u))
 /usr/include/d/dmd/phobos/std/regex.d(2146):        called from here:  
 this.lightPostprocess()
 /usr/include/d/dmd/phobos/std/regex.d(1958):        called from here:  
 (Regex!(char) __ctmp1221 = 0;
   , __ctmp1221).this(this)
 /usr/include/d/dmd/phobos/std/regex.d(6402):        called from here:  
 parser.program()
 regex_test.d(3):        called from here:  
 regex("\\b(A(Z)?|B(Z)?|C(Z)?)\\b","i")
 </code>
This newsgroup is read-only - don't know why it's allowed to post here. It's only meant as a bugzilla feed. Post bugs to http://d.puremagic.com/issues/, and ask questions in D.learn: http://forum.dlang.org/group/digitalmars.D.learn
Mar 28 2012
parent "James Blewitt" <jim jblewitt.com> writes:
Ok, I'll do that.  Thanks
Mar 28 2012
prev sibling parent reply "James Blewitt" <jim jblewitt.com> writes:
How can I put code into my posts without it looking bad?
Mar 28 2012
parent simendsjo <simendsjo gmail.com> writes:
On Wed, 28 Mar 2012 11:30:40 +0200, James Blewitt <jim jblewitt.com> wrote:

 How can I put code into my posts without it looking bad?
Depends on your newsreader I guess. Using spaces instead of tabs and keeping linelengths below 80 usually makes the formatting ok.
Mar 28 2012