mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
* data/m4sugar/m4sugar.m4 (m4_map): Recognize when the list of
arguments is really empty, not only equal to `[]'. * src/symtab.h, src/symtab.c (symbol_t): `destructor' is a new member. (symbol_destructor_set): New. * src/output.c (symbol_destructors_output): New. * src/reader.h (brace_code_t, current_braced_code): New. * src/scan-gram.l (BRACED_CODE): Use it to branch on... (handle_dollar): Rename as... (handle_action_dollar): this. (handle_destructor_dollar): New. * src/parse-gram.y (PERCENT_DESTRUCTOR): New. (grammar_declaration): Use it. * data/bison.simple (yystos): Is always defined. (yydestructor): New. * tests/actions.at (Destructors): New. * tests/calc.at (_AT_CHECK_CALC_ERROR): Don't rely on egrep.
This commit is contained in:
20
src/symtab.c
20
src/symtab.c
@@ -48,6 +48,7 @@ symbol_new (const char *tag, location_t location)
|
||||
|
||||
res->tag = xstrdup (tag);
|
||||
res->type_name = NULL;
|
||||
res->destructor = NULL;
|
||||
res->location = location;
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
@@ -114,6 +115,25 @@ symbol_type_set (symbol_t *symbol, location_t location, char *type_name)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Set the DESTRUCTOR associated to SYMBOL. Does nothing if passed 0 |
|
||||
| as DESTRUCTOR. |
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
symbol_destructor_set (symbol_t *symbol, location_t location, char *destructor)
|
||||
{
|
||||
if (destructor)
|
||||
{
|
||||
if (symbol->destructor)
|
||||
complain_at (location,
|
||||
_("destructor redeclaration for %s"),
|
||||
symbol_tag_get (symbol));
|
||||
symbol->destructor = destructor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Set the PRECEDENCE associated to SYMBOL. Does nothing if invoked |
|
||||
| with UNDEF_ASSOC as ASSOC. |
|
||||
|
||||
Reference in New Issue
Block a user