- int write_line = 1;
-
- c = getc (fpars);
-
- /* See if the line starts with `#line.
- If so, set write_line to 0. */
- if (no_lines_flag)
- if (c == '#')
- {
- c = getc (fpars);
- if (c == 'l')
- {
- c = getc (fpars);
- if (c == 'i')
- {
- c = getc (fpars);
- if (c == 'n')
- {
- c = getc (fpars);
- if (c == 'e')
- write_line = 0;
- else
- fprintf (ftable, "#lin");
- }
- else
- fprintf (ftable, "#li");
- }
- else
- fprintf (ftable, "#l");
- }
- else
- fprintf (ftable, "#");
- }
-
- /* now write out the line... */
- for (; c != '\n' && c != EOF; c = getc (fpars))
- if (write_line)
- {
- if (c == '$')
- {
- number_of_dollar_signs++;
- assert (number_of_dollar_signs == 1);
- /* `$' in the parser file indicates where to put the actions.
- Copy them in at this point. */
- rewind (faction);
- for (c = getc (faction); c != EOF; c = getc (faction))
- putc (c, ftable);
- /* Skip the end of the line containing `$'. */
- write_line = 0;
- }
- else
- putc (c, ftable);
- }
- if (c == EOF)
- break;
- putc (c, ftable);
+ if (c != '%')
+ {
+ if (c == '\n')
+ {
+ ++output_line;
+ ++skeleton_line;
+ }
+ putc (c, out);
+ c = getc (fskel);
+ }
+ else if ((c = getc (fskel)) == '%')
+ {
+ /* Read the muscle. */
+ const char *muscle_key = 0;
+ const char *muscle_value = 0;
+
+ while (isalnum (c = getc (fskel)) || c == '-')
+ obstack_1grow (&muscle_obstack, c);
+ obstack_1grow (&muscle_obstack, 0);
+
+ /* Output the right value, or see if it's something special. */
+ muscle_key = obstack_finish (&muscle_obstack);
+ muscle_value = muscle_find (muscle_key);
+ if (!strcmp (muscle_key, "actions"))
+ actions_output (out, &output_line);
+ else if (!strcmp (muscle_key, "guards"))
+ guards_output (out, &output_line);
+ else if (!strcmp (muscle_key, "line"))
+ fprintf (out, "%d", output_line);
+ else if (!strcmp (muscle_key, "tokendef"))
+ token_definitions_output (out, &output_line);
+ else if (!strcmp (muscle_key, "skeleton-line"))
+ fprintf (out, "%d", skeleton_line);
+ else if (muscle_value)
+ {
+ fputs (muscle_value, out);
+ output_line += get_lines_number (muscle_value);
+ }
+ else
+ {
+ fputs ("%%", out);
+ fputs (muscle_key, out);
+ }
+ }
+ else
+ putc ('%', out);