%merge: let mergers record a typing-symbol, rather than a type

Symbols are richer than types, and in M4 it is my simpler (and more
common) to deal with symbols rather than types.  So let's associate
mergers to a symbol rather than a type name.

* src/reader.h (merger_list): Replace the 'type' member by a symbol
member.
* src/reader.c (record_merge_function_type): Take a symbol as
argument, rather than a type name.
* src/output.c (merger_output): Adjust.
This commit is contained in:
Akim Demaille
2020-12-30 08:27:24 +01:00
parent edfcca8481
commit ac3d5b76f7
3 changed files with 25 additions and 23 deletions

View File

@@ -554,14 +554,12 @@ merger_output (FILE *out)
int n;
merger_list* p;
for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)
{
if (p->type[0] == '\0')
fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n",
n, p->name);
else
fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n",
n, p->type, p->name);
}
if (p->sym && p->sym->content->type_name)
fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n",
n, p->sym->content->type_name, p->name);
else
fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n",
n, p->name);
fputs ("]])\n\n", out);
}