diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index df1d84240..1e97cd033 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -1240,6 +1240,10 @@ dynare_sensitivity_option : o_gsa_identification | o_gsa_alpha_rmse | o_gsa_alpha2_rmse | o_gsa_threshold_redform + | o_gsa_namendo + | o_gsa_namexo + | o_gsa_namlagendo + | o_gsa_var_rmse ; homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END @@ -1364,23 +1368,19 @@ o_gsa_nsam : NSAM EQUAL INT_NUMBER { driver.option_num("identification", $3); }; o_gsa_load_redform : LOAD_REDFORM EQUAL INT_NUMBER { driver.option_num("identification", $3); }; o_gsa_load_rmse : LOAD_RMSE EQUAL INT_NUMBER { driver.option_num("load_rmse", $3); }; o_gsa_load_stab : LOAD_STAB EQUAL INT_NUMBER { driver.option_num("load_stab", $3); }; -o_gsa_alpha2_stab : ALPHA2_STAB EQUAL number { driver.option_num("identification", $3); }; +o_gsa_alpha2_stab : ALPHA2_STAB EQUAL number { driver.option_num("alpha2_stab", $3); }; o_gsa_ksstat : KSSTAT EQUAL number { driver.option_num("ksstat", $3); }; o_gsa_logtrans_redform : LOGTRANS_REDFORM EQUAL INT_NUMBER { driver.option_num("logtrans_redform", $3); }; o_gsa_threshold_redform : THRESHOLD_REDFORM EQUAL vec_int { driver.option_num("threshold_redfor",$3); }; o_gsa_ksstat_redform : KSSTAT_REDFORM EQUAL number { driver.option_num("ksstat_redfrom", $3); }; o_gsa_alpha2_redform : ALPHA2_REDFORM EQUAL number { driver.option_num("alpha2_redform", $3); }; -/* -o_gsa_namendo : NAMENDO EQUAL tmp_var_list { driver.option_list("namendo", $3); }; -o_gsa_namlagendo : NAMLAGENDO tmp_var_list { driver.option_list("namlagendo", $3); }; -o_gsa_namexo : NAMEXO tmp_var_list { driver.option_list("namexo", $3); }; -*/ +o_gsa_namendo : NAMENDO EQUAL '(' tmp_var_list ')' { driver.option_str_lst("namendo"); }; +o_gsa_namlagendo : NAMLAGENDO EQUAL '(' tmp_var_list ')' { driver.option_str_lst("namlagendo"); }; +o_gsa_namexo : NAMEXO EQUAL '(' tmp_var_list ')' { driver.option_str_lst("namexo"); }; o_gsa_rmse : RMSE EQUAL INT_NUMBER { driver.option_num("rmse", $3); }; o_gsa_lik_only : LIK_ONLY EQUAL INT_NUMBER { driver.option_num("lik_only", $3); }; -/* -o_gsa_var_rmse : VAR_RMSE tmp_var_list { driver.option_list("var_rmse", $3); }; -*/ +o_gsa_var_rmse : VAR_RMSE EQUAL '(' tmp_var_list ')' { driver.option_str_lst("var_rmse"); }; o_gsa_pfilt_rmse : PFILT_RMSE EQUAL number { driver.option_num("pfilt_rmse", $3); }; o_gsa_istart_rmse : ISTART_RMSE EQUAL INT_NUMBER { driver.option_num("istart_rmse", $3); }; o_gsa_alpha_rmse : ALPHA_RMSE EQUAL number { driver.option_num("alpha_rmse", $3); }; diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 6e0e10b12..6730e1a8d 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -654,6 +654,20 @@ ParsingDriver::option_str(const string &name_option, const string &opt) options_list.string_options[name_option] = opt; } +void +ParsingDriver::option_str_lst(const string &name_option) +{ + if (options_list.string_list_options.find(name_option) + != options_list.string_list_options.end()) + error("option " + name_option + " declared twice"); + + options_list.string_list_options[name_option] = new TmpSymbolTable::TmpSymbolTable(*tmp_symbol_table); + tmp_symbol_table->clear(); +} + + + + void ParsingDriver::linear() { diff --git a/preprocessor/Statement.cc b/preprocessor/Statement.cc index 8b3b035af..735f21c3f 100644 --- a/preprocessor/Statement.cc +++ b/preprocessor/Statement.cc @@ -67,6 +67,10 @@ OptionsList::writeOutput(ostream &output) const for(string_options_type::const_iterator it = string_options.begin(); it != string_options.end(); it++) output << "options_." << it->first << " = '" << it->second << "';" << endl; + + for(string_list_options_type::const_iterator it = string_list_options.begin(); + it != string_list_options.end(); it++) + it->second->writeOutput("options_."+it->first,output); } void diff --git a/preprocessor/include/ParsingDriver.hh b/preprocessor/include/ParsingDriver.hh index 071e5592e..dca90dc0e 100644 --- a/preprocessor/include/ParsingDriver.hh +++ b/preprocessor/include/ParsingDriver.hh @@ -264,6 +264,8 @@ public: 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); + //! Sets an option to a list of strings + void option_str_lst(const string &name_option); //! Indicates that the model is linear void linear(); //! Adds a variable to temp symbol table and sets its value diff --git a/preprocessor/include/Statement.hh b/preprocessor/include/Statement.hh index 5e5d89099..4379066db 100644 --- a/preprocessor/include/Statement.hh +++ b/preprocessor/include/Statement.hh @@ -26,6 +26,7 @@ using namespace std; #include #include +#include "TmpSymbolTable.hh" class ModFileStructure { public: @@ -71,9 +72,11 @@ public: typedef map num_options_type; typedef map > paired_num_options_type; typedef map string_options_type; + typedef map string_list_options_type; num_options_type num_options; paired_num_options_type paired_num_options; string_options_type string_options; + string_list_options_type string_list_options; void writeOutput(ostream &output) const; void clear(); };