Add precompiled bison 2.4.1
[msysgit.git] / share / bison / xslt / bison.xsl
blob9a6ce8a48bbb316097edfc686fa46dd456d9a37e
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!--
4 bison.xsl - common templates for Bison XSLT.
6 Copyright (C) 2007, 2008 Free Software Foundation, Inc.
8 This file is part of Bison, the GNU Compiler Compiler.
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.
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.
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 -->
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/">
28 <xsl:key
29 name="bison:symbolByName"
30 match="/bison-xml-report/grammar/nonterminals/nonterminal"
31 use="@name"
33 <xsl:key
34 name="bison:symbolByName"
35 match="/bison-xml-report/grammar/terminals/terminal"
36 use="@name"
38 <xsl:key
39 name="bison:ruleByNumber"
40 match="/bison-xml-report/grammar/rules/rule"
41 use="@number"
43 <xsl:key
44 name="bison:ruleByLhs"
45 match="/bison-xml-report/grammar/rules/rule[
46 @usefulness != 'useless-in-grammar']"
47 use="lhs"
49 <xsl:key
50 name="bison:ruleByRhs"
51 match="/bison-xml-report/grammar/rules/rule[
52 @usefulness != 'useless-in-grammar']"
53 use="rhs/symbol"
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
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])"
75 <xsl:variable
76 name="reduce-count"
77 select="count($reductions/reduction[@symbol=$name])"
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>
93 </xsl:stylesheet>