Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Mar 20, 2024
2 parents 18a93eb + 51068d2 commit eb40a6d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,40 @@ 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.
-->
<!--
@todo #2921:30m Add check if there are atoms, but no +rt meta. It should be illegal.
Don't forget to remove the puzzle.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="rt-without-atom" version="2.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="rt-and-atoms" version="2.0">
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/program/errors">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:if test="/program/metas/meta[head='rt']">
<xsl:if test="not(//o[@atom])">
<xsl:if test="//o[@atom]">
<xsl:if test="not(/program/metas/meta[head='rt'])">
<xsl:element name="error">
<xsl:attribute name="check">
<xsl:text>rt-and-atoms</xsl:text>
</xsl:attribute>
<xsl:attribute name="line">
<xsl:value-of select="@line"/>
</xsl:attribute>
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>Using atoms without +rt meta is prohibited</xsl:text>
</xsl:element>
</xsl:if>
</xsl:if>
<xsl:if test="not(//o[@atom])">
<xsl:if test="/program/metas/meta[head='rt']">
<xsl:element name="error">
<xsl:attribute name="check">
<xsl:text>rt-without-atoms</xsl:text>
<xsl:text>rt-and-atoms</xsl:text>
</xsl:attribute>
<xsl:attribute name="line">
<xsl:value-of select="@line"/>
</xsl:attribute>
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>Using +rt meta without atoms</xsl:text>
<xsl:text>Using +rt meta without atoms is prohibited</xsl:text>
</xsl:element>
</xsl:if>
</xsl:if>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
xsls:
- /org/eolang/parser/errors/rt-and-atoms.xsl
tests:
- /program/errors[count(error[@severity='error'])=1]
eo: |
+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+package org.eolang
+version 0.0.0
# Bytes.
[] > bytes
# Equals to another object.
[x] > eq /bool
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
xsls:
- /org/eolang/parser/errors/rt-without-atom.xsl
- /org/eolang/parser/errors/rt-and-atoms.xsl
tests:
- /program/errors[count(error[@severity='error'])=1]
eo: |
Expand Down

1 comment on commit eb40a6d

@0pdd
Copy link

@0pdd 0pdd commented on eb40a6d Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2921-5e2fe8e5 disappeared from eo-parser/src/main/resources/org/eolang/parser/errors/rt-without-atom.xsl), that's why I closed #2948. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.