mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* NEWS: Document minor wording changes in diagnostics of
Bison-generated parsers. * data/glr.c (yyMemoryExhausted): Renamed from yyStackOverflow. Remove unused formals. All uses changed. (yyreportAmbiguity): "ambiguity detected" -> "syntax is ambiguous". (yyparse): Rename yyoverflowlab to yyexhaustedlab. * data/yacc.c (yyparse): "parser stack overflow" -> "memory exhausted". Rename yyoverflowab to yyexhaustedlab. When memory exhaustion occurs during syntax-error reporting, report it separately rather than in a single diagnostic; this eases translation. * doc/bison.texinfo (Memory Management): Renamed from Stack Overflow. (Memory Exhausted): Renamed from Parser Stack Overflow. Revamp wording slightly to prefer "memory exhaustion". * tests/actions.at: "parser stack overflow" -> "memory exhausted".
This commit is contained in:
25
data/glr.c
25
data/glr.c
@@ -698,7 +698,7 @@ yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yymsg)
|
||||
}
|
||||
|
||||
static void
|
||||
yyStackOverflow (yyGLRStack* yystack]b4_pure_formals[)
|
||||
yyMemoryExhausted (yyGLRStack* yystack)
|
||||
{
|
||||
longjmp (yystack->yyexception_buffer, 2);
|
||||
}
|
||||
@@ -995,13 +995,13 @@ yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[)
|
||||
size_t yyn;
|
||||
yysize = yystack->yynextFree - yystack->yyitems;
|
||||
if (YYMAXDEPTH <= yysize)
|
||||
yyStackOverflow (yystack]b4_pure_args[);
|
||||
yyMemoryExhausted (yystack);
|
||||
yynewSize = 2*yysize;
|
||||
if (YYMAXDEPTH < yynewSize)
|
||||
yynewSize = YYMAXDEPTH;
|
||||
yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]);
|
||||
if (! yynewItems)
|
||||
yyStackOverflow (yystack]b4_pure_args[);
|
||||
yyMemoryExhausted (yystack);
|
||||
for (yyp0 = yystack->yyitems, yyp1 = yynewItems, yyn = yysize;
|
||||
0 < yyn;
|
||||
yyn -= 1, yyp0 += 1, yyp1 += 1)
|
||||
@@ -1044,7 +1044,7 @@ yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[)
|
||||
|
||||
#else
|
||||
|
||||
yyStackOverflow (yystack]b4_pure_args[);
|
||||
yyMemoryExhausted (yystack);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1321,7 +1321,7 @@ yysplitStack (yyGLRStack* yystack, size_t yyk]b4_pure_formals[)
|
||||
(yyGLRState**) YYREALLOC (yystack->yytops.yystates,
|
||||
((yystack->yytops.yycapacity *= 2)
|
||||
* sizeof yynewStates[0])))))
|
||||
yyStackOverflow (yystack]b4_pure_args[);
|
||||
yyMemoryExhausted (yystack);
|
||||
yystack->yytops.yystates = yynewStates;
|
||||
}
|
||||
yystack->yytops.yystates[yystack->yytops.yysize]
|
||||
@@ -1536,7 +1536,7 @@ yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
|
||||
yyreportTree (yyx1, 2);
|
||||
YYFPRINTF (stderr, "\n");
|
||||
#endif
|
||||
yyFail (yystack][]b4_pure_args[, YY_("ambiguity detected"));
|
||||
yyFail (yystack][]b4_pure_args[, YY_("syntax is ambiguous"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1815,7 +1815,10 @@ yyreportSyntaxError (yyGLRStack* yystack,
|
||||
YYFREE (yymsg);
|
||||
}
|
||||
else
|
||||
yyerror (]b4_lyyerror_args[YY_("syntax error; also memory exhausted"));
|
||||
{
|
||||
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
||||
yyMemoryExhausted (yystack);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
@@ -1993,11 +1996,11 @@ m4_popdef([b4_at_dollar])dnl
|
||||
b4_syncline([@oline@], [@ofile@])])dnl
|
||||
[
|
||||
if (! yyinitGLRStack (&yystack, YYINITDEPTH))
|
||||
goto yyoverflowlab;
|
||||
goto yyexhaustedlab;
|
||||
switch (setjmp (yystack.yyexception_buffer))
|
||||
{
|
||||
case 1: goto yyabortlab;
|
||||
case 2: goto yyoverflowlab;
|
||||
case 2: goto yyexhaustedlab;
|
||||
}
|
||||
yystack.yytokenp = &yytoken;
|
||||
yyglrShift (&yystack, 0, 0, 0, yylval, &yylloc]b4_user_args[);
|
||||
@@ -2109,8 +2112,8 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
||||
yyresult = 1;
|
||||
goto yyreturn;
|
||||
|
||||
yyoverflowlab:
|
||||
yyerror (]b4_lyyerror_args[YY_("parser stack overflow"));
|
||||
yyexhaustedlab:
|
||||
yyerror (]b4_lyyerror_args[YY_("memory exhausted"));
|
||||
yyresult = 2;
|
||||
/* Fall through. */
|
||||
|
||||
|
||||
23
data/yacc.c
23
data/yacc.c
@@ -911,7 +911,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
||||
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 (YY_("parser stack overflow"),
|
||||
yyoverflow (YY_("memory exhausted"),
|
||||
&yyss1, yysize * sizeof (*yyssp),
|
||||
&yyvs1, yysize * sizeof (*yyvsp),
|
||||
]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[
|
||||
@@ -922,11 +922,11 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
||||
}
|
||||
#else /* no yyoverflow */
|
||||
# ifndef YYSTACK_RELOCATE
|
||||
goto yyoverflowlab;
|
||||
goto yyexhaustedlab;
|
||||
# else
|
||||
/* Extend the stack our own way. */
|
||||
if (YYMAXDEPTH <= yystacksize)
|
||||
goto yyoverflowlab;
|
||||
goto yyexhaustedlab;
|
||||
yystacksize *= 2;
|
||||
if (YYMAXDEPTH < yystacksize)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
@@ -936,7 +936,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
||||
union yyalloc *yyptr =
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
if (! yyptr)
|
||||
goto yyoverflowlab;
|
||||
goto yyexhaustedlab;
|
||||
YYSTACK_RELOCATE (yyss);
|
||||
YYSTACK_RELOCATE (yyvs);
|
||||
]b4_location_if([ YYSTACK_RELOCATE (yyls);])[
|
||||
@@ -1201,7 +1201,10 @@ yyerrlab:
|
||||
YYSTACK_FREE (yymsg);
|
||||
}
|
||||
else
|
||||
yyerror (]b4_yyerror_args[YY_("syntax error; also memory exhausted"));
|
||||
{
|
||||
yyerror (]b4_yyerror_args[YY_("syntax error"));
|
||||
goto yyexhaustedlab;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
@@ -1317,11 +1320,11 @@ yyabortlab:
|
||||
goto yyreturn;
|
||||
|
||||
#ifndef yyoverflow
|
||||
/*----------------------------------------------.
|
||||
| yyoverflowlab -- parser overflow comes here. |
|
||||
`----------------------------------------------*/
|
||||
yyoverflowlab:
|
||||
yyerror (]b4_yyerror_args[YY_("parser stack overflow"));
|
||||
/*-------------------------------------------------.
|
||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||
`-------------------------------------------------*/
|
||||
yyexhaustedlab:
|
||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
||||
yyresult = 2;
|
||||
/* Fall through. */
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user