bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT


From: Akim Demaille
Subject: FYI: lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT
Date: Wed, 12 May 2010 10:33:35 +0200

Installed in master.  Will be installed in 2.5 too.


From 38435078b14ad063d7bc9e82a7db9bac366b2e65 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Tue, 11 May 2010 23:51:59 +0200
Subject: [PATCH 3/3] lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT.

        * data/lalr1.cc (YYLLOC_DEFAULT): Move its definition from the
        header file to the implementation file, after the user %code
        sections.
        * NEWS: Document it.
---
 ChangeLog     |    8 ++++++++
 data/lalr1.cc |   42 +++++++++++++++++++++---------------------
 2 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9cef074..071a754 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-05-11  Akim Demaille  <address@hidden>
 
+       lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT.
+       * data/lalr1.cc (YYLLOC_DEFAULT): Move its definition from the
+       header file to the implementation file, after the user %code
+       sections.
+       * NEWS (2.5): Document this.
+
+2010-05-11  Akim Demaille  <address@hidden>
+
        doc: please Emacs.
        * doc/bison.texinfo (Local Variables): Move this after the
        LocalWords, since the latter are looked for in the whole document,
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 8094ccc..646ee90 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -175,27 +175,6 @@ b4_namespace_close])[
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
-]b4_locations_if([dnl
-[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
-#ifndef YYLLOC_DEFAULT
-# 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;        \
-     }                                                                 \
- while (false)
-#endif]])[
-
 ]b4_namespace_open[
 
   /// A Bison parser.
@@ -407,6 +386,27 @@ b4_percent_code_get[]dnl
 # endif
 #endif
 
+]b4_locations_if([dnl
+[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
+#ifndef YYLLOC_DEFAULT
+# 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;        \
+     }                                                                 \
+ while (false)
+#endif]])[
+
 /* Suppress unused-variable warnings by "using" E.  */
 #define YYUSE(e) ((void) (e))
 
-- 
1.7.0.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]