+/*-----------------------------.
+| Output the actions to OOUT. |
+`-----------------------------*/
+
+void
+actions_output (FILE *out, size_t *line)
+{
+ 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 ? ";" : "");
+
+ /* We always output 4 '\n' per action. */
+ *line += 4;
+ /* Plus one if !no_lines_flag. */
+ if (!no_lines_flag)
+ ++*line;
+ /* Get the number of lines written by the user. */
+ *line += get_lines_number (rules[rule].action);
+ }
+}
+
+
+/*----------------------------.
+| Output the guards to OOUT. |
+`----------------------------*/
+
+void
+guards_output (FILE *out, size_t *line)
+{
+ 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].guard_line,
+ quotearg_style (c_quoting_style,
+ muscle_find ("filename")));
+ fprintf (out, "{ %s; }\n break;\n\n",
+ rules[rule].guard);
+
+ /* We always output 4 '\n' per action. */
+ *line += 4;
+ /* Plus one if !no_lines_flag. */
+ if (!no_lines_flag)
+ ++*line;
+ /* Get the number of lines written by the user. */
+ *line += get_lines_number (rules[rule].guard);
+ }
+}
+
+
+/*---------------------------------------.
+| Output the tokens definition to OOUT. |
+`---------------------------------------*/
+
+void
+token_definitions_output (FILE *out, size_t *line)
+{
+ int i;
+ for (i = 0; i < ntokens; ++i)
+ {
+ bucket *symbol = symbols[i];
+ int number = symbol->user_token_number;
+
+ if (number == SALIAS)
+ continue;
+ /* Skip error token. */
+ if (symbol->value == error_token_number)
+ 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, "# define %s\t%d\n",
+ symbol->tag, number);
+ ++*line;
+ 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->value);
+ ++*line;
+ }
+ }
+}
+
+