Advertisement
Guest User

Boost Spirit 1.63 "Char >> (Literal | Sequence)" Bug

a guest
Mar 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <boost/spirit/include/qi.hpp>
  2.  
  3. #include <cstdlib>
  4. #include <iostream>
  5. #include <string>
  6.  
  7. int main(int argc, char * argv[]) {
  8.     namespace qi = boost::spirit::qi;
  9.     const std::string input("xabc");
  10.  
  11.     char x = 0;
  12.     char a = 0;
  13.     char b = 0;
  14.     char c = 0;
  15.  
  16.     const int result = qi::parse(
  17.         input.begin(),
  18.         input.end(),
  19.             qi::char_ >> (qi::lit("Z") | (qi::char_ >> qi::char_ >> qi::char_)),
  20.             x, a, b, c
  21.     );
  22.  
  23.     std::cout << (result ? "Success" : "Failure") << ": "
  24.         << '"' << x << "\" \"" << a << "\" \""  << b << "\" \"" << c << '"' << std::endl;
  25.     return result ? EXIT_SUCCESS : EXIT_FAILURE;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement