+static inline void
+copy_comment (FILE *fin, FILE *fout)
+{
+ copy_comment2 (fin, fout, NULL);
+}
+
+
+/*-----------------------------------------------------------------.
+| FIN is pointing to a location (i.e., a `@'). Output to FOUT a |
+| reference to this location. STACK_OFFSET is the number of values |
+| in the current rule so far, which says where to find `$0' with |
+| respect to the top of the stack. |
+`-----------------------------------------------------------------*/
+
+static inline void
+copy_at (FILE *fin, FILE *fout, int stack_offset)
+{
+ int c;
+
+ c = getc (fin);
+ if (c == '$')
+ {
+ fprintf (fout, "yyloc");
+ locations_flag = 1;
+ }
+ else if (isdigit (c) || c == '-')
+ {
+ int n;
+
+ ungetc (c, fin);
+ n = read_signed_integer (fin);
+
+ fprintf (fout, "yylsp[%d]", n - stack_offset);
+ locations_flag = 1;
+ }
+ else
+ {
+ char buf[] = "@c";
+ buf[1] = c;
+ complain (_("%s is invalid"), quote (buf));
+ }
+}
+
+
+/*-------------------------------------------------------------------.
+| FIN is pointing to a wannabee semantic value (i.e., a `$'). |
+| |
+| Possible inputs: $[<TYPENAME>]($|integer) |
+| |
+| Output to FOUT a reference to this semantic value. STACK_OFFSET is |
+| the number of values in the current rule so far, which says where |
+| to find `$0' with respect to the top of the stack. |
+`-------------------------------------------------------------------*/
+
+static inline void
+copy_dollar (FILE *fin, FILE *fout,
+ symbol_list *rule, int stack_offset)
+{
+ int c = getc (fin);
+ char *type_name = NULL;
+
+ /* Get the type name if explicit. */
+ if (c == '<')
+ {
+ read_type_name (fin);
+ type_name = token_buffer;
+ value_components_used = 1;
+ c = getc (fin);
+ }
+
+ if (c == '$')
+ {
+ fprintf (fout, "yyval");
+ if (!type_name)
+ type_name = get_type_name (0, rule);
+ if (type_name)
+ fprintf (fout, ".%s", type_name);
+ if (!type_name && typed)
+ complain (_("$$ of `%s' has no declared type"),
+ rule->sym->tag);
+ }
+ else if (isdigit (c) || c == '-')
+ {
+ int n;
+ ungetc (c, fin);
+ n = read_signed_integer (fin);
+
+ if (!type_name && n > 0)
+ type_name = get_type_name (n, rule);
+
+ fprintf (fout, "yyvsp[%d]", n - stack_offset);
+ if (type_name)
+ fprintf (fout, ".%s", type_name);
+ if (!type_name && typed)
+ complain (_("$%d of `%s' has no declared type"),
+ n, rule->sym->tag);
+ }
+ else
+ {
+ char buf[] = "$c";
+ buf[1] = c;
+ complain (_("%s is invalid"), quote (buf));
+ }
+}
+\f
+/*-------------------------------------------------------------------.
+| Copy the contents of a `%{ ... %}' into the definitions file. The |
+| `%{' has already been read. Return after reading the `%}'. |
+`-------------------------------------------------------------------*/
+
+static void