/[bison]/bison/data/yacc.c
ViewVC logotype

Diff of /bison/data/yacc.c

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

revision 1.33 by akim, Tue Nov 12 09:03:12 2002 UTC revision 1.34 by akim, Wed Nov 13 09:49:49 2002 UTC
# Line 138  m4_changecom() Line 138  m4_changecom()
138  m4_divert(0)dnl  m4_divert(0)dnl
139  @output @output_parser_name@  @output @output_parser_name@
140  b4_copyright([Skeleton parser for Yacc-like parsing with Bison],  b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
141               [1984, 1989, 1990, 2000, 2001, 2002])               [1984, 1989, 1990, 2000, 2001, 2002])[
142    
143  /* As a special exception, when this file is copied by Bison into a  /* As a special exception, when this file is copied by Bison into a
144     Bison output file, you may use that output file without restriction.     Bison output file, you may use that output file without restriction.
# Line 155  b4_copyright([Skeleton parser for Yacc-l Line 155  b4_copyright([Skeleton parser for Yacc-l
155     define necessary library symbols; they are noted "INFRINGES ON     define necessary library symbols; they are noted "INFRINGES ON
156     USER NAME SPACE" below.  */     USER NAME SPACE" below.  */
157    
158  b4_identification  ]b4_identification
159  m4_if(b4_prefix[], [yy], [],  m4_if(b4_prefix[], [yy], [],
160  [/* If NAME_PREFIX is specified substitute the variables and functions  [/* If NAME_PREFIX is specified substitute the variables and functions
161     names.  */     names.  */
# Line 166  m4_if(b4_prefix[], [yy], [], Line 166  m4_if(b4_prefix[], [yy], [],
166  #define yychar  b4_prefix[]char  #define yychar  b4_prefix[]char
167  #define yydebug b4_prefix[]debug  #define yydebug b4_prefix[]debug
168  #define yynerrs b4_prefix[]nerrs  #define yynerrs b4_prefix[]nerrs
169  b4_location_if([#define yylloc b4_prefix[]lloc])])  b4_location_if([#define yylloc b4_prefix[]lloc])])[
170    
171  b4_token_defines(b4_tokens)  ]b4_token_defines(b4_tokens)[
172    
173  /* Copy the first part of user declarations.  */  /* Copy the first part of user declarations.  */
174  b4_pre_prologue  ]b4_pre_prologue[
175    
176  /* Enabling traces.  */  /* Enabling traces.  */
177  #ifndef YYDEBUG  #ifndef YYDEBUG
178  # define YYDEBUG b4_debug  # define YYDEBUG ]b4_debug[
179  #endif  #endif
180    
181  /* Enabling verbose error messages.  */  /* Enabling verbose error messages.  */
# Line 183  b4_pre_prologue Line 183  b4_pre_prologue
183  # undef YYERROR_VERBOSE  # undef YYERROR_VERBOSE
184  # define YYERROR_VERBOSE 1  # define YYERROR_VERBOSE 1
185  #else  #else
186  # define YYERROR_VERBOSE b4_error_verbose  # define YYERROR_VERBOSE ]b4_error_verbose[
187  #endif  #endif
188    
189  #ifndef YYSTYPE  #ifndef YYSTYPE
190  m4_ifdef([b4_stype],  ]m4_ifdef([b4_stype],
191  [b4_syncline([b4_stype_line], [b4_filename])  [b4_syncline([b4_stype_line], [b4_filename])
192  typedef union b4_stype yystype;  typedef union b4_stype yystype;
193  /* Line __line__ of __file__.  */  /* Line __line__ of __file__.  */
194  b4_syncline([@oline@], [@ofile@])],  b4_syncline([@oline@], [@ofile@])],
195  [typedef int yystype;])  [typedef int yystype;])[
196  # define YYSTYPE yystype  # define YYSTYPE yystype
197  # define YYSTYPE_IS_TRIVIAL 1  # define YYSTYPE_IS_TRIVIAL 1
198  #endif  #endif
# Line 205  typedef struct yyltype Line 205  typedef struct yyltype
205    int last_line;    int last_line;
206    int last_column;    int last_column;
207  } yyltype;  } yyltype;
208  # define YYLTYPE b4_location_type  # define YYLTYPE ]b4_location_type[
209  # define YYLTYPE_IS_TRIVIAL 1  # define YYLTYPE_IS_TRIVIAL 1
210  #endif  #endif
211    
212  /* Copy the second part of user declarations.  */  /* Copy the second part of user declarations.  */
213  b4_post_prologue  ]b4_post_prologue[
214    
215  /* Line __line__ of __file__.  */  /* Line __line__ of __file__.  */
216  b4_syncline([@oline@], [@ofile@])  ]b4_syncline([@oline@], [@ofile@])[
217    
218  #if ! defined (yyoverflow) || YYERROR_VERBOSE  #if ! defined (yyoverflow) || YYERROR_VERBOSE
219    
# Line 256  union yyalloc Line 256  union yyalloc
256  {  {
257    short yyss;    short yyss;
258    YYSTYPE yyvs;    YYSTYPE yyvs;
259    b4_location_if([  YYLTYPE yyls;    ]b4_location_if([  YYLTYPE yyls;
260  ])dnl  ])dnl
261  };  [};
262    
263  /* The size of the maximum gap between one aligned stack and the next.  */  /* The size of the maximum gap between one aligned stack and the next.  */
264  # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)  # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
265    
266  /* The size of an array large to enough to hold all stacks, each with  /* The size of an array large to enough to hold all stacks, each with
267     N elements.  */     N elements.  */
268  b4_location_if(  ]b4_location_if(
269  [# define YYSTACK_BYTES(N) \  [# define YYSTACK_BYTES(N) \
270       ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))      \       ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))      \
271        + 2 * YYSTACK_GAP_MAX)],        + 2 * YYSTACK_GAP_MAX)],
272  [# define YYSTACK_BYTES(N) \  [# define YYSTACK_BYTES(N) \
273       ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \       ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
274        + YYSTACK_GAP_MAX)])        + YYSTACK_GAP_MAX)])[
275    
276  /* Copy COUNT objects from FROM to TO.  The source and destination do  /* Copy COUNT objects from FROM to TO.  The source and destination do
277     not overlap.  */     not overlap.  */
# Line 285  b4_location_if( Line 285  b4_location_if(
285          {                                       \          {                                       \
286            register YYSIZE_T yyi;                \            register YYSIZE_T yyi;                \
287            for (yyi = 0; yyi < (Count); yyi++)   \            for (yyi = 0; yyi < (Count); yyi++)   \
288              (To)[[yyi]] = (From)[[yyi]];        \              (To)[yyi] = (From)[yyi];            \
289          }                                       \          }                                       \
290        while (0)        while (0)
291  #  endif  #  endif
# Line 316  b4_location_if( Line 316  b4_location_if(
316  #endif  #endif
317    
318  /* YYFINAL -- State number of the termination state. */  /* YYFINAL -- State number of the termination state. */
319  #define YYFINAL  b4_final_state_number  #define YYFINAL  ]b4_final_state_number[
320  /* YYLAST -- Last index in YYTABLE.  */  /* YYLAST -- Last index in YYTABLE.  */
321  #define YYLAST   b4_last  #define YYLAST   ]b4_last[
322    
323  /* YYNTOKENS -- Number of terminals. */  /* YYNTOKENS -- Number of terminals. */
324  #define YYNTOKENS  b4_tokens_number  #define YYNTOKENS  ]b4_tokens_number[
325  /* YYNNTS -- Number of nonterminals. */  /* YYNNTS -- Number of nonterminals. */
326  #define YYNNTS  b4_nterms_number  #define YYNNTS  ]b4_nterms_number[
327  /* YYNRULES -- Number of rules. */  /* YYNRULES -- Number of rules. */
328  #define YYNRULES  b4_rules_number  #define YYNRULES  ]b4_rules_number[
329  /* YYNRULES -- Number of states. */  /* YYNRULES -- Number of states. */
330  #define YYNSTATES  b4_states_number  #define YYNSTATES  ]b4_states_number[
331    
332  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
333  #define YYUNDEFTOK  b4_undef_token_number  #define YYUNDEFTOK  ]b4_undef_token_number[
334  #define YYMAXUTOK   b4_user_token_number_max[  #define YYMAXUTOK   ]b4_user_token_number_max[
335    
336  #define YYTRANSLATE(YYX)                                                \  #define YYTRANSLATE(YYX)                                                \
337    ((YYX <= 0) ? YYEOF :                                                 \    ((YYX <= 0) ? YYEOF :                                                 \
# Line 441  static const b4_int_type_for([b4_check]) Line 441  static const b4_int_type_for([b4_check])
441     symbol of state STATE-NUM.  */     symbol of state STATE-NUM.  */
442  static const b4_int_type_for([b4_stos]) yystos[[]] =  static const b4_int_type_for([b4_stos]) yystos[[]] =
443  {  {
444    b4_stos    b4_stos[
445  };  };
446    
447  #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)  #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# Line 489  do                                                             \ Line 489  do                                                             \
489      }                                                           \      }                                                           \
490    else                                                          \    else                                                          \
491      {                                                           \      {                                                           \
492        yyerror (b4_yyerror_args"syntax error: cannot back up");  \        yyerror (]b4_yyerror_args["syntax error: cannot back up");\
493        YYERROR;                                                  \        YYERROR;                                                  \
494      }                                                           \      }                                                           \
495  while (0)  while (0)
# Line 501  while (0) Line 501  while (0)
501     are run).  */     are run).  */
502    
503  #ifndef YYLLOC_DEFAULT  #ifndef YYLLOC_DEFAULT
504  # define YYLLOC_DEFAULT(Current, Rhs, N)           \  # define YYLLOC_DEFAULT(Current, Rhs, N)         \
505    Current.first_line   = Rhs[[1]].first_line;      \    Current.first_line   = Rhs[1].first_line;      \
506    Current.first_column = Rhs[[1]].first_column;    \    Current.first_column = Rhs[1].first_column;    \
507    Current.last_line    = Rhs[[N]].last_line;       \    Current.last_line    = Rhs[N].last_line;       \
508    Current.last_column  = Rhs[[N]].last_column;    Current.last_column  = Rhs[N].last_column;
509  #endif  #endif
510    
511  /* YYLEX -- calling `yylex' with the right arguments.  */  /* YYLEX -- calling `yylex' with the right arguments.  */
512    
513  #ifdef YYLEX_PARAM  #ifdef YYLEX_PARAM
514  # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)  # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
515  #else  #else
516  # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)  # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
517  #endif  #endif
518    
519  /* Enable debugging if requested.  */  /* Enable debugging if requested.  */
# Line 534  do {                                           \ Line 534  do {                                           \
534    if (yydebug)                                  \    if (yydebug)                                  \
535      yysymprint Args;                            \      yysymprint Args;                            \
536  } while (0)  } while (0)
537    # define YYDSYMPRINTF(Title, Token, Value, Location)            \
538    do {                                                            \
539      if (yydebug)                                                  \
540        {                                                           \
541          YYFPRINTF (stderr, "%s ", Title);                         \
542          yysymprint (stderr,                                       \
543                      Token, Value]b4_location_if([, Location])[);  \
544          YYFPRINTF (stderr, "\n");                                 \
545        }                                                           \
546    } while (0)
547    
548  /* Nonzero means print parse trace.  It is left uninitialized so that  /* Nonzero means print parse trace.  It is left uninitialized so that
549     multiple parsers can coexist.  */     multiple parsers can coexist.  */
550  int yydebug;  int yydebug;
551  #else /* !YYDEBUG */  #else /* !YYDEBUG */
552  # define YYDPRINTF(Args)  # define YYDPRINTF(Args)
553  # define YYDSYMPRINT(Args)  # define YYDSYMPRINT(Args)
554    # define YYDSYMPRINTF(Title, Token, Value, Location)
555  #endif /* !YYDEBUG */  #endif /* !YYDEBUG */
556    
557  /* YYINITDEPTH -- initial size of the parser's stacks.  */  /* YYINITDEPTH -- initial size of the parser's stacks.  */
558  #ifndef YYINITDEPTH  #ifndef YYINITDEPTH
559  # define YYINITDEPTH b4_stack_depth_init  # define YYINITDEPTH ]b4_stack_depth_init[
560  #endif  #endif
561    
562  /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only  /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
# Line 559  int yydebug; Line 571  int yydebug;
571  #endif  #endif
572    
573  #ifndef YYMAXDEPTH  #ifndef YYMAXDEPTH
574  # define YYMAXDEPTH b4_stack_depth_max  # define YYMAXDEPTH ]b4_stack_depth_max[
575  #endif  #endif
576    
577    
# Line 620  yystpcpy (yydest, yysrc) Line 632  yystpcpy (yydest, yysrc)
632    
633    
634  #if YYDEBUG  #if YYDEBUG
635  b4_yysymprint_generate([b4_c_function_def])  ]b4_yysymprint_generate([b4_c_function_def])[
636  #endif /* YYDEBUG. */  #endif /* YYDEBUG. */
637  b4_yydestruct_generate([b4_c_function_def])  ]b4_yydestruct_generate([b4_c_function_def])
638    
639    
640  /* Prevent warnings from -Wmissing-prototypes.  */  /* Prevent warnings from -Wmissing-prototypes.  */
# Line 853  yybackup: Line 865  yybackup:
865      {      {
866        /* We have to keep this `#if YYDEBUG', since we use variables        /* We have to keep this `#if YYDEBUG', since we use variables
867           which are defined only if `YYDEBUG' is set.  */           which are defined only if `YYDEBUG' is set.  */
868        YYDPRINTF ((stderr, "Next token is "));        YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
       YYDSYMPRINT ((stderr, yytoken, &yylval]b4_location_if([, &yyloc])[));  
       YYDPRINTF ((stderr, "\n"));  
869      }      }
870    
871    /* If the proper action on seeing token YYTOKEN is to reduce or to    /* If the proper action on seeing token YYTOKEN is to reduce or to
# Line 876  yybackup: Line 886  yybackup:
886      YYACCEPT;      YYACCEPT;
887    
888    /* Shift the lookahead token.  */    /* Shift the lookahead token.  */
889    YYDPRINTF ((stderr, "Shifting token %d (%s), ",    YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
               yytoken, yytname[yytoken]));  
890    
891    /* Discard the token being shifted unless it is eof.  */    /* Discard the token being shifted unless it is eof.  */
892    if (yytoken != YYEOF)    if (yytoken != YYEOF)
# Line 933  yyreduce: Line 942  yyreduce:
942      {      {
943        int yyi;        int yyi;
944    
945        YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",        YYFPRINTF (stderr, "Reducing by rule %d (line %d), ",
946                   yyn - 1, yyrline[yyn]);                   yyn - 1, yyrline[yyn]);
947    
948        /* Print the symbols being reduced, and their result.  */        /* Print the symbols being reduced, and their result.  */
949        for (yyi = yyprhs[yyn]; 0 <= yyrhs[yyi]; yyi++)        for (yyi = yyprhs[yyn]; 0 <= yyrhs[yyi]; yyi++)
950          YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);          YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
951        YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);        YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyn]]);
952      }      }
953  #endif  #endif
954    switch (yyn)    switch (yyn)
# Line 1060  yyerrlab1: Line 1069  yyerrlab1:
1069            /* Pop the rest of the stack.  */            /* Pop the rest of the stack.  */
1070            while (yyss < yyssp)            while (yyss < yyssp)
1071              {              {
1072                YYDPRINTF ((stderr, "Error: popping "));                YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
               YYDSYMPRINT ((stderr,  
                             yystos[*yyssp],  
                             yyvsp]b4_location_if([, yylsp])[));  
               YYDPRINTF ((stderr, "\n"));  
1073                yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);                yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
1074                YYPOPSTACK;                YYPOPSTACK;
1075              }              }
1076            YYABORT;            YYABORT;
1077          }          }
1078    
1079        YYDPRINTF ((stderr, "Discarding token %d (%s).\n",        YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
                   yytoken, yytname[yytoken]));  
1080        yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);        yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);
1081        yytoken = YYEMPTY;        yytoken = YYEMPTY;
1082      }      }
# Line 1100  yyerrlab1: Line 1104  yyerrlab1:
1104        if (yyssp == yyss)        if (yyssp == yyss)
1105          YYABORT;          YYABORT;
1106    
1107        YYDPRINTF ((stderr, "Error: popping "));        YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
       YYDSYMPRINT ((stderr,  
                     yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[));  
       YYDPRINTF ((stderr, "\n"));  
   
1108        yydestruct (yystos[yystate], yyvsp]b4_location_if([, yylsp])[);        yydestruct (yystos[yystate], yyvsp]b4_location_if([, yylsp])[);
1109        yyvsp--;        yyvsp--;
1110        yystate = *--yyssp;        yystate = *--yyssp;

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

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