]> git.saurik.com Git - bison.git/commit - src/symlist.c
maint: factor the handling of %printer and %destructor
authorVictor Santet <victor.santet@epita.fr>
Fri, 22 Jun 2012 12:11:05 +0000 (14:11 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Fri, 22 Jun 2012 12:36:08 +0000 (14:36 +0200)
commit71da68b3662b7169c58f8c5d4c0e89bc3caa31c4
tree28a79b6226b1efc659a0951229e47ab46110cb04
parentdfe292c695e1b6dcc7bc7257b59b98be960faff8
maint: factor the handling of %printer and %destructor

There is too much code duplication between %printer and %destructor.
We used to have two functions for each action: the first one for
destructors, the second one for printers. Factor using a
'code_props_type', and an array of code_props instead of two
members.

* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Fuse into...
(symbol_list_code_props_set): this.
* src/symtab.h, src/symtab.c (default_tagged_destructor)
(default_tagged_printer): Fuse into...
(default_tagged_code_props): this.
(default_tagless_destructor, default_tagless_printer)
(default_tagless_code_props): Likewise.
(code_props_type_string): new.
(symbol_destructor_set, symbol_destructor_get, semantic_type_destructor_set)
(default_tagged_destructor_set, default_tagless_destructor_set)
(symbol_printer_set, symbol_printer_get, semantic_type_printer_set)
(default_tagged_printer_set, default_tagless_printer_set): Replace by...
(symbol_code_props_set, symbol_code_props_get, semantic_type_code_props_set)
(default_tagged_code_props_set, default_tagless_code_props_set): these.
* src/parse-gram.y (grammar_declaration): Adjust.
* src/output.c (CODE_PROP, grammar_declaration): Ditto.
* src/reader.c (symbol_should_be_used): Ditto.
src/output.c
src/parse-gram.c
src/parse-gram.y
src/reader.c
src/symlist.c
src/symlist.h
src/symtab.c
src/symtab.h