Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12932: Boost Spirit 1.63 "Char >> (Literal | Sequence)" Bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-05-01 10:30:36
#12932: Boost Spirit 1.63 "Char >> (Literal | Sequence)" Bug
-------------------------------+-------------------------
Reporter: jetdog330@⦠| Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.63.0 | Severity: Problem
Resolution: | Keywords: or sequence
-------------------------------+-------------------------
Comment (by Amine):
The attribute of the parser {{{ (qi::char_ >> qi::char_ >> qi::char_) }}}
is {{{ boost::fusion::vector3<char, char, char> }}} so you should write
your code this way :
{{{
#include <boost/spirit/include/qi.hpp>
#include <cstdlib>
#include <iostream>
#include <string>
int main(int argc, char * argv[]) {
namespace qi = boost::spirit::qi;
namespace fusion = boost::fusion;
const std::string input("xabc");
char x = 0;
fusion::vector3<char, char, char> v;
const int result = qi::parse(
input.begin(),
input.end(),
qi::char_ >> (qi::lit("Z") | (qi::char_ >> qi::char_ >>
qi::char_)),
x, v
);
std::cout << (result ? "Success" : "Failure") << ": "
<< '"' << x << "\" \"" << fusion::at_c<0>(v) << "\" \""
<< fusion::at_c<1>(v) << "\" \""
<< fusion::at_c<2>(v) << '"' << std::endl;
return result ? EXIT_SUCCESS : EXIT_FAILURE;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12932#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-05-01 10:37:25 UTC