rule_fail.cpp 998 B

123456789101112131415161718192021222324252627282930
  1. /*=============================================================================
  2. Copyright (c) 2001-2010 Hartmut Kaiser
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #include <boost/spirit/include/qi_operator.hpp>
  7. #include <boost/spirit/include/qi_char.hpp>
  8. #include <boost/spirit/include/qi_numeric.hpp>
  9. #include <boost/spirit/include/qi_nonterminal.hpp>
  10. #include <boost/spirit/include/qi_parse.hpp>
  11. using namespace boost::spirit;
  12. using namespace boost::spirit::qi;
  13. // this test must fail compiling
  14. int main()
  15. {
  16. char const* input = "some input, it doesn't matter";
  17. char const* end = &input[strlen(input)];
  18. rule<char const*, rule<char const*> > def;
  19. def = int_ >> *(',' >> int_);
  20. phrase_parse(input, end, def,
  21. qi::space | ('%' >> *~char_('\n') >> '\n'));
  22. return 0;
  23. }