1 #ifndef STAN_LANG_GRAMMARS_BARE_TYPE_GRAMMAR_DEF_HPP
2 #define STAN_LANG_GRAMMARS_BARE_TYPE_GRAMMAR_DEF_HPP
4 #include <boost/spirit/include/qi.hpp>
5 #include <boost/spirit/include/phoenix_core.hpp>
18 template <
typename Iterator>
19 bare_type_grammar<Iterator>::bare_type_grammar(variable_map& var_map,
20 std::stringstream& error_msgs)
21 : bare_type_grammar::base_type(bare_type_r),
23 error_msgs_(error_msgs) {
24 using boost::spirit::qi::eps;
25 using boost::spirit::qi::lit;
26 using boost::spirit::qi::_val;
28 bare_type_r.name(
"bare type definition\n"
29 " (no dimensions or constraints, just commas,\n"
30 " e.g. real[,] for a 2D array or int for a single integer,\n"
31 " and constrained types such as cov_matrix not allowed)");
32 bare_type_r %= type_identifier_r >> array_dims_r;
34 type_identifier_r.name(
"bare type identifier\n"
35 " legal values: void, int, real, vector, row_vector, matrix");
44 array_dims_r.name(
"array dimensions,\n"
45 " e.g., empty (not an array) [] (1D array) or [,] (2D array)");
48 >> -(lit(
'[')[
assign_lhs_f(_val, static_cast<size_t>(1))]
52 end_bare_types_r.name(
"comma to indicate more dimensions"
53 " or ] to end type declaration");
54 end_bare_types_r %= lit(
']');
Probability, optimization and sampling library.
BOOST_FUSION_ADAPT_STRUCT(stan::lang::expr_type,(stan::lang::base_expr_type, base_type_)(size_t, num_dims_)) namespace stan
boost::phoenix::function< assign_lhs > assign_lhs_f
boost::phoenix::function< increment_size_t > increment_size_t_f