In XML output, remove redundant class attribute on symbol element.

* data/xslt/bison.xsl (xsl:key name="bison:symbolByName"): New.
* data/xslt/xml2xhtml.xsl (xsl:template match="symbol"): Use it to
look up a symbol to determine whether it's a nonterminal or terminal.
* src/gram.c (rule_rhs_print_xml): Remove class attribute.
* src/state.c (state_rule_lookahead_tokens_print_xml): Likewise.

Add prec/assoc information to XML output.
* src/gram.c (grammar_rules_print_xml): For each rule that has a
%prec, add a percent_prec attribute.
* src/print-xml.c (print_grammar): For each terminal that has a
precedence or associativity, add a prec or assoc attribute.
(xml_indent): New.
(xml_puts): Use xml_indent.
(xml_printf): Use xml_indent.
* src/print-xml.h (xml_indent): Prototype.

* tests/existing.at (GNU pic Grammar): Fix a rule miscopied from
<http://lists.gnu.org/archive/html/bug-bison/2003-04/msg00026.html>.
This commit is contained in:
Joel E. Denny
2007-12-15 02:08:02 +00:00
parent d4a26c4832
commit 408476bca9
8 changed files with 66 additions and 19 deletions

View File

@@ -262,8 +262,7 @@ state_rule_lookahead_tokens_print_xml (state *s, rule *r,
xml_puts (out, level, "<lookaheads>");
BITSET_FOR_EACH (biter, reds->lookahead_tokens[red], k, 0)
{
xml_printf (out, level + 1, "<symbol class=\"%s\">%s</symbol>",
symbol_class_get_string (symbols[k]),
xml_printf (out, level + 1, "<symbol>%s</symbol>",
xml_escape (symbols[k]->tag));
}
xml_puts (out, level, "</lookaheads>");