From 3907462ae90179739a021e075b1f4186c22135dc Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 13 Oct 2015 17:40:15 +0200
Subject: [PATCH] preprocessor: prior_posterior_function: change option
 'prior_posterior_sampling_draws' to 'sampling_draws' #1076

---
 ComputingTasks.cc | 8 ++------
 DynareBison.yy    | 6 +++---
 DynareFlex.ll     | 2 +-
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 1d0ed9ac..52b8ffa0 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -167,17 +167,13 @@ PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, Wa
 void
 PriorPosteriorFunctionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
 {
-  OptionsList::num_options_t::const_iterator it =
-      options_list.num_options.find("prior_posterior_sampling_draws");
-  if (it != options_list.num_options.end())
-      cout << it->first << " = " << it->second << ";" << endl;
-
+  options_list.writeOutput(output);
   string type = "posterior";
   if (options_list.num_options.find("prior") != options_list.num_options.end())
       type = "prior";
 
   output << "oo_ = execute_prior_posterior_function("
-         << "'" << options_list.string_options.find("function")->second << "',"
+         << "'" << options_list.string_options.find("function")->second << "', "
          << "M_, options_, oo_, estim_params_, bayestopt_, dataset_, dataset_info, "
          << "'" << type << "');" << endl;
 }
diff --git a/DynareBison.yy b/DynareBison.yy
index 45f2c920..fee3fdb3 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -162,7 +162,7 @@ class ParsingDriver;
 %token SELECTED_VARIABLES_ONLY COVA_COMPUTE SIMULATION_FILE_TAG FILE_TAG
 %token NO_ERROR_BANDS ERROR_BAND_PERCENTILES SHOCKS_PER_PARAMETER NO_CREATE_INIT
 %token SHOCK_DRAWS FREE_PARAMETERS MEDIAN DATA_OBS_NBR NEIGHBORHOOD_WIDTH PVALUE_KS PVALUE_CORR
-%token FILTERED_PROBABILITIES REAL_TIME_SMOOTHED PRIOR_POSTERIOR_FUNCTION PRIOR_POSTERIOR_SAMPLING_DRAWS
+%token FILTERED_PROBABILITIES REAL_TIME_SMOOTHED PRIOR_POSTERIOR_FUNCTION SAMPLING_DRAWS
 %token PROPOSAL_TYPE PROPOSAL_UPPER_BOUND PROPOSAL_LOWER_BOUND PROPOSAL_DRAWS USE_MEAN_CENTER
 %token ADAPTIVE_MH_DRAWS THINNING_FACTOR COEFFICIENTS_PRIOR_HYPERPARAMETERS
 %token CONVERGENCE_STARTING_VALUE CONVERGENCE_ENDING_VALUE CONVERGENCE_INCREMENT_VALUE
@@ -1034,7 +1034,7 @@ prior_posterior_function_options_list : prior_posterior_function_options_list CO
 prior_posterior_function_options : o_function
                                  | o_prior
                                  | o_posterior
-                                 | o_prior_posterior_sampling_draws
+                                 | o_sampling_draws
                                  ;
 
 simul : SIMUL ';'
@@ -3084,7 +3084,7 @@ o_occbin : OCCBIN {driver.option_num("occbin", "1"); };
 o_function : FUNCTION EQUAL filename { driver.option_str("function", $3); };
 o_prior : PRIOR { driver.option_num("prior", "1"); };
 o_posterior : POSTERIOR { driver.option_num("posterior", "1"); };
-o_prior_posterior_sampling_draws : PRIOR_POSTERIOR_SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("prior_posterior_sampling_draws",$3); };
+o_sampling_draws : SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("sampling_draws",$3); };
 
 range : symbol ':' symbol
         {
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 72aeb64e..d64e2fe8 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -221,7 +221,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
 <INITIAL>std {BEGIN DYNARE_STATEMENT; return token::STD;}
 <INITIAL>corr {BEGIN DYNARE_STATEMENT; return token::CORR;}
 <DYNARE_STATEMENT>function {return token::FUNCTION;}
-<DYNARE_STATEMENT>prior_posterior_sampling_draws {return token::PRIOR_POSTERIOR_SAMPLING_DRAWS;}
+<DYNARE_STATEMENT>sampling_draws {return token::SAMPLING_DRAWS;}
 <INITIAL>prior_posterior_function {BEGIN DYNARE_STATEMENT; return token::PRIOR_POSTERIOR_FUNCTION;}
 
  /* Inside  of a Dynare statement */
-- 
GitLab