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

Added check if there are atoms, but no +rt meta. #2986

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 [email protected]
+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