11.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef BOOST_METAPARSE_GETTING_STARTED_11_HPP
  2. #define BOOST_METAPARSE_GETTING_STARTED_11_HPP
  3. // Automatically generated header file
  4. // Definitions before section 10
  5. #include "10.hpp"
  6. // Definitions of section 10
  7. using lparen_token = token<lit_c<'('>>;
  8. using rparen_token = token<lit_c<')'>>;
  9. using plus_exp1 =
  10. foldl_start_with_parser<
  11. sequence<one_of<plus_token, minus_token>, mult_exp4>,
  12. mult_exp4,
  13. boost::mpl::quote2<binary_op>
  14. >;
  15. using paren_exp1 = sequence<lparen_token, plus_exp1, rparen_token>;
  16. #include <boost/metaparse/middle_of.hpp>
  17. using paren_exp2 = middle_of<lparen_token, plus_exp1, rparen_token>;
  18. using primary_exp1 = one_of<int_token, paren_exp2>;
  19. struct plus_exp2;
  20. using paren_exp3 = middle_of<lparen_token, plus_exp2, rparen_token>;
  21. using primary_exp2 = one_of<int_token, paren_exp2>;
  22. using unary_exp2 =
  23. foldr_start_with_parser<
  24. minus_token,
  25. primary_exp2,
  26. boost::mpl::lambda<boost::mpl::negate<boost::mpl::_1>>::type
  27. >;
  28. using mult_exp5 =
  29. foldl_start_with_parser<
  30. sequence<one_of<times_token, divides_token>, unary_exp2>,
  31. unary_exp2,
  32. boost::mpl::quote2<binary_op>
  33. >;
  34. struct plus_exp2 :
  35. foldl_start_with_parser<
  36. sequence<one_of<plus_token, minus_token>, mult_exp5>,
  37. mult_exp5,
  38. boost::mpl::quote2<binary_op>
  39. > {};
  40. using exp_parser19 = build_parser<plus_exp2>;
  41. // query:
  42. // exp_parser19::apply<BOOST_METAPARSE_STRING("(1 + 2) * 3")>::type
  43. #endif