- register int i;
- register int j;
-
- fprintf(ftable, "\nstatic const short yystos[] = { 0");
-
- j = 10;
- for (i = 1; i < nstates; i++)
- {
- putc(',', ftable);
-
- if (j >= 10)
- {
- putc('\n', ftable);
- j = 1;
- }
- else
- {
- j++;
- }
-
- fprintf(ftable, "%6d", accessing_symbol[i]);
- }
-
- fprintf(ftable, "\n};\n");
-}
-
-
-void
-output_rule_data()
-{
- register int i;
- register int j;
-
- fprintf(ftable, "\n#if YYDEBUG != 0\n");
- fprintf(ftable, "static const short yyrline[] = { 0");
-
- j = 10;
- for (i = 1; i <= nrules; i++)
- {
- putc(',', ftable);
-
- if (j >= 10)
- {
- putc('\n', ftable);
- j = 1;
- }
- else
- {
- j++;
- }
-
- fprintf(ftable, "%6d", rline[i]);
- }
- fprintf(ftable, "\n};\n#endif\n\n");
-
- if (toknumflag || noparserflag)
- {
- fprintf(ftable, "#define YYNTOKENS %d\n", ntokens);
- fprintf(ftable, "#define YYNNTS %d\n", nvars);
- fprintf(ftable, "#define YYNRULES %d\n", nrules);
- fprintf(ftable, "#define YYNSTATES %d\n", nstates);
- fprintf(ftable, "#define YYMAXUTOK %d\n\n", max_user_token_number);
- }
-
- if (! toknumflag && ! noparserflag)
- fprintf(ftable, "\n#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)\n\n");
-
- /* Output the table of symbol names. */
-
- fprintf(ftable,
- "static const char * const yytname[] = { \"%s\"",
- tags[0]);
-
- j = strlen (tags[0]) + 44;
- for (i = 1; i < nsyms; i++)
- /* this used to be i<=nsyms, but that output a final "" symbol
- almost by accident */
- {
- register char *p;
- putc(',', ftable);
- j++;
-
- if (j > 75)
- {
- putc('\n', ftable);
- j = 0;
- }
-
- putc ('\"', ftable);
- j++;
-
- for (p = tags[i]; p && *p; p++)
- {
- if (*p == '"' || *p == '\\')
- {
- fprintf(ftable, "\\%c", *p);
- j += 2;
- }
- else if (*p == '\n')
- {
- fprintf(ftable, "\\n");
- j += 2;
- }
- else if (*p == '\t')
- {
- fprintf(ftable, "\\t");
- j += 2;
- }
- else if (*p == '\b')
- {
- fprintf(ftable, "\\b");
- j += 2;
- }
- else if (*p < 040 || *p >= 0177)
- {
- fprintf(ftable, "\\%03o", *p);
- j += 4;
- }
- else
- {
- putc(*p, ftable);
- j++;
- }
- }
-
- putc ('\"', ftable);
- j++;
- }
- fprintf(ftable, ", NULL\n};\n"); /* add a NULL entry to list of tokens */
-
- if (! toknumflag && ! noparserflag)
- fprintf(ftable, "#endif\n\n");
+ long int max = output_token_number_table (&format_obstack,
+ token_translations,
+ 0, 1, max_user_token_number + 1);
+ muscle_insert ("translate", obstack_finish (&format_obstack));
+ MUSCLE_INSERT_LONG_INT ("token_number_max", max);
+ XFREE (token_translations);
+
+ {
+ int i;
+ int j = 0;
+ for (i = 0; i < nsyms; i++)
+ {
+ /* Be sure not to use twice the same quotearg slot. */
+ const char *cp =
+ quotearg_n_style (1, c_quoting_style,
+ quotearg_style (escape_quoting_style,
+ symbols[i]->tag));
+ /* Width of the next token, including the two quotes, the coma
+ and the space. */
+ int strsize = strlen (cp) + 2;
+
+ if (j + strsize > 75)
+ {
+ obstack_sgrow (&format_obstack, "\n ");
+ j = 2;
+ }