Skip to content

Commit

Permalink
bug(objectionary#3674): auto named const to EO
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Feb 21, 2025
1 parent c8bc817 commit 76b5a8e
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 3 deletions.
2 changes: 1 addition & 1 deletion eo-parser/src/main/java/org/eolang/parser/Xmir.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public final class Xmir implements XML {
new StEndless(
new StClasspath("/org/eolang/parser/print/tuples-to-stars.xsl")
),
new StClasspath("/org/eolang/parser/print/dataized-to-const.xsl"),
Xmir.UNHEX,
new StClasspath("/org/eolang/parser/print/inline-cactoos.xsl"),
new StClasspath("/org/eolang/parser/print/dataized-to-const.xsl"),
new StClasspath("/org/eolang/parser/print/to-eo.xsl")
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SOFTWARE.
<xsl:template match="o[@base='.as-bytes' and o[position()=1 and @base='Q.org.eolang.dataized']]">
<xsl:variable name="argument" select="o[position()=1]/o[1]"/>
<xsl:choose>
<xsl:when test="exists($argument) and not(exists($argument/@name))">
<xsl:when test="exists($argument)">
<xsl:element name="o">
<xsl:apply-templates select="$argument/@*"/>
<xsl:attribute name="name" select="@name"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ SOFTWARE.
<xsl:variable name="auto" select="concat('a', $eo:cactoos)"/>
<xsl:template match="o[contains(@base, concat('.', $auto))]" priority="0">
<xsl:variable name="name" select="substring-after(@base, substring-before(@base, $auto))"/>
<xsl:copy-of select="ancestor::o/o[@name=$name]"/>
<xsl:variable name="target" select="ancestor::o/o[@name=$name][1]"/>
<xsl:element name="o">
<xsl:apply-templates select="$target/@*"/>
<xsl:apply-templates select="$target/node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="o[starts-with(@name, $auto)]" priority="1">
<!-- Nothing here -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ SOFTWARE.
<!-- PROGRAM -->
<xsl:template match="program">
<program>
<xsl:copy-of select="sheets"/>
<xsl:copy-of select="metas"/>
<xsl:copy-of select="objects"/>
<eo>
<xsl:apply-templates select="license"/>
<xsl:apply-templates select="metas"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2025 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
sheets: [ ]
asserts:
- /program[not(errors)]
- //o[@base='.as-bytes' and @name='a🌵46']/o[@base='Q.org.eolang.dataized']/o[@base='$.a🌵46-1']
- //o[@name='a🌵46-1']
input: |
# No.
[] > foo
x > first
[] >>!
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2025 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
origin: |
# no.
[] > y
x > first
5 > [] >>!
printed: |
# No comments.
[] > y
x > first
[] >>!
5 > @

0 comments on commit 76b5a8e

Please sign in to comment.