2007-10-11 change, the child elements here are items not rules.
(<xsl:template match="item"): New.
(xsl:template match="rule"): Update for new reduced itemset.
(xsl:template match="point"): Remove.
(xsl:template match="empty"): For consistency with --graph, don't
output "/* empty */".
* data/xslt/xml2text.xsl (xsl:template match="terminal"): When invoking
line-wrap, don't pass a negative value as first-line-length since this
won't work with the following changes.
(xsl:template name="line-wrap"): Simplify slightly.
(xsl:template name="ws-search"): Eliminate recursion.
* src/print_graph.c (print_core): Don't print a reduction's lookahead
set next to an item whose dot is not at the end of the RHS even if it
happens to be associated with the same rule.
+2007-10-21 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * data/xslt/xml2dot.xsl (xsl:template match="automaton/state"): After
+ 2007-10-11 change, the child elements here are items not rules.
+ (<xsl:template match="item"): New.
+ (xsl:template match="rule"): Update for new reduced itemset.
+ (xsl:template match="point"): Remove.
+ (xsl:template match="empty"): For consistency with --graph, don't
+ output "/* empty */".
+ * data/xslt/xml2text.xsl (xsl:template match="terminal"): When invoking
+ line-wrap, don't pass a negative value as first-line-length since this
+ won't work with the following changes.
+ (xsl:template name="line-wrap"): Simplify slightly.
+ (xsl:template name="ws-search"): Eliminate recursion.
+ * src/print_graph.c (print_core): Don't print a reduction's lookahead
+ set next to an item whose dot is not at the end of the RHS even if it
+ happens to be associated with the same rule.
+
2007-10-19 Joel E. Denny <jdenny@ces.clemson.edu>
Add %define lr.keep_unreachable_states.
-->
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:bison="http://www.gnu.org/software/bison/">
+
+<xsl:import href="bison.xsl"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:with-param name="number" select="@number"/>
<xsl:with-param name="label">
<xsl:value-of select="@number"/>
- <xsl:apply-templates select="itemset/rule"/>
+ <xsl:apply-templates select="itemset/item"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="actions/transitions"/>
<xsl:apply-templates select="transition"/>
</xsl:template>
+<xsl:template match="item">
+ <xsl:apply-templates select="key('bison:ruleNumber', @rule-number)">
+ <xsl:with-param name="point" select="@point"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="lookaheads"/>
+</xsl:template>
+
<xsl:template match="rule">
+ <xsl:param name="point"/>
<xsl:text> </xsl:text>
<xsl:value-of select="lhs"/>
<xsl:text> -></xsl:text>
- <xsl:apply-templates select="rhs/symbol|rhs/point|rhs/empty"/>
- <xsl:apply-templates select="lookaheads"/>
+ <xsl:if test="$point = 0">
+ <xsl:text> .</xsl:text>
+ </xsl:if>
+ <xsl:for-each select="rhs/symbol|rhs/empty">
+ <xsl:apply-templates select="."/>
+ <xsl:if test="$point = position()">
+ <xsl:text> .</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
</xsl:template>
<xsl:template match="symbol">
<xsl:value-of select="."/>
</xsl:template>
-<xsl:template match="point">
- <xsl:text> .</xsl:text>
-</xsl:template>
-
-<xsl:template match="empty">
- <xsl:text> /* empty */</xsl:text>
-</xsl:template>
+<xsl:template match="empty"/>
<xsl:template match="lookaheads">
<xsl:text>[</xsl:text>
<xsl:template match="terminal">
<xsl:value-of select="@name"/>
<xsl:call-template name="line-wrap">
- <xsl:with-param
- name="first-line-length" select="66 - string-length(@name)"
- />
+ <xsl:with-param name="first-line-length">
+ <xsl:choose>
+ <xsl:when test="string-length(@name) > 66">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="66 - string-length(@name)" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
<xsl:with-param name="line-length" select="66" />
<xsl:with-param name="text">
<xsl:value-of select="concat(' (', @number, ')')"/>
<xsl:param name="first-line-length" select="$line-length"/>
<xsl:param name="text"/> <!-- required -->
<xsl:choose>
- <xsl:when test="string-length($text) = 0 or normalize-space($text) = ''" />
+ <xsl:when test="normalize-space($text) = ''" />
<xsl:when test="string-length($text) <= $first-line-length">
<xsl:value-of select="concat($text, ' ')" />
</xsl:when>
<xsl:variable name="break-pos">
<xsl:call-template name="ws-search">
<xsl:with-param name="text" select="$text" />
- <xsl:with-param name="pos" select="$first-line-length+1" />
+ <xsl:with-param name="start" select="$first-line-length+1" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="substring($text, 1, $break-pos - 1)" />
<xsl:template name="ws-search">
<xsl:param name="text"/> <!-- required -->
- <xsl:param name="pos"/> <!-- required -->
+ <xsl:param name="start"/> <!-- required -->
+ <xsl:variable name="search-text" select="substring($text, $start)" />
<xsl:choose>
- <xsl:when
- test="$pos > string-length($text) or substring($text, $pos, 1) = ' '"
- >
- <xsl:value-of select="$pos" />
+ <xsl:when test="not(contains($search-text, ' '))">
+ <xsl:value-of select="string-length($text)+1" />
</xsl:when>
<xsl:otherwise>
- <xsl:call-template name="ws-search">
- <xsl:with-param name="text" select="$text" />
- <xsl:with-param name="pos" select="$pos+1" />
- </xsl:call-template>
+ <xsl:value-of
+ select="$start + string-length(substring-before($search-text, ' '))"
+ />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
obstack_fgrow1 (oout, " %s", symbols[*sp]->tag);
/* Experimental feature: display the lookahead tokens. */
- if (report_flag & report_lookahead_tokens)
+ if (report_flag & report_lookahead_tokens
+ && item_number_is_rule_number (*sp1))
{
/* Find the reduction we are handling. */
reductions *reds = s->reductions;