Boost logo

Boost Users :

From: Pearson, Andrew (Andrew.Pearson_at_[hidden])
Date: 2007-06-11 07:35:47


Hi,

 

I'm having trouble porting some code to use v1.34.0 of boost.

We are using the spirit parser and have found that strings containing
trailing white space are not parsed as before.

The following code is a simple example of the problem. This code works
with boost 1.33.1 but not 1.34.0.

 

Can anyone help explain why the code no longer works and what we should
do to fix the problem?

 

Regards,

Andy

 

#include <string>

#include <iostream>

#include <boost/spirit/core.hpp>

 

using namespace std;

using namespace boost::spirit;

 

bool parseStr(const string& str)

{

      return parse(str.c_str(), real_p >> *(',' >> real_p),
space_p).full;

}

 

int main(int argc, _TCHAR* argv[])

{

      string s1 = "1,2,3,4,5";

      string s2 = "1,2,3,4,5 ";

 

      cout << "parsing: '" << s1 << "' : " << (parseStr(s1) ? "OK" :
"ERROR") << endl;

      cout << "parsing: '" << s2 << "' : " << (parseStr(s2) ? "OK" :
"ERROR") << endl;

      return 0;

}

 

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net