]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
2005-07-12 Akim Demaille <akim@epita.fr>
[bison.git] / data / yacc.c
index e7a7537c7e31ebf63c4213cd7a7bfedc64e7521c..945d09604705febb699d0c8d77ff669117f9a140 100644 (file)
@@ -135,7 +135,7 @@ m4_changecom()
 m4_divert(0)dnl
 @output @output_parser_name@
 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
-             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[
+             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
@@ -214,14 +214,21 @@ typedef struct YYLTYPE
 /* Line __line__ of yacc.c.  */
 b4_syncline([@oline@], [@ofile@])[
 
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
 
-# ifndef YYFREE
-#  define YYFREE free
-# endif
-# ifndef YYMALLOC
-#  define YYMALLOC malloc
-# endif
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
@@ -231,6 +238,10 @@ b4_syncline([@oline@], [@ofile@])[
 #    define YYSTACK_ALLOC __builtin_alloca
 #   else
 #    define YYSTACK_ALLOC alloca
+#    if defined (__STDC__) || defined (__cplusplus)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#     define YYINCLUDED_STDLIB_H
+#    endif
 #   endif
 #  endif
 # endif
@@ -246,17 +257,31 @@ b4_syncline([@oline@], [@ofile@])[
 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
 #  endif
 # else
-#  if defined (__STDC__) || defined (__cplusplus)
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   define YYSIZE_T size_t
-#  else
-#   define YYSIZE_T unsigned long int
-#  endif
 #  define YYSTACK_ALLOC YYMALLOC
 #  define YYSTACK_FREE YYFREE
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
 #  endif
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
+       && (defined (__STDC__) || defined (__cplusplus)))
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
+       && (defined (__STDC__) || defined (__cplusplus)))
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifdef __cplusplus
+}
+#  endif
 # endif
 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
@@ -463,22 +488,6 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
   ]b4_stos[
 };
 
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
 #define yyerrok                (yyerrstatus = 0)
 #define yyclearin      (yychar = YYEMPTY)
 #define YYEMPTY                (-2)
@@ -850,18 +859,19 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
 #endif
 ]])
 m4_ifdef([b4_initial_action], [
-m4_pushdef([b4_at_dollar],     [yylloc])dnl
-m4_pushdef([b4_dollar_dollar], [yylval])dnl
+m4_pushdef([b4_at_dollar],     [m4_define([b4_at_dollar_used])yylloc])dnl
+m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
   /* User initialization code. */
 b4_initial_action
 m4_popdef([b4_dollar_dollar])dnl
 m4_popdef([b4_at_dollar])dnl
 /* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])])dnl
-[
-  yyvsp[0] = yylval;
-]b4_location_if([[    yylsp[0] = yylloc;
-]])
+b4_syncline([@oline@], [@ofile@])
+])dnl
+m4_ifdef([b4_dollar_dollar_used],[[  yyvsp[0] = yylval;
+]])dnl
+m4_ifdef([b4_at_dollar_used], [[  yylsp[0] = yylloc;
+]])dnl
 [  goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -1154,7 +1164,7 @@ yyerrlab:
              }
 
          yyf = _(yyformat);
-         yysize1 = yysize + strlen (yyf);
+         yysize1 = yysize + yystrlen (yyf);
          yysize_overflow |= yysize1 < yysize;
          yysize = yysize1;
 
@@ -1296,9 +1306,6 @@ yyacceptlab:
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
 yyabortlab:
-  yydestruct (_("Error: discarding lookahead"),
-              yytoken, &yylval]b4_location_if([, &yylloc])[);
-  yychar = YYEMPTY;
   yyresult = 1;
   goto yyreturn;
 
@@ -1308,13 +1315,14 @@ yyabortlab:
 `----------------------------------------------*/
 yyoverflowlab:
   yyerror (]b4_yyerror_args[_("parser stack overflow"));
-  yydestruct (_("Error: discarding lookahead"),
-             yytoken, &yylval]b4_location_if([, &yylloc])[);
   yyresult = 2;
   /* Fall through.  */
 #endif
 
 yyreturn:
+  if (yychar != YYEOF && yychar != YYEMPTY)
+     yydestruct (_("Error: discarding lookahead"),
+                yytoken, &yylval]b4_location_if([, &yylloc])[);
   if (yyssp != yyss)
     for (;;)
       {
@@ -1337,7 +1345,7 @@ b4_epilogue
 m4_if(b4_defines_flag, 0, [],
 [@output @output_header_name@
 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
-             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])
+             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.