- rules[ruleno].line = p->line;
- rules[ruleno].useful = TRUE;
- rules[ruleno].action = p->action;
- rules[ruleno].action_line = p->action_line;
-
- p = p->next;
- while (p && p->sym)
+ rules[ruleno].prec = NULL;
+ rules[ruleno].dprec = p->dprec;
+ rules[ruleno].merger = p->merger;
+ rules[ruleno].precsym = NULL;
+ rules[ruleno].location = p->location;
+ rules[ruleno].useful = true;
+ rules[ruleno].action = p->action_props.code;
+ rules[ruleno].action_location = p->action_props.location;
+
+ /* If the midrule's $$ is set or its $n is used, remove the `$' from the
+ symbol name so that it's a user-defined symbol so that the default
+ %destructor and %printer apply. */
+ if (p->midrule_parent_rule
+ && (p->action_props.is_value_used
+ || symbol_list_n_get (p->midrule_parent_rule,
+ p->midrule_parent_rhs_index)
+ ->action_props.is_value_used))
+ p->content.sym->tag += 1;
+
+ /* Don't check the generated rule 0. It has no action, so some rhs
+ symbols may appear unused, but the parsing algorithm ensures that
+ %destructor's are invoked appropriately. */
+ if (p != grammar)
+ grammar_rule_check (p);
+
+ for (p = p->next; p && p->content.sym; p = p->next)