1 #ifndef STAN_LANG_AST_NODE_VARIABLE_HPP 2 #define STAN_LANG_AST_NODE_VARIABLE_HPP 3 4 #include <stan/lang/ast/type/bare_expr_type.hpp> 5 #include <cstddef> 6 #include <string> 7 8 namespace stan { 9 namespace lang { 10 11 /** 12 * Structure to hold a variable. 13 */ 14 struct variable { 15 /** 16 * Name of variable. 17 */ 18 std::string name_; 19 20 /** 21 * Type of variable. 22 */ 23 bare_expr_type type_; 24 25 /** 26 * Construct a default variable. 27 */ 28 variable(); 29 30 /** 31 * Construct a variable with the specified name and nil type. 32 * 33 * @param name variable name 34 */ 35 variable(const std::string& name); // NOLINT(runtime/explicit) 36 37 /** 38 * Set the variable type. 39 * 40 * @param bare_type bare expression type 41 */ 42 void set_type(const bare_expr_type& bare_type); 43 }; 44 45 } 46 } 47 #endif 48