Stan  2.10.0
probability, sampling & optimization
expression07_grammar_def.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_GRAMMARS_EXPRESSION07_GRAMMAR_DEF_HPP
2 #define STAN_LANG_GRAMMARS_EXPRESSION07_GRAMMAR_DEF_HPP
3 
4 // probably don't need to turn off warnings now, but if so, uncomment
5 // #include <boost/config/warning_disable.hpp>
6 #include <boost/spirit/include/qi.hpp>
7 #include <boost/spirit/include/phoenix_core.hpp>
8 #include <stan/lang/ast.hpp>
13 #include <sstream>
14 #include <string>
15 
16 namespace stan {
17 
18  namespace lang {
19 
20  template <typename Iterator>
22  std::stringstream& error_msgs,
24  : expression07_grammar::base_type(expression07_r),
25  var_map_(var_map),
26  error_msgs_(error_msgs),
27  term_g(var_map, error_msgs, eg) {
28  using boost::spirit::qi::_1;
29  using boost::spirit::qi::eps;
30  using boost::spirit::qi::lit;
31  using boost::spirit::qi::_pass;
32  using boost::spirit::qi::_val;
33  using boost::spirit::qi::labels::_r1;
34 
35  expression07_r.name("expression");
37  %= term_g(_r1)
38  [assign_lhs_f(_val, _1)]
39  > *((lit('+')
40  > term_g(_r1)
41  [addition3_f(_val, _1, boost::phoenix::ref(error_msgs))])
42  |
43  (lit('-')
44  > term_g(_r1)
45  [subtraction3_f(_val, _1, boost::phoenix::ref(error_msgs))]))
46  > eps[validate_expr_type3_f(_val, _pass,
47  boost::phoenix::ref(error_msgs_))];
48  }
49 
50  }
51 }
52 #endif
boost::spirit::qi::rule< Iterator, expression(var_origin), whitespace_grammar< Iterator > > expression07_r
boost::phoenix::function< validate_expr_type3 > validate_expr_type3_f
Probability, optimization and sampling library.
boost::phoenix::function< subtraction_expr3 > subtraction3_f
boost::phoenix::function< addition_expr3 > addition3_f
expression07_grammar(variable_map &var_map, std::stringstream &error_msgs, expression_grammar< Iterator > &eg)
boost::phoenix::function< assign_lhs > assign_lhs_f

     [ Stan Home Page ] © 2011–2016, Stan Development Team.