parser_context_test.cpp 837 B

123456789101112131415161718192021222324
  1. /*=============================================================================
  2. Copyright (c) 2003 Vaclav Vesely
  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_assign_actor.hpp>
  11. using namespace boost;
  12. using namespace BOOST_SPIRIT_CLASSIC_NS;
  13. int main()
  14. {
  15. rule<parser_context<int> > int_rule = int_p;
  16. int result(0);
  17. parse("123", int_rule[assign_a(result)]);
  18. BOOST_TEST(result == 123);
  19. return boost::report_errors();
  20. }