symbols: improve symbol aliasing

Rather than having duplicate info in the symbol and the alias that has
to be resolved later on, both the symbol and the alias have a common
pointer to a separate structure containing this info.

* src/symtab.h (sym_content): New structure.
* src/symtab.c (sym_content_new, sym_content_free, symbol_free): New

* src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h,
* src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c
* src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c,
* src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c:
Adjust.

* tests/input.at: Fix expectations (order changes).
This commit is contained in:
Valentin Tolmer
2013-07-31 11:51:59 +02:00
committed by Akim Demaille
parent c4aa4ff541
commit a728075710
18 changed files with 262 additions and 267 deletions

View File

@@ -46,7 +46,7 @@ static void
print_core (struct obstack *oout, state *s)
{
item_number const *sitems = s->items;
symbol *previous_lhs = NULL;
sym_content *previous_lhs = NULL;
size_t i;
size_t snritems = s->nitems;
@@ -72,11 +72,12 @@ print_core (struct obstack *oout, state *s)
r = &rules[item_number_as_rule_number (*sp)];
obstack_printf (oout, "%3d ", r->number);
if (previous_lhs && UNIQSTR_EQ (previous_lhs->tag, r->lhs->tag))
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
r->lhs->symbol->tag))
obstack_printf (oout, "%*s| ",
(int) strlen (previous_lhs->tag), "");
(int) strlen (previous_lhs->symbol->tag), "");
else
obstack_printf (oout, "%s: ", escape (r->lhs->tag));
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
previous_lhs = r->lhs;
for (sp = r->rhs; sp < sp1; sp++)