1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- 4 xml2html.xsl - transform Bison XML Report into XHTML. 5 6 Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc. 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 <https://www.gnu.org/licenses/>. 22 23 Written by Wojciech Polak <[email protected]>. 24 --> 25 26<xsl:stylesheet version="1.0" 27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 28 xmlns="http://www.w3.org/1999/xhtml" 29 xmlns:bison="https://www.gnu.org/software/bison/"> 30 31<xsl:import href="bison.xsl"/> 32 33<xsl:output method="xml" encoding="UTF-8" 34 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 35 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 36 indent="yes"/> 37 38<xsl:template match="/"> 39 <html> 40 <head> 41 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> 42 <title> 43 <xsl:value-of select="bison-xml-report/filename"/> 44 <xsl:text> - GNU Bison XML Automaton Report</xsl:text> 45 </title> 46 <style type="text/css"><![CDATA[ 47 body { 48 font-family: "Nimbus Sans L", Arial, sans-serif; 49 font-size: 9pt; 50 } 51 a:link { 52 color: #1f00ff; 53 text-decoration: none; 54 } 55 a:visited { 56 color: #1f00ff; 57 text-decoration: none; 58 } 59 a:hover { 60 color: red; 61 } 62 #menu a { 63 text-decoration: underline; 64 } 65 .i { 66 font-style: italic; 67 } 68 .pre { 69 font-family: monospace; 70 white-space: pre; 71 } 72 ol.decimal { 73 list-style-type: decimal; 74 } 75 ol.lower-alpha { 76 list-style-type: lower-alpha; 77 } 78 .dot { 79 color: #cc0000; 80 } 81 #footer { 82 margin-top: 3.5em; 83 font-size: 7pt; 84 } 85 ]]></style> 86 </head> 87 <body> 88 <xsl:apply-templates select="bison-xml-report"/> 89 <xsl:text> </xsl:text> 90 <div id="footer"><hr />This document was generated using 91 <a href="https://www.gnu.org/software/bison/" title="GNU Bison"> 92 GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a> 93 XML Automaton Report.<br /> 94 <!-- default copying notice --> 95 Verbatim copying and distribution of this entire page is 96 permitted in any medium, provided this notice is preserved.</div> 97 </body> 98 </html> 99</xsl:template> 100 101<xsl:template match="bison-xml-report"> 102 <h1>GNU Bison XML Automaton Report</h1> 103 <p> 104 input grammar: <span class="i"><xsl:value-of select="filename"/></span> 105 </p> 106 107 <xsl:text> </xsl:text> 108 <h3>Table of Contents</h3> 109 <ul id="menu"> 110 <li> 111 <a href="#reductions">Reductions</a> 112 <ul class="lower-alpha"> 113 <li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li> 114 <li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li> 115 <li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li> 116 <xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']"> 117 <li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li> 118 </xsl:if> 119 </ul> 120 </li> 121 <li><a href="#conflicts">Conflicts</a></li> 122 <li> 123 <a href="#grammar">Grammar</a> 124 <ul class="lower-alpha"> 125 <li><a href="#grammar">Itemset</a></li> 126 <li><a href="#terminals">Terminal symbols</a></li> 127 <li><a href="#nonterminals">Nonterminal symbols</a></li> 128 </ul> 129 </li> 130 <li><a href="#automaton">Automaton</a></li> 131 </ul> 132 <xsl:apply-templates select="grammar" mode="reductions"/> 133 <xsl:apply-templates select="grammar" mode="useless-in-parser"/> 134 <xsl:apply-templates select="automaton" mode="conflicts"/> 135 <xsl:apply-templates select="grammar"/> 136 <xsl:apply-templates select="automaton"/> 137</xsl:template> 138 139<xsl:template match="grammar" mode="reductions"> 140 <h2> 141 <a name="reductions"/> 142 <xsl:text> Reductions</xsl:text> 143 </h2> 144 <xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/> 145 <xsl:apply-templates select="terminals" mode="unused-in-grammar"/> 146 <xsl:apply-templates select="rules" mode="useless-in-grammar"/> 147</xsl:template> 148 149<xsl:template match="nonterminals" mode="useless-in-grammar"> 150 <h3> 151 <a name="nonterminals_useless_in_grammar"/> 152 <xsl:text> Nonterminals useless in grammar</xsl:text> 153 </h3> 154 <xsl:text> </xsl:text> 155 <xsl:if test="nonterminal[@usefulness='useless-in-grammar']"> 156 <p class="pre"> 157 <xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']"> 158 <xsl:text> </xsl:text> 159 <xsl:value-of select="@name"/> 160 <xsl:text> </xsl:text> 161 </xsl:for-each> 162 <xsl:text> </xsl:text> 163 </p> 164 </xsl:if> 165</xsl:template> 166 167<xsl:template match="terminals" mode="unused-in-grammar"> 168 <h3> 169 <a name="terminals_unused_in_grammar"/> 170 <xsl:text> Terminals unused in grammar</xsl:text> 171 </h3> 172 <xsl:text> </xsl:text> 173 <xsl:if test="terminal[@usefulness='unused-in-grammar']"> 174 <p class="pre"> 175 <xsl:for-each select="terminal[@usefulness='unused-in-grammar']"> 176 <xsl:sort select="@symbol-number" data-type="number"/> 177 <xsl:text> </xsl:text> 178 <xsl:value-of select="@name"/> 179 <xsl:text> </xsl:text> 180 </xsl:for-each> 181 <xsl:text> </xsl:text> 182 </p> 183 </xsl:if> 184</xsl:template> 185 186<xsl:template match="rules" mode="useless-in-grammar"> 187 <h3> 188 <a name="rules_useless_in_grammar"/> 189 <xsl:text> Rules useless in grammar</xsl:text> 190 </h3> 191 <xsl:text> </xsl:text> 192 <xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/> 193 <xsl:if test="$set"> 194 <p class="pre"> 195 <xsl:call-template name="style-rule-set"> 196 <xsl:with-param name="rule-set" select="$set"/> 197 </xsl:call-template> 198 <xsl:text> </xsl:text> 199 </p> 200 </xsl:if> 201</xsl:template> 202 203<xsl:template match="grammar" mode="useless-in-parser"> 204 <xsl:variable 205 name="set" select="rules/rule[@usefulness='useless-in-parser']" 206 /> 207 <xsl:if test="$set"> 208 <h2> 209 <a name="rules_useless_in_parser"/> 210 <xsl:text> Rules useless in parser due to conflicts</xsl:text> 211 </h2> 212 <xsl:text> </xsl:text> 213 <p class="pre"> 214 <xsl:call-template name="style-rule-set"> 215 <xsl:with-param name="rule-set" select="$set"/> 216 </xsl:call-template> 217 </p> 218 <xsl:text> </xsl:text> 219 </xsl:if> 220</xsl:template> 221 222<xsl:template match="grammar"> 223 <h2> 224 <a name="grammar"/> 225 <xsl:text> Grammar</xsl:text> 226 </h2> 227 <xsl:text> </xsl:text> 228 <p class="pre"> 229 <xsl:call-template name="style-rule-set"> 230 <xsl:with-param name="anchor" select="'true'" /> 231 <xsl:with-param 232 name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']" 233 /> 234 </xsl:call-template> 235 </p> 236 <xsl:text> </xsl:text> 237 <xsl:apply-templates select="terminals"/> 238 <xsl:apply-templates select="nonterminals"/> 239</xsl:template> 240 241<xsl:template name="style-rule-set"> 242 <xsl:param name="anchor"/> 243 <xsl:param name="rule-set"/> 244 <xsl:for-each select="$rule-set"> 245 <xsl:apply-templates select="."> 246 <xsl:with-param name="anchor" select="$anchor"/> 247 <xsl:with-param name="pad" select="'3'"/> 248 <xsl:with-param name="prev-lhs"> 249 <xsl:if test="position()>1"> 250 <xsl:variable name="position" select="position()"/> 251 <xsl:value-of select="$rule-set[$position - 1]/lhs"/> 252 </xsl:if> 253 </xsl:with-param> 254 </xsl:apply-templates> 255 </xsl:for-each> 256</xsl:template> 257 258<xsl:template match="automaton" mode="conflicts"> 259 <h2> 260 <a name="conflicts"/> 261 <xsl:text> Conflicts</xsl:text> 262 </h2> 263 <xsl:text> </xsl:text> 264 <xsl:variable name="conflict-report"> 265 <xsl:apply-templates select="state" mode="conflicts"/> 266 </xsl:variable> 267 <xsl:if test="string-length($conflict-report) != 0"> 268 <p class="pre"> 269 <xsl:copy-of select="$conflict-report"/> 270 <xsl:text> </xsl:text> 271 </p> 272 </xsl:if> 273</xsl:template> 274 275<xsl:template match="state" mode="conflicts"> 276 <xsl:variable name="conflict-counts"> 277 <xsl:apply-templates select="." mode="bison:count-conflicts" /> 278 </xsl:variable> 279 <xsl:variable 280 name="sr-count" select="substring-before($conflict-counts, ',')" 281 /> 282 <xsl:variable 283 name="rr-count" select="substring-after($conflict-counts, ',')" 284 /> 285 <xsl:if test="$sr-count > 0 or $rr-count > 0"> 286 <a> 287 <xsl:attribute name="href"> 288 <xsl:value-of select="concat('#state_', @number)"/> 289 </xsl:attribute> 290 <xsl:value-of select="concat('State ', @number)"/> 291 </a> 292 <xsl:text> conflicts:</xsl:text> 293 <xsl:if test="$sr-count > 0"> 294 <xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/> 295 <xsl:if test="$rr-count > 0"> 296 <xsl:value-of select="(',')"/> 297 </xsl:if> 298 </xsl:if> 299 <xsl:if test="$rr-count > 0"> 300 <xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/> 301 </xsl:if> 302 <xsl:value-of select="' '"/> 303 </xsl:if> 304</xsl:template> 305 306<xsl:template match="grammar/terminals"> 307 <h3> 308 <a name="terminals"/> 309 <xsl:text> Terminals, with rules where they appear</xsl:text> 310 </h3> 311 <xsl:text> </xsl:text> 312 <ul> 313 <xsl:text> </xsl:text> 314 <xsl:apply-templates select="terminal"/> 315 </ul> 316 <xsl:text> </xsl:text> 317</xsl:template> 318 319<xsl:template match="grammar/nonterminals"> 320 <h3> 321 <a name="nonterminals"/> 322 <xsl:text> Nonterminals, with rules where they appear</xsl:text> 323 </h3> 324 <xsl:text> </xsl:text> 325 <ul> 326 <xsl:text> </xsl:text> 327 <xsl:apply-templates 328 select="nonterminal[@usefulness!='useless-in-grammar']" 329 /> 330 </ul> 331</xsl:template> 332 333<xsl:template match="terminal"> 334 <xsl:text> </xsl:text> 335 <li> 336 <b><xsl:value-of select="@name"/></b> 337 <xsl:if test="string-length(@type) != 0"> 338 <xsl:value-of select="concat(' <', @type, '>')"/> 339 </xsl:if> 340 <xsl:value-of select="concat(' (', @token-number, ')')"/> 341 <xsl:for-each select="key('bison:ruleByRhs', @name)"> 342 <xsl:apply-templates select="." mode="number-link"/> 343 </xsl:for-each> 344 </li> 345 <xsl:text> </xsl:text> 346</xsl:template> 347 348<xsl:template match="nonterminal"> 349 <xsl:text> </xsl:text> 350 <li> 351 <b><xsl:value-of select="@name"/></b> 352 <xsl:if test="string-length(@type) != 0"> 353 <xsl:value-of select="concat(' <', @type, '>')"/> 354 </xsl:if> 355 <xsl:value-of select="concat(' (', @symbol-number, ')')"/> 356 <xsl:text> </xsl:text> 357 <ul> 358 <xsl:text> </xsl:text> 359 <xsl:if test="key('bison:ruleByLhs', @name)"> 360 <xsl:text> </xsl:text> 361 <li> 362 <xsl:text>on left:</xsl:text> 363 <xsl:for-each select="key('bison:ruleByLhs', @name)"> 364 <xsl:apply-templates select="." mode="number-link"/> 365 </xsl:for-each> 366 </li> 367 <xsl:text> </xsl:text> 368 </xsl:if> 369 <xsl:if test="key('bison:ruleByRhs', @name)"> 370 <xsl:text> </xsl:text> 371 <li> 372 <xsl:text>on right:</xsl:text> 373 <xsl:for-each select="key('bison:ruleByRhs', @name)"> 374 <xsl:apply-templates select="." mode="number-link"/> 375 </xsl:for-each> 376 </li> 377 <xsl:text> </xsl:text> 378 </xsl:if> 379 <xsl:text> </xsl:text> 380 </ul> 381 <xsl:text> </xsl:text> 382 </li> 383 <xsl:text> </xsl:text> 384</xsl:template> 385 386<xsl:template match="rule" mode="number-link"> 387 <xsl:text> </xsl:text> 388 <a> 389 <xsl:attribute name="href"> 390 <xsl:value-of select="concat('#rule_', @number)"/> 391 </xsl:attribute> 392 <xsl:value-of select="@number"/> 393 </a> 394</xsl:template> 395 396<xsl:template match="automaton"> 397 <h2> 398 <a name="automaton"/> 399 <xsl:text> Automaton</xsl:text> 400 </h2> 401 <xsl:apply-templates select="state"> 402 <xsl:with-param name="pad" select="'3'"/> 403 </xsl:apply-templates> 404</xsl:template> 405 406<xsl:template match="automaton/state"> 407 <xsl:param name="pad"/> 408 <xsl:text> </xsl:text> 409 <h3> 410 <a> 411 <xsl:attribute name="name"> 412 <xsl:value-of select="concat('state_', @number)"/> 413 </xsl:attribute> 414 </a> 415 <xsl:text>State </xsl:text> 416 <xsl:value-of select="@number"/> 417 </h3> 418 <xsl:text> </xsl:text> 419 <p class="pre"> 420 <xsl:apply-templates select="itemset/item"> 421 <xsl:with-param name="pad" select="$pad"/> 422 </xsl:apply-templates> 423 <xsl:apply-templates select="actions/transitions"> 424 <xsl:with-param name="type" select="'shift'"/> 425 </xsl:apply-templates> 426 <xsl:apply-templates select="actions/errors"/> 427 <xsl:apply-templates select="actions/reductions"/> 428 <xsl:apply-templates select="actions/transitions"> 429 <xsl:with-param name="type" select="'goto'"/> 430 </xsl:apply-templates> 431 <xsl:apply-templates select="solved-conflicts"/> 432 </p> 433</xsl:template> 434 435<xsl:template match="actions/transitions"> 436 <xsl:param name="type"/> 437 <xsl:if test="transition[@type = $type]"> 438 <xsl:text> </xsl:text> 439 <xsl:apply-templates select="transition[@type = $type]"> 440 <xsl:with-param name="pad"> 441 <xsl:call-template name="max-width-symbol"> 442 <xsl:with-param name="node" select="transition[@type = $type]"/> 443 </xsl:call-template> 444 </xsl:with-param> 445 </xsl:apply-templates> 446 </xsl:if> 447</xsl:template> 448 449<xsl:template match="actions/errors"> 450 <xsl:if test="error"> 451 <xsl:text> </xsl:text> 452 <xsl:apply-templates select="error"> 453 <xsl:with-param name="pad"> 454 <xsl:call-template name="max-width-symbol"> 455 <xsl:with-param name="node" select="error"/> 456 </xsl:call-template> 457 </xsl:with-param> 458 </xsl:apply-templates> 459 </xsl:if> 460</xsl:template> 461 462<xsl:template match="actions/reductions"> 463 <xsl:if test="reduction"> 464 <xsl:text> </xsl:text> 465 <xsl:apply-templates select="reduction"> 466 <xsl:with-param name="pad"> 467 <xsl:call-template name="max-width-symbol"> 468 <xsl:with-param name="node" select="reduction"/> 469 </xsl:call-template> 470 </xsl:with-param> 471 </xsl:apply-templates> 472 </xsl:if> 473</xsl:template> 474 475<xsl:template match="item"> 476 <xsl:param name="pad"/> 477 <xsl:param name="prev-rule-number" 478 select="preceding-sibling::item[1]/@rule-number"/> 479 <xsl:apply-templates 480 select="key('bison:ruleByNumber', current()/@rule-number)" 481 > 482 <xsl:with-param name="itemset" select="'true'"/> 483 <xsl:with-param name="pad" select="$pad"/> 484 <xsl:with-param name="prev-lhs" 485 select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]" 486 /> 487 <xsl:with-param name="dot" select="@dot"/> 488 <xsl:with-param name="lookaheads"> 489 <xsl:apply-templates select="lookaheads"/> 490 </xsl:with-param> 491 </xsl:apply-templates> 492</xsl:template> 493 494<!-- 495anchor = 'true': define as an <a> anchor. 496itemset = 'true': show the items. 497 --> 498<xsl:template match="rule"> 499 <xsl:param name="anchor"/> 500 <xsl:param name="itemset"/> 501 <xsl:param name="pad"/> 502 <xsl:param name="prev-lhs"/> 503 <xsl:param name="dot"/> 504 <xsl:param name="lookaheads"/> 505 506 <xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])"> 507 <xsl:text> </xsl:text> 508 </xsl:if> 509 510 <xsl:text> </xsl:text> 511 512 <xsl:choose> 513 <xsl:when test="$anchor = 'true'"> 514 <a> 515 <xsl:attribute name="name"> 516 <xsl:value-of select="concat('rule_', @number)"/> 517 </xsl:attribute> 518 <xsl:call-template name="lpad"> 519 <xsl:with-param name="str" select="string(@number)"/> 520 <xsl:with-param name="pad" select="number($pad)"/> 521 </xsl:call-template> 522 </a> 523 </xsl:when> 524 <xsl:otherwise> 525 <a> 526 <xsl:attribute name="href"> 527 <xsl:value-of select="concat('#rule_', @number)"/> 528 </xsl:attribute> 529 <xsl:call-template name="lpad"> 530 <xsl:with-param name="str" select="string(@number)"/> 531 <xsl:with-param name="pad" select="number($pad)"/> 532 </xsl:call-template> 533 </a> 534 </xsl:otherwise> 535 </xsl:choose> 536 <xsl:text> </xsl:text> 537 538 <!-- LHS --> 539 <xsl:choose> 540 <xsl:when test="$prev-lhs = lhs[text()]"> 541 <xsl:call-template name="lpad"> 542 <xsl:with-param name="str" select="'|'"/> 543 <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/> 544 </xsl:call-template> 545 </xsl:when> 546 <xsl:otherwise> 547 <span class="i"> 548 <xsl:value-of select="lhs"/> 549 </span> 550 <xsl:text> →</xsl:text> 551 </xsl:otherwise> 552 </xsl:choose> 553 554 <!-- RHS --> 555 <xsl:for-each select="rhs/*"> 556 <xsl:if test="position() = $dot + 1"> 557 <xsl:text> </xsl:text> 558 <span class="dot">•</span> 559 </xsl:if> 560 <xsl:apply-templates select="."/> 561 <xsl:if test="position() = last() and position() = $dot"> 562 <xsl:text> </xsl:text> 563 <span class="dot">•</span> 564 </xsl:if> 565 </xsl:for-each> 566 <xsl:if test="$lookaheads"> 567 <xsl:value-of select="$lookaheads"/> 568 </xsl:if> 569 570 <xsl:text> </xsl:text> 571</xsl:template> 572 573<xsl:template match="symbol"> 574 <xsl:text> </xsl:text> 575 <xsl:choose> 576 <xsl:when test="name(key('bison:symbolByName', .)) = 'nonterminal'"> 577 <span class="i"><xsl:value-of select="."/></span> 578 </xsl:when> 579 <xsl:otherwise> 580 <b><xsl:value-of select="."/></b> 581 </xsl:otherwise> 582 </xsl:choose> 583</xsl:template> 584 585<xsl:template match="empty"> 586 <xsl:text> %empty</xsl:text> 587</xsl:template> 588 589<xsl:template match="lookaheads"> 590 <xsl:text> [</xsl:text> 591 <xsl:apply-templates select="symbol"/> 592 <xsl:text>]</xsl:text> 593</xsl:template> 594 595<xsl:template match="lookaheads/symbol"> 596 <xsl:value-of select="."/> 597 <xsl:if test="position() != last()"> 598 <xsl:text>, </xsl:text> 599 </xsl:if> 600</xsl:template> 601 602<xsl:template match="transition"> 603 <xsl:param name="pad"/> 604 <xsl:text> </xsl:text> 605 <xsl:call-template name="rpad"> 606 <xsl:with-param name="str" select="string(@symbol)"/> 607 <xsl:with-param name="pad" select="number($pad) + 2"/> 608 </xsl:call-template> 609 <xsl:choose> 610 <xsl:when test="@type = 'shift'"> 611 <a> 612 <xsl:attribute name="href"> 613 <xsl:value-of select="concat('#state_', @state)"/> 614 </xsl:attribute> 615 <xsl:value-of select="concat('shift, and go to state ', @state)"/> 616 </a> 617 </xsl:when> 618 <xsl:when test="@type = 'goto'"> 619 <a> 620 <xsl:attribute name="href"> 621 <xsl:value-of select="concat('#state_', @state)"/> 622 </xsl:attribute> 623 <xsl:value-of select="concat('go to state ', @state)"/> 624 </a> 625 </xsl:when> 626 </xsl:choose> 627 <xsl:text> </xsl:text> 628</xsl:template> 629 630<xsl:template match="error"> 631 <xsl:param name="pad"/> 632 <xsl:text> </xsl:text> 633 <xsl:call-template name="rpad"> 634 <xsl:with-param name="str" select="string(@symbol)"/> 635 <xsl:with-param name="pad" select="number($pad) + 2"/> 636 </xsl:call-template> 637 <xsl:text>error</xsl:text> 638 <xsl:text> (</xsl:text> 639 <xsl:value-of select="text()"/> 640 <xsl:text>)</xsl:text> 641 <xsl:text> </xsl:text> 642</xsl:template> 643 644<xsl:template match="reduction"> 645 <xsl:param name="pad"/> 646 <xsl:text> </xsl:text> 647 <xsl:call-template name="rpad"> 648 <xsl:with-param name="str" select="string(@symbol)"/> 649 <xsl:with-param name="pad" select="number($pad) + 2"/> 650 </xsl:call-template> 651 <xsl:if test="@enabled = 'false'"> 652 <xsl:text>[</xsl:text> 653 </xsl:if> 654 <xsl:choose> 655 <xsl:when test="@rule = 'accept'"> 656 <xsl:text>accept</xsl:text> 657 </xsl:when> 658 <xsl:otherwise> 659 <a> 660 <xsl:attribute name="href"> 661 <xsl:value-of select="concat('#rule_', @rule)"/> 662 </xsl:attribute> 663 <xsl:value-of select="concat('reduce using rule ', @rule)"/> 664 </a> 665 <xsl:text> (</xsl:text> 666 <xsl:value-of 667 select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]" 668 /> 669 <xsl:text>)</xsl:text> 670 </xsl:otherwise> 671 </xsl:choose> 672 <xsl:if test="@enabled = 'false'"> 673 <xsl:text>]</xsl:text> 674 </xsl:if> 675 <xsl:text> </xsl:text> 676</xsl:template> 677 678<xsl:template match="solved-conflicts"> 679 <xsl:if test="resolution"> 680 <xsl:text> </xsl:text> 681 <xsl:apply-templates select="resolution"/> 682 </xsl:if> 683</xsl:template> 684 685<xsl:template match="resolution"> 686 <xsl:text> Conflict between </xsl:text> 687 <a> 688 <xsl:attribute name="href"> 689 <xsl:value-of select="concat('#rule_', @rule)"/> 690 </xsl:attribute> 691 <xsl:value-of select="concat('rule ',@rule)"/> 692 </a> 693 <xsl:text> and token </xsl:text> 694 <xsl:value-of select="@symbol"/> 695 <xsl:text> resolved as </xsl:text> 696 <xsl:if test="@type = 'error'"> 697 <xsl:text>an </xsl:text> 698 </xsl:if> 699 <xsl:value-of select="@type"/> 700 <xsl:text> (</xsl:text> 701 <xsl:value-of select="."/> 702 <xsl:text>). </xsl:text> 703</xsl:template> 704 705<xsl:template name="max-width-symbol"> 706 <xsl:param name="node"/> 707 <xsl:variable name="longest"> 708 <xsl:for-each select="$node"> 709 <xsl:sort data-type="number" select="string-length(@symbol)" 710 order="descending"/> 711 <xsl:if test="position() = 1"> 712 <xsl:value-of select="string-length(@symbol)"/> 713 </xsl:if> 714 </xsl:for-each> 715 </xsl:variable> 716 <xsl:value-of select="$longest"/> 717</xsl:template> 718 719<xsl:template name="lpad"> 720 <xsl:param name="str" select="''"/> 721 <xsl:param name="pad" select="0"/> 722 <xsl:variable name="diff" select="$pad - string-length($str)" /> 723 <xsl:choose> 724 <xsl:when test="$diff < 0"> 725 <xsl:value-of select="$str"/> 726 </xsl:when> 727 <xsl:otherwise> 728 <xsl:call-template name="space"> 729 <xsl:with-param name="repeat" select="$diff"/> 730 </xsl:call-template> 731 <xsl:value-of select="$str"/> 732 </xsl:otherwise> 733 </xsl:choose> 734</xsl:template> 735 736<xsl:template name="rpad"> 737 <xsl:param name="str" select="''"/> 738 <xsl:param name="pad" select="0"/> 739 <xsl:variable name="diff" select="$pad - string-length($str)"/> 740 <xsl:choose> 741 <xsl:when test="$diff < 0"> 742 <xsl:value-of select="$str"/> 743 </xsl:when> 744 <xsl:otherwise> 745 <xsl:value-of select="$str"/> 746 <xsl:call-template name="space"> 747 <xsl:with-param name="repeat" select="$diff"/> 748 </xsl:call-template> 749 </xsl:otherwise> 750 </xsl:choose> 751</xsl:template> 752 753<xsl:template name="space"> 754 <xsl:param name="repeat">0</xsl:param> 755 <xsl:param name="fill" select="' '"/> 756 <xsl:if test="number($repeat) >= 1"> 757 <xsl:call-template name="space"> 758 <xsl:with-param name="repeat" select="$repeat - 1"/> 759 <xsl:with-param name="fill" select="$fill"/> 760 </xsl:call-template> 761 <xsl:value-of select="$fill"/> 762 </xsl:if> 763</xsl:template> 764 765</xsl:stylesheet> 766