mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
* src/reader.c (grammar_midrule_action): If $$ is set in a
mid-rule, move the `used' bit to its lhs. * tests/input.at (Unused values): New. * tests/actions.at (Exotic Dollars): Adjust: exp is not typed.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* Input parser for Bison
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003,
|
||||
2005 Free Software Foundation, Inc.
|
||||
2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -307,6 +307,10 @@ grammar_midrule_action (void)
|
||||
midrule->action = current_rule->action;
|
||||
midrule->action_location = dummy_location;
|
||||
current_rule->action = NULL;
|
||||
/* If $$ was used in the action, the LHS of the enclosing rule was
|
||||
incorrectly flagged as used. */
|
||||
midrule->used = current_rule->used;
|
||||
current_rule->used = false;
|
||||
|
||||
if (previous_rule_end)
|
||||
previous_rule_end->next = midrule;
|
||||
|
||||
@@ -56,11 +56,12 @@ symbol_list_new (symbol *sym, location loc)
|
||||
`------------------*/
|
||||
|
||||
void
|
||||
symbol_list_print (symbol_list *l, FILE *f)
|
||||
symbol_list_print (const symbol_list *l, FILE *f)
|
||||
{
|
||||
for (/* Nothing. */; l && l->sym; l = l->next)
|
||||
{
|
||||
symbol_print (l->sym, f);
|
||||
fprintf (stderr, l->used ? " used" : " unused");
|
||||
if (l && l->sym)
|
||||
fprintf (f, ", ");
|
||||
}
|
||||
@@ -96,7 +97,7 @@ symbol_list_free (symbol_list *list)
|
||||
`--------------------*/
|
||||
|
||||
unsigned int
|
||||
symbol_list_length (symbol_list *l)
|
||||
symbol_list_length (const symbol_list *l)
|
||||
{
|
||||
int res = 0;
|
||||
for (/* Nothing. */; l; l = l->next)
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct symbol_list
|
||||
symbol_list *symbol_list_new (symbol *sym, location loc);
|
||||
|
||||
/* Print it. */
|
||||
void symbol_list_print (symbol_list *l, FILE *f);
|
||||
void symbol_list_print (const symbol_list *l, FILE *f);
|
||||
|
||||
/* Prepend SYM at LOC to the LIST. */
|
||||
symbol_list *symbol_list_prepend (symbol_list *l,
|
||||
@@ -64,7 +64,7 @@ symbol_list *symbol_list_prepend (symbol_list *l,
|
||||
void symbol_list_free (symbol_list *l);
|
||||
|
||||
/* Return its length. */
|
||||
unsigned int symbol_list_length (symbol_list *l);
|
||||
unsigned int symbol_list_length (const symbol_list *l);
|
||||
|
||||
/* Get symbol N in symbol list L. */
|
||||
symbol_list *symbol_list_n_get (symbol_list *l, int n);
|
||||
|
||||
Reference in New Issue
Block a user