11_3.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef BOOST_METAPARSE_GETTING_STARTED_11_3_HPP
  2. #define BOOST_METAPARSE_GETTING_STARTED_11_3_HPP
  3. // Automatically generated header file
  4. // Definitions before section 11.2
  5. #include "11_2.hpp"
  6. // Definitions of section 11.2
  7. #include <boost/metaparse/define_error.hpp>
  8. BOOST_METAPARSE_DEFINE_ERROR(missing_primary_expression, "Missing primary expression");
  9. struct plus_exp3;
  10. using paren_exp4 = middle_of<lparen_token, plus_exp3, rparen_token>;
  11. #include <boost/metaparse/fail.hpp>
  12. using primary_exp3 = one_of<int_token, paren_exp4, fail<missing_primary_expression>>;
  13. using unary_exp3 =
  14. foldr_start_with_parser<
  15. minus_token,
  16. primary_exp3,
  17. boost::mpl::lambda<boost::mpl::negate<boost::mpl::_1>>::type
  18. >;
  19. using mult_exp6 =
  20. foldl_start_with_parser<
  21. sequence<one_of<times_token, divides_token>, unary_exp3>,
  22. unary_exp3,
  23. boost::mpl::quote2<binary_op>
  24. >;
  25. struct plus_exp3 :
  26. foldl_start_with_parser<
  27. sequence<one_of<plus_token, minus_token>, mult_exp6>,
  28. mult_exp6,
  29. boost::mpl::quote2<binary_op>
  30. > {};
  31. using exp_parser20 = build_parser<plus_exp3>;
  32. // query:
  33. // exp_parser20::apply<BOOST_METAPARSE_STRING("hello")>::type
  34. #endif