Use variant semantic values in the Bison parser
We can therefore manipulate objects by value rather than by pointers, which saves a lot of memory manipulations (and avoid potential segfaults and memory leaks). Note that there is no default action ("$$ = $1") when using the variant type, so we add them explicitly.issue#70
parent
725b91e5d6
commit
7280c92642
File diff suppressed because it is too large
Load Diff
|
@ -226,7 +226,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>subsamples {return token::SUBSAMPLES;}
|
||||
<DYNARE_STATEMENT>options {return token::OPTIONS;}
|
||||
<DYNARE_STATEMENT>prior {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::PRIOR;
|
||||
}
|
||||
<INITIAL>std {BEGIN DYNARE_STATEMENT; return token::STD;}
|
||||
|
@ -260,7 +260,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
*yyout << yytext + 1;
|
||||
#endif
|
||||
}
|
||||
<DYNARE_STATEMENT>dates {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->string_val = new string("dates");}
|
||||
<DYNARE_STATEMENT>dates {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->build<string>("dates");}
|
||||
<DYNARE_STATEMENT>file {return token::FILE;}
|
||||
<DYNARE_STATEMENT>datafile {return token::DATAFILE;}
|
||||
<DYNARE_STATEMENT>dirname {return token::DIRNAME;}
|
||||
|
@ -293,10 +293,10 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>posterior_nograph {return token::POSTERIOR_NOGRAPH;}
|
||||
<DYNARE_STATEMENT>nodisplay {return token::NODISPLAY;}
|
||||
<DYNARE_STATEMENT>graph_format {return token::GRAPH_FORMAT;}
|
||||
<DYNARE_STATEMENT>eps {yylval->string_val = new string(yytext); return token::EPS;}
|
||||
<DYNARE_STATEMENT>pdf {yylval->string_val = new string(yytext); return token::PDF;}
|
||||
<DYNARE_STATEMENT>fig {yylval->string_val = new string(yytext); return token::FIG;}
|
||||
<DYNARE_STATEMENT>none {yylval->string_val = new string(yytext); return token::NONE;}
|
||||
<DYNARE_STATEMENT>eps {yylval->build<string>(yytext); return token::EPS;}
|
||||
<DYNARE_STATEMENT>pdf {yylval->build<string>(yytext); return token::PDF;}
|
||||
<DYNARE_STATEMENT>fig {yylval->build<string>(yytext); return token::FIG;}
|
||||
<DYNARE_STATEMENT>none {yylval->build<string>(yytext); return token::NONE;}
|
||||
<DYNARE_STATEMENT>print {return token::PRINT;}
|
||||
<DYNARE_STATEMENT>noprint {return token::NOPRINT;}
|
||||
<DYNARE_STATEMENT>conf_sig {return token::CONF_SIG;}
|
||||
|
@ -428,43 +428,43 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>use_penalized_objective_for_hessian {return token::USE_PENALIZED_OBJECTIVE_FOR_HESSIAN;}
|
||||
|
||||
<DYNARE_STATEMENT>alpha {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::ALPHA;
|
||||
}
|
||||
<DYNARE_STATEMENT>beta {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::BETA;
|
||||
}
|
||||
<DYNARE_STATEMENT>gamma {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::GAMMA;
|
||||
}
|
||||
<DYNARE_STATEMENT>inv_gamma {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::INV_GAMMA;
|
||||
}
|
||||
<DYNARE_STATEMENT>inv_gamma1 {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::INV_GAMMA1;
|
||||
}
|
||||
<DYNARE_STATEMENT>inv_gamma2 {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::INV_GAMMA2;
|
||||
}
|
||||
<DYNARE_STATEMENT>dirichlet {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::DIRICHLET;
|
||||
}
|
||||
<DYNARE_STATEMENT>weibull {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::WEIBULL;
|
||||
}
|
||||
<DYNARE_STATEMENT>normal {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::NORMAL;
|
||||
}
|
||||
<DYNARE_STATEMENT>uniform {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::UNIFORM;
|
||||
}
|
||||
<DYNARE_STATEMENT>gsig2_lmdm {return token::GSIG2_LMDM;}
|
||||
|
@ -475,13 +475,13 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>ncsk {return token::NCSK;}
|
||||
<DYNARE_STATEMENT>nstd {return token::NSTD;}
|
||||
<DYNARE_STATEMENT>ninv {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::NINV;
|
||||
}
|
||||
<DYNARE_STATEMENT>indxparr {return token::INDXPARR;}
|
||||
<DYNARE_STATEMENT>indxovr {return token::INDXOVR;}
|
||||
<DYNARE_STATEMENT>aband {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::ABAND;
|
||||
}
|
||||
<DYNARE_STATEMENT>write_equation_tags {return token::WRITE_EQUATION_TAGS;}
|
||||
|
@ -498,18 +498,18 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>indxgdls {return token::INDXGDLS;}
|
||||
<DYNARE_STATEMENT>eq_ms {return token::EQ_MS;}
|
||||
<DYNARE_STATEMENT>cms {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::CMS;
|
||||
}
|
||||
<DYNARE_STATEMENT>ncms {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::NCMS;
|
||||
}
|
||||
<DYNARE_STATEMENT>eq_cms {return token::EQ_CMS;}
|
||||
<DYNARE_STATEMENT>tlindx {return token::TLINDX;}
|
||||
<DYNARE_STATEMENT>tlnumber {return token::TLNUMBER;}
|
||||
<DYNARE_STATEMENT>cnum {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::CNUM;
|
||||
}
|
||||
<DYNARE_STATEMENT>nodecomposition {return token::NODECOMPOSITION;};
|
||||
|
@ -561,15 +561,15 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>opt_algo {return token::OPT_ALGO;}
|
||||
<DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
|
||||
<DYNARE_STATEMENT>hessian {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::HESSIAN;
|
||||
}
|
||||
<DYNARE_STATEMENT>prior_variance {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::PRIOR_VARIANCE;
|
||||
}
|
||||
<DYNARE_STATEMENT>identity_matrix {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::IDENTITY_MATRIX;
|
||||
}
|
||||
<DYNARE_STATEMENT>mcmc_jumping_covariance {return token::MCMC_JUMPING_COVARIANCE;}
|
||||
|
@ -655,11 +655,11 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>recursive_order_estimation {return token::RECURSIVE_ORDER_ESTIMATION; }
|
||||
<DYNARE_STATEMENT>bartlett_kernel_lag {return token::BARTLETT_KERNEL_LAG; }
|
||||
<DYNARE_STATEMENT>optimal {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::OPTIMAL;
|
||||
}
|
||||
<DYNARE_STATEMENT>diagonal {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::DIAGONAL;
|
||||
}
|
||||
<DYNARE_STATEMENT>weighting_matrix {return token::WEIGHTING_MATRIX; }
|
||||
|
@ -677,7 +677,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
|
||||
<DYNARE_STATEMENT>[\$][^$]*[\$] {
|
||||
strtok(yytext+1, "$");
|
||||
yylval->string_val = new string(yytext + 1);
|
||||
yylval->build<string>(yytext + 1);
|
||||
return token::TEX_NAME;
|
||||
}
|
||||
|
||||
|
@ -716,7 +716,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>sylvester {return token::SYLVESTER;}
|
||||
<DYNARE_STATEMENT>lyapunov {return token::LYAPUNOV;}
|
||||
<DYNARE_STATEMENT>dr {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::DR;
|
||||
}
|
||||
<DYNARE_STATEMENT>sylvester_fixed_point_tol {return token::SYLVESTER_FIXED_POINT_TOL;}
|
||||
|
@ -883,38 +883,37 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>colormap {return token::COLORMAP;}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[A-Za-z_][A-Za-z0-9_]* {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::NAME;
|
||||
}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>((([0-9]*\.[0-9]+)|([0-9]+\.))([edED][-+]?[0-9]+)?)|([0-9]+[edED][-+]?[0-9]+) {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::FLOAT_NUMBER;
|
||||
}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[0-9]+ {
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::INT_NUMBER;
|
||||
}
|
||||
|
||||
<DATES_STATEMENT>\( { yylval->string_val->append(yytext); dates_parens_nb++; }
|
||||
<DATES_STATEMENT>\( { yylval->as<string>().append(yytext); dates_parens_nb++; }
|
||||
<DATES_STATEMENT>\) {
|
||||
yylval->string_val->append(yytext);
|
||||
yylval->as<string>().append(yytext);
|
||||
if (--dates_parens_nb == 0)
|
||||
{
|
||||
BEGIN DYNARE_STATEMENT;
|
||||
return token::DATES;
|
||||
}
|
||||
}
|
||||
<DATES_STATEMENT>. { yylval->string_val->append(yytext); }
|
||||
<DATES_STATEMENT>. { yylval->as<string>().append(yytext); }
|
||||
|
||||
<DYNARE_BLOCK>\|[eE] { return token::PIPE_E; }
|
||||
<DYNARE_BLOCK>\|[xX] { return token::PIPE_X; }
|
||||
<DYNARE_BLOCK>\|[pP] { return token::PIPE_P; }
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>\'[^\']+\' {
|
||||
yylval->string_val = new string(yytext + 1);
|
||||
yylval->string_val->resize(yylval->string_val->length() - 1);
|
||||
yylval->build<string>(yytext + 1).pop_back();
|
||||
return token::QUOTED_STRING;
|
||||
}
|
||||
|
||||
|
@ -922,11 +921,9 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
/* Verbatim Block */
|
||||
<INITIAL>verbatim[[:space:]]*; {
|
||||
BEGIN VERBATIM_BLOCK;
|
||||
yylval->string_val = new string();
|
||||
}
|
||||
<VERBATIM_BLOCK>end[[:space:]]*; {
|
||||
BEGIN INITIAL;
|
||||
yylval->string_val = new string();
|
||||
}
|
||||
<VERBATIM_BLOCK>\n {
|
||||
if (strlen(yytext) > 1)
|
||||
|
@ -952,7 +949,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(yytext))
|
||||
{
|
||||
BEGIN DYNARE_STATEMENT;
|
||||
yylval->string_val = new string(yytext);
|
||||
yylval->build<string>(yytext);
|
||||
return token::NAME;
|
||||
}
|
||||
else
|
||||
|
@ -973,20 +970,15 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
yytextcpy.erase(remove(yytextcpy.begin(), yytextcpy.end(), ' '), yytextcpy.end());
|
||||
istringstream ss(yytextcpy);
|
||||
string token;
|
||||
yylval->vector_string_val = new vector<string>;
|
||||
yylval->vector_string_p_val = new vector<string *>;
|
||||
vector<string> val;
|
||||
|
||||
bool dynare_statement = true;
|
||||
|
||||
while(getline(ss, token, ','))
|
||||
if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(token.c_str()))
|
||||
yylval->vector_string_p_val->push_back(new string(token));
|
||||
if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(token))
|
||||
val.push_back(token);
|
||||
else
|
||||
{
|
||||
for (vector<string *>::iterator it=yylval->vector_string_p_val->begin();
|
||||
it != yylval->vector_string_p_val->end(); it++)
|
||||
delete *it;
|
||||
delete yylval->vector_string_p_val;
|
||||
BEGIN NATIVE;
|
||||
yyless(0);
|
||||
dynare_statement = false;
|
||||
|
@ -995,6 +987,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
if (dynare_statement)
|
||||
{
|
||||
BEGIN DYNARE_STATEMENT;
|
||||
yylval->build<vector<string>>(val);
|
||||
return token::SYMBOL_VEC;
|
||||
}
|
||||
}
|
||||
|
|
1305
src/ParsingDriver.cc
1305
src/ParsingDriver.cc
File diff suppressed because it is too large
Load Diff
|
@ -85,23 +85,23 @@ private:
|
|||
void check_symbol_existence(const string &name);
|
||||
|
||||
//! Checks that a given symbol exists and is a parameter, and stops with an error message if it isn't
|
||||
void check_symbol_is_parameter(string *name);
|
||||
void check_symbol_is_parameter(const string &name);
|
||||
|
||||
//! Checks that a given symbol was assigned within a Statement
|
||||
void check_symbol_is_statement_variable(string *name);
|
||||
void check_symbol_is_statement_variable(const string &name);
|
||||
|
||||
//! Checks that a given symbol exists and is a endogenous or exogenous, and stops with an error message if it isn't
|
||||
void check_symbol_is_endogenous_or_exogenous(string *name);
|
||||
void check_symbol_is_endogenous_or_exogenous(const string &name);
|
||||
|
||||
//! Checks that a given symbol exists and is a exogenous, and stops with an error message if it isn't
|
||||
void check_symbol_is_exogenous(string *name);
|
||||
void check_symbol_is_exogenous(const string &name);
|
||||
|
||||
//! Checks for symbol existence in model block. If it doesn't exist, an error message is stored to be printed at
|
||||
//! the end of the model block
|
||||
void check_symbol_existence_in_model_block(const string &name);
|
||||
|
||||
//! Helper to add a symbol declaration
|
||||
void declare_symbol(const string *name, SymbolType type, const string *tex_name, const vector<pair<string *, string *> *> *partition_value);
|
||||
void declare_symbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value);
|
||||
|
||||
//! Creates option "optim_opt" in OptionsList if it doesn't exist, else add a comma, and adds the option name
|
||||
void optim_options_helper(const string &name);
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
void create_error_string(const Dynare::parser::location_type &l, const string &m, ostream &stream);
|
||||
|
||||
//! Check if a given symbol exists in the parsing context, and is not a mod file local variable
|
||||
bool symbol_exists_and_is_not_modfile_local_or_external_function(const char *s);
|
||||
bool symbol_exists_and_is_not_modfile_local_or_external_function(const string &s);
|
||||
//! Sets mode of ModelTree class to use C output
|
||||
void use_dll();
|
||||
//! the modelis block decomposed
|
||||
|
@ -320,72 +320,72 @@ public:
|
|||
//! the differentiate_forward_vars option is enabled (for a subset of vars)
|
||||
void differentiate_forward_vars_some();
|
||||
//! cutoff option of model block
|
||||
void cutoff(string *value);
|
||||
void cutoff(const string &value);
|
||||
//! mfs option of model block
|
||||
void mfs(string *value);
|
||||
void mfs(const string &value);
|
||||
//! Sets the FILENAME for the initial value in initval
|
||||
void initval_file(string *filename);
|
||||
void initval_file(const string &filename);
|
||||
//! Declares an endogenous variable
|
||||
void declare_endogenous(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
|
||||
void declare_endogenous(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
|
||||
//! Declares an exogenous variable
|
||||
void declare_exogenous(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
|
||||
void declare_exogenous(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
|
||||
//! Declares an exogenous deterministic variable
|
||||
void declare_exogenous_det(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
|
||||
void declare_exogenous_det(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
|
||||
//! Declares a parameter
|
||||
void declare_parameter(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
|
||||
void declare_parameter(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
|
||||
//! Declares a VAR variable and adds to symbol_list
|
||||
void declare_var_endogenous(string *name);
|
||||
void declare_var_endogenous(const string &name);
|
||||
//! Declares a model local variable
|
||||
void declare_model_local_variable(string *name, string *tex_name = nullptr);
|
||||
void declare_model_local_variable(const string &name, const string &tex_name = "");
|
||||
//! Declares a statement local variable
|
||||
void declare_statement_local_variable(string *name);
|
||||
void declare_statement_local_variable(const string &name);
|
||||
//! Completes a subsample statement
|
||||
void set_subsamples(string *name1, string *name2);
|
||||
void set_subsamples(string name1, string name2);
|
||||
//! Declares a subsample, assigning the value to name
|
||||
void set_subsample_name_equal_to_date_range(string *name, string *date1, string *date2);
|
||||
void set_subsample_name_equal_to_date_range(string name, string date1, string date2);
|
||||
//! Checks that a subsample statement (and given name) were provided for the pair name1 & name2
|
||||
void check_subsample_declaration_exists(string *name1, string *subsample_name);
|
||||
void check_subsample_declaration_exists(string *name1, string *name2, string *subsample_name);
|
||||
void check_subsample_declaration_exists(const string &name1, const string &subsample_name);
|
||||
void check_subsample_declaration_exists(const string &name1, const string &name2, const string &subsample_name);
|
||||
//! Copies the set of subsamples from_name to_name
|
||||
void copy_subsamples(string *to_name1, string *to_name2, string *from_name1, string *from_name2);
|
||||
void copy_subsamples(string to_name1, string to_name2, string from_name1, string from_name2);
|
||||
//! Declares declare_optimal_policy_discount_factor as a parameter and initializes it to exprnode
|
||||
void declare_optimal_policy_discount_factor_parameter(expr_t exprnode);
|
||||
//! Adds a predetermined_variable
|
||||
void add_predetermined_variable(string *name);
|
||||
void add_predetermined_variable(const string &name);
|
||||
//! Declares and initializes a local parameter
|
||||
void declare_and_init_model_local_variable(string *name, expr_t rhs);
|
||||
void declare_and_init_model_local_variable(const string &name, expr_t rhs);
|
||||
//! Changes type of a symbol
|
||||
void change_type(SymbolType new_type, vector<string *> *var_list);
|
||||
void change_type(SymbolType new_type, const vector<string> &var_list);
|
||||
//! Adds a list of tags for the current equation
|
||||
void add_equation_tags(string *key, string *value);
|
||||
void add_equation_tags(string key, string value);
|
||||
//! Adds a non-negative constant to DataTree
|
||||
expr_t add_non_negative_constant(string *constant);
|
||||
expr_t add_non_negative_constant(const string &constant);
|
||||
//! Adds a NaN constant to DataTree
|
||||
expr_t add_nan_constant();
|
||||
//! Adds an Inf constant to DataTree
|
||||
expr_t add_inf_constant();
|
||||
//! Adds a model variable to ModelTree and VariableTable
|
||||
expr_t add_model_variable(string *name);
|
||||
expr_t add_model_variable(const string &name);
|
||||
//! Declares a variable of type new_type OR changes a variable in the equations to type new_type
|
||||
//! and removes any error messages that may have been issued in model_errors
|
||||
expr_t declare_or_change_type(SymbolType new_type, string *name);
|
||||
expr_t declare_or_change_type(SymbolType new_type, const string &name);
|
||||
//! Adds an Expression's variable
|
||||
expr_t add_expression_variable(string *name);
|
||||
expr_t add_expression_variable(const string &name);
|
||||
//! Adds a "periods" statement
|
||||
void periods(string *periods);
|
||||
void periods(const string &periods);
|
||||
//! Adds a "dsample" statement
|
||||
void dsample(string *arg1);
|
||||
void dsample(const string &arg1);
|
||||
//! Adds a "dsample" statement
|
||||
void dsample(string *arg1, string *arg2);
|
||||
void dsample(const string &arg1, const string &arg2);
|
||||
//! Writes parameter intitialisation expression
|
||||
void init_param(string *name, expr_t rhs);
|
||||
void init_param(const string &name, expr_t rhs);
|
||||
//! Writes an initval block
|
||||
void init_val(string *name, expr_t rhs);
|
||||
void init_val(const string &name, expr_t rhs);
|
||||
//! Writes an histval block
|
||||
void hist_val(string *name, string *lag, expr_t rhs);
|
||||
void hist_val(const string &name, const string &lag, expr_t rhs);
|
||||
//! Adds an entry in a homotopy_setup block
|
||||
/*! Second argument "val1" can be NULL if no initial value provided */
|
||||
void homotopy_val(string *name, expr_t val1, expr_t val2);
|
||||
void homotopy_val(const string &name, expr_t val1, expr_t val2);
|
||||
//! Writes end of an initval block
|
||||
void end_initval(bool all_values_required);
|
||||
//! Writes end of an endval block
|
||||
|
@ -403,58 +403,52 @@ public:
|
|||
//! Writes a mshocks statement
|
||||
void end_mshocks(bool overwrite);
|
||||
//! Adds a deterministic shock or a path element inside a conditional_forecast_paths block
|
||||
void add_det_shock(string *var, bool conditional_forecast);
|
||||
void add_det_shock(const string &var, bool conditional_forecast);
|
||||
//! Adds a std error chock
|
||||
void add_stderr_shock(string *var, expr_t value);
|
||||
void add_stderr_shock(const string &var, expr_t value);
|
||||
//! Adds a variance chock
|
||||
void add_var_shock(string *var, expr_t value);
|
||||
void add_var_shock(const string &var, expr_t value);
|
||||
//! Adds a covariance chock
|
||||
void add_covar_shock(string *var1, string *var2, expr_t value);
|
||||
void add_covar_shock(const string &var1, const string &var2, expr_t value);
|
||||
//! Adds a correlated chock
|
||||
void add_correl_shock(string *var1, string *var2, expr_t value);
|
||||
void add_correl_shock(const string &var1, const string &var2, expr_t value);
|
||||
//! Adds a shock period range
|
||||
void add_period(string *p1, string *p2);
|
||||
void add_period(const string &p1, const string &p2);
|
||||
//! Adds a shock period
|
||||
void add_period(string *p1);
|
||||
void add_period(const string &p1);
|
||||
//! Adds a deterministic shock value
|
||||
void add_value(expr_t value);
|
||||
//! Adds a deterministic shock value
|
||||
/*! \param v a string containing a (possibly negative) numeric constant */
|
||||
void add_value(string *v);
|
||||
void add_value(const string &v);
|
||||
//! Writes a Sigma_e block
|
||||
void do_sigma_e();
|
||||
//! Ends row of Sigma_e block
|
||||
void end_of_row();
|
||||
//! Adds a constant element to current row of Sigma_e
|
||||
void add_to_row_const(string *v);
|
||||
void add_to_row_const(const string &v);
|
||||
//! Adds an expression element to current row of Sigma_e
|
||||
void add_to_row(expr_t v);
|
||||
//! Write a steady command
|
||||
void steady();
|
||||
//! Sets an option to a numerical value
|
||||
void option_num(const string &name_option, string *opt);
|
||||
void option_num(string name_option, string opt);
|
||||
//! Sets an option to a numerical value
|
||||
void option_num(const string &name_option, const string &opt);
|
||||
//! Sets an option to a numerical value
|
||||
void option_num(const string &name_option, string *opt1, string *opt2);
|
||||
void option_num(string name_option, string opt1, string opt2);
|
||||
//! Sets an option to a string value
|
||||
void option_str(const string &name_option, string *opt);
|
||||
//! Sets an option to a string value
|
||||
void option_str(const string &name_option, const string &opt);
|
||||
void option_str(string name_option, string opt);
|
||||
//! Sets an option to a date value
|
||||
void option_date(const string &name_option, string *opt);
|
||||
//! Sets an option to a date value
|
||||
void option_date(const string &name_option, const string &opt);
|
||||
void option_date(string name_option, string opt);
|
||||
//! Sets an option to a list of symbols (used in conjunction with add_in_symbol_list())
|
||||
void option_symbol_list(const string &name_option);
|
||||
void option_symbol_list(string name_option);
|
||||
//! Sets an option to a vector of integers
|
||||
void option_vec_int(const string &name_option, const vector<int> *opt);
|
||||
void option_vec_int(string name_option, vector<int> opt);
|
||||
//! Sets an option to a vector of strings
|
||||
void option_vec_str(const string &name_option, const vector<string> *opt);
|
||||
void option_vec_str(string name_option, vector<string> opt);
|
||||
//! Indicates that the model is linear
|
||||
void linear();
|
||||
//! Adds a variable to temporary symbol list
|
||||
void add_in_symbol_list(string *tmp_var);
|
||||
void add_in_symbol_list(const string &tmp_var);
|
||||
//! Writes a rplot() command
|
||||
void rplot();
|
||||
//! Writes a stock_simul command
|
||||
|
@ -476,8 +470,6 @@ public:
|
|||
//! Adds a declaration for a user-defined external function
|
||||
void external_function();
|
||||
//! Sets an external_function option to a string value
|
||||
void external_function_option(const string &name_option, string *opt);
|
||||
//! Sets an external_function option to a string value
|
||||
void external_function_option(const string &name_option, const string &opt);
|
||||
//! Add a line in an estimated params block
|
||||
void add_estimated_params_element();
|
||||
|
@ -486,78 +478,78 @@ public:
|
|||
//! Add a line in an osr params block
|
||||
void add_osr_params_element();
|
||||
//! Sets the frequency of the data
|
||||
void set_time(string *arg);
|
||||
void set_time(const string &arg);
|
||||
//! Estimation Data
|
||||
void estimation_data();
|
||||
//! Sets the prior for a parameter
|
||||
void set_prior(string *arg1, string *arg2);
|
||||
void set_prior(const string &name, const string &subsample_name);
|
||||
//! Sets the joint prior for a set of parameters
|
||||
void set_joint_prior(vector<string *> *symbol_vec);
|
||||
void set_joint_prior(const vector<string> &symbol_vec);
|
||||
//! Adds a parameters to the list of joint parameters
|
||||
void add_joint_parameter(string *name);
|
||||
void add_joint_parameter(string name);
|
||||
//! Adds the variance option to its temporary holding place
|
||||
void set_prior_variance(expr_t variance = nullptr);
|
||||
//! Copies the prior from_name to_name
|
||||
void copy_prior(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
|
||||
string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name);
|
||||
void copy_prior(const string &to_declaration_type, const string &to_name1, const string &to_name2, const string &to_subsample_name,
|
||||
const string &from_declaration_type, const string &from_name1, const string &from_name2, const string &from_subsample_name);
|
||||
//! Sets the options for a parameter
|
||||
void set_options(string *arg1, string *arg2);
|
||||
void set_options(const string &name, const string &subsample_name);
|
||||
//! Copies the options from_name to_name
|
||||
void copy_options(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
|
||||
string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name);
|
||||
void copy_options(const string &to_declaration_type, const string &to_name1, const string &to_name2, const string &to_subsample_name,
|
||||
const string &from_declaration_type, const string &from_name1, const string &from_name2, const string &from_subsample_name);
|
||||
//! Sets the prior for estimated std dev
|
||||
void set_std_prior(string *arg1, string *arg2);
|
||||
void set_std_prior(const string &name, const string &subsample_name);
|
||||
//! Sets the options for estimated std dev
|
||||
void set_std_options(string *arg1, string *arg2);
|
||||
void set_std_options(const string &name, const string &subsample_name);
|
||||
//! Sets the prior for estimated correlation
|
||||
void set_corr_prior(string *arg1, string *arg2, string *arg3);
|
||||
void set_corr_prior(const string &name1, const string &name2, const string &subsample_name);
|
||||
//! Sets the options for estimated correlation
|
||||
void set_corr_options(string *arg1, string *arg2, string *arg3);
|
||||
void set_corr_options(const string &name1, const string &name2, const string &subsample_name);
|
||||
//! Runs estimation process
|
||||
void run_estimation();
|
||||
//! Runs dynare_sensitivy()
|
||||
void dynare_sensitivity();
|
||||
//! Adds an optimization option (string value)
|
||||
void optim_options_string(string *name, string *value);
|
||||
void optim_options_string(const string &name, const string &value);
|
||||
//! Adds an optimization option (numeric value)
|
||||
void optim_options_num(string *name, string *value);
|
||||
void optim_options_num(const string &name, const string &value);
|
||||
//! Adds an sampling option (string value)
|
||||
void sampling_options_string(string *name, string *value);
|
||||
void sampling_options_string(const string &name, const string &value);
|
||||
//! Adds an sampling option (numeric value)
|
||||
void sampling_options_num(string *name, string *value);
|
||||
void sampling_options_num(const string &name, const string &value);
|
||||
//! Check that no observed variable has yet be defined
|
||||
void check_varobs();
|
||||
//! Add a new observed variable
|
||||
void add_varobs(string *name);
|
||||
void add_varobs(const string &name);
|
||||
//! Check that no observed exogenous variable has yet be defined
|
||||
void check_varexobs();
|
||||
//! Add a new observed exogenous variable
|
||||
void add_varexobs(string *name);
|
||||
void add_varexobs(const string &name);
|
||||
//! Svar_Identification Statement
|
||||
void begin_svar_identification();
|
||||
void end_svar_identification();
|
||||
//! Svar_Identification Statement: match list of restrictions and equation number with lag
|
||||
void combine_lag_and_restriction(string *lag);
|
||||
void combine_lag_and_restriction(const string &lag);
|
||||
//! Svar_Identification Statement: match list of restrictions with equation number
|
||||
void add_restriction_in_equation(string *equation);
|
||||
void add_restriction_in_equation(const string &equation);
|
||||
//! Svar_Identification Statement: add list of restriction symbol ids
|
||||
void add_in_svar_restriction_symbols(string *name);
|
||||
void add_in_svar_restriction_symbols(const string &tmp_var);
|
||||
//! Svar_Identification Statement: add exclusions of constants
|
||||
void add_constants_exclusion();
|
||||
//! Svar_Identification Statement: add equation number for following restriction equations
|
||||
void add_restriction_equation_nbr(string *eq_nbr);
|
||||
void add_restriction_equation_nbr(const string &eq_nbr);
|
||||
//! Svar_Identification Statement: record presence of equal sign
|
||||
void add_restriction_equal();
|
||||
//! Svar_Idenditification Statement: add coefficient of a linear restriction (positive value)
|
||||
void add_positive_restriction_element(expr_t value, string *variable, string *lag);
|
||||
void add_positive_restriction_element(expr_t value, const string &variable, const string &lag);
|
||||
//! Svar_Idenditification Statement: add unit coefficient of a linear restriction
|
||||
void add_positive_restriction_element(string *variable, string *lag);
|
||||
void add_positive_restriction_element(const string &variable, const string &lag);
|
||||
//! Svar_Idenditification Statement: add coefficient of a linear restriction (negative value)
|
||||
void add_negative_restriction_element(expr_t value, string *variable, string *lag);
|
||||
void add_negative_restriction_element(expr_t value, const string &variable, const string &lag);
|
||||
//! Svar_Idenditification Statement: add negative unit coefficient of a linear restriction
|
||||
void add_negative_restriction_element(string *variable, string *lag);
|
||||
void add_negative_restriction_element(const string &variable, const string &lag);
|
||||
//! Svar_Idenditification Statement: add restriction element
|
||||
void add_restriction_element(expr_t value, string *variable, string *lag);
|
||||
void add_restriction_element(expr_t value, const string &variable, const string &lag);
|
||||
//! Svar_Identification Statement: check that restriction is homogenous
|
||||
void check_restriction_expression_constant(expr_t value);
|
||||
//! Svar_Identification Statement: restriction of form upper cholesky
|
||||
|
@ -568,24 +560,24 @@ public:
|
|||
void add_svar_global_identification_check();
|
||||
//! generate_irfs Block
|
||||
void end_generate_irfs();
|
||||
void add_generate_irfs_element(string *name);
|
||||
void add_generate_irfs_exog_element(string *exo, string *value);
|
||||
void add_generate_irfs_element(string name);
|
||||
void add_generate_irfs_exog_element(string exo, const string &value);
|
||||
//! Forecast Statement
|
||||
void forecast();
|
||||
void set_trends();
|
||||
void set_trend_element(string *arg1, expr_t arg2);
|
||||
void set_trend_element(string arg1, expr_t arg2);
|
||||
void set_unit_root_vars();
|
||||
void optim_weights();
|
||||
void set_optim_weights(string *name, expr_t value);
|
||||
void set_optim_weights(string *name1, string *name2, expr_t value);
|
||||
void set_optim_weights(string name, expr_t value);
|
||||
void set_optim_weights(const string &name1, const string &name2, expr_t value);
|
||||
void set_osr_params();
|
||||
void run_osr();
|
||||
void run_dynasave(string *filename);
|
||||
void run_dynatype(string *filename);
|
||||
void run_load_params_and_steady_state(string *filename);
|
||||
void run_save_params_and_steady_state(string *filename);
|
||||
void run_dynasave(const string &filename);
|
||||
void run_dynatype(const string &filename);
|
||||
void run_load_params_and_steady_state(const string &filename);
|
||||
void run_save_params_and_steady_state(const string &filename);
|
||||
void run_identification();
|
||||
void add_mc_filename(string *filename, string *prior = new string ("1"));
|
||||
void add_mc_filename(string filename, string prior = "1");
|
||||
void run_model_comparison();
|
||||
//! Begin a planner_objective statement
|
||||
void begin_planner_objective();
|
||||
|
@ -596,15 +588,15 @@ public:
|
|||
//! Ramsey constraints statement
|
||||
void add_ramsey_constraints_statement();
|
||||
//! Ramsey less constraint
|
||||
void ramsey_constraint_add_less(const string *name, const expr_t rhs);
|
||||
void ramsey_constraint_add_less(const string &name, const expr_t rhs);
|
||||
//! Ramsey greater constraint
|
||||
void ramsey_constraint_add_greater(const string *name, const expr_t rhs);
|
||||
void ramsey_constraint_add_greater(const string &name, const expr_t rhs);
|
||||
//! Ramsey less or equal constraint
|
||||
void ramsey_constraint_add_less_equal(const string *name, const expr_t rhs);
|
||||
void ramsey_constraint_add_less_equal(const string &name, const expr_t rhs);
|
||||
//! Ramsey greater or equal constraint
|
||||
void ramsey_constraint_add_greater_equal(const string *name, const expr_t rhs);
|
||||
void ramsey_constraint_add_greater_equal(const string &name, const expr_t rhs);
|
||||
//! Ramsey constraint helper function
|
||||
void add_ramsey_constraint(const string *name, BinaryOpcode op_code, const expr_t rhs);
|
||||
void add_ramsey_constraint(const string &name, BinaryOpcode op_code, const expr_t rhs);
|
||||
//! Ramsey policy statement
|
||||
void ramsey_policy();
|
||||
//! Discretionary policy statement
|
||||
|
@ -618,9 +610,9 @@ public:
|
|||
//! Adds a write_latex_steady_state_model statement
|
||||
void write_latex_steady_state_model();
|
||||
//! BVAR marginal density
|
||||
void bvar_density(string *maxnlags);
|
||||
void bvar_density(const string &maxnlags);
|
||||
//! BVAR forecast
|
||||
void bvar_forecast(string *nlags);
|
||||
void bvar_forecast(const string &nlags);
|
||||
//! SBVAR statement
|
||||
void sbvar();
|
||||
//! Markov Switching Statement: Estimation
|
||||
|
@ -654,7 +646,7 @@ public:
|
|||
//! Conditional forecast paths block
|
||||
void conditional_forecast_paths();
|
||||
//! Plot conditional forecast statement
|
||||
void plot_conditional_forecast(string *periods = nullptr);
|
||||
void plot_conditional_forecast(const string &periods = "");
|
||||
//! Smoother on calibrated models
|
||||
void calib_smoother();
|
||||
//! Extended path
|
||||
|
@ -688,20 +680,20 @@ public:
|
|||
//! Writes token "arg1^arg2" to model tree
|
||||
expr_t add_power(expr_t arg1, expr_t arg2);
|
||||
//! Writes token "E(arg1)(arg2)" to model tree
|
||||
expr_t add_expectation(string *arg1, expr_t arg2);
|
||||
expr_t add_expectation(const string &arg1, expr_t arg2);
|
||||
//! Writes token "VAR_EXPECTATION(arg1, arg2, arg3)" to model tree
|
||||
expr_t add_var_expectation(string *arg1, string *arg2, string *arg3);
|
||||
expr_t add_var_expectation(const string &arg1, const string &arg2, const string &arg3);
|
||||
//! Writes token "PAC_EXPECTATION(model_name, discount, growth)" to model tree
|
||||
expr_t add_pac_expectation(string *var_model_name);
|
||||
expr_t add_pac_expectation(const string &var_model_name);
|
||||
//! Creates pac_model statement
|
||||
void pac_model();
|
||||
//! Add undiff option for pac_model statement
|
||||
void pac_model_undiff(string *eqtag, string *order);
|
||||
void pac_model_undiff(string eqtag, const string &order);
|
||||
//! Writes token "diff(arg1)" to model tree
|
||||
expr_t add_diff(expr_t arg1);
|
||||
//! Writes token "adl(arg1, lag)" to model tree
|
||||
expr_t add_adl(expr_t arg1, string *name, string *lag);
|
||||
expr_t add_adl(expr_t arg1, string *name, vector<int> *lags);
|
||||
expr_t add_adl(expr_t arg1, const string &name, const string &lag);
|
||||
expr_t add_adl(expr_t arg1, const string &name, const vector<int> &lags);
|
||||
//! Writes token "exp(arg1)" to model tree
|
||||
expr_t add_exp(expr_t arg1);
|
||||
//! Writes token "log(arg1)" to model tree
|
||||
|
@ -761,31 +753,31 @@ public:
|
|||
//! Test to see if model/external function has exactly one integer argument
|
||||
pair<bool, double> is_there_one_integer_argument() const;
|
||||
//! Adds an external function call node
|
||||
expr_t add_model_var_or_external_function(string *function_name, bool in_model_block);
|
||||
expr_t add_model_var_or_external_function(const string &function_name, bool in_model_block);
|
||||
//! Adds a native statement
|
||||
void add_native(const string &s);
|
||||
//! Adds a native statement, first removing the set of characters passed in token (and everything after)
|
||||
void add_native_remove_charset(const char *s, const string &token);
|
||||
void add_native_remove_charset(string str, const string &token);
|
||||
//! Adds a verbatim statement
|
||||
void add_verbatim(const string &s);
|
||||
//! Adds a verbatim statement, first removing the set of characters passed in token (and everything after)
|
||||
void add_verbatim_remove_charset(const char *s, const string &token);
|
||||
void add_verbatim_remove_charset(string str, const string &token);
|
||||
//! Resets data_tree and model_tree pointers to default (i.e. mod_file->expressions_tree)
|
||||
void reset_data_tree();
|
||||
//! Begin a steady_state_model block
|
||||
void begin_steady_state_model();
|
||||
//! Add an assignment equation in steady_state_model block
|
||||
void add_steady_state_model_equal(string *varname, expr_t expr);
|
||||
void add_steady_state_model_equal(const string &varname, expr_t expr);
|
||||
//! Add a multiple assignment equation in steady_state_model block
|
||||
void add_steady_state_model_equal_multiple(expr_t expr);
|
||||
//! Switches datatree
|
||||
void begin_trend();
|
||||
//! Declares a trend variable with its growth factor
|
||||
void declare_trend_var(bool log_trend, string *name, string *tex_name = nullptr);
|
||||
void declare_trend_var(bool log_trend, const string &name, const string &tex_name = "");
|
||||
//! Ends declaration of trend variable
|
||||
void end_trend_var(expr_t growth_factor);
|
||||
//! Declares a nonstationary variable with its deflator
|
||||
void declare_nonstationary_var(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
|
||||
void declare_nonstationary_var(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
|
||||
//! Ends declaration of nonstationary variable
|
||||
void end_nonstationary_var(bool log_deflator, expr_t deflator);
|
||||
//! Add a graph format to the list of formats requested
|
||||
|
@ -797,40 +789,40 @@ public:
|
|||
//! Model diagnostics
|
||||
void model_diagnostics();
|
||||
//! Processing the parallel_local_files option
|
||||
void add_parallel_local_file(string *filename);
|
||||
void add_parallel_local_file(string filename);
|
||||
//! Add an item of a moment_calibration statement
|
||||
void add_moment_calibration_item(string *endo1, string *endo2, string *lags, vector<string *> *range);
|
||||
void add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<string, string> &range);
|
||||
//! End a moment_calibration statement
|
||||
void end_moment_calibration();
|
||||
//! Add an item of an irf_calibration statement
|
||||
void add_irf_calibration_item(string *endo, string *periods, string *exo, vector<string *> *range);
|
||||
void add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<string, string> &range);
|
||||
//! End a moment_calibration statement
|
||||
void end_irf_calibration();
|
||||
//! Add a shock to a group
|
||||
void add_shock_group_element(string *name);
|
||||
void add_shock_group_element(string name);
|
||||
//! Add a set of shock groups
|
||||
void add_shock_group(string *name);
|
||||
void add_shock_group(string name);
|
||||
//! End shock groups declaration
|
||||
void end_shock_groups(const string *name);
|
||||
void end_shock_groups(const string &name);
|
||||
//! Add an element to the ramsey policy list
|
||||
void add_to_ramsey_policy_list(string *name);
|
||||
void add_to_ramsey_policy_list(string name);
|
||||
void smoother2histval();
|
||||
void histval_file(string *filename);
|
||||
void histval_file(const string &filename);
|
||||
void perfect_foresight_setup();
|
||||
void perfect_foresight_solver();
|
||||
void prior_posterior_function(bool prior_func);
|
||||
//! VAR Restrictions
|
||||
void begin_VAR_restrictions();
|
||||
void end_VAR_restrictions(string *var_model_name);
|
||||
void add_VAR_exclusion_restriction(string *lagstr);
|
||||
void add_VAR_restriction_exclusion_equation(string *name);
|
||||
void add_VAR_restriction_coeff(string *name1, string *name2, string *lagstr);
|
||||
void end_VAR_restrictions(const string &var_model_name);
|
||||
void add_VAR_exclusion_restriction(const string &lagstr);
|
||||
void add_VAR_restriction_exclusion_equation(const string &name);
|
||||
void add_VAR_restriction_coeff(const string &name1, const string &name2, const string &lagstr);
|
||||
void add_VAR_restriction_eq_or_crosseq(expr_t expr);
|
||||
void add_VAR_restriction_equation_or_crossequation(string *numberstr);
|
||||
void add_VAR_restriction_equation_or_crossequation(const string &numberstr);
|
||||
void multiply_arg2_by_neg_one();
|
||||
void add_VAR_restriction_equation_or_crossequation_final(string *name);
|
||||
void add_VAR_covariance_number_restriction(string *name1, string *name2, string *valuestr);
|
||||
void add_VAR_covariance_pair_restriction(string *name11, string *name12, string *name21, string *name22);
|
||||
void add_VAR_restriction_equation_or_crossequation_final(const string &name);
|
||||
void add_VAR_covariance_number_restriction(const string &name1, const string &name2, const string &valuestr);
|
||||
void add_VAR_covariance_pair_restriction(const string &name11, const string &name12, const string &name21, const string &name22);
|
||||
//! Runs VAR estimation process
|
||||
void run_var_estimation();
|
||||
//! GMM Estimation statement
|
||||
|
|
|
@ -42,7 +42,7 @@ SymbolTable::SymbolTable()
|
|||
= default;
|
||||
|
||||
int
|
||||
SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false)
|
||||
SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value) noexcept(false)
|
||||
{
|
||||
if (frozen)
|
||||
throw FrozenException();
|
||||
|
@ -69,12 +69,11 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
|
|||
|
||||
string final_long_name = name;
|
||||
bool non_long_name_partition_exists = false;
|
||||
if (partition_value)
|
||||
for (auto it : *partition_value)
|
||||
if (*(it->first) == "long_name")
|
||||
final_long_name = *(it->second);
|
||||
else
|
||||
non_long_name_partition_exists = true;
|
||||
for (auto it : partition_value)
|
||||
if (it.first == "long_name")
|
||||
final_long_name = it.second;
|
||||
else
|
||||
non_long_name_partition_exists = true;
|
||||
|
||||
int id = symbol_table.size();
|
||||
|
||||
|
@ -86,8 +85,8 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
|
|||
if (non_long_name_partition_exists)
|
||||
{
|
||||
map<string, string> pmv;
|
||||
for (auto it : *partition_value)
|
||||
pmv[*(it->first)] = *(it->second);
|
||||
for (auto it : partition_value)
|
||||
pmv[it.first] = it.second;
|
||||
partition_value_map[id] = pmv;
|
||||
}
|
||||
return id;
|
||||
|
@ -96,7 +95,7 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
|
|||
int
|
||||
SymbolTable::addSymbol(const string &name, SymbolType type) noexcept(false)
|
||||
{
|
||||
return addSymbol(name, type, "", nullptr);
|
||||
return addSymbol(name, type, "", {});
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -237,7 +237,7 @@ private:
|
|||
public:
|
||||
//! Add a symbol
|
||||
/*! Returns the symbol ID */
|
||||
int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false);
|
||||
int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value) noexcept(false);
|
||||
//! Add a symbol without its TeX name (will be equal to its name)
|
||||
/*! Returns the symbol ID */
|
||||
int addSymbol(const string &name, SymbolType type) noexcept(false);
|
||||
|
|
Loading…
Reference in New Issue