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(
']');
const int ROW_VECTOR_T
Row vector type; scalar type is real.
Probability, optimization and sampling library.
const int DOUBLE_T
Real scalar type.
int base_expr_type
The type of a base expression.
Structure of the type of an expression, which consists of a base type and a number of dimensions...
BOOST_FUSION_ADAPT_STRUCT(stan::lang::expr_type,(stan::lang::base_expr_type, base_type_)(size_t, num_dims_)) namespace stan
const int VOID_T
Void type.
boost::phoenix::function< assign_lhs > assign_lhs_f
const int INT_T
Integer type.
boost::phoenix::function< increment_size_t > increment_size_t_f
const int VECTOR_T
Column vector type; scalar type is real.
const int MATRIX_T
Matrix type; scalar type is real.