mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
Don't apply the default %destructor/%printer to an unreferenced midrule
value. Mentioned at <http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00104.html>. * src/symtab.c (dummy_symbol_get): Name all dummy symbols initially like $@n instead of just @n so that the default %destructor/%printer logic doesn't see them as user-defined symbols. (symbol_is_dummy): Check for both forms of the name. * src/reader.c (packgram): Remove the `$' from each midrule symbol name for which the midrule value is referenced in any action. * tests/actions.at (Default %printer and %destructor for mid-rule values): New test. * tests/regression.at (Rule Line Numbers, Web2c Report): Update output for change to dummy symbol names.
This commit is contained in:
@@ -769,7 +769,7 @@ dummy_symbol_get (location loc)
|
||||
|
||||
symbol *sym;
|
||||
|
||||
sprintf (buf, "@%d", ++dummy_count);
|
||||
sprintf (buf, "$@%d", ++dummy_count);
|
||||
sym = symbol_get (buf, loc);
|
||||
sym->class = nterm_sym;
|
||||
sym->number = nvars++;
|
||||
@@ -779,7 +779,7 @@ dummy_symbol_get (location loc)
|
||||
bool
|
||||
symbol_is_dummy (const symbol *sym)
|
||||
{
|
||||
return sym->tag[0] == '@';
|
||||
return sym->tag[0] == '@' || (sym->tag[0] == '$' && sym->tag[1] == '@');
|
||||
}
|
||||
|
||||
/*-------------------.
|
||||
|
||||
Reference in New Issue
Block a user