negated_eps_p_test.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*=============================================================================
  2. Copyright (c) 2004 Joao Abecasis
  3. Copyright (c) 2004 Joel de Guzman
  4. http://spirit.sourceforge.net/
  5. Use, modification and distribution is subject to the Boost Software
  6. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. http://www.boost.org/LICENSE_1_0.txt)
  8. =============================================================================*/
  9. #include <boost/spirit/include/classic_core.hpp>
  10. #include <boost/spirit/include/classic_dynamic.hpp>
  11. #include <boost/spirit/include/phoenix1.hpp>
  12. #include <boost/detail/lightweight_test.hpp>
  13. #include <iostream>
  14. #include <string>
  15. using namespace BOOST_SPIRIT_CLASSIC_NS;
  16. using namespace phoenix;
  17. int main()
  18. {
  19. using std::cout;
  20. using std::endl;
  21. using std::string;
  22. bool f = false;
  23. rule<> start =
  24. while_p(~eps_p(anychar_p[var(f) = true]))
  25. [
  26. anychar_p
  27. ];
  28. parse("This goes to prove my point.", start);
  29. BOOST_TEST(f == false);
  30. return boost::report_errors();
  31. }