www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with std.regex: *+? not allowed in atom

reply Jacob Carlborg <doob me.com> writes:
I'm trying to use the std.regex module but when I run my application I 
get an exception. The exception message says:

*+? not allowed in atom

The code I have is:

import std.regex;

void main ()
{
     regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
}

I'm compiling this with DMD 2.052 on Mac OS X.

Full stack trace:

----------------
5   test                                0x00002356 void 
std.regex.Regex!(char).Regex.error(immutable(char)[]) + 126
6   test                                0x00007c1d int 
std.regex.Regex!(char).Regex.parseAtom!(const(immutable(char)[])).parseAtom(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 237
7   test                                0x0000772d int 
std.regex.Regex!(char).Regex.parsePiece!(const(immutable(char)[])).parsePiece(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 117
8   test                                0x000076b3 int 
std.regex.Regex!(char).Regex.parseRegex!(const(immutable(char)[])).parseRegex(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 431
9   test                                0x00007c88 int 
std.regex.Regex!(char).Regex.parseAtom!(const(immutable(char)[])).parseAtom(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 344
10  test                                0x0000772d int 
std.regex.Regex!(char).Regex.parsePiece!(const(immutable(char)[])).parsePiece(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 117
11  test                                0x000074ff int 
std.regex.Regex!(char).Regex.parseRegex!(immutable(char)[]).parseRegex(const
immutable(char)[]), 
ref uint, std.outbuffer.OutBuffer) + 431
12  test                                0x000072f2 void 
std.regex.Regex!(char).Regex.compile!(immutable(char)[]).compil
(immutable(char)[], 
immutable(char)[]) + 370
13  test                                0x00007176 ref 
std.regex.Regex!(char).Regex 
std.regex.Regex!(char).Regex.__ctor!(immutable(char)[]).__cto
(immutable(char)[], 
immutable(char)[]) + 26
14  test                                0x000021f7 
std.regex.Regex!(char).Regex 
std.regex.regex!(immutable(char)[]).regex(immutable(char)[], 
immutable(char)[]) + 187
15  test                                0x00002138 _Dmain + 44
16  test                                0x0001b213 extern (C) int 
rt.dmain2.main(int, char**).void runMain() + 23
17  test                                0x0001b19a extern (C) int 
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
18  test                                0x0001b25b extern (C) int 
rt.dmain2.main(int, char**).void runAll() + 59
19  test                                0x0001b19a extern (C) int 
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
20  test                                0x0001b12b main + 179
21  test                                0x00002101 start + 53

-- 
/Jacob Carlborg
Feb 26 2011
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my application I 
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
     regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
 I'm compiling this with DMD 2.052 on Mac OS X.

 Full stack trace:

 ----------------
 5   test                                0x00002356 void 
 std.regex.Regex!(char).Regex.error(immutable(char)[]) + 126
 6   test                                0x00007c1d int 
 std.regex.Regex!(char).Regex.parseAtom!(const(immutable(char)[])).parseAtom(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 237
 7   test                                0x0000772d int 
 std.regex.Regex!(char).Regex.parsePiece!(const(immutable(char)[])).parsePiece(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 117
 8   test                                0x000076b3 int 
 std.regex.Regex!(char).Regex.parseRegex!(const(immutable(char)[])).parseRegex(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 431
 9   test                                0x00007c88 int 
 std.regex.Regex!(char).Regex.parseAtom!(const(immutable(char)[])).parseAtom(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 344
 10  test                                0x0000772d int 
 std.regex.Regex!(char).Regex.parsePiece!(const(immutable(char)[])).parsePiece(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 117
 11  test                                0x000074ff int 
 std.regex.Regex!(char).Regex.parseRegex!(immutable(char)[]).parseRegex(const
immutable(char)[]), 
 ref uint, std.outbuffer.OutBuffer) + 431
 12  test                                0x000072f2 void 
 std.regex.Regex!(char).Regex.compile!(immutable(char)[]).compil
(immutable(char)[], 
 immutable(char)[]) + 370
 13  test                                0x00007176 ref 
 std.regex.Regex!(char).Regex 
 std.regex.Regex!(char).Regex.__ctor!(immutable(char)[]).__cto
(immutable(char)[], 
 immutable(char)[]) + 26
 14  test                                0x000021f7 
 std.regex.Regex!(char).Regex 
 std.regex.regex!(immutable(char)[]).regex(immutable(char)[], 
 immutable(char)[]) + 187
 15  test                                0x00002138 _Dmain + 44
 16  test                                0x0001b213 extern (C) int 
 rt.dmain2.main(int, char**).void runMain() + 23
 17  test                                0x0001b19a extern (C) int 
 rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
 18  test                                0x0001b25b extern (C) int 
 rt.dmain2.main(int, char**).void runAll() + 59
 19  test                                0x0001b19a extern (C) int 
 rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
 20  test                                0x0001b12b main + 179
 21  test                                0x00002101 start + 53
-- Dmitry Olshansky
Feb 26 2011
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
Ok thanks. I'll try the patch. -- /Jacob Carlborg
Feb 26 2011
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
I tried the patch but with no success. I still get the same error. -- /Jacob Carlborg
Feb 26 2011
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 26.02.2011 19:52, Jacob Carlborg wrote:
 On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
I tried the patch but with no success. I still get the same error.
The patch fixes only (?: ) form and not the lookahead and others. Sorry, it was the only one I needed back then. I'll check if I can make a patch for them as well when I have some spare time. That's would be around monday if, of course, nobody else wishes to rush into the depths of std.regex. -- Dmitry Olshansky
Feb 26 2011
parent reply Jacob Carlborg <doob me.com> writes:
On 2011-02-26 19:49, Dmitry Olshansky wrote:
 On 26.02.2011 19:52, Jacob Carlborg wrote:
 On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
I tried the patch but with no success. I still get the same error.
The patch fixes only (?: ) form and not the lookahead and others. Sorry, it was the only one I needed back then. I'll check if I can make a patch for them as well when I have some spare time. That's would be around monday if, of course, nobody else wishes to rush into the depths of std.regex.
Ok. -- /Jacob Carlborg
Feb 27 2011
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 27.02.2011 13:41, Jacob Carlborg wrote:
 On 2011-02-26 19:49, Dmitry Olshansky wrote:
 On 26.02.2011 19:52, Jacob Carlborg wrote:
 On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my 
 application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
I tried the patch but with no success. I still get the same error.
The patch fixes only (?: ) form and not the lookahead and others. Sorry, it was the only one I needed back then. I'll check if I can make a patch for them as well when I have some spare time. That's would be around monday if, of course, nobody else wishes to rush into the depths of std.regex.
Ok.
So here it is, hot and bobbling. For now no lookbehind. I added it into another Bugzilla requesthttp://d.puremagic.com/issues/show_bug.cgi?id=5673 -- Dmitry Olshansky
Mar 01 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-03-01 16:54, Dmitry Olshansky wrote:
 On 27.02.2011 13:41, Jacob Carlborg wrote:
 On 2011-02-26 19:49, Dmitry Olshansky wrote:
 On 26.02.2011 19:52, Jacob Carlborg wrote:
 On 2011-02-26 12:29, Dmitry Olshansky wrote:
 On 26.02.2011 14:10, Jacob Carlborg wrote:
 I'm trying to use the std.regex module but when I run my
 application I
 get an exception. The exception message says:

 *+? not allowed in atom

 The code I have is:

 import std.regex;

 void main ()
 {
 regex(`\.(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))`, "m");
 }
Well the thing is, std.regex is not quite ECMA complaint (as vaguely stated in docs). To the best of my knowledge not a single one variant of the forms (?:...) ... (?=...) is supported . Also see http://d.puremagic.com/issues/show_bug.cgi?id=5169, you may try out my patch there to support (?:...). It's a slightly outdated, but std.regex wasn't in very active development.
I tried the patch but with no success. I still get the same error.
The patch fixes only (?: ) form and not the lookahead and others. Sorry, it was the only one I needed back then. I'll check if I can make a patch for them as well when I have some spare time. That's would be around monday if, of course, nobody else wishes to rush into the depths of std.regex.
Ok.
So here it is, hot and bobbling. For now no lookbehind. I added it into another Bugzilla requesthttp://d.puremagic.com/issues/show_bug.cgi?id=5673
Ok, thanks. -- /Jacob Carlborg
Mar 01 2011