Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#3147): remove sigma #3168

Merged
merged 12 commits into from
May 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public final class TranspileMojo extends SafeMojo {
"/org/eolang/maven/pre/tests.xsl",
"/org/eolang/maven/pre/rename-tests-inners.xsl",
"/org/eolang/maven/pre/attrs.xsl",
"/org/eolang/maven/pre/varargs.xsl",
"/org/eolang/maven/pre/data.xsl"
).back(),
new TrDefault<>(
Expand Down
17 changes: 3 additions & 14 deletions eo-maven-plugin/src/main/resources/org/eolang/maven/phi/to-phi.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ SOFTWARE.
<xsl:variable name="rho">
<select>ρ</select>
</xsl:variable>
<xsl:variable name="sigma">
<select>σ</select>
</xsl:variable>
<xsl:variable name="program">
<select>Φ</select>
</xsl:variable>
Expand Down Expand Up @@ -105,14 +102,6 @@ SOFTWARE.
<xsl:text>.</xsl:text>
<xsl:value-of select="$rho"/>
</xsl:when>
<xsl:when test="$n='&amp;'">
<xsl:value-of select="eo:add-xi(not($is-name))"/>
<xsl:value-of select="$sigma"/>
</xsl:when>
<xsl:when test="$n='.&amp;'">
<xsl:text>.</xsl:text>
<xsl:value-of select="$sigma"/>
</xsl:when>
<xsl:when test="$n='$'">
<xsl:value-of select="$xi"/>
</xsl:when>
Expand Down Expand Up @@ -245,14 +234,14 @@ SOFTWARE.
<xsl:template match="*" mode="path">
<xsl:param name="find"/>
<xsl:variable name="parent" select="parent::*"/>
<xsl:variable name="sigma-dot">
<xsl:value-of select="eo:specials('&amp;', true())"/>
<xsl:variable name="rho-dot">
<xsl:value-of select="eo:specials('^', true())"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<xsl:choose>
<xsl:when test="$parent[@abstract]">
<xsl:if test="not($parent/o[@name=$find])">
<xsl:value-of select="$sigma-dot"/>
<xsl:value-of select="$rho-dot"/>
<xsl:apply-templates select="$parent" mode="path">
<xsl:with-param name="find" select="$find"/>
</xsl:apply-templates>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ SOFTWARE.
<xsl:variable name="t">
<xsl:choose>
<xsl:when test="@base">
<xsl:choose>
<xsl:when test="@cut">
<xsl:text>formed</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>bound</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>bound</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>void</xsl:text>
Expand Down
70 changes: 20 additions & 50 deletions eo-maven-plugin/src/main/resources/org/eolang/maven/pre/to-java.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ SOFTWARE.
<xsl:import href="/org/eolang/parser/_datas.xsl"/>
<xsl:param name="disclaimer"/>
<xsl:output encoding="UTF-8" method="xml"/>
<!-- VARIABLES -->
<xsl:variable name="TAB">
<xsl:text> </xsl:text>
</xsl:variable>
<xsl:variable name="RHO">
<xsl:text>ρ</xsl:text>
</xsl:variable>
<xsl:variable name="PHI">
<xsl:text>φ</xsl:text>
</xsl:variable>
<!-- FUNCTIONS -->
<!-- EOL -->
<xsl:function name="eo:eol">
Expand Down Expand Up @@ -58,7 +65,7 @@ SOFTWARE.
<!-- Get clean escaped object name -->
<xsl:function name="eo:clean" as="xs:string">
<xsl:param name="n" as="xs:string"/>
<xsl:value-of select="concat('EO', replace(replace(replace(replace(replace($n, '_', '__'), '-', '_'), '@', 'φ'), 'α', '_'), '\$', '\$EO'))"/>
<xsl:value-of select="concat('EO', replace(replace(replace(replace(replace($n, '_', '__'), '-', '_'), '@', $PHI), 'α', '_'), '\$', '\$EO'))"/>
</xsl:function>
<!-- Get object name with suffix -->
<xsl:function name="eo:suffix" as="xs:string">
Expand Down Expand Up @@ -104,10 +111,10 @@ SOFTWARE.
<xsl:param name="n" as="xs:string"/>
<xsl:choose>
<xsl:when test="$n='@'">
<xsl:text>φ</xsl:text>
<xsl:value-of select="$PHI"/>
</xsl:when>
<xsl:when test="$n='^'">
<xsl:text>ρ</xsl:text>
<xsl:value-of select="$RHO"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('', $n)"/>
Expand Down Expand Up @@ -191,19 +198,10 @@ SOFTWARE.
<xsl:value-of select="eo:class-name(@name, eo:suffix(@line, @pos))"/>
<xsl:text>() {</xsl:text>
</xsl:when>
<xsl:when test="@ancestors">
<xsl:text>public </xsl:text>
<xsl:value-of select="eo:class-name(@name, eo:suffix(@line, @pos))"/>
<xsl:text>(final Phi sigma) {</xsl:text>
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>super(sigma);</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>public </xsl:text>
<xsl:value-of select="eo:class-name(@name, eo:suffix(@line, @pos))"/>
<xsl:text>(final Phi sigma) {</xsl:text>
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>super(sigma);</xsl:text>
<xsl:text>() {</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="attr">
Expand Down Expand Up @@ -235,22 +233,6 @@ SOFTWARE.
<xsl:value-of select="$name"/>
<xsl:text>")</xsl:text>
</xsl:template>
<!-- Formed attribute -->
<xsl:template match="formed">
<xsl:text>new AtFormed(() -&gt; {</xsl:text>
<xsl:value-of select="eo:eol(0)"/>
<xsl:apply-templates select="*">
<xsl:with-param name="name" select="'ret'"/>
<xsl:with-param name="indent">
<xsl:value-of select="eo:tabs(3)"/>
</xsl:with-param>
<xsl:with-param name="rho" select="'this'"/>
</xsl:apply-templates>
<xsl:value-of select="eo:tabs(3)"/>
<xsl:text>return ret;</xsl:text>
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>})</xsl:text>
</xsl:template>
<!-- Bound attribute -->
<xsl:template match="bound">
<xsl:text>new AtOnce(</xsl:text>
Expand All @@ -261,7 +243,6 @@ SOFTWARE.
<xsl:with-param name="indent">
<xsl:value-of select="eo:tabs(3)"/>
</xsl:with-param>
<xsl:with-param name="rho" select="'rho'"/>
</xsl:apply-templates>
<xsl:value-of select="eo:tabs(3)"/>
<xsl:text>return ret;</xsl:text>
Expand All @@ -286,7 +267,6 @@ SOFTWARE.
<xsl:template match="o[@base and not(starts-with(@base, '.'))]">
<xsl:param name="indent"/>
<xsl:param name="name"/>
<xsl:param name="rho"/>
<xsl:variable name="current" select="."/>
<xsl:variable name="source" select="//*[generate-id()!=generate-id($current) and @name=$current/@base and @line=$current/@ref]"/>
<!-- Terminate -->
Expand Down Expand Up @@ -320,24 +300,21 @@ SOFTWARE.
<xsl:text>.copy()</xsl:text>
</xsl:when>
<xsl:when test="@base='$'">
<xsl:value-of select="$rho"/>
<xsl:text>rho</xsl:text>
</xsl:when>
<xsl:when test="@base='Q'">
<xsl:text>Phi.Φ</xsl:text>
</xsl:when>
<xsl:when test="@base='^'">
<xsl:text>new PhMethod(rho, "ρ")</xsl:text>
</xsl:when>
<xsl:when test="@base='&amp;'">
<xsl:text>new PhMethod(rho, "σ")</xsl:text>
<xsl:text>new PhMethod(rho, "</xsl:text>
<xsl:value-of select="$RHO"/>
<xsl:text>")</xsl:text>
</xsl:when>
<!-- TBD -->
<xsl:when test="$source/@ancestors">
<xsl:text>new </xsl:text>
<xsl:value-of select="eo:class-name($source/@name, eo:suffix(@line, @pos))"/>
<xsl:text>(</xsl:text>
<xsl:value-of select="$rho"/>
<xsl:text>)</xsl:text>
<xsl:text>()</xsl:text>
</xsl:when>
<xsl:when test="$source and name($source)='class'">
<xsl:value-of select="eo:fetch(concat($source/@package, '.', $source/@name))"/>
Expand All @@ -348,7 +325,9 @@ SOFTWARE.
</xsl:for-each>
<xsl:text>rho</xsl:text>
<xsl:for-each select="1 to $source/@level">
<xsl:text>, "σ")</xsl:text>
<xsl:text>, "</xsl:text>
<xsl:value-of select="$RHO"/>
<xsl:text>")</xsl:text>
</xsl:for-each>
<xsl:text>, "</xsl:text>
<xsl:value-of select="$source/@name"/>
Expand All @@ -368,7 +347,6 @@ SOFTWARE.
<xsl:apply-templates select="." mode="application">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="indent" select="$indent"/>
<xsl:with-param name="rho" select="$rho"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="located">
<xsl:with-param name="name" select="$name"/>
Expand All @@ -379,7 +357,6 @@ SOFTWARE.
<xsl:template match="o[starts-with(@base, '.') and *]">
<xsl:param name="indent"/>
<xsl:param name="name"/>
<xsl:param name="rho"/>
<xsl:apply-templates select="*[1]">
<xsl:with-param name="name">
<xsl:value-of select="$name"/>
Expand All @@ -388,7 +365,6 @@ SOFTWARE.
<xsl:with-param name="indent">
<xsl:value-of select="$indent"/>
</xsl:with-param>
<xsl:with-param name="rho" select="$rho"/>
</xsl:apply-templates>
<xsl:value-of select="$indent"/>
<xsl:text>Phi </xsl:text>
Expand All @@ -399,10 +375,7 @@ SOFTWARE.
<xsl:variable name="method" select="substring-after(@base, '.')"/>
<xsl:choose>
<xsl:when test="$method='^'">
<xsl:text>ρ</xsl:text>
</xsl:when>
<xsl:when test="$method='&amp;'">
<xsl:text>σ</xsl:text>
<xsl:value-of select="$RHO"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eo:attr-name($method)"/>
Expand All @@ -418,7 +391,6 @@ SOFTWARE.
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="indent" select="$indent"/>
<xsl:with-param name="skip" select="1"/>
<xsl:with-param name="rho" select="$rho"/>
</xsl:apply-templates>
</xsl:template>
<!-- Location of object -->
Expand Down Expand Up @@ -448,7 +420,6 @@ SOFTWARE.
<xsl:param name="indent"/>
<xsl:param name="skip" select="0"/>
<xsl:param name="name" select="'o'"/>
<xsl:param name="rho"/>
<xsl:for-each select="./*[name()!='value' and name()!='tuple' and position() &gt; $skip][not(@level)]">
<xsl:if test="position() = 1">
<xsl:value-of select="$indent"/>
Expand All @@ -470,7 +441,6 @@ SOFTWARE.
<xsl:value-of select="$indent"/>
<xsl:value-of select="eo:tabs(1)"/>
</xsl:with-param>
<xsl:with-param name="rho" select="$rho"/>
</xsl:apply-templates>
</xsl:for-each>
<xsl:for-each select="./*[name()!='value' and position() &gt; $skip][not(@level)]">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ xsls:
- /org/eolang/maven/pre/tests.xsl
- /org/eolang/maven/pre/rename-tests-inners.xsl
- /org/eolang/maven/pre/attrs.xsl
- /org/eolang/maven/pre/varargs.xsl
- /org/eolang/maven/pre/data.xsl
- /org/eolang/maven/pre/to-java.xsl
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xsls:
- /org/eolang/maven/pre/to-java.xsl
tests:
- /program/errors[count(*)=0]
- //java[contains(text(), 'PhMethod(new PhMethod(rho, "σ"), "σ")')]
- //java[contains(text(), 'PhMethod(new PhMethod(rho, "ρ"), "ρ")')]
eo: |
# This is the default 64+ symbols comment in front of named abstract object.
[x] > foo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ xsls:
- /org/eolang/maven/pre/tests.xsl
- /org/eolang/maven/pre/rename-tests-inners.xsl
- /org/eolang/maven/pre/attrs.xsl
- /org/eolang/maven/pre/varargs.xsl
- /org/eolang/maven/pre/data.xsl
- /org/eolang/maven/pre/to-java.xsl
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
xsls:
- /org/eolang/parser/add-default-package.xsl
- /org/eolang/maven/pre/classes.xsl
- /org/eolang/maven/pre/attrs.xsl
- /org/eolang/maven/pre/data.xsl
- /org/eolang/maven/pre/to-java.xsl
tests:
- /program/errors[count(*)=0]
- //java/text()[not(contains(., '&amp;'))]

eo: |
# This is the default 64+ symbols comment in front of named abstract object.
[] > foo
5 > five
a > @

# This is the default 64+ symbols comment in front of named abstract object.
[] > a
# This is the default 64+ symbols comment in front of named abstract object.
[] > @
&.&.five > @
[] > object
x > first
[] >>
01- > b
phi: |-
{
object ↦ ⟦
first ↦ Φ.org.eolang.x(
α0 ↦ ξ.auto-named-attr-at-4-6
),
auto-named-attr-at-4-6 ↦ ⟦
b ↦ Φ.org.eolang.bytes(
Δ ⤍ 01-
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ phi: |-
)
).if(
α0 ↦ ξ.n,
α1 ↦ ξ.σ.fibonacci(
α1 ↦ ξ.ρ.fibonacci(
α0 ↦ ξ.n.minus(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Expand All @@ -59,7 +59,7 @@ phi: |-
)
)
).plus(
α0 ↦ ξ.σ.fibonacci(
α0 ↦ ξ.ρ.fibonacci(
α0 ↦ ξ.n.minus(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Expand Down
Loading
Loading