+/*-----------------------------.
+| Output the actions to OOUT. |
+`-----------------------------*/
+
+void
+actions_output (FILE *out)
+{
+ int rule;
+ for (rule = 1; rule < nrules + 1; ++rule)
+ if (rules[rule].action)
+ {
+ fprintf (out, " case %d:\n", rule);
+
+ if (!no_lines_flag)
+ fprintf (out, muscle_find ("linef"),
+ rules[rule].action_line,
+ quotearg_style (c_quoting_style,
+ muscle_find ("filename")));
+ /* As a Bison extension, add the ending semicolon. Since some
+ Yacc don't do that, help people using bison as a Yacc
+ finding their missing semicolons. */
+ fprintf (out, "{ %s%s }\n break;\n\n",
+ rules[rule].action,
+ yacc_flag ? ";" : "");
+ }
+}
+
+
+/*----------------------------.
+| Output the guards to OOUT. |
+`----------------------------*/
+
+void
+guards_output (FILE *out)
+{
+ int rule;
+ for (rule = 1; rule < nrules + 1; ++rule)
+ if (rules[rule].guard)
+ {
+ fprintf (out, " case %d:\n", rule);
+
+ if (!no_lines_flag)
+ fprintf (out, muscle_find ("linef"),
+ rules[rule].guard_line,
+ quotearg_style (c_quoting_style,
+ muscle_find ("filename")));
+ fprintf (out, "{ %s; }\n break;\n\n",
+ rules[rule].guard);
+ }
+}
+
+
+/*---------------------------------------.
+| Output the tokens definition to OOUT. |
+`---------------------------------------*/
+
+void
+token_definitions_output (FILE *out)
+{
+ int i;
+ int first = 1;
+ for (i = 0; i < ntokens; ++i)
+ {
+ symbol_t *symbol = symbols[i];
+ int number = symbol->user_token_number;
+
+ if (number == SALIAS)
+ continue;
+ /* Skip error token. */
+ if (symbol == errtoken)
+ continue;
+ if (symbol->tag[0] == '\'')
+ continue; /* skip literal character */
+ if (symbol->tag[0] == '\"')
+ {
+ /* use literal string only if given a symbol with an alias */
+ if (symbol->alias)
+ symbol = symbol->alias;
+ else
+ continue;
+ }
+
+ /* Don't #define nonliteral tokens whose names contain periods
+ or '$' (as does the default value of the EOF token). */
+ if (strchr (symbol->tag, '.') || strchr (symbol->tag, '$'))
+ continue;
+
+ fprintf (out, "%s [[[%s]], [%d]]",
+ first ? "" : ",\n", symbol->tag, number);
+ if (semantic_parser)
+ /* FIXME: This is probably wrong, and should be just as
+ above. --akim. */
+ fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->number);
+ first = 0;
+ }
+}
+
+