/[bison]/bison/src/bison.simple
ViewVC logotype

Diff of /bison/src/bison.simple

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.87 by marc, Tue Dec 11 20:10:22 2001 UTC revision 1.88 by eggert, Fri Dec 14 01:52:50 2001 UTC
# Line 82  typedef struct yyltype Line 82  typedef struct yyltype
82    
83  #include <stdio.h>  #include <stdio.h>
84    
 #ifndef __cplusplus  
 # ifndef __STDC__  
 #  define const  
 # endif  
 #endif  
   
85  /* All symbols defined below should begin with yy or YY, to avoid  /* All symbols defined below should begin with yy or YY, to avoid
86     infringing on user name space.  This should be done even for local     infringing on user name space.  This should be done even for local
87     variables, as they might otherwise be expanded by user macros.     variables, as they might otherwise be expanded by user macros.
88     There are some unavoidable exceptions within include files to     There are some unavoidable exceptions within include files to
89     define necessary C library symbols; they are noted "INFRINGES ON     define necessary library symbols; they are noted "INFRINGES ON
90     USER NAME SPACE" below.  */     USER NAME SPACE" below.  */
91    
92  #if ! defined (yyoverflow) || YYERROR_VERBOSE  #if ! defined (yyoverflow) || YYERROR_VERBOSE
# Line 129  typedef struct yyltype Line 123  typedef struct yyltype
123     /* Pacify GCC's `empty if-body' warning. */     /* Pacify GCC's `empty if-body' warning. */
124  #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)  #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
125  # else  # else
126  #  define YYSTACK_ALLOC malloc  #  ifdef __cplusplus
127  #  define YYSTACK_FREE(Ptr) free (Ptr)  #   include <cstdlib> /* INFRINGES ON USER NAME SPACE */
128  #  if defined (__STDC__) || defined (__cplusplus)  #   define YYSIZE_T std::size_t
129  #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */  #   define YYSTACK_ALLOC std::malloc
130  #   define YYSIZE_T size_t  #   define YYSTACK_FREE std::free
131    #  else
132    #   ifdef __STDC__
133    #    include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
134    #    define YYSIZE_T size_t
135    #   endif
136    #   define YYSTACK_ALLOC malloc
137    #   define YYSTACK_FREE free
138  #  endif  #  endif
139  # endif  # endif
140    
# Line 288  static const short yycheck[] = Line 289  static const short yycheck[] =
289  #if ! defined (YYSIZE_T) && defined (size_t)  #if ! defined (YYSIZE_T) && defined (size_t)
290  # define YYSIZE_T size_t  # define YYSIZE_T size_t
291  #endif  #endif
292  #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))  #if ! defined (YYSIZE_T)
293  # include <stddef.h> /* INFRINGES ON USER NAME SPACE */  # ifdef __cplusplus
294  # define YYSIZE_T size_t  #  include <cstddef> /* INFRINGES ON USER NAME SPACE */
295    #  define YYSIZE_T std::size_t
296    # else
297    #  ifdef __STDC__
298    #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
299    #   define YYSIZE_T size_t
300    #  endif
301    # endif
302  #endif  #endif
303  #if ! defined (YYSIZE_T)  #if ! defined (YYSIZE_T)
304  # define YYSIZE_T unsigned int  # define YYSIZE_T unsigned int
# Line 368  while (0) Line 376  while (0)
376    
377  /* Enable debugging if requested.  */  /* Enable debugging if requested.  */
378  #if YYDEBUG  #if YYDEBUG
379  # include <stdio.h>  
380    # ifndef YYFPRINTF
381    #  ifdef __cplusplus
382    #   include <cstdio.h> /* INFRINGES ON USER NAME SPACE */
383    #   define YYFPRINTF std::fprintf
384    #   define YYSTDERR std::stderr
385    #  else
386    #   include <stdio.h> /* INFRINGES ON USER NAME SPACE */
387    #   define YYFPRINTF fprintf
388    #   define YYSTDERR stderr
389    #  endif
390    # endif
391    
392  # define YYDPRINTF(Args)                        \  # define YYDPRINTF(Args)                        \
393  do {                                            \  do {                                            \
394    if (yydebug)                                  \    if (yydebug)                                  \
395      fprintf Args;                               \      YYFPRINTF Args;                             \
396  } while (0)  } while (0)
397  /* Nonzero means print parse trace. [The following comment makes no  /* Nonzero means print parse trace. [The following comment makes no
398     sense to me.  Could someone clarify it?  --akim] Since this is     sense to me.  Could someone clarify it?  --akim] Since this is
# Line 608  yyparse (YYPARSE_PARAM_ARG) Line 628  yyparse (YYPARSE_PARAM_ARG)
628       rule.  */       rule.  */
629    int yylen;    int yylen;
630    
631    YYDPRINTF ((stderr, "Starting parse\n"));    YYDPRINTF ((YYSTDERR, "Starting parse\n"));
632    
633    yystate = 0;    yystate = 0;
634    yyerrstatus = 0;    yyerrstatus = 0;
# Line 704  yyparse (YYPARSE_PARAM_ARG) Line 724  yyparse (YYPARSE_PARAM_ARG)
724        yylsp = yyls + yysize - 1;        yylsp = yyls + yysize - 1;
725  #endif  #endif
726    
727        YYDPRINTF ((stderr, "Stack size increased to %lu\n",        YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
728                    (unsigned long int) yystacksize));                    (unsigned long int) yystacksize));
729    
730        if (yyssp >= yyss + yystacksize - 1)        if (yyssp >= yyss + yystacksize - 1)
731          YYABORT;          YYABORT;
732      }      }
733    
734    YYDPRINTF ((stderr, "Entering state %d\n", yystate));    YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
735    
736    goto yybackup;    goto yybackup;
737    
# Line 737  yybackup: Line 757  yybackup:
757    
758    if (yychar == YYEMPTY)    if (yychar == YYEMPTY)
759      {      {
760        YYDPRINTF ((stderr, "Reading a token: "));        YYDPRINTF ((YYSTDERR, "Reading a token: "));
761        yychar = YYLEX;        yychar = YYLEX;
762      }      }
763    
# Line 748  yybackup: Line 768  yybackup:
768        yychar1 = 0;        yychar1 = 0;
769        yychar = YYEOF;           /* Don't call YYLEX any more.  */        yychar = YYEOF;           /* Don't call YYLEX any more.  */
770    
771        YYDPRINTF ((stderr, "Now at end of input.\n"));        YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
772      }      }
773    else    else
774      {      {
# Line 759  yybackup: Line 779  yybackup:
779          which are defined only if `YYDEBUG' is set.  */          which are defined only if `YYDEBUG' is set.  */
780        if (yydebug)        if (yydebug)
781          {          {
782            fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);            YYFPRINTF (YYSTDERR, "Next token is %d (%s",
783                         yychar, yytname[yychar1]);
784            /* Give the individual parser a way to print the precise            /* Give the individual parser a way to print the precise
785               meaning of a token, for further debugging info.  */               meaning of a token, for further debugging info.  */
786  # ifdef YYPRINT  # ifdef YYPRINT
787            YYPRINT (stderr, yychar, yylval);            YYPRINT (YYSTDERR, yychar, yylval);
788  # endif  # endif
789            fprintf (stderr, ")\n");            YYFPRINTF (YYSTDERR, ")\n");
790          }          }
791  #endif  #endif
792      }      }
# Line 797  yybackup: Line 818  yybackup:
818      YYACCEPT;      YYACCEPT;
819    
820    /* Shift the lookahead token.  */    /* Shift the lookahead token.  */
821    YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]));    YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
822                  yychar, yytname[yychar1]));
823    
824    /* Discard the token being shifted unless it is eof.  */    /* Discard the token being shifted unless it is eof.  */
825    if (yychar != YYEOF)    if (yychar != YYEOF)
# Line 858  yyreduce: Line 880  yyreduce:
880      {      {
881        int yyi;        int yyi;
882    
883        fprintf (stderr, "Reducing via rule %d (line %d), ",        YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
884                 yyn, yyrline[yyn]);                   yyn, yyrline[yyn]);
885    
886        /* Print the symbols being reduced, and their result.  */        /* Print the symbols being reduced, and their result.  */
887        for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)        for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
888          fprintf (stderr, "%s ", yytname[yyrhs[yyi]]);          YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
889        fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);        YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
890      }      }
891  #endif  #endif
892    switch (yyn)    switch (yyn)
# Line 883  yyreduce: Line 905  yyreduce:
905    if (yydebug)    if (yydebug)
906      {      {
907        short *yyssp1 = yyss - 1;        short *yyssp1 = yyss - 1;
908        fprintf (stderr, "state stack now");        YYFPRINTF (YYSTDERR, "state stack now");
909        while (yyssp1 != yyssp)        while (yyssp1 != yyssp)
910          fprintf (stderr, " %d", *++yyssp1);          YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
911        fprintf (stderr, "\n");        YYFPRINTF (YYSTDERR, "\n");
912      }      }
913  #endif  #endif
914    
# Line 964  yyerrlab: Line 986  yyerrlab:
986              yyerror ("parse error; also virtual memory exhausted");              yyerror ("parse error; also virtual memory exhausted");
987          }          }
988        else        else
989  #endif /* defined (YYERROR_VERBOSE) */  #endif /* YYERROR_VERBOSE */
990          yyerror ("parse error");          yyerror ("parse error");
991      }      }
992    goto yyerrlab1;    goto yyerrlab1;
# Line 982  yyerrlab1: Line 1004  yyerrlab1:
1004        /* Return failure if at end of input.  */        /* Return failure if at end of input.  */
1005        if (yychar == YYEOF)        if (yychar == YYEOF)
1006          YYABORT;          YYABORT;
1007        YYDPRINTF ((stderr, "Discarding token %d (%s).\n",        YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
1008                    yychar, yytname[yychar1]));                    yychar, yytname[yychar1]));
1009        yychar = YYEMPTY;        yychar = YYEMPTY;
1010      }      }
# Line 1028  yyerrpop: Line 1050  yyerrpop:
1050    if (yydebug)    if (yydebug)
1051      {      {
1052        short *yyssp1 = yyss - 1;        short *yyssp1 = yyss - 1;
1053        fprintf (stderr, "Error: state stack now");        YYFPRINTF (YYSTDERR, "Error: state stack now");
1054        while (yyssp1 != yyssp)        while (yyssp1 != yyssp)
1055          fprintf (stderr, " %d", *++yyssp1);          YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
1056        fprintf (stderr, "\n");        YYFPRINTF (YYSTDERR, "\n");
1057      }      }
1058  #endif  #endif
1059    
# Line 1061  yyerrhandle: Line 1083  yyerrhandle:
1083    if (yyn == YYFINAL)    if (yyn == YYFINAL)
1084      YYACCEPT;      YYACCEPT;
1085    
1086    YYDPRINTF ((stderr, "Shifting error token, "));    YYDPRINTF ((YYSTDERR, "Shifting error token, "));
1087    
1088    *++yyvsp = yylval;    *++yyvsp = yylval;
1089  #if YYLSP_NEEDED  #if YYLSP_NEEDED

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26