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