]>
git.saurik.com Git - bison.git/blob - data/xslt/bison.xsl
6d96e014ae64be1ab20b79187132b233c15ca13e
1 <?xml version=
"1.0" encoding=
"UTF-8"?>
4 bison.xsl - common templates for Bison XSLT.
5 Copyright (C) 2007 Free Software Foundation, Inc.
7 This file is part of Bison, the GNU Compiler Compiler.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 <xsl:stylesheet version=
"1.0"
24 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
25 xmlns:
bison=
"http://www.gnu.org/software/bison/">
27 <!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
28 <xsl:template match=
"state" mode=
"bison:count-conflicts">
29 <xsl:variable name=
"transitions" select=
"actions/transitions"/>
30 <xsl:variable name=
"reductions" select=
"actions/reductions"/>
34 $transitions/transition[@type='shift']/@symbol
35 | $reductions/reduction/@symbol
38 <xsl:variable name=
"conflict-data">
39 <xsl:for-each select=
"$terminals">
40 <xsl:variable name=
"name" select=
"."/>
41 <xsl:if test=
"generate-id($terminals[. = $name][1]) = generate-id(.)">
44 select=
"count($transitions/transition[@symbol=$name])"
48 select=
"count($reductions/reduction[@symbol=$name])"
50 <xsl:if test=
"$shift-count > 0 and $reduce-count > 0">
51 <xsl:text>s
</xsl:text>
53 <xsl:if test=
"$reduce-count > 1">
54 <xsl:text>r
</xsl:text>
59 <xsl:value-of select=
"string-length(translate($conflict-data, 'r', ''))"/>
60 <xsl:text>,
</xsl:text>
61 <xsl:value-of select=
"string-length(translate($conflict-data, 's', ''))"/>