diff --git a/DynareBison.yy b/DynareBison.yy index df1d842400b9c5d5cbd32ad6c0e7789d03cd14a7..1e97cd033a3b0ef192cb68c3ed97f6da4a636f11 100644 --- a/DynareBison.yy +++ b/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/ParsingDriver.cc b/ParsingDriver.cc index 6e0e10b120ad487d4bd8f3cd8a8d0c71082f58f9..6730e1a8da6b84b6d91c46e369fcbeea0d2f0094 100644 --- a/ParsingDriver.cc +++ b/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/Statement.cc b/Statement.cc index 8b3b035af9a2e53972aea8e1c9de2e84f0f66fd9..735f21c3f7177e015e66ff7f4da593c28fda6f51 100644 --- a/Statement.cc +++ b/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/include/ParsingDriver.hh b/include/ParsingDriver.hh index 071e5592eb5d0f91324b1a695827c24fd05878b2..dca90dc0ea18c04d40fedc2ae4b7d18431718c5c 100644 --- a/include/ParsingDriver.hh +++ b/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/include/Statement.hh b/include/Statement.hh index 5e5d89099e6baa7248e029a30f8035e9ace342a0..4379066dbc818e535c1a601a41217fb3901b265d 100644 --- a/include/Statement.hh +++ b/include/Statement.hh @@ -26,6 +26,7 @@ using namespace std; #include <string> #include <map> +#include "TmpSymbolTable.hh" class ModFileStructure { public: @@ -71,9 +72,11 @@ public: typedef map<string, string> num_options_type; typedef map<string, pair<string, string> > paired_num_options_type; typedef map<string, string> string_options_type; + typedef map<string, TmpSymbolTable*> 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(); };