From b121f679bbea8ff8319d25a37d4bf7a976c59d7f Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Fri, 27 Feb 2009 14:29:08 +0000
Subject: [PATCH] trunk preprocessor: fix compatibility issues with Bison 2.4

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2442 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 DynareBison.yy           | 10 ++++++++--
 DynareFlex.ll            |  1 -
 include/ParsingDriver.hh |  4 ++++
 macro/MacroBison.yy      |  6 ++++++
 macro/MacroDriver.hh     |  2 +-
 macro/MacroFlex.ll       |  1 -
 6 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/DynareBison.yy b/DynareBison.yy
index be5e33a1..282dde82 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -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;
 
@@ -1287,8 +1293,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 filename { driver.option_str("datafile", $3); };
 o_nobs : NOBS EQUAL vec_int
          { driver.option_num("nobs", $3); }
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 8aea0759..df7c9bb0 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -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/include/ParsingDriver.hh b/include/ParsingDriver.hh
index a1d7f861..dcf2c2ed 100644
--- a/include/ParsingDriver.hh
+++ b/include/ParsingDriver.hh
@@ -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/macro/MacroBison.yy b/macro/MacroBison.yy
index 5d1c24f0..3774e34c 100644
--- a/macro/MacroBison.yy
+++ b/macro/MacroBison.yy
@@ -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/macro/MacroDriver.hh b/macro/MacroDriver.hh
index 6bc3bc0d..1a6ce998 100644
--- a/macro/MacroDriver.hh
+++ b/macro/MacroDriver.hh
@@ -30,8 +30,8 @@
 #include <map>
 #include <set>
 
-#include "MacroBison.hh"
 #include "MacroValue.hh"
+#include "MacroBison.hh"
 
 using namespace std;
 
diff --git a/macro/MacroFlex.ll b/macro/MacroFlex.ll
index 855d740e..1d1927cb 100644
--- a/macro/MacroFlex.ll
+++ b/macro/MacroFlex.ll
@@ -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