X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/c5b95ccf6b5d646850709952e02466053a3ccbca..1ce590705a5ffe376fcffa3a166ae950f3385624:/data/yacc.c diff --git a/data/yacc.c b/data/yacc.c index 7331b65c..49697138 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -1,7 +1,8 @@ m4_divert(-1) -*- C -*- # Yacc compatible skeleton for Bison -# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 + +# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -93,7 +94,7 @@ m4_define([b4_int_type], # -------------------- # Expansion of $$. m4_define([b4_lhs_value], -[yyval[]m4_ifval([$1], [.$1])]) +[(yyval[]m4_ifval([$1], [.$1]))]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) @@ -101,7 +102,7 @@ m4_define([b4_lhs_value], # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], -[yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3])]) +[(yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3]))]) @@ -113,7 +114,7 @@ m4_define([b4_rhs_value], # ----------------- # Expansion of @$. m4_define([b4_lhs_location], -[yyloc]) +[(yyloc)]) # b4_rhs_location(RULE-LENGTH, NUM) @@ -121,7 +122,7 @@ m4_define([b4_lhs_location], # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], -[yylsp@{m4_eval([$2 - $1])@}]) +[(yylsp@{m4_eval([$2 - $1])@})]) @@ -226,14 +227,10 @@ b4_syncline([@oline@], [@ofile@])[ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca # endif # endif # endif @@ -289,7 +286,7 @@ union yyalloc # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -378,6 +375,11 @@ static const char *const yytname[] = }; #endif +/* INFRINGES ON USER NAME SPACE */ +#ifndef _ +# define _(msgid) msgid +#endif + # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ @@ -495,7 +497,7 @@ do \ } \ else \ { \ - yyerror (]b4_yyerror_args["syntax error: cannot back up");\ + yyerror (]b4_yyerror_args[_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) @@ -515,17 +517,17 @@ while (0) do \ if (N) \ { \ - (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ - YYRHSLOC(Rhs, 0).last_line; \ + YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ - YYRHSLOC(Rhs, 0).last_column; \ + YYRHSLOC (Rhs, 0).last_column; \ } \ while (0) #endif @@ -589,7 +591,7 @@ do { \ [[short int *bottom], [bottom]], [[short int *top], [top]])[ { - YYFPRINTF (stderr, "Stack now"); + YYFPRINTF (stderr, _("Stack now")); for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); @@ -611,7 +613,7 @@ do { \ { int yyi; unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + YYFPRINTF (stderr, _("Reducing stack by rule %d (line %u), "), yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) @@ -648,10 +650,6 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH ]b4_stack_depth_max[ #endif @@ -673,7 +671,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -698,8 +696,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -771,8 +769,8 @@ b4_c_function_def([yyparse], [int], b4_parse_param) #endif {[ ]b4_pure_if([b4_declare_parser_variables])[ - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -790,12 +788,12 @@ b4_c_function_def([yyparse], [int], b4_parse_param) /* The state stack. */ short int yyssa[YYINITDEPTH]; short int *yyss = yyssa; - register short int *yyssp; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; ]b4_location_if( [[ /* The location stack. */ @@ -843,7 +841,7 @@ m4_ifdef([b4_initial_action], [ m4_pushdef([b4_at_dollar], [yylloc])dnl m4_pushdef([b4_dollar_dollar], [yylval])dnl /* User initialization code. */ - b4_initial_action +b4_initial_action m4_popdef([b4_dollar_dollar])dnl m4_popdef([b4_at_dollar])dnl /* Line __line__ of yacc.c. */ @@ -884,7 +882,7 @@ b4_syncline([@oline@], [@ofile@])])dnl data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (_("parser stack overflow"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ @@ -924,14 +922,14 @@ b4_syncline([@oline@], [@ofile@])])dnl yyvsp = yyvs + yysize - 1; ]b4_location_if([ yylsp = yyls + yysize - 1;])[ - YYDPRINTF ((stderr, "Stack size increased to %lu\n", + YYDPRINTF ((stderr, _("Stack size increased to %lu\n"), (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YYDPRINTF ((stderr, _("Entering state %d\n"), yystate)); goto yybackup; @@ -955,19 +953,19 @@ yybackup: /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, _("Reading a token: "))); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + YYDPRINTF ((stderr, _("Now at end of input.\n"))); } else { yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT (_("Next token is"), yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -988,7 +986,7 @@ yybackup: YYACCEPT; /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT (_("Shifting"), yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1040,6 +1038,7 @@ yyreduce: switch (yyn) ]{ b4_actions + default: break; } /* Line __line__ of yacc.c. */ @@ -1097,7 +1096,7 @@ yyerrlab: int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 0; - yyprefix = ", expecting "; + yyprefix = _(", expecting "); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { @@ -1109,34 +1108,34 @@ yyerrlab: break; } } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); + yysize += (strlen (_("syntax error, unexpected ")) + + yystrlen (yytname[yytype]) + 1); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + char *yyp = yystpcpy (yymsg, _("syntax error, unexpected ")); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { - yyprefix = ", expecting "; + yyprefix = _(", expecting "); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; + yyprefix = _(" or "); } } yyerror (]b4_yyerror_args[yymsg); YYSTACK_FREE (yymsg); } else - yyerror (]b4_yyerror_args["syntax error; also virtual memory exhausted"); + yyerror (]b4_yyerror_args[_("syntax error; also virtual memory exhausted")); } else #endif /* YYERROR_VERBOSE */ - yyerror (]b4_yyerror_args["syntax error"); + yyerror (]b4_yyerror_args[_("syntax error")); } ]b4_location_if([[ yyerror_range[0] = yylloc;]])[ @@ -1157,13 +1156,13 @@ yyerrlab: YYPOPSTACK; if (yyssp == yyss) YYABORT; - yydestruct ("Error: popping", + yydestruct (_("Error: popping"), yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[); } } else { - yydestruct ("Error: discarding", yytoken, &yylval]b4_location_if([, &yylloc])[); + yydestruct (_("Error: discarding"), yytoken, &yylval]b4_location_if([, &yylloc])[); yychar = YYEMPTY; } } @@ -1178,12 +1177,11 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif ]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; yylsp -= yylen; @@ -1218,7 +1216,7 @@ yyerrlab1: YYABORT; ]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ - yydestruct ("Error: popping", yystos[yystate], yyvsp]b4_location_if([, yylsp])[); + yydestruct (_("Error: popping"), yystos[yystate], yyvsp]b4_location_if([, yylsp])[); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1236,7 +1234,7 @@ yyerrlab1: *++yylsp = yyloc;]])[ /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT (_("Shifting"), yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1253,7 +1251,7 @@ yyacceptlab: | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yydestruct ("Error: discarding lookahead", + yydestruct (_("Error: discarding lookahead"), yytoken, &yylval]b4_location_if([, &yylloc])[); yychar = YYEMPTY; yyresult = 1; @@ -1264,7 +1262,7 @@ yyabortlab: | yyoverflowlab -- parser overflow comes here. | `----------------------------------------------*/ yyoverflowlab: - yyerror (]b4_yyerror_args["parser stack overflow"); + yyerror (]b4_yyerror_args[_("parser stack overflow")); yyresult = 2; /* Fall through. */ #endif