From 96e973a07fc979028f5e92bc4ccb5f2d9806a609 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Sat, 28 Dec 2013 20:44:30 +0100
Subject: [PATCH] Fix compatibility issue with Bison 3.

Closes #570
---
 preprocessor/DynareBison.yy      | 26 +++++++++++++-------------
 preprocessor/macro/MacroBison.yy |  2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 3e95184c9..4b63badbf 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -38,23 +38,23 @@ class ParsingDriver;
 /* Little hack: we redefine the macro which computes the locations, because
    we need to access the location from within the parsing driver for error
    and warning messages. */
-#define YYLLOC_DEFAULT(Current, Rhs, N)                 \
-  do {                                                  \
-    if (N)                                              \
-      {                                                 \
-        (Current).begin = (Rhs)[1].begin;               \
-        (Current).end   = (Rhs)[N].end;                 \
-      }                                                 \
-    else                                                \
-      {                                                 \
-        (Current).begin = (Current).end = (Rhs)[0].end;	\
-      }                                                 \
-    driver.location = (Current);                        \
+#define YYLLOC_DEFAULT(Current, Rhs, N)                         \
+  do {                                                          \
+    if (N)                                                      \
+      {                                                         \
+        (Current).begin = YYRHSLOC(Rhs, 1).begin;               \
+        (Current).end   = YYRHSLOC(Rhs, N).end;                 \
+      }                                                         \
+    else                                                        \
+      {                                                         \
+        (Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end;	\
+      }                                                         \
+    driver.location = (Current);                                \
   } while(false)
 
 %}
 
-%name-prefix="Dynare"
+%name-prefix "Dynare"
 
 %parse-param { ParsingDriver &driver }
 %lex-param { ParsingDriver &driver }
diff --git a/preprocessor/macro/MacroBison.yy b/preprocessor/macro/MacroBison.yy
index a7a6456e8..260bc77de 100644
--- a/preprocessor/macro/MacroBison.yy
+++ b/preprocessor/macro/MacroBison.yy
@@ -35,7 +35,7 @@ using namespace std;
 class MacroDriver;
 %}
 
-%name-prefix="Macro"
+%name-prefix "Macro"
 
 %parse-param { MacroDriver &driver }
 %parse-param { ostream &out }
-- 
GitLab