1 #ifndef STAN_LANG_GRAMMARS_FUNCTIONS_GRAMMAR_DEF_HPP 2 #define STAN_LANG_GRAMMARS_FUNCTIONS_GRAMMAR_DEF_HPP 8 #include <boost/spirit/include/qi.hpp> 9 #include <boost/spirit/include/phoenix_core.hpp> 16 (std::vector<stan::lang::arg_decl>, arg_decls_)
20 (
stan::lang::expr_type, arg_type_)
22 (
stan::lang::statement, body_) )
28 template <
typename Iterator>
29 functions_grammar<Iterator>::functions_grammar(variable_map& var_map,
30 std::stringstream& error_msgs,
32 : functions_grammar::base_type(functions_r),
34 functions_declared_(),
36 error_msgs_(error_msgs),
37 statement_g(var_map_, error_msgs_),
38 bare_type_g(var_map_, error_msgs_) {
39 using boost::spirit::qi::_1;
40 using boost::spirit::qi::char_;
41 using boost::spirit::qi::eps;
42 using boost::spirit::qi::lexeme;
43 using boost::spirit::qi::lit;
44 using boost::spirit::qi::_pass;
45 using boost::spirit::qi::_val;
46 using boost::spirit::qi::labels::_a;
47 using boost::spirit::qi::labels::_b;
49 functions_r.name(
"function declarations and definitions");
51 %= (lit(
"functions") > lit(
"{"))
61 function_r.name(
"function declaration or definition");
85 " to end argument declarations");
88 arg_decls_r.name(
"function argument declaration sequence");
93 arg_decl_r.name(
"function argument declaration");
104 %= lexeme[char_(
"a-zA-Z")
105 >> *char_(
"a-zA-Z0-9_.")];
boost::phoenix::function< set_void_function > set_void_function_f
Structure to wrap the variant type of statements.
boost::spirit::qi::rule< Iterator, std::vector< arg_decl >), whitespace_grammar< Iterator > > arg_decls_r
boost::spirit::qi::rule< Iterator, boost::spirit::qi::locals< bool, int >, function_decl_def(), whitespace_grammar< Iterator > > function_r
boost::spirit::qi::rule< Iterator, arg_decl(), whitespace_grammar< Iterator > > arg_decl_r
boost::spirit::qi::rule< Iterator, boost::spirit::qi::unused_type, whitespace_grammar< Iterator > > close_arg_decls_r
Probability, optimization and sampling library.
Template specification of functions in std for Stan.
bare_type_grammar< Iterator > bare_type_g
Structure of the type of an expression, which consists of a base type and a number of dimensions...
boost::spirit::qi::rule< Iterator, std::string(), whitespace_grammar< Iterator > > identifier_r
boost::phoenix::function< validate_non_void_arg_function > validate_non_void_arg_f
boost::spirit::qi::rule< Iterator, std::vector< function_decl_def >), whitespace_grammar< Iterator > > functions_r
BOOST_FUSION_ADAPT_STRUCT(stan::lang::expr_type,(stan::lang::base_expr_type, base_type_)(size_t, num_dims_)) namespace stan
boost::phoenix::function< validate_prob_fun > validate_prob_fun_f
boost::phoenix::function< validate_pmf_pdf_variate > validate_pmf_pdf_variate_f
std::set< std::pair< std::string, function_signature_t > > functions_defined_
std::stringstream & error_msgs_
boost::phoenix::function< set_allows_sampling_origin > set_allows_sampling_origin_f
statement_grammar< Iterator > statement_g
boost::phoenix::function< add_function_signature > add_function_signature_f
boost::phoenix::function< unscope_variables > unscope_variables_f
std::set< std::pair< std::string, function_signature_t > > functions_declared_
AST node for a function declaration and definition including return type name, arguments, and body.
boost::phoenix::function< validate_return_type > validate_return_type_f
boost::phoenix::function< add_fun_var > add_fun_var_f
boost::phoenix::function< validate_declarations > validate_declarations_f
boost::phoenix::function< scope_lp > scope_lp_f