Skip to content

Commit

Permalink
tweaked pretty-printed XBGF and BGF
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@424 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Jan 26, 2009
1 parent 9038500 commit 1d40992
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 13 additions & 4 deletions shared/xsl/bgf2bnf.xslt
Expand Up @@ -14,11 +14,12 @@
</xsl:template>

<xsl:template match="bgf:production">
<xsl:value-of select="./nonterminal"/>
<xsl:if test="./label">
<xsl:text>#</xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="./label"/>
<xsl:text>] </xsl:text>
</xsl:if>
<xsl:value-of select="./nonterminal"/>
<xsl:text>:</xsl:text>
<xsl:choose>
<xsl:when test="./bgf:expression/choice">
Expand All @@ -28,6 +29,13 @@
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:when>
<xsl:when test="./bgf:expression/sequence">
<xsl:text>
</xsl:text>
<xsl:apply-templates select="./bgf:expression/sequence/*"/>
<xsl:text>
</xsl:text>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -57,9 +65,8 @@
</xsl:template>

<xsl:template match="optional">
<xsl:text>[ </xsl:text>
<xsl:apply-templates select="./*"/>
<xsl:text>] </xsl:text>
<xsl:text>? </xsl:text>
</xsl:template>

<xsl:template match="terminal">
Expand Down Expand Up @@ -103,7 +110,9 @@
</xsl:template>

<xsl:template match="sequence">
<xsl:text>( </xsl:text>
<xsl:apply-templates select="./*"/>
<xsl:text>)</xsl:text>
</xsl:template>

<!-- top level choices - one per line -->
Expand Down
6 changes: 4 additions & 2 deletions shared/xsl/xbgf2xbnf.xslt
Expand Up @@ -25,8 +25,9 @@
<xsl:value-of select="$in/nonterminal" />
</xsl:when>
<xsl:when test="$in/label">
<xsl:text> in #</xsl:text>
<xsl:text> in [</xsl:text>
<xsl:value-of select="$in/label" />
<xsl:text>]</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
Expand Down Expand Up @@ -170,8 +171,9 @@
<xsl:text>(</xsl:text>
<xsl:choose>
<xsl:when test="label">
<xsl:text>#</xsl:text>
<xsl:text>[</xsl:text>
<xsl:value-of select="*/text()" />
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:when test="selector">
<xsl:value-of select="*/text()" />
Expand Down

0 comments on commit 1d40992

Please sign in to comment.