From a03bc44d4508780474fdbfb9aa6289f208d58984 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 8 Apr 2014 17:53:10 +0200
Subject: [PATCH] Remove workaround preventing the use of "shocks" before
 "endval".

It now works correctly since 82b31156.

Closes #35
---
 preprocessor/ComputingTasks.cc          |  3 ---
 preprocessor/NumericalInitialization.cc |  6 ------
 preprocessor/Shocks.cc                  | 10 ----------
 preprocessor/Shocks.hh                  |  1 -
 preprocessor/Statement.cc               |  3 +--
 preprocessor/Statement.hh               |  7 +------
 6 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index acf039f853..d3777117ba 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -95,9 +95,6 @@ void
 SimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
   mod_file_struct.simul_present = true;
-
-  // The following is necessary to allow shocks+endval+simul in a loop
-  mod_file_struct.shocks_present_but_simul_not_yet = false;
 }
 
 void
diff --git a/preprocessor/NumericalInitialization.cc b/preprocessor/NumericalInitialization.cc
index c328c988bb..3df225fcff 100644
--- a/preprocessor/NumericalInitialization.cc
+++ b/preprocessor/NumericalInitialization.cc
@@ -239,12 +239,6 @@ EndValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
 
   if (endogs.size() > 0 || exogs.size() > 0)
     exit(EXIT_FAILURE);
-
-  if (mod_file_struct.shocks_present_but_simul_not_yet)
-    {
-      cerr << "ERROR: Putting a \"shocks\" block before an \"endval\" block is not permitted. Please swap the two blocks. This limitation will be removed in a future release of Dynare." << endl;
-      exit(EXIT_FAILURE);
-    }
 }
 
 void
diff --git a/preprocessor/Shocks.cc b/preprocessor/Shocks.cc
index e7c059d5a6..fef8bda453 100644
--- a/preprocessor/Shocks.cc
+++ b/preprocessor/Shocks.cc
@@ -200,9 +200,6 @@ ShocksStatement::writeCovarAndCorrShocks(ostream &output) const
 void
 ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
-  // Workaround for trac ticket #35
-  mod_file_struct.shocks_present_but_simul_not_yet = true;
-
   /* Error out if variables are not of the right type. This must be done here
      and not at parsing time (see #448).
      Also Determine if there is a calibrated measurement error */
@@ -312,13 +309,6 @@ MShocksStatement::writeOutput(ostream &output, const string &basename) const
   writeDetShocks(output);
 }
 
-void
-MShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
-{
-  // Workaround for trac ticket #35
-  mod_file_struct.shocks_present_but_simul_not_yet = true;
-}
-
 ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg) :
   paths(paths_arg),
   path_length(-1)
diff --git a/preprocessor/Shocks.hh b/preprocessor/Shocks.hh
index ef68b78e47..6f893d2bbc 100644
--- a/preprocessor/Shocks.hh
+++ b/preprocessor/Shocks.hh
@@ -83,7 +83,6 @@ public:
   MShocksStatement(const det_shocks_t &det_shocks_arg,
                    const SymbolTable &symbol_table_arg);
   virtual void writeOutput(ostream &output, const string &basename) const;
-  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
 };
 
 class ConditionalForecastPathsStatement : public Statement
diff --git a/preprocessor/Statement.cc b/preprocessor/Statement.cc
index 4331c4dc61..688883cc38 100644
--- a/preprocessor/Statement.cc
+++ b/preprocessor/Statement.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2013 Dynare Team
+ * Copyright (C) 2006-2014 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -40,7 +40,6 @@ ModFileStructure::ModFileStructure() :
   identification_present(false),
   estimation_analytic_derivation(false),
   partial_information(false),
-  shocks_present_but_simul_not_yet(false),
   histval_present(false),
   k_order_solver(false),
   calibrated_measurement_errors(false),
diff --git a/preprocessor/Statement.hh b/preprocessor/Statement.hh
index 9f4a3c0457..0f5838653d 100644
--- a/preprocessor/Statement.hh
+++ b/preprocessor/Statement.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2013 Dynare Team
+ * Copyright (C) 2006-2014 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -72,11 +72,6 @@ public:
   bool estimation_analytic_derivation;
   //! Whether the option partial_information is given to stoch_simul/estimation/osr/ramsey_policy
   bool partial_information;
-  //! Whether a shocks or mshocks block has been parsed and no simul command yet run
-  /*! Used for the workaround for trac ticket #35. When a simul command is
-      seen, this flag is cleared in order to allow a sequence
-      shocks+endval+simul in a loop */
-  bool shocks_present_but_simul_not_yet;
   //! Whether a histval bloc is present
   /*! Used for the workaround for trac ticket #157 */
   bool histval_present;
-- 
GitLab