mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
printer/destructor: translate only once
Currently "%printer {...} a b c d e f" translates the {...} six times.
Not only is this bad for time and space, it also issues six times the
same warnings.
* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Take the action as code_props instead of
const char *.
* src/parse-gram.y: Translate these actions here.
* src/scan-code.h: Comment change.
* tests/input.at: Check that warnings are issued only once.
This commit is contained in:
@@ -347,17 +347,27 @@ grammar_declaration:
|
||||
}
|
||||
| "%destructor" "{...}" generic_symlist
|
||||
{
|
||||
symbol_list *list;
|
||||
for (list = $3; list; list = list->next)
|
||||
symbol_list_destructor_set (list, $2, @2);
|
||||
symbol_list_free ($3);
|
||||
code_props code;
|
||||
code_props_symbol_action_init (&code, $2, @2);
|
||||
code_props_translate_code (&code);
|
||||
{
|
||||
symbol_list *list;
|
||||
for (list = $3; list; list = list->next)
|
||||
symbol_list_destructor_set (list, &code);
|
||||
symbol_list_free ($3);
|
||||
}
|
||||
}
|
||||
| "%printer" "{...}" generic_symlist
|
||||
{
|
||||
symbol_list *list;
|
||||
for (list = $3; list; list = list->next)
|
||||
symbol_list_printer_set (list, $2, @2);
|
||||
symbol_list_free ($3);
|
||||
code_props code;
|
||||
code_props_symbol_action_init (&code, $2, @2);
|
||||
code_props_translate_code (&code);
|
||||
{
|
||||
symbol_list *list;
|
||||
for (list = $3; list; list = list->next)
|
||||
symbol_list_printer_set (list, &code);
|
||||
symbol_list_free ($3);
|
||||
}
|
||||
}
|
||||
| "%default-prec"
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user