1 #ifndef STAN_LANG_GRAMMARS_EXPRESSION_GRAMMAR_DEF_HPP 2 #define STAN_LANG_GRAMMARS_EXPRESSION_GRAMMAR_DEF_HPP 5 #include <boost/spirit/include/qi.hpp> 6 #include <boost/spirit/include/phoenix_core.hpp> 21 template <
typename Iterator>
22 expression_grammar<Iterator>::expression_grammar(variable_map& var_map,
23 std::stringstream& error_msgs)
24 : expression_grammar::base_type(expression_r),
26 error_msgs_(error_msgs),
27 expression07_g(var_map, error_msgs, *
this) {
28 using boost::spirit::qi::char_;
29 using boost::spirit::qi::eps;
30 using boost::spirit::qi::lit;
31 using boost::spirit::qi::no_skip;
32 using boost::spirit::qi::_1;
33 using boost::spirit::qi::_pass;
34 using boost::spirit::qi::_val;
35 using boost::spirit::qi::labels::_r1;
37 expression_r.name(
"expression");
39 %= (expression15_r(_r1) >> no_skip[!char_(
'?')] > eps)
40 | conditional_op_r(_r1);
42 conditional_op_r.name(
"conditional op expression, cond ? t_val : f_val ");
44 %= expression15_r(_r1)
49 boost::phoenix::ref(var_map_),
50 boost::phoenix::ref(error_msgs))];
52 expression15_r.name(
"expression");
58 boost::phoenix::ref(error_msgs))]);
60 expression14_r.name(
"expression");
66 boost::phoenix::ref(error_msgs))]);
68 expression10_r.name(
"expression");
74 boost::phoenix::ref(error_msgs))])
79 boost::phoenix::ref(error_msgs))]));
81 expression09_r.name(
"expression");
87 boost::phoenix::ref(error_msgs))])
91 boost::phoenix::ref(error_msgs))])
95 boost::phoenix::ref(error_msgs))])
99 boost::phoenix::ref(error_msgs))]));
boost::phoenix::function< binary_op_expr > binary_op_f
boost::phoenix::function< validate_conditional_op > validate_conditional_op_f
Probability, optimization and sampling library.
BOOST_FUSION_ADAPT_STRUCT(stan::lang::conditional_op,(stan::lang::expression, cond_)(stan::lang::expression, true_val_)(stan::lang::expression, false_val_)) namespace stan
boost::phoenix::function< assign_lhs > assign_lhs_f
Structure for the conditional operator.