7_2.hpp 844 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef BOOST_METAPARSE_GETTING_STARTED_7_2_HPP
  2. #define BOOST_METAPARSE_GETTING_STARTED_7_2_HPP
  3. // Automatically generated header file
  4. // Definitions before section 7.1
  5. #include "7_1.hpp"
  6. // Definitions of section 7.1
  7. #include <boost/mpl/times.hpp>
  8. template <class L, class R> struct eval_binary_op<L, '*', R> : boost::mpl::times<L, R>::type {};
  9. // query:
  10. // eval_binary_op<boost::mpl::int_<3>, '*', boost::mpl::int_<4>>::type
  11. using times_token = token<lit_c<'*'>>;
  12. using exp_parser14 =
  13. build_parser<
  14. foldl_start_with_parser<
  15. sequence<one_of<plus_token, minus_token, times_token>, int_token>,
  16. int_token,
  17. boost::mpl::quote2<binary_op>
  18. >
  19. >;
  20. // query:
  21. // exp_parser14::apply<BOOST_METAPARSE_STRING("2 * 3")>::type
  22. // query:
  23. // exp_parser14::apply<BOOST_METAPARSE_STRING("1 + 2 * 3")>::type
  24. #endif