* src/symtab.h, src/symtab.c (symbol_t): printer and

printer_location are new members.
(symbol_printer_set): New.
* src/parse-gram.y (PERCENT_PRINTER): New token.
Handle its associated rule.
* src/scan-gram.l: Adjust.
(handle_destructor_at, handle_destructor_dollar): Rename as...
(handle_symbol_code_at, handle_symbol_code_dollar): these.
* src/output.c (symbol_printers_output): New.
(output_skeleton): Call it.
* data/bison.simple (yysymprint): New.  Cannot be named yyprint
since there are already many grammar files with a user `yyprint'.
Replace the calls to YYPRINT to calls to yysymprint.
* tests/calc.at: Adjust.
* tests/torture.at (AT_DATA_STACK_TORTURE): Remove YYPRINT: it was
taking advantage of parser very internal details (stack size!).
This commit is contained in:
Akim Demaille
2002-06-20 09:08:37 +00:00
parent 1ce5149ac8
commit 366eea36d3
13 changed files with 1104 additions and 1011 deletions

View File

@@ -118,8 +118,7 @@ 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. |
| Set the DESTRUCTOR associated to SYMBOL. Do nothing if passed 0. |
`-------------------------------------------------------------------*/
void
@@ -129,14 +128,33 @@ symbol_destructor_set (symbol_t *symbol, location_t location, char *destructor)
{
if (symbol->destructor)
complain_at (location,
_("destructor redeclaration for %s"),
symbol_tag_get (symbol));
_("%s redeclaration for %s"),
"%destructor", symbol_tag_get (symbol));
symbol->destructor = destructor;
symbol->destructor_location = location;
}
}
/*----------------------------------------------------------------.
| Set the PRITNER associated to SYMBOL. Do nothing if passed 0. |
`----------------------------------------------------------------*/
void
symbol_printer_set (symbol_t *symbol, char *printer, location_t location)
{
if (printer)
{
if (symbol->printer)
complain_at (location,
_("%s redeclaration for %s"),
"%printer", symbol_tag_get (symbol));
symbol->printer = printer;
symbol->printer_location = location;
}
}
/*------------------------------------------------------------------.
| Set the PRECEDENCE associated to SYMBOL. Does nothing if invoked |
| with UNDEF_ASSOC as ASSOC. |