]>
git.saurik.com Git - bison.git/blob - data/xslt/bison.xsl
dc0dd9c516dbe2560c6b87d9d5e00816ffe32f92
1 <?xml version=
"1.0" encoding=
"UTF-8"?>
4 bison.xsl - common templates for Bison XSLT.
7 Copyright (C) 2007 Free Software Foundation, Inc.
9 This file is part of Bison, the GNU Compiler Compiler.
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 <xsl:stylesheet version=
"1.0"
26 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
27 xmlns:
bison=
"http://www.gnu.org/software/bison/">
30 name=
"bison:ruleByNumber"
31 match=
"/bison-xml-report/grammar/rules/rule"
35 name=
"bison:ruleByLhs"
36 match=
"/bison-xml-report/grammar/rules/rule[
37 @usefulness != 'useless-in-grammar']"
41 name=
"bison:ruleByRhs"
42 match=
"/bison-xml-report/grammar/rules/rule[
43 @usefulness != 'useless-in-grammar']"
47 <!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
48 <xsl:template match=
"state" mode=
"bison:count-conflicts">
49 <xsl:variable name=
"transitions" select=
"actions/transitions"/>
50 <xsl:variable name=
"reductions" select=
"actions/reductions"/>
54 $transitions/transition[@type='shift']/@symbol
55 | $reductions/reduction/@symbol
58 <xsl:variable name=
"conflict-data">
59 <xsl:for-each select=
"$terminals">
60 <xsl:variable name=
"name" select=
"."/>
61 <xsl:if test=
"generate-id($terminals[. = $name][1]) = generate-id(.)">
64 select=
"count($transitions/transition[@symbol=$name])"
68 select=
"count($reductions/reduction[@symbol=$name])"
70 <xsl:if test=
"$shift-count > 0 and $reduce-count > 0">
71 <xsl:text>s
</xsl:text>
73 <xsl:if test=
"$reduce-count > 1">
74 <xsl:text>r
</xsl:text>
79 <xsl:value-of select=
"string-length(translate($conflict-data, 'r', ''))"/>
80 <xsl:text>,
</xsl:text>
81 <xsl:value-of select=
"string-length(translate($conflict-data, 's', ''))"/>