-/*---------------------------------------.
-| Output the tokens definition to OOUT. |
-`---------------------------------------*/
-
-void
-token_definitions_output (FILE *out)
-{
- int i;
- int first = 1;
-
- fputs ("m4_define([b4_tokens], \n[", out);
- for (i = 0; i < ntokens; ++i)
- {
- symbol_t *symbol = symbols[i];
- int number = symbol->user_token_number;
-
- /* At this stage, if there are literal aliases, they are part of
- SYMBOLS, so we should not find symbols which are the aliases
- here. */
- assert (number != USER_NUMBER_ALIAS);
-
- /* Skip error token. */
- if (symbol == errtoken)
- continue;
-
- /* If this string has an alias, then it is necessarily the alias
- which is to be output. */
- if (symbol->alias)
- symbol = symbol->alias;
-
- /* Don't output literal chars or strings (when defined only as a
- string). Note that must be done after the alias resolution:
- think about `%token 'f' "f"'. */
- if (symbol->tag[0] == '\'' || symbol->tag[0] == '\"')
- 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);
-
- first = 0;
- }
- fputs ("])\n\n", out);
-}
-
-
-/*----------------------------------------.
-| Output the symbol destructors to OOUT. |
-`----------------------------------------*/
-
-static void
-symbol_destructors_output (FILE *out)
-{
- int i;
- int first = 1;
-
- fputs ("m4_define([b4_symbol_destructors], \n[", out);
- for (i = 0; i < nsyms; ++i)
- if (symbols[i]->destructor)
- {
- symbol_t *symbol = symbols[i];
-
- /* Filename, lineno,
- Symbol-name, Symbol-number,
- destructor, typename. */
- fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
- first ? "" : ",\n",
- infile, symbol->destructor_location.first_line,
- symbol_tag_get (symbol),
- symbol->number,
- symbol->destructor,
- symbol->type_name);
-
- first = 0;
- }
- fputs ("])\n\n", out);
-}
-