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