X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/f693ad146e6e4951662d60903b8512d518cb09da..dbfb6dcd339f9aa3bf2a7ed43521319aaf66f7a5:/src/output.c diff --git a/src/output.c b/src/output.c index 4a4f8bd3..b1dd19c0 100644 --- a/src/output.c +++ b/src/output.c @@ -198,11 +198,6 @@ output_gram (void) XFREE (yyrhs); } - -#if 0 - if (!semantic_parser && !no_parser_flag) - obstack_sgrow (&table_obstack, "\n#endif\n"); -#endif } @@ -885,6 +880,7 @@ output_check (void) static void output_actions (void) { + int i; nvectors = nstates + nvars; froms = XCALLOC (short *, nvectors); @@ -893,8 +889,6 @@ output_actions (void) width = XCALLOC (short, nvectors); token_actions (); - LIST_FREE (shifts, first_shift); - LIST_FREE (reductions, first_reduction); XFREE (LA); XFREE (LAruleno); @@ -910,7 +904,14 @@ output_actions (void) output_table (); output_check (); - LIST_FREE (state_t, first_state); + + for (i = 0; i < nstates; ++i) + { + XFREE (state_table[i]->shifts); + XFREE (state_table[i]->reductions); + XFREE (state_table[i]->errs); + free (state_table[i]); + } XFREE (state_table); } @@ -958,8 +959,6 @@ output_parser (const char *skel_filename, struct obstack *oout) obstack_sgrow (oout, muscle_value); else if (!strcmp (muscle_key, "line")) obstack_fgrow1 (oout, "%d", line + 1); - else if (!strcmp (muscle_key, "input-line")) - obstack_fgrow1 (oout, "%d", lineno); else { obstack_sgrow (oout, "%%"); @@ -1028,6 +1027,7 @@ prepare (void) MUSCLE_INSERT_INT ("maxtok", max_user_token_number); MUSCLE_INSERT_INT ("ntbase", ntokens); MUSCLE_INSERT_INT ("error-verbose", error_verbose); + MUSCLE_INSERT_STRING ("prefix", spec_name_prefix); MUSCLE_INSERT_INT ("nnts", nvars); MUSCLE_INSERT_INT ("nrules", nrules); @@ -1037,10 +1037,9 @@ prepare (void) MUSCLE_INSERT_INT ("locations-flag", locations_flag); /* We need to save the actions in the muscle %%action. */ + obstack_1grow (&action_obstack, 0); muscle_insert ("action", obstack_finish (&action_obstack)); - if (spec_name_prefix) - MUSCLE_INSERT_STRING ("prefix", spec_name_prefix); } /*----------------------------------------------------------. @@ -1062,11 +1061,9 @@ output (void) XFREE (user_toknums); output_actions (); -#if 0 - if (!no_parser_flag) */ -#endif prepare (); /* Copy definitions in directive. */ + obstack_1grow (&attrs_obstack, 0); muscle_insert ("prologue", obstack_finish (&attrs_obstack)); output_master_parser ();