Skip to content

Commit

Permalink
adapting the Zoo and the Tank to comply with the updated framework
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@1084 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Jun 7, 2011
1 parent ba925b5 commit a210e72
Show file tree
Hide file tree
Showing 9 changed files with 1,996 additions and 1,993 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tankprj:
cp ../topics/convergence/fl/snapshot/*.bgf tank/fl/
cp ../topics/testing/gbtf/tests/tescol/*.bgf tank/tescol/
chmod 644 tank/*/*.bgf
xsltproc _dev/list2makefile.xslt _dev/tank.xml | grep -v 'add tank fl' | grep -v 'add tank tescol' > _dev/Makefile.y
xsltproc _dev/list2makefile.xslt _dev/tank.xml | grep -v 'tank/fl' | grep -v 'tank/tescol' > _dev/Makefile.y
make -f _dev/Makefile.y
xsltproc --stringparam date `date +"%d/%m/%Y"` _dev/list2xhtml.xslt _dev/tank.xml > tank/index.html

Expand Down
25 changes: 0 additions & 25 deletions _dev/add

This file was deleted.

4 changes: 0 additions & 4 deletions _dev/fancy

This file was deleted.

40 changes: 8 additions & 32 deletions _dev/format
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
#!/bin/sh

../shared/tools/bgf2bnf $1/$2/$3.bgf $1/$2/$3.bnf
../shared/tools/bgf2dms $1/$2/$3.bgf $1/$2/$3.dms
../shared/tools/bgf2sdf $1/$2/$3.bgf $1/$2/$3.sdf
../shared/tools/bgf2rsc $1/$2/$3.bgf $1/$2/$3.rsc
if [ $3 == 'iso-23270-2003-recovered' ]; then
_dev/fancy $1 $2 $3 csharp-iso-23270-2003
elif [ $3 == 'jls1-read' ]; then
_dev/fancy $1 $2 $3 jls1
elif [ $3 == 'jls2-read' ]; then
_dev/fancy $1 $2 $3 jls2
elif [ $3 == 'jls3-read' ]; then
_dev/fancy $1 $2 $3 jls3
elif [ $3 == 'jls1-impl' ]; then
_dev/fancy $1 $2 $3 jls1
elif [ $3 == 'jls2-impl' ]; then
_dev/fancy $1 $2 $3 jls2
elif [ $3 == 'jls3-impl' ]; then
_dev/fancy $1 $2 $3 jls3
elif [ $2 == 'java' ]; then
_dev/fancy $1 $2 $3 $2-$3
ls -1 ../topics/grammars/$2/antlr-java-5/$3/*.xbgf | xargs -n1 -I _ basename _ .xbgf | xargs -n1 -I _ ../shared/tools/xbgf2html ../topics/grammars/$2/antlr-java-5/$3/_.xbgf $1/$2/$3-_.html $3.html
elif [ $2 == 'metasyntax' ]; then
_dev/fancy $1 $2 $3 $2-$3
ls -1 ../topics/grammars/$2/$3/*.xbgf | xargs -n1 -I _ basename _ .xbgf | xargs -n1 -I _ ../shared/tools/xbgf2html ../topics/grammars/$2/$3/_.xbgf $1/$2/$3-_.html $3.html
elif [ $1 == 'tank' ]; then
_dev/fancy $1 $2 $3 $2-$3
elif [ -r ../topics/grammars/$2/$3 ]; then
_dev/fancy $1 $2 $3 $2-$3
ls -1 ../topics/grammars/$2/$3/*.xbgf | xargs -n1 -I _ basename _ .xbgf | xargs -n1 -I _ ../shared/tools/xbgf2html ../topics/grammars/$2/$3/_.xbgf $1/$2/$3-_.html $3.html
else
echo Cannot find directory $2/$3
exit -1
../shared/tools/bgf2bnf $1/$2.bgf $1/$2.bnf
../shared/tools/bgf2dms $1/$2.bgf $1/$2.dms
../shared/tools/bgf2sdf $1/$2.bgf $1/$2.sdf
../shared/tools/bgf2rsc $1/$2.bgf $1/$2.rsc
../topics/investigation/analysis/overview_bgf.py $1/$2.bgf >tmp.xml || exit -1
xsltproc --stringparam date `date +"%d/%m/%Y"` --stringparam zoo ../../../www/_dev/$1.xml --stringparam id $3 --stringparam report ../../../www/tmp.xml ../topics/export/hypertext/bgf2fancy.xslt $1/$2.bgf >$1/$2.html || exit -1
if [ -r ../topics/grammars/$3 ]; then
ls -1 ../topics/grammars/$3/*.xbgf | xargs -n1 -I _ basename _ .xbgf | xargs -n1 -I _ ../shared/tools/xbgf2html ../topics/grammars/$3/_.xbgf $1/$2-_.html `basename $2`.html
fi
55 changes: 49 additions & 6 deletions _dev/list2makefile.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,65 @@
</xsl:text>
<xsl:for-each select="language">
<xsl:for-each select="version/grammar">
<xsl:text> _dev/add </xsl:text>
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="../../short">
<xsl:value-of select="handle"/>
</xsl:when>
<xsl:when test="substring-after(handle,concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),'/'))=''">
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(handle,'/','-')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',substring-after(handle,'/')))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text> cp ../topics/grammars/</xsl:text>
<xsl:value-of select="handle"/>
<xsl:text>/grammar.bgf </xsl:text>
<xsl:value-of select="/zoo/name"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>.bgf
_dev/format </xsl:text>
<xsl:value-of select="/zoo/name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="../../handle"/>
<xsl:value-of select="$filename"/>
<xsl:text> </xsl:text>
<xsl:value-of select="handle"/>
<xsl:text>
</xsl:text>
<xsl:text> _dev/format </xsl:text>
</xsl:for-each>
<xsl:for-each select="version/grammarset/grammarname">
<!-- clone! -->
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="../../short">
<xsl:value-of select="concat(translate(../../short,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')))"/>
</xsl:when>
<xsl:when test="../../name">
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>error</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text> cp ../topics/grammars/</xsl:text>
<xsl:value-of select="."/>
<xsl:text>/grammar.bgf </xsl:text>
<xsl:value-of select="/zoo/name"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>.bgf
_dev/format </xsl:text>
<xsl:value-of select="/zoo/name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="../../handle"/>
<xsl:value-of select="$filename"/>
<xsl:text> </xsl:text>
<xsl:value-of select="handle"/>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
Expand Down
156 changes: 114 additions & 42 deletions _dev/list2xhtml.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
</em>
</div>
</xsl:if>
<h2><xsl:value-of select="count(//grammar)"/> grammars and counting</h2>
<h2><xsl:value-of select="count(//grammar)+count(//grammarname)"/> grammars and counting</h2>
<h1>
<a href="#{translate(language[1]/handle,' +#“”','_ps__')}">
<a href="#{translate(language[1]/name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')}">
<xsl:choose>
<xsl:when test="language[1]/short">
<xsl:value-of select="language[1]/short"/>
Expand All @@ -67,7 +67,7 @@
</a>
<xsl:for-each select="language[position()&gt;1]">
<xsl:text> — </xsl:text>
<a href="#{translate(handle,' +#“”','_ps__')}">
<a href="#{translate(name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')}">
<xsl:choose>
<xsl:when test="short">
<xsl:value-of select="short"/>
Expand All @@ -82,7 +82,7 @@
<xsl:for-each select="language">
<hr/>
<h2>
<a name="{translate(handle,' +#“”','_ps__')}"/>
<a name="{translate(name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')}"/>
<xsl:value-of select="name"/>
<br/>
<a href="#{translate(version[1]/name,' +#“”','_ps__')}">
Expand All @@ -99,43 +99,23 @@
<h3>
<a name="{translate(name,' +#“”','_ps__')}"/>
<xsl:value-of select="name"/>
<xsl:if test="count(grammar) &gt; 1">
<xsl:if test="grammarset or count(grammar) &gt; 1">
<em>
<xsl:text> (</xsl:text>
<xsl:value-of select="count(grammar)"/>
<xsl:value-of select="count(grammar)+count(grammarset/grammarname)"/>
<xsl:text> grammars)</xsl:text>
</em>
</xsl:if>
</h3>
<ul>
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="local-name(.)='name'"/>
<xsl:when test="local-name(.)='toolset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/toolset[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='item' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/item[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='itemset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/itemset[@name=$name]/item"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ul>
<xsl:apply-templates select="grammar|grammarset"/>
</xsl:for-each>
</xsl:for-each>
<hr/>
<h3>Appendix: Notations and Formats</h3>
<ul>
<xsl:apply-templates select="/zoo/toolset[@name='export']"/>
<li>
<xsl:text>Browsable:</xsl:text>
<xsl:text>Browsable (hypertext) format:</xsl:text>
<span class="links">
[<a href="http://www.w3.org/TR/xhtml1/">W3C XHTML Rec</a>]
</span>
Expand Down Expand Up @@ -250,7 +230,7 @@
</xsl:template>
<xsl:template match="source">
<li xmlns="http://www.w3.org/1999/xhtml">
<strong>Source: </strong>
<xsl:text>Source: </xsl:text>
<xsl:copy-of select="title/node()"/>
<xsl:if test="date">
<xsl:text> (</xsl:text>
Expand All @@ -267,23 +247,115 @@
</li>
</xsl:template>
<xsl:template match="grammar">
<li xmlns="http://www.w3.org/1999/xhtml">
<xsl:value-of select="name"/>
<xsl:text> grammar: </xsl:text>
<span class="links">
[<a href="{../../handle}/{handle}.html" class="red">Browsable</a>]
[<a href="{../../handle}/{handle}.bgf">BGF</a>]
[<a href="{../../handle}/{handle}.bnf">EBNF</a>]
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="../../short">
<xsl:value-of select="handle"/>
</xsl:when>
<xsl:when test="substring-after(handle,concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),'/'))=''">
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(handle,'/','-')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',substring-after(handle,'/')))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ul xmlns="http://www.w3.org/1999/xhtml">
<xsl:apply-templates select="source"/>
<xsl:if test="handle">
<li>
<xsl:value-of select="name"/>
<xsl:text> grammar: </xsl:text>
<span class="links">
[<a href="{$filename}.html" class="red">Browsable</a>]
[<a href="{$filename}.bgf">BGF</a>]
[<a href="{$filename}.bnf">EBNF</a>]
<!--
<xsl:if test="(../../handle='c') or (../../handle='cpp') or ((../../handle='csharp') and not(handle='iso-23270-2003') and not(handle='iso-23270-2003-recovered'))">
[<a href="{../../handle}/{handle}.lll">LLL</a>]
[<a href="{$filename}.lll">LLL</a>]
</xsl:if>
-->
[<a href="{../../handle}/{handle}.dms">DMS BNF</a>]
[<a href="{../../handle}/{handle}.sdf">SDF</a>]
[<a href="{../../handle}/{handle}.rsc">Rascal</a>]
[<a href="{$filename}.dms">DMS BNF</a>]
[<a href="{$filename}.sdf">SDF</a>]
[<a href="{$filename}.rsc">Rascal</a>]
</span>
</li>
</li>
</xsl:if>
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="local-name(.)='name'"/>
<xsl:when test="local-name(.)='handle'"/>
<xsl:when test="local-name(.)='source'"/>
<xsl:when test="local-name(.)='toolset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/toolset[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='item' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/item[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='itemset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/itemset[@name=$name]/item"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="grammarset">
<!-- clone of match="grammar"!!! -->
<ul xmlns="http://www.w3.org/1999/xhtml">
<xsl:apply-templates select="source"/>
<xsl:for-each select="grammarname">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="../../short">
<xsl:value-of select="concat(translate(../../short,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')))"/>
</xsl:when>
<xsl:when test="../../name">
<xsl:value-of select="concat(translate(../../name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__'),concat('/',translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ +#“”','abcdefghijklmnopqrstuvwxyz_ps__')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>error</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li>
<xsl:value-of select="."/>
<xsl:text> grammar: </xsl:text>
<span class="links">
[<a href="{$filename}.html" class="red">Browsable</a>]
[<a href="{$filename}.bgf">BGF</a>]
[<a href="{$filename}.bnf">EBNF</a>]
[<a href="{$filename}.dms">DMS BNF</a>]
[<a href="{$filename}.sdf">SDF</a>]
[<a href="{$filename}.rsc">Rascal</a>]
</span>
</li>
</xsl:for-each>
<xsl:for-each select="tool|toolset|item|itemset">
<xsl:choose>
<xsl:when test="local-name(.)='toolset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/toolset[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='item' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/item[@name=$name]"/>
</xsl:when>
<xsl:when test="local-name(.)='itemset' and @ref">
<xsl:variable name="name" select="@ref"/>
<xsl:apply-templates select="/zoo/itemset[@name=$name]/item"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="item">
<li xmlns="http://www.w3.org/1999/xhtml">
Expand Down
Loading

0 comments on commit a210e72

Please sign in to comment.