mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
* data/Makefile.am: Update copyright date.
* data/push.c (yypull_parse): Report memory exhaustion and return 2 if yypstate_new returns NULL. (yypstate_new): Return NULL if malloc does. * src/reader.c (packgram): Move translation of rule actions from the beginning of packgram to... (check_and_convert_grammar): ... here right before packgram is invoked so it's easier to write more complete comments, and remove redundant code.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
2007-02-11 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
* data/Makefile.am: Update copyright date.
|
||||||
|
* data/push.c (yypull_parse): Report memory exhaustion and return 2 if
|
||||||
|
yypstate_new returns NULL.
|
||||||
|
(yypstate_new): Return NULL if malloc does.
|
||||||
|
* src/reader.c (packgram): Move translation of rule actions from the
|
||||||
|
beginning of packgram to...
|
||||||
|
(check_and_convert_grammar): ... here right before packgram is invoked
|
||||||
|
so it's easier to write more complete comments, and remove redundant
|
||||||
|
code.
|
||||||
|
|
||||||
2007-02-10 Joel E. Denny <jdenny@ces.clemson.edu>
|
2007-02-10 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
As in semantic actions, make @$ in %initial-action, %destructor, and
|
As in semantic actions, make @$ in %initial-action, %destructor, and
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
11
data/push.c
11
data/push.c
@@ -1091,7 +1091,14 @@ b4_push_if(
|
|||||||
]b4_locations_if([[ YYLTYPE yylloc;
|
]b4_locations_if([[ YYLTYPE yylloc;
|
||||||
]])])[
|
]])])[
|
||||||
if (yyps == 0)
|
if (yyps == 0)
|
||||||
yyps_local = yypstate_new ();
|
{
|
||||||
|
yyps_local = yypstate_new ();
|
||||||
|
if (!yyps_local)
|
||||||
|
{
|
||||||
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
do {
|
do {
|
||||||
@@ -1108,6 +1115,8 @@ b4_push_if(
|
|||||||
]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
|
]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
|
||||||
{
|
{
|
||||||
yypstate *yyps = (yypstate *) malloc (sizeof *yyps);
|
yypstate *yyps = (yypstate *) malloc (sizeof *yyps);
|
||||||
|
if (!yyps)
|
||||||
|
return 0;
|
||||||
yyps->yynew = 1;
|
yyps->yynew = 1;
|
||||||
return yyps;
|
return yyps;
|
||||||
}
|
}
|
||||||
|
|||||||
28
src/reader.c
28
src/reader.c
@@ -444,20 +444,6 @@ packgram (void)
|
|||||||
|
|
||||||
rules = xnmalloc (nrules, sizeof *rules);
|
rules = xnmalloc (nrules, sizeof *rules);
|
||||||
|
|
||||||
/* Before invoking grammar_rule_check on any rule, make sure all actions have
|
|
||||||
already been scanned in order to set `used' flags. Otherwise, checking
|
|
||||||
that a midrule's $$ should be set will not always work properly because
|
|
||||||
the check must forward-reference the midrule's parent rule. For the same
|
|
||||||
reason, all the `used' flags must be set before checking whether to remove
|
|
||||||
`$' from any midrule symbol name. */
|
|
||||||
while (p)
|
|
||||||
{
|
|
||||||
code_props_translate_code (&p->action_props);
|
|
||||||
if (p)
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = grammar;
|
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
int rule_length = 0;
|
int rule_length = 0;
|
||||||
@@ -643,6 +629,20 @@ check_and_convert_grammar (void)
|
|||||||
token symbols into FDEFINES if requested. */
|
token symbols into FDEFINES if requested. */
|
||||||
symbols_pack ();
|
symbols_pack ();
|
||||||
|
|
||||||
|
/* Scan rule actions after invoking symbol_check_alias_consistency (in
|
||||||
|
symbols_pack above) so that token types are set correctly before the rule
|
||||||
|
action type checking.
|
||||||
|
|
||||||
|
Before invoking grammar_rule_check (in packgram below) on any rule, make
|
||||||
|
sure all actions have already been scanned in order to set `used' flags.
|
||||||
|
Otherwise, checking that a midrule's $$ should be set will not always work
|
||||||
|
properly because the check must forward-reference the midrule's parent
|
||||||
|
rule. For the same reason, all the `used' flags must be set before
|
||||||
|
checking whether to remove `$' from any midrule symbol name (also in
|
||||||
|
packgram). */
|
||||||
|
for (symbol_list *sym = grammar; sym; sym = sym->next)
|
||||||
|
code_props_translate_code (&sym->action_props);
|
||||||
|
|
||||||
/* Convert the grammar into the format described in gram.h. */
|
/* Convert the grammar into the format described in gram.h. */
|
||||||
packgram ();
|
packgram ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user