From a7b0a324c9b97ec1bbcf3e3487dcaa176423598a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 16 Jan 2023 15:02:50 +0100
Subject: [PATCH] =?UTF-8?q?Drop=20the=20=E2=80=9Cperiods=E2=80=9D=20statem?=
 =?UTF-8?q?ent?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/ComputingTasks.cc | 18 ------------------
 src/ComputingTasks.hh | 12 +-----------
 src/DynareBison.yy    |  9 +--------
 src/DynareFlex.ll     |  3 +--
 src/ParsingDriver.cc  | 11 +----------
 src/ParsingDriver.hh  |  4 +---
 6 files changed, 5 insertions(+), 52 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index f9725180..f7107855 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -1216,24 +1216,6 @@ UnitRootVarsStatement::writeJsonOutput(ostream &output) const
          << R"("steady_state.nocheck": 1})";
 }
 
-PeriodsStatement::PeriodsStatement(int periods_arg) : periods{periods_arg}
-{
-}
-
-void
-PeriodsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename,
-                              [[maybe_unused]] bool minimal_workspace) const
-{
-  output << "options_.periods = " << periods << ";" << endl;
-}
-
-void
-PeriodsStatement::writeJsonOutput(ostream &output) const
-{
-  output << R"({"statementName": "periods", )"
-         << R"("periods": )" << periods << "}";
-}
-
 DsampleStatement::DsampleStatement(int val1_arg) : val1{val1_arg}, val2{-1}
 {
 }
diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh
index 23d6600e..1c8f65fa 100644
--- a/src/ComputingTasks.hh
+++ b/src/ComputingTasks.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -285,16 +285,6 @@ public:
   void writeJsonOutput(ostream &output) const override;
 };
 
-class PeriodsStatement : public Statement
-{
-private:
-  const int periods;
-public:
-  explicit PeriodsStatement(int periods_arg);
-  void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
-  void writeJsonOutput(ostream &output) const override;
-};
-
 class DsampleStatement : public Statement
 {
 private:
diff --git a/src/DynareBison.yy b/src/DynareBison.yy
index dc8d066b..29913ab7 100644
--- a/src/DynareBison.yy
+++ b/src/DynareBison.yy
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -236,7 +236,6 @@ statement : parameters
           | predetermined_variables
           | model_local_variable
           | change_type
-          | periods
           | model
           | initval
           | initval_file
@@ -611,12 +610,6 @@ change_type_arg : PARAMETERS
                   { $$ = SymbolType::exogenousDet; }
                 ;
 
-periods : PERIODS INT_NUMBER ';'
-          { driver.periods($2); }
-        | PERIODS EQUAL INT_NUMBER ';'
-          { driver.periods($3); }
-        ;
-
 init_param : symbol EQUAL expression ';' { driver.init_param($1, $3); };
 
 expression : '(' expression ')'
diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll
index f8aeb5b0..ed382526 100644
--- a/src/DynareFlex.ll
+++ b/src/DynareFlex.ll
@@ -1,6 +1,6 @@
 /* -*- C++ -*- */
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -112,7 +112,6 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <INITIAL>predetermined_variables {BEGIN DYNARE_STATEMENT; return token::PREDETERMINED_VARIABLES;}
 <INITIAL>parameters {BEGIN DYNARE_STATEMENT; return token::PARAMETERS;}
 <INITIAL>model_local_variable {BEGIN DYNARE_STATEMENT; return token::MODEL_LOCAL_VARIABLE;}
-<INITIAL>periods 	{BEGIN DYNARE_STATEMENT; return token::PERIODS;}
 <INITIAL>model_info {BEGIN DYNARE_STATEMENT; return token::MODEL_INFO;}
 <INITIAL>estimation {BEGIN DYNARE_STATEMENT; return token::ESTIMATION;}
 <INITIAL>set_time {BEGIN DYNARE_STATEMENT; return token::SET_TIME;}
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index b82fe92e..2d00e83c 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -501,15 +501,6 @@ ParsingDriver::end_nonstationary_var(bool log_deflator, expr_t deflator, const v
   reset_data_tree();
 }
 
-void
-ParsingDriver::periods(const string &periods)
-{
-  warning("periods: this command is now deprecated and may be removed in a future version of Dynare. Please use the ''periods'' option of the ''simul'' command instead.");
-
-  int periods_val = stoi(periods);
-  mod_file->addStatement(make_unique<PeriodsStatement>(periods_val));
-}
-
 void
 ParsingDriver::dsample(const string &arg1)
 {
diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh
index 53b2f4b3..896c15f1 100644
--- a/src/ParsingDriver.hh
+++ b/src/ParsingDriver.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -408,8 +408,6 @@ public:
   expr_t declare_or_change_type(SymbolType new_type, const string &name);
   //! Adds an Expression's variable
   expr_t add_expression_variable(const string &name);
-  //! Adds a "periods" statement
-  void periods(const string &periods);
   //! Adds a "dsample" statement
   void dsample(const string &arg1);
   //! Adds a "dsample" statement
-- 
GitLab