[xpressive] Two problems with nested_results

I've been using Xpressive and think it's great. But, I think the following
program shows two problems.
Problem 1: You get a runtime error if you uncomment the line "std::wcout
<< what2.position(0) << L'\n';"
Problem 2: I think it should output:
This is my face
is
my
face
But it actually outputs:
This is
is
Note that if you replace the nested regular expression with the (commented
out) non-nested one, it still outputs the wrong thing. It outputs "This is"
instead of "This is my face."
Here is the program. Thanks for your help.
#include <iostream>
#include

David Jenkins wrote:
I've been using Xpressive and think it's great. But, I think the following program shows two problems.
Problem 1: You get a runtime error if you uncomment the line "std::wcout << what2.position(0) << L'\n';"
Looks like you found a bug. position() doesn't work on nested_results. I'll look into it. Thanks for the report.
Problem 2: I think it should output: This is my face is my face
But it actually outputs: This is is
The pattern is:
wsregex subtokens = +alnum; wsregex token = as_xpr(L"This ") >> subtokens;
So, token will match "This " following by 1 or more alpha-numeric characters. The match stops after "is" because the next character is a space, which is not alpha-numeric.
Note that if you replace the nested regular expression with the (commented out) non-nested one, it still outputs the wrong thing. It outputs "This is" instead of "This is my face." Here is the program. Thanks for your help.
Same thing. Not a bug. -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric Niebler wrote:
David Jenkins wrote:
I've been using Xpressive and think it's great. But, I think the following program shows two problems.
Problem 1: You get a runtime error if you uncomment the line "std::wcout << what2.position(0) << L'\n';"
Looks like you found a bug. position() doesn't work on nested_results. I'll look into it. Thanks for the report.
Fixed both in HEAD and on the RC branch. I'll update the .zip in the sandbox soon. -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric,
Thanks for fixing the bug so quickly. I tested it in my real code, which
uses nested_results four deep, and it works fine. And sorry about the
second "problem". That was just my muddled thinking.
Dave Jenkins
"Eric Niebler"
Eric Niebler wrote:
David Jenkins wrote:
I've been using Xpressive and think it's great. But, I think the following program shows two problems.
Problem 1: You get a runtime error if you uncomment the line "std::wcout << what2.position(0) << L'\n';"
Looks like you found a bug. position() doesn't work on nested_results. I'll look into it. Thanks for the report.
Fixed both in HEAD and on the RC branch. I'll update the .zip in the sandbox soon.
-- Eric Niebler Boost Consulting www.boost-consulting.com
participants (2)
-
David Jenkins
-
Eric Niebler