+/*---------------------------------------.
+| Output the tokens definition to OOUT. |
+`---------------------------------------*/
+
+static 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;
+ }
+ }
+}
+
+