* src/output.c (token_actions): Introduce a temporary array,

YYDEFACT, that makes it possible for this function to use
output_short_table.
This commit is contained in:
Akim Demaille
2000-10-02 07:55:11 +00:00
parent d019d65507
commit f2acea59d9
2 changed files with 16 additions and 27 deletions

View File

@@ -1,3 +1,10 @@
2000-10-02 Akim Demaille <akim@epita.fr>
* src/output.c (token_actions): Introduce a temporary array,
YYDEFACT, that makes it possible for this function to use
output_short_table.
2000-10-02 Akim Demaille <akim@epita.fr> 2000-10-02 Akim Demaille <akim@epita.fr>
`user_toknums' is output as a `short[]' in `output.c', while it is `user_toknums' is output as a `short[]' in `output.c', while it is

View File

@@ -734,45 +734,27 @@ save_row (int state)
| Figure out the actions for the specified state, indexed by | | Figure out the actions for the specified state, indexed by |
| lookahead token type. | | lookahead token type. |
| | | |
| The yydefact table is output now. The detailed info is saved for | | The YYDEFACT table is output now. The detailed info is saved for |
| putting into yytable later. | | putting into YYTABLE later. |
`------------------------------------------------------------------*/ `------------------------------------------------------------------*/
static void static void
token_actions (void) token_actions (void)
{ {
int i; int i;
int j; short *yydefact = NEW2 (nstates, short);
int k;
actrow = NEW2 (ntokens, short); actrow = NEW2 (ntokens, short);
for (i = 0; i < nstates; ++i)
k = action_row (0);
fprintf (ftable, "\nstatic const short yydefact[] = {%6d", k);
save_row (0);
j = 10;
for (i = 1; i < nstates; i++)
{ {
putc (',', ftable); yydefact[i] = action_row (i);
if (j >= 10)
{
putc ('\n', ftable);
j = 1;
}
else
{
j++;
}
k = action_row (i);
fprintf (ftable, "%6d", k);
save_row (i); save_row (i);
} }
fprintf (ftable, "\n};\n");
FREE (actrow); FREE (actrow);
output_short_table (ftable, "yydefact", yydefact,
yydefact[0], 1, nstates);
FREE (yydefact);
} }