custom_real_parser.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /*=============================================================================
  2. Copyright (c) 2007 Hartmut Kaiser
  3. http://spirit.sourceforge.net/
  4. Use, modification and distribution is subject to the Boost Software
  5. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. =============================================================================*/
  8. #include <boost/detail/lightweight_test.hpp>
  9. #include <boost/spirit/include/classic_core.hpp>
  10. #include <boost/spirit/include/classic_actor.hpp>
  11. #include <boost/math/concepts/real_concept.hpp>
  12. using namespace BOOST_SPIRIT_CLASSIC_NS;
  13. using boost::math::concepts::real_concept;
  14. int main()
  15. {
  16. real_parser<real_concept> const rr_p;
  17. bool started = false;
  18. real_concept a, b;
  19. parse_info<> pi = parse("range 0 1",
  20. str_p("range")[assign_a(started, false)]
  21. && rr_p[assign_a(a)]
  22. && rr_p[assign_a(b)],
  23. space_p);
  24. BOOST_TEST(pi.full && a == 0.0 && b == 1.0);
  25. return boost::report_errors();
  26. }