Update of /cvsroot/qooxdoo/qooxdoo/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30517/tools
Added Files:
Tag: renderer
compileng_compress.xsl compileng_methods.xsl
Log Message:
Some new stuff
--- NEW FILE: compileng_compress.xsl ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
<xsl:output method="text" version="1.0" encoding="iso-8859-1"/>
<xsl:template match="/">
<result>
<xsl:apply-templates/>
</result>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template match="block">
<xsl:apply-templates/>
<xsl:if test="parent::casecontent or count(following-sibling::*) > 0">
<xsl:text>;
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="commandgroup">
<xsl:text>{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="preceding-sibling::*[position()=1 and name() = 'protected' and @detail = 'DO'] and following-sibling::*[position()=1 and name() = 'protected' and @detail = 'WHILE']">
<!-- PASS: Do-While -->
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and name() != 'token' and not(@detail = 'ELSE' or @detail = 'CATCH' or @detail = 'FINALLY')]">
<xsl:text>;
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="argumentgroup">
<xsl:text>(</xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
<xsl:if test="following-sibling::*[position()=1 and (name() = 'namegroup' or (name() = 'protected' and not(@detail = 'ELSE' or @detail = 'IN')))]">
<xsl:text>;
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="accessgroup">
<xsl:text>[</xsl:text>
<xsl:apply-templates/>
<xsl:text>]</xsl:text>
<xsl:if test="count(following-sibling::*) > 0 and following-sibling::*[position()=1 and ((name() = 'protected' and not(@detail = 'ELSE' or @detail = 'IN')) or name() = 'namegroup' or name() = 'builtin')]">
<xsl:text>;
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="namegroup">
<xsl:for-each select="*">
<xsl:value-of select="text()"/>
<xsl:if test="position()!=last()">.</xsl:if>
</xsl:for-each>
<xsl:if test="count(following-sibling::*) > 0">
<xsl:choose>
<xsl:when test="following-sibling::*[position()=1 and name() = 'protected' and (@detail = 'IN' or @detail = 'INSTANCEOF')]">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and ((name() = 'protected' and not(@detail = 'ELSE')) or name() = 'namegroup' or name() = 'builtin')]">
<xsl:text>;
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="command">
<xsl:value-of select="concat(text(), ' ')"/>
</xsl:template>
<xsl:template match="protected">
<xsl:value-of select="text()"/>
<xsl:choose>
<xsl:when test="@detail = 'ELSE' and following-sibling::*[position()=1 and name() = 'protected' and @detail = 'IF']">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="@detail != 'ELSE' and following-sibling::*[position()=1 and name() = 'protected' and (@detail = 'IF' or @detail = 'RETURN')]">
<xsl:text>;
</xsl:text>
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and name() = 'protected' and (@detail = 'CASE' or @detail = 'DEFAULT')]">
<xsl:text>;
</xsl:text>
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and name() = 'token']">
<!-- PASS -->
</xsl:when>
<xsl:when test="(@detail = 'DELETE' or @detail = 'FUNCTION' or @detail = 'RETURN' or @detail = 'VAR' or @detail = 'IN' or @detail = 'INSTANCEOF' or @detail = 'TYPEOF' or @detail = 'THROW' or @detail = 'NEW' or @detail = 'CASE') and following-sibling::*[position()=1 and (name() = 'namegroup' or name() = 'protected' or name() = 'string' or name() = 'number' or name() = 'boolean' or name() = 'regexp' or name() = 'token')]">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and (name() = 'namegroup' or name() = 'protected' or name() = 'string' or name() = 'number' or name() = 'boolean' or name() = 'regexp' or name() = 'token')]">
<xsl:text>;
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="token">
<xsl:value-of select="text()"/>
<xsl:choose>
<xsl:when test="@detail = 'INC' or @detail = 'DEC'">
<xsl:text>;
</xsl:text>
</xsl:when>
<xsl:when test="following-sibling::*[position()=1 and name() = 'protected' and (@detail = 'IF' or @detail = 'WHILE' or @detail = 'DO' or @detail = 'DELETE')]">
<xsl:text>;
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="number|regexp|boolean|name|string|builtin">
<xsl:value-of select="text()"/>
<xsl:if test="count(following-sibling::*) > 0 and following-sibling::*[position()=1 and ((name() = 'protected' and not(@detail = 'ELSE')) or name() = 'namegroup' or name() = 'builtin')]">
<xsl:text>;
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--- NEW FILE: compileng_methods.xsl ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
<xsl:output method="xml" indent="yes" version="1.0" encoding="iso-8859-1"/>
<xsl:template match="/">
<result>
<xsl:apply-templates/>
</result>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template name="tolower">
<xsl:param name="in"/>
<xsl:value-of select="translate($in, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:template>
<xsl:template name="firsttolower">
<xsl:param name="in"/>
<xsl:call-template name="tolower">
<xsl:with-param name="in">
<xsl:value-of select="substring($in, 1, 1)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="substring($in, 2)"/>
</xsl:template>
<xsl:template match="namegroup[following-sibling::assign/protected[@detail='FUNCTION']]/name[text() = 'proto']">
<protomethod>
<xsl:variable name="name">
<xsl:value-of select="following-sibling::name"/>
</xsl:variable>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:if test="starts-with($name, '_')">
<xsl:attribute name="private">true</xsl:attribute>
<xsl:if test="starts-with($name, '_modify')">
<xsl:attribute name="modifier">true</xsl:attribute>
<xsl:attribute name="property">
<xsl:call-template name="firsttolower">
<xsl:with-param name="in" select="substring($name, 8)"/>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
</xsl:if>
</protomethod>
</xsl:template>
</xsl:stylesheet>
|