Stan  2.14.0
probability, sampling & optimization
returns_type_vis.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_FUN_RETURNS_TYPE_VIS_HPP
2 #define STAN_LANG_AST_FUN_RETURNS_TYPE_VIS_HPP
3 
5 #include <boost/variant/static_visitor.hpp>
6 #include <ostream>
7 
8 namespace stan {
9  namespace lang {
10 
11  struct nil;
12  struct assignment;
13  struct assgn;
14  struct sample;
15  struct increment_log_prob_statement;
16  struct expression;
17  struct statements;
18  struct for_statement;
19  struct conditional_statement;
20  struct while_statement;
21  struct break_continue_statement;
22  struct print_statement;
23  struct reject_statement;
24  struct no_op_statement;
25  struct return_statement;
26 
31  struct returns_type_vis : public boost::static_visitor<bool> {
41  returns_type_vis(const expr_type& return_type, std::ostream& error_msgs);
42 
51  bool operator()(const nil& st) const;
52 
61  bool operator()(const assignment& st) const;
62 
71  bool operator()(const assgn& st) const;
72 
81  bool operator()(const sample& st) const;
82 
91  bool operator()(const increment_log_prob_statement& st) const;
92 
101  bool operator()(const expression& st) const;
102 
111  bool operator()(const statements& st) const;
112 
121  bool operator()(const for_statement& st) const;
122 
131  bool operator()(const conditional_statement& st) const;
132 
141  bool operator()(const while_statement& st) const;
142 
151  bool operator()(const break_continue_statement& st) const;
152 
161  bool operator()(const print_statement& st) const;
162 
171  bool operator()(const reject_statement& st) const;
172 
181  bool operator()(const no_op_statement& st) const;
182 
192  bool operator()(const return_statement& st) const;
193 
198 
202  std::ostream& error_msgs_;
203  };
204 
205  }
206 }
207 #endif
AST node for print statements.
Holder for local variable declarations and a sequence of statements.
Definition: statements.hpp:16
AST node for assignment to variable with multi-indexing.
Definition: assgn.hpp:15
void sample(stan::mcmc::base_mcmc *sampler, int num_warmup, int num_samples, int num_thin, int refresh, bool save, stan::services::sample::mcmc_writer< Model, SampleRecorder, DiagnosticRecorder, MessageRecorder > &mcmc_writer, stan::mcmc::sample &init_s, Model &model, RNG &base_rng, const std::string &prefix, const std::string &suffix, std::ostream &o, StartTransitionCallback &callback, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
Definition: sample.hpp:17
bool operator()(const nil &st) const
Return true if the specified statement is a return statement with an expression of the type specified...
AST node for the increment log prob (deprecated) and target increment statements. ...
Probability, optimization and sampling library.
AST node for the reject statement.
AST structure for break and continue statements.
Structure of the type of an expression, which consists of a base type and a number of dimensions...
Definition: expr_type.hpp:14
AST node for sampling statements.
Definition: sample.hpp:17
Visitor for reporting an error message if the statement is not a return statement with a type specifi...
expr_type return_type_
The type of the returned expression expected.
AST node for representing while statements.
AST node for the no-operation statement.
AST node for the return statement.
returns_type_vis(const expr_type &return_type, std::ostream &error_msgs)
Construct visitor expecting a return statement with an expression of the specified type...
The nil structure used as a placeholder for undefined or empty values in several structures.
Definition: nil.hpp:11
AST node for representing a for statement.
AST node for conditional statements.
std::ostream & error_msgs_
Stream to which error messages are written.
AST node for assignment statements.
Definition: assignment.hpp:14

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