+ grammar_rules_partial_print (out, _("Grammar"), rule_useful_in_grammar_p);
+}
+
+void
+grammar_rules_print_xml (FILE *out, int level)
+{
+ rule_number r;
+ bool first = true;
+
+ for (r = 0; r < nrules + nuseless_productions; r++)
+ {
+ if (first)
+ xml_puts (out, level + 1, "<rules>");
+ first = false;
+ {
+ char const *usefulness;
+ if (rule_useless_in_grammar_p (&rules[r]))
+ usefulness = "useless-in-grammar";
+ else if (rule_useless_in_parser_p (&rules[r]))
+ usefulness = "useless-in-parser";
+ else
+ usefulness = "useful";
+ xml_indent (out, level + 2);
+ fprintf (out, "<rule number=\"%d\" usefulness=\"%s\"",
+ rules[r].number, usefulness);
+ if (rules[r].precsym)
+ fprintf (out, " percent_prec=\"%s\"",
+ xml_escape (rules[r].precsym->tag));
+ fputs (">\n", out);
+ }
+ rule_lhs_print_xml (&rules[r], out, level + 3);
+ rule_rhs_print_xml (&rules[r], out, level + 3);
+ xml_puts (out, level + 2, "</rule>");
+ }
+ if (!first)
+ xml_puts (out, level + 1, "</rules>");
+ else
+ xml_puts (out, level + 1, "<rules/>");
+}