X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/fc7ddd2818456815e4860aab1a4e73348fd5771f..e89a22bfab22e4d2ee73be49dcb66b51f8d0e892:/src/bison.simple diff --git a/src/bison.simple b/src/bison.simple index 5259a28c..72cd1487 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -1,7 +1,9 @@ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line /* Skeleton output parser for bison, - Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc. + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,35 +34,29 @@ infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to - define necessary C library symbols; they are noted "INFRINGES ON + define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +#ifdef __cplusplus +# define YYSTD(x) std::x +#else +# define YYSTD(x) x +#endif + #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca -# define YYSIZE_T size_t # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca -# define YYSIZE_T size_t # else -# if defined (__GNUC__) || defined (_AIX) || defined (__hpux) +# ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif -# ifndef __GNUC__ -# ifdef _AIX - # pragma alloca -# endif -# if defined (__sgi) || defined (__sparc__) || defined (__sparc) || defined (__sun) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSTACK_ALLOC alloca -# define YYSIZE_T size_t -# endif -# endif # endif # endif # endif @@ -69,21 +65,26 @@ /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE(Ptr) free (Ptr) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifdef __cplusplus +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T std::size_t +# else +# ifdef __STDC__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif # endif +# define YYSTACK_ALLOC YYSTD (malloc) +# define YYSTACK_FREE YYSTD (free) # endif /* A type that is properly aligned for any stack member. */ union yyalloc { - short yys; - YYSTYPE yyv; + short yyss; + YYSTYPE yyvs; # if YYLSP_NEEDED - YYLTYPE yyl; + YYLTYPE yyls; # endif }; @@ -111,12 +112,11 @@ union yyalloc do \ { \ YYSIZE_T yynewbytes; \ - yymemcpy (yyptr, (char *) (Stack), \ + yymemcpy ((char *) yyptr, (char *) (Stack), \ yysize * (YYSIZE_T) sizeof (Type)); \ - (Stack) = (Type *) yyptr; \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \ - yynewbytes -= yynewbytes % sizeof (union yyalloc); \ - yyptr += yynewbytes; \ + yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) @@ -129,9 +129,16 @@ union yyalloc #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +#if ! defined (YYSIZE_T) +# ifdef __cplusplus +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T std::size_t +# else +# ifdef __STDC__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int @@ -207,11 +214,20 @@ while (0) /* Enable debugging if requested. */ #if YYDEBUG -# include + +# ifndef YYFPRINTF +# ifdef __cplusplus +# include /* INFRINGES ON USER NAME SPACE */ +# else +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYFPRINTF YYSTD (fprintf) +# endif + # define YYDPRINTF(Args) \ do { \ if (yydebug) \ - fprintf Args; \ + YYFPRINTF Args; \ } while (0) /* Nonzero means print parse trace. [The following comment makes no sense to me. Could someone clarify it? --akim] Since this is @@ -301,12 +317,12 @@ yystrlen (yystr) /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * -# ifndef __cplusplus +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; -# else -yystpcpy (char *yydest, const char *yysrc) # endif { register char *yyd = yydest; @@ -519,7 +535,8 @@ yyparse (YYPARSE_PARAM_ARG) { short *yyss1 = yyss; - char *yyptr = (char *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (short, yyss); @@ -595,13 +612,14 @@ yybackup: which are defined only if `YYDEBUG' is set. */ if (yydebug) { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT YYPRINT (stderr, yychar, yylval); # endif - fprintf (stderr, ")\n"); + YYFPRINTF (stderr, ")\n"); } #endif } @@ -633,7 +651,8 @@ yybackup: YYACCEPT; /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -694,13 +713,13 @@ yyreduce: { int yyi; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - fprintf (stderr, "%s ", yytname[yyrhs[yyi]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif %% actions /* The action file replaces this line. */ @@ -716,10 +735,10 @@ yyreduce: if (yydebug) { short *yyssp1 = yyss - 1; - fprintf (stderr, "state stack now"); + YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) - fprintf (stderr, " %d", *++yyssp1); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif @@ -797,7 +816,7 @@ yyerrlab: yyerror ("parse error; also virtual memory exhausted"); } else -#endif /* YYERROR_VERBOSE */ +#endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; @@ -861,10 +880,10 @@ yyerrpop: if (yydebug) { short *yyssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); + YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) - fprintf (stderr, " %d", *++yyssp1); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif