Opened 6 years ago

#12870 new Bugs

bugs?: xpressive: xp::skip(xp::_s) does not work

Reported by: shinichiro.hamada@… Owned by: Eric Niebler
Milestone: To Be Determined Component: xpressive
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:

Description

If you execute the following code, "[ 4]" will be output, but right output is supposed to be "[4]".

Source Code

#include <iostream>
#include <boost/xpressive/xpressive.hpp>

using namespace std;
namespace xp = boost::xpressive;

int main()
{
	xp::sregex rule2 = xp::skip(xp::_s)('(' >> (xp::s1= *xp::_d) >> ')');
	xp::sregex rule1 = xp::skip(xp::_s)(rule2);
	xp::smatch match1;
	if (!xp::regex_match(string("( 4  )"), match1, rule1)) {
		cout << "syntax error" << endl;
	} else {
		auto&& match2 = *match1.nested_results().begin();
		string text = match2[1];
		cout << "[" << text << "]" << endl;
	}
	return 0;
}

Compilation Environment

  • [OS] centos 6.8
  • [Compiler] g++ v4.9.3
  • [Command Line] g++ -std=c++11 a.cpp
  • [Libs] boost-1.63.0

Thanks for Boost.Xpressive!

Change History (0)

Note: See TracTickets for help on using tickets.