]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
Have lalr1.cc catch with Paul Eggert's patch to fix the infinite
[bison.git] / data / yacc.c
index 1af5ec0b09c211e74cbab4d5683bdf576afb75ed..92c0ddec42627308fd020cb5c8d37d7b6e777aa3 100644 (file)
@@ -216,6 +216,13 @@ b4_syncline([@oline@], [@ofile@])[
 
 #if ! defined (yyoverflow) || YYERROR_VERBOSE
 
+# ifndef YYFREE
+#  define YYFREE free
+# endif
+# ifndef YYMALLOC
+#  define YYMALLOC malloc
+# endif
+
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
 # ifdef YYSTACK_USE_ALLOCA
@@ -240,8 +247,8 @@ b4_syncline([@oline@], [@ofile@])[
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #   define YYSIZE_T size_t
 #  endif
-#  define YYSTACK_ALLOC malloc
-#  define YYSTACK_FREE free
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
 # endif
 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
@@ -501,11 +508,11 @@ while (0)
    are run).  */
 
 #ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)         \
-  Current.first_line   = Rhs[1].first_line;      \
-  Current.first_column = Rhs[1].first_column;    \
-  Current.last_line    = Rhs[N].last_line;       \
-  Current.last_column  = Rhs[N].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N)               \
+   ((Current).first_line   = (Rhs)[1].first_line,      \
+    (Current).first_column = (Rhs)[1].first_column,    \
+    (Current).last_line    = (Rhs)[N].last_line,       \
+    (Current).last_column  = (Rhs)[N].last_column)
 #endif
 
 /* YYLEX -- calling `yylex' with the right arguments.  */
@@ -983,7 +990,7 @@ yyreduce:
 
 ]b4_location_if(
 [  /* Default location. */
-  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);])[
+  YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);])[
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     ]{
@@ -1180,7 +1187,7 @@ yyerrlab1:
   YYDPRINTF ((stderr, "Shifting error token, "));
 
   *++yyvsp = yylval;
-]b4_location_if([  YYLLOC_DEFAULT (yyloc, yylsp, (yylerrsp - yylsp));
+]b4_location_if([  YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp);
   *++yylsp = yyloc;])[
 
   yystate = yyn;