+static inline void
+copy_comment (FILE *fin, struct obstack *oout)
+{
+ copy_comment2 (fin, oout, NULL);
+}
+
+
+/*-----------------------------------------------------------------.
+| FIN is pointing to a location (i.e., a `@'). Output to OOUT 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, struct obstack *oout, int stack_offset)
+{
+ int c;
+
+ c = getc (fin);
+ if (c == '$')
+ {
+ obstack_sgrow (oout, "yyloc");
+ locations_flag = 1;
+ }
+ else if (isdigit (c) || c == '-')
+ {
+ int n;
+
+ ungetc (c, fin);
+ n = read_signed_integer (fin);
+
+ obstack_fgrow1 (oout, "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 OOUT 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, struct obstack *oout,
+ symbol_list *rule, int stack_offset)
+{
+ int c = getc (fin);
+ const 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 == '$')
+ {
+ obstack_sgrow (oout, "yyval");
+
+ if (!type_name)
+ type_name = get_type_name (0, rule);
+ if (type_name)
+ obstack_fgrow1 (oout, ".%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);
+
+ obstack_fgrow1 (oout, "yyvsp[%d]", n - stack_offset);
+
+ if (type_name)
+ obstack_fgrow1 (oout, ".%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