Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/spirit/include/qi.hpp>
- #include <cstdlib>
- #include <iostream>
- #include <string>
- int main(int argc, char * argv[]) {
- namespace qi = boost::spirit::qi;
- const std::string input("xabc");
- char x = 0;
- char a = 0;
- char b = 0;
- char c = 0;
- const int result = qi::parse(
- input.begin(),
- input.end(),
- qi::char_ >> (qi::lit("Z") | (qi::char_ >> qi::char_ >> qi::char_)),
- x, a, b, c
- );
- std::cout << (result ? "Success" : "Failure") << ": "
- << '"' << x << "\" \"" << a << "\" \"" << b << "\" \"" << c << '"' << std::endl;
- return result ? EXIT_SUCCESS : EXIT_FAILURE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement