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