mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
This completes and fixesa728075710. Reported by Valentin Tolmer. Before it Bison used to put the properties of the symbols (associativity, printer, etc.) in the 'symbol' structure. An identifier-named token (FOO) and its string-named alias ("foo") duplicated these properties, and symbol_check_alias_consistency() checked that both had compatible properties and fused them, at the end of the parsing of the grammar. The commita728075710introduces a sym_content structure that keeps all these properties, and ensures that both aliases point to the same sym_content (instead of duplicating). However, it removed symbol_check_alias_consistency, which resulted in the non-fusion of *existing* properties: %token FOO "foo" %left FOO %left "foo" was properly diagnosed as a redeclaration, but %left FOO %left "foo" %token FOO "foo" was not, as the properties of FOO and "foo" were not checked before fusion. It certainly also means that %left "foo" %token FOO "foo" did not transfer properly the associativity to FOO. The fix is simple: reintroduce symbol_check_alias_consistency (under a better name, symbol_merge_properties) and call it where appropriate. Also, that commit made USER_NUMBER_HAS_STRING_ALIAS useless, but left it. * src/symtab.h (USER_NUMBER_HAS_STRING_ALIAS): Remove, unused. Adjust dependencies. * src/symtab.c (symbol_merge_properties): New, based on the former symbol_check_alias_consistency. * tests/input.at: Re-enable tests that we now pass.