mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
* src/reader.c (copy_dollar, copy_at): Better checking of `n' in
`$n' and `@n'.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* src/reader.c (copy_dollar, copy_at): Better checking of `n' in
|
||||
`$n' and `@n'.
|
||||
|
||||
|
||||
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* src/lalr.c (add_lookback_edge): Use state_t instead of ints.
|
||||
|
||||
46
src/reader.c
46
src/reader.c
@@ -334,9 +334,16 @@ copy_at (FILE *fin, struct obstack *oout, int stack_offset)
|
||||
|
||||
ungetc (c, fin);
|
||||
n = read_signed_integer (fin);
|
||||
|
||||
obstack_fgrow1 (oout, "yylsp[%d]", n - stack_offset);
|
||||
locations_flag = 1;
|
||||
if (n > stack_offset)
|
||||
complain (_("invalid value: %s%d"), "@", n);
|
||||
else
|
||||
{
|
||||
/* Offset is always 0 if parser has already popped the stack
|
||||
pointer. */
|
||||
obstack_fgrow1 (oout, "yylsp[%d]",
|
||||
n - (semantic_parser ? 0 : stack_offset));
|
||||
locations_flag = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -391,16 +398,24 @@ copy_dollar (FILE *fin, struct obstack *oout,
|
||||
ungetc (c, fin);
|
||||
n = read_signed_integer (fin);
|
||||
|
||||
if (!type_name && n > 0)
|
||||
type_name = get_type_name (n, rule);
|
||||
if (n > stack_offset)
|
||||
complain (_("invalid value: %s%d"), "$", n);
|
||||
else
|
||||
{
|
||||
if (!type_name && n > 0)
|
||||
type_name = get_type_name (n, rule);
|
||||
|
||||
obstack_fgrow1 (oout, "yyvsp[%d]", n - stack_offset);
|
||||
/* Offset is always 0 if parser has already popped the stack
|
||||
pointer. */
|
||||
obstack_fgrow1 (oout, "yyvsp[%d]",
|
||||
n - (semantic_parser ? 0 : stack_offset));
|
||||
|
||||
if (type_name)
|
||||
obstack_fgrow1 (oout, ".%s", type_name);
|
||||
if (!type_name && typed)
|
||||
complain (_("$%d of `%s' has no declared type"),
|
||||
n, rule->sym->tag);
|
||||
if (type_name)
|
||||
obstack_fgrow1 (oout, ".%s", type_name);
|
||||
if (!type_name && typed)
|
||||
complain (_("$%d of `%s' has no declared type"),
|
||||
n, rule->sym->tag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -882,6 +897,7 @@ parse_thong_decl (void)
|
||||
nsyms--;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
parse_muscle_decl (void)
|
||||
{
|
||||
@@ -1081,8 +1097,8 @@ read_declarations (void)
|
||||
| values in the current rule so far, which says where to find `$0' |
|
||||
| with respect to the top of the stack. |
|
||||
| |
|
||||
| This routine is used both for actions and guards. Only the |
|
||||
| actions_obstack is used, but this is fine, since we use only |
|
||||
| This routine is used both for actions and guards. Only |
|
||||
| ACTION_OBSTACK is used, but this is fine, since we use only |
|
||||
| pointers to relevant portions inside this obstack. |
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
@@ -1092,10 +1108,6 @@ parse_braces (symbol_list *rule, int stack_offset)
|
||||
int c;
|
||||
int count;
|
||||
|
||||
/* offset is always 0 if parser has already popped the stack pointer */
|
||||
if (semantic_parser)
|
||||
stack_offset = 0;
|
||||
|
||||
count = 1;
|
||||
while (count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user