]>
git.saurik.com Git - bison.git/blob - data/xslt/bison.xsl
b5d163d3ce2f49c6a30fcd3f1d204280f68c9f9a
1 <?xml version=
"1.0" encoding=
"UTF-8"?>
4 bison.xsl - common templates for Bison XSLT.
6 Copyright (C) 2007-2010 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/>.
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/">
29 name=
"bison:symbolByName"
30 match=
"/bison-xml-report/grammar/nonterminals/nonterminal"
34 name=
"bison:symbolByName"
35 match=
"/bison-xml-report/grammar/terminals/terminal"
39 name=
"bison:ruleByNumber"
40 match=
"/bison-xml-report/grammar/rules/rule"
44 name=
"bison:ruleByLhs"
45 match=
"/bison-xml-report/grammar/rules/rule[
46 @usefulness != 'useless-in-grammar']"
50 name=
"bison:ruleByRhs"
51 match=
"/bison-xml-report/grammar/rules/rule[
52 @usefulness != 'useless-in-grammar']"
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"/>
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(.)">
73 select=
"count($transitions/transition[@symbol=$name])"
77 select=
"count($reductions/reduction[@symbol=$name])"
79 <xsl:if test=
"$shift-count > 0 and $reduce-count > 0">
80 <xsl:text>s
</xsl:text>
82 <xsl:if test=
"$reduce-count > 1">
83 <xsl:text>r
</xsl:text>
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', ''))"/>