From eea358eae71af0c51d16301c43baa89021b0188a Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan.bastani@ens.fr>
Date: Wed, 20 Apr 2011 12:13:30 +0200
Subject: [PATCH] identification: added advanced and max_dim_cova_group to the
 preprocessor

---
 ComputingTasks.cc | 13 +++++++++++--
 ComputingTasks.hh |  2 +-
 DynareBison.yy    |  6 +++++-
 DynareFlex.ll     |  3 ++-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 0b12ef76..ed1454ed 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -939,9 +939,18 @@ MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const
   output << "ms_sbvar(1,M_,options_);" << endl;
 }
 
-IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) :
-  options_list(options_list_arg)
+IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg)
 {
+  options_list = options_list_arg;
+  if (options_list.num_options.find("advanced") == options_list.num_options.end())
+    options_list.num_options["advanced"] = "0";
+
+  if (options_list.num_options.find("max_dim_cova_group") != options_list.num_options.end())
+    if (atoi(options_list.num_options["max_dim_cova_group"].c_str()) == 0)
+      {
+        cerr << "ERROR: The max_dim_cova_group option to identification only accepts integers > 0." << endl;
+        exit(EXIT_FAILURE);
+      }
 }
 
 void
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index 055ffc4f..4c22c140 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -391,7 +391,7 @@ public:
 class IdentificationStatement : public Statement
 {
 private:
-  const OptionsList options_list;
+  OptionsList options_list;
 public:
   IdentificationStatement(const OptionsList &options_list_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct);
diff --git a/DynareBison.yy b/DynareBison.yy
index f3518452..ef9d5193 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -113,7 +113,7 @@ class ParsingDriver;
 %token <string_val> NAME
 %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
 %token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
-%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS
+%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED
 %token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
 %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING
 %token <string_val> QUOTED_STRING
@@ -1265,6 +1265,8 @@ identification_option : o_ar
                       | o_useautocorr
                       | o_load_ident_files
                       | o_prior_mc
+                      | o_advanced
+                      | o_max_dim_cova_group
                       ;
 
 model_comparison : MODEL_COMPARISON mc_filename_list ';'
@@ -1820,6 +1822,8 @@ o_gsa_trans_ident : TRANS_IDENT EQUAL INT_NUMBER { driver.option_num("trans_iden
 o_load_ident_files : LOAD_IDENT_FILES EQUAL INT_NUMBER { driver.option_num("load_ident_files", $3); }
 o_useautocorr : USEAUTOCORR EQUAL INT_NUMBER { driver.option_num("useautocorr", $3); }
 o_prior_mc : PRIOR_MC EQUAL INT_NUMBER { driver.option_num("prior_mc", $3); }
+o_advanced : ADVANCED EQUAL signed_integer { driver.option_num("advanced", $3); }
+o_max_dim_cova_group : MAX_DIM_COVA_GROUP EQUAL INT_NUMBER { driver.option_num("max_dim_cova_group", $3); }
 
 o_homotopy_mode : HOMOTOPY_MODE EQUAL INT_NUMBER {driver.option_num("homotopy_mode",$3); };
 o_homotopy_steps : HOMOTOPY_STEPS EQUAL INT_NUMBER {driver.option_num("homotopy_steps",$3); };
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 0f15b24b..5861e64d 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -530,7 +530,8 @@ string eofbuff;
 
  /* For identification() statement */
 <DYNARE_STATEMENT>prior_mc {return token::PRIOR_MC;}
-
+<DYNARE_STATEMENT>advanced {return token::ADVANCED;}
+<DYNARE_STATEMENT>max_dim_cova_group {return token::MAX_DIM_COVA_GROUP;}
 
 <DYNARE_STATEMENT,DYNARE_BLOCK>[A-Za-z_][A-Za-z0-9_]* {
   yylval->string_val = new string(yytext);
-- 
GitLab