From 2253db8d3e94bc14eb96e5ff8479c937b4373309 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Fri, 27 Feb 2009 14:31:48 +0000
Subject: [PATCH] 4.0 preprocessor: merged r2442 changeset from trunk (fix
 compatibility issues with Bison 2.4)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2443 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 preprocessor/DynareBison.yy           | 12 +++++++++---
 preprocessor/DynareFlex.ll            |  3 +--
 preprocessor/include/ParsingDriver.hh |  6 +++++-
 preprocessor/macro/MacroBison.yy      |  8 +++++++-
 preprocessor/macro/MacroDriver.hh     |  4 ++--
 preprocessor/macro/MacroFlex.ll       |  3 +--
 6 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index d1a2092ee9..b9c68306d3 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2008 Dynare Team
+ * Copyright (C) 2003-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -21,6 +21,12 @@
 %require "2.3"
 %defines
 
+/* Prologue:
+   In Bison <= 2.3, it is inserted in both the .cc and .hh files.
+   In Bison >= 2.3a, it is inserted only in the .cc file.
+   Since Bison 2.4, the new %code directives provide a cleaner way of dealing
+   with the prologue.
+*/
 %{
 using namespace std;
 
@@ -1346,8 +1352,8 @@ o_method : METHOD EQUAL INT_NUMBER { driver.option_num("simulation_method",$3);}
            | METHOD EQUAL BICGSTAB { driver.option_num("simulation_method", "3"); };
 o_markowitz : MARKOWITZ EQUAL number { driver.option_num("markowitz", $3); };
 o_simul : SIMUL { driver.option_num("simul", "1"); };
-o_simul_seed : SIMUL_SEED EQUAL INT_NUMBER { driver.option_num("simul_seed", $3)} ;
-o_qz_criterium : QZ_CRITERIUM EQUAL number { driver.option_num("qz_criterium", $3) };
+o_simul_seed : SIMUL_SEED EQUAL INT_NUMBER { driver.option_num("simul_seed", $3); } ;
+o_qz_criterium : QZ_CRITERIUM EQUAL number { driver.option_num("qz_criterium", $3); };
 o_datafile : DATAFILE EQUAL NAME { driver.option_str("datafile", $3); };
 o_nobs : NOBS EQUAL vec_int
          { driver.option_num("nobs", $3); }
diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll
index c22bc08388..39cdf3b7af 100644
--- a/preprocessor/DynareFlex.ll
+++ b/preprocessor/DynareFlex.ll
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2008 Dynare Team
+ * Copyright (C) 2003-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -21,7 +21,6 @@
 using namespace std;
 
 #include "ParsingDriver.hh"
-#include "DynareBison.hh"
 
 // Announce to Flex the prototype we want for lexing function
 #define YY_DECL                                                \
diff --git a/preprocessor/include/ParsingDriver.hh b/preprocessor/include/ParsingDriver.hh
index df1bfb0fad..88b9bf8b86 100644
--- a/preprocessor/include/ParsingDriver.hh
+++ b/preprocessor/include/ParsingDriver.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2008 Dynare Team
+ * Copyright (C) 2003-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -30,7 +30,11 @@
 
 #include "ModFile.hh"
 #include "SymbolList.hh"
+
+class ParsingDriver;
+#include "ExprNode.hh"
 #include "DynareBison.hh"
+
 #include "ComputingTasks.hh"
 #include "Shocks.hh"
 #include "SigmaeInitialization.hh"
diff --git a/preprocessor/macro/MacroBison.yy b/preprocessor/macro/MacroBison.yy
index e44f5bfc4d..13b985a6cf 100644
--- a/preprocessor/macro/MacroBison.yy
+++ b/preprocessor/macro/MacroBison.yy
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Dynare Team
+ * Copyright (C) 2008-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -21,6 +21,12 @@
 %require "2.3"
 %defines
 
+/* Prologue:
+   In Bison <= 2.3, it is inserted in both the .cc and .hh files.
+   In Bison >= 2.3a, it is inserted only in the .cc file.
+   Since Bison 2.4, the new %code directives provide a cleaner way of dealing
+   with the prologue.
+*/
 %{
 using namespace std;
 
diff --git a/preprocessor/macro/MacroDriver.hh b/preprocessor/macro/MacroDriver.hh
index a482e10b6b..4cb893ca5b 100644
--- a/preprocessor/macro/MacroDriver.hh
+++ b/preprocessor/macro/MacroDriver.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Dynare Team
+ * Copyright (C) 2008-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -30,8 +30,8 @@
 #include <map>
 #include <set>
 
-#include "MacroBison.hh"
 #include "MacroValue.hh"
+#include "MacroBison.hh"
 
 using namespace std;
 
diff --git a/preprocessor/macro/MacroFlex.ll b/preprocessor/macro/MacroFlex.ll
index 748b0d3730..1098522f9b 100644
--- a/preprocessor/macro/MacroFlex.ll
+++ b/preprocessor/macro/MacroFlex.ll
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Dynare Team
+ * Copyright (C) 2008-2009 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -23,7 +23,6 @@ using namespace std;
 #include <fstream>
 
 #include "MacroDriver.hh"
-#include "MacroBison.hh"
 
 // Announce to Flex the prototype we want for lexing function
 #define YY_DECL                                              \
-- 
GitLab