1 // Copyright (c) 2001-2011 Hartmut Kaiser 2 // 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/detail/lightweight_test.hpp> 7 8 #define BOOST_SPIRIT_DEBUG 1 9 10 #include <boost/spirit/include/qi.hpp> 11 #include <boost/spirit/include/support_utree.hpp> 12 13 #include <string> 14 15 namespace qi = boost::spirit::qi; 16 namespace spirit = boost::spirit; 17 main()18int main() 19 { 20 qi::rule<std::string::iterator, spirit::utree()> r = qi::int_; 21 BOOST_SPIRIT_DEBUG_NODE(r); 22 23 spirit::utree ut; 24 std::string input("1"); 25 BOOST_TEST(qi::parse(input.begin(), input.end(), r, ut)); 26 BOOST_TEST(ut.which() == spirit::utree_type::int_type && ut.get<int>() == 1); 27 28 return boost::report_errors(); 29 } 30