]> git.saurik.com Git - bison.git/blame - data/xslt/bison.xsl
Complain about unused %define variables and %code qualifiers.
[bison.git] / data / xslt / bison.xsl
CommitLineData
21f1b063
JD
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4 bison.xsl - common templates for Bison XSLT.
fc8b70bf 5
38609c34 6 Copyright (C) 2007, 2008-2009 Free Software Foundation, Inc.
21f1b063
JD
7
8 This file is part of Bison, the GNU Compiler Compiler.
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24<xsl:stylesheet version="1.0"
25 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26 xmlns:bison="http://www.gnu.org/software/bison/">
27
408476bc
JD
28<xsl:key
29 name="bison:symbolByName"
30 match="/bison-xml-report/grammar/nonterminals/nonterminal"
31 use="@name"
32/>
33<xsl:key
34 name="bison:symbolByName"
35 match="/bison-xml-report/grammar/terminals/terminal"
36 use="@name"
37/>
d4a26c48
JD
38<xsl:key
39 name="bison:ruleByNumber"
40 match="/bison-xml-report/grammar/rules/rule"
41 use="@number"
42/>
43<xsl:key
44 name="bison:ruleByLhs"
45 match="/bison-xml-report/grammar/rules/rule[
46 @usefulness != 'useless-in-grammar']"
47 use="lhs"
48/>
49<xsl:key
50 name="bison:ruleByRhs"
51 match="/bison-xml-report/grammar/rules/rule[
52 @usefulness != 'useless-in-grammar']"
53 use="rhs/symbol"
54/>
fc8b70bf 55
21f1b063
JD
56<!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
57<xsl:template match="state" mode="bison:count-conflicts">
58 <xsl:variable name="transitions" select="actions/transitions"/>
59 <xsl:variable name="reductions" select="actions/reductions"/>
60 <xsl:variable
61 name="terminals"
62 select="
63 $transitions/transition[@type='shift']/@symbol
64 | $reductions/reduction/@symbol
65 "
66 />
67 <xsl:variable name="conflict-data">
68 <xsl:for-each select="$terminals">
69 <xsl:variable name="name" select="."/>
70 <xsl:if test="generate-id($terminals[. = $name][1]) = generate-id(.)">
71 <xsl:variable
72 name="shift-count"
73 select="count($transitions/transition[@symbol=$name])"
74 />
75 <xsl:variable
76 name="reduce-count"
77 select="count($reductions/reduction[@symbol=$name])"
78 />
79 <xsl:if test="$shift-count > 0 and $reduce-count > 0">
80 <xsl:text>s</xsl:text>
81 </xsl:if>
82 <xsl:if test="$reduce-count > 1">
83 <xsl:text>r</xsl:text>
84 </xsl:if>
85 </xsl:if>
86 </xsl:for-each>
87 </xsl:variable>
88 <xsl:value-of select="string-length(translate($conflict-data, 'r', ''))"/>
89 <xsl:text>,</xsl:text>
90 <xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
91</xsl:template>
92
93</xsl:stylesheet>