before_5.qbk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. [#before_5]
  2. ['Definitions before section 5.]
  3. #include <boost/metaparse/string.hpp>
  4. #include <boost/metaparse/int_.hpp>
  5. #include <boost/metaparse/build_parser.hpp>
  6. using namespace boost::metaparse;
  7. using exp_parser1 = build_parser<int_>;
  8. #include <boost/metaparse/entire_input.hpp>
  9. using exp_parser2 = build_parser<entire_input<int_>>;
  10. #include <boost/metaparse/token.hpp>
  11. using exp_parser3 = build_parser<entire_input<token<int_>>>;
  12. #include <boost/metaparse/lit_c.hpp>
  13. #include <boost/metaparse/sequence.hpp>
  14. using exp_parser4 = build_parser<sequence<token<int_>, token<lit_c<'+'>>, token<int_>>>;
  15. #include <metashell/formatter.hpp>
  16. using int_token = token<int_>;
  17. using plus_token = token<lit_c<'+'>>;
  18. using exp_parser5 = build_parser<sequence<int_token, plus_token, int_token>>;
  19. #include <boost/metaparse/transform.hpp>
  20. #include <boost/mpl/plus.hpp>
  21. #include <boost/mpl/at.hpp>
  22. template <class Vector>
  23. struct eval_plus :
  24. boost::mpl::plus<
  25. typename boost::mpl::at_c<Vector, 0>::type,
  26. typename boost::mpl::at_c<Vector, 2>::type
  27. > {};
  28. #include <boost/mpl/quote.hpp>
  29. using exp_parser6 =
  30. build_parser<
  31. transform<
  32. sequence<int_token, plus_token, int_token>,
  33. boost::mpl::quote1<eval_plus>
  34. >
  35. >;