]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
c++: use YYRHSLOC.
[bison.git] / data / lalr1.cc
index 4009b7c87fae84454831617d18e80d0ef1c0e2c2..b400b310306db385f840b6fe14f000d59304c375 100644 (file)
@@ -73,19 +73,20 @@ dnl FIXME: This is wrong, we want computed header guards.
    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])
 #ifndef YYLLOC_DEFAULT
-# 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;  \
-    }                                                  \
-} while (false)
+# 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[