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:
Akim Demaille
2012-07-27 12:47:02 +02:00
parent 263137264f
commit 1c292035e1
5 changed files with 42 additions and 32 deletions

View File

@@ -1377,13 +1377,16 @@ AT_CLEANUP
AT_SETUP([[Stray $ or @]])
# Give %printer and %destructor "<*> exp TOK" instead of "<*>" to
# check that the warnings are reported once, not three times.
AT_DATA_GRAMMAR([[input.y]],
[[%token TOK
%destructor { $%; @%; } <*>;
%destructor { $%; @%; } <*> exp TOK;
%initial-action { $%; @%; };
%printer { $%; @%; } <*>;
%printer { $%; @%; } <*> exp TOK;
%%
exp: TOK { $%; @%; };
exp: TOK { $%; @%; $$ = $1; };
]])
AT_BISON_CHECK([[input.y]], 0, [],