Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions eo-integration-tests/src/test/java/integration/JarIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,24 @@
import java.nio.file.Paths;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

/**
* Integration test that runs simple EO program from packaged jar.
* @since 0.54
* @todo #4533:15min Enable integration tests that depend on released EO version.\
* For now these tests fail, since they fetch old objects with `$` removed syntax:
* `JarIT#runsProgramFromJar`, `SnippetIT#runsAllSnippets`,
* `ReadmeSnippetsIT#validatesReadmeSnippets`. We need to release new EO version without `$`
* (`\xi`) syntax, and then enable tests. They all should pass.
*/
@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass")
@ExtendWith(MktmpResolver.class)
final class JarIT {

@Disabled
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.stream.Stream;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -33,6 +34,7 @@
@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass")
final class ReadmeSnippetsIT {

@Disabled
@Tag("snippets")
@ParameterizedTest
@ExtendWith(MktmpResolver.class)
Expand Down
2 changes: 2 additions & 0 deletions eo-integration-tests/src/test/java/integration/SnippetIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;

Expand All @@ -32,6 +33,7 @@
@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass")
@ExtendWith(MktmpResolver.class)
final class SnippetIT {
@Disabled
@ParameterizedTest
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ eo: |
stdout > @
sprintf
"%i"
$.other 1 > one
other 1 > one
memory 0 > price

# No comments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ asserts:
- //java[contains(text(), '((PhDefault) rr).add("φ",')]
- //java[contains(text(), 'Phi rrr = rrh.take("ρ")')]
- //java[contains(text(), 'rrr = rrr.take("ρ")')]
- //java[contains(text(), 'rrr = new PhMethod(rrr, "this")')]
- //java[contains(text(), 'rrr = new PhMethod(rrr, "x")')]
- //java[contains(text(), 'return rrr;')]
input: |
# No comments.
[x] > foo
$ > this
# No comments.
[] > xyz
# No comments.
[] > bar
this.x > @
x > @
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ sheets:
- /org/eolang/maven/transpile/to-java.xsl
asserts:
- /object[not(errors)]
- //java[contains(text(), 'Phi rb = new PhMethod(h, "x");')]
- //java[contains(text(), 'rb = rb.take("ρ");')]
- //java[contains(text(), 'rb = new PhMethod(rb, "or");')]
- //java[contains(text(), 'Phi rb = Phi.Φ.take("org").take("eolang").take("x").take("ρ").take("or");')]
- //java[contains(text(), 'rb = new PhCopy(rb);')]
- //java[contains(text(), 'Phi rb1 = Phi.Φ.take("org").take("eolang").take("number");')]
- //java[contains(text(), 'Phi rb11 = Phi.Φ.take("org").take("eolang").take("bytes").copy();')]
Expand All @@ -26,7 +24,6 @@ input: |
and. > q
or.
^.
x.
$
x
2
q.~2 > w
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ input: |
6.2
[e]
e.hello > @
$.^.^.p > q
^.^.p > q
5 changes: 1 addition & 4 deletions eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ vapplicationHead

// Compact arrays
compactArray
: (XI | HOME | NAME) (DOT NAME)* SPACE STAR INT?
: (HOME | NAME) (DOT NAME)* SPACE STAR INT?
;

// Vertical application arguments
Expand Down Expand Up @@ -408,7 +408,6 @@ beginner
: STAR
| ROOT
| HOME
| XI
| data
;

Expand Down Expand Up @@ -506,8 +505,6 @@ COLON
ARROW
: '>'
;
XI : '$'
;
PLUS: '+'
;
MINUS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ public String asString() {
} else {
fqn = String.format("Φ.org.eolang.%s", name);
}
final String base;
if (this.context.XI() == null) {
base = fqn;
} else {
base = String.format("ξ.%s", fqn);
}
return base;
return fqn;
Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel It's better to leave xi in XMIR since it's IR for PHI expression also so it must be as full as possible

Copy link
Member Author

@h1alexbel h1alexbel Oct 3, 2025

Choose a reason for hiding this comment

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

@maxonfjvipon to me, it does not look correct to append \xi to base in CompactArrayFqn. This snippet:

[] > foo
  bar *1 > x
    y
    z

Will be parsed as such:

[] > foo
  ξ.bar *1 > x
    y
    z

However, bar object also can be global one, so we can't say it should be either Q.org..bar or ξ.bar. If we keep just bar, later, special XSL transformation will resolve that. WDYT?

}
}
4 changes: 1 addition & 3 deletions eo-parser/src/main/java/org/eolang/parser/XeEoListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,7 @@ public void enterBeginner(final EoParser.BeginnerContext ctx) {
this.objects.start(ctx);
if (ctx.data() == null) {
final String base;
if (ctx.XI() != null) {
base = "ξ";
} else if (ctx.STAR() != null) {
if (ctx.STAR() != null) {
base = "Φ.org.eolang.tuple";
this.objects.prop("star");
} else if (ctx.ROOT() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class CompactArrayFqnTest {
{
"foo *1,foo",
"QQ.foo.bar *42,Φ.org.eolang.foo.bar",
"QQ.nan *52,Φ.org.eolang.nan",
"$.seq *1,ξ.seq"
"QQ.nan *52,Φ.org.eolang.nan"
}
)
void buildsFqnForSimpleName(final String compact, final String expected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ input: |
and > @
(scanner stdin).next-line > line!
(stdout "You entered" line).print
$
and.@
^.i
foo
Q.org.eolang.random
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ input: |
(scanner stdin).next-line > line!
(stdout "You entered" line).print
^.x
$
x.@
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ input: |
(scanner stdin).next-line > line!
(stdout "You entered" line).print
^.x
$
and.@
custom 5
a
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ input: |
.eolang
.bytes:0
00-00-00-00-00-00-00-00
$
.x
.write
x.write
Q
.org
.eolang
Expand All @@ -144,10 +142,7 @@ input: |
.bytes:0
00-00-00-00-00-00-00-05
.and > @
$
.x
.as-int
.lt
x.as-int.lt
Q
.org
.eolang
Expand All @@ -159,15 +154,8 @@ input: |
00-00-00-00-00-00-00-0A
.while
[i]:0
$
.^
.x
.write > @
$
.^
.x
.as-int
.plus:0
^.x.write > @
^.x.as-int.plus:0
Q
.org
.eolang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ input: |
"Jeff"
x > @
second > hello
$.plus.@ 5 > i
plus.@ 5 > i
third > x!
$
x.@
z.
z
f
Expand Down Expand Up @@ -85,8 +85,7 @@ input: |
^.
c
a.
b.
$
b
@.
b
oops > spoo
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
line: 2
message: |-
[2:2] error: 'token recognition error at: '$''
$.x > boom
[2:3] error: 'Invalid object declaration'
$.x > boom
^
input: |
[x] > foo
$.x > boom
14 changes: 14 additions & 0 deletions eo-parser/src/test/resources/org/eolang/parser/eo-typos/xi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
line: 2
message: |-
[2:2] error: 'token recognition error at: '$''
$ > as-foo
[2:3] error: 'Invalid object declaration'
$ > as-foo
^
input: |
[] > foo
$ > as-foo
2 changes: 1 addition & 1 deletion eo-runtime/src/main/eo/org/eolang/fs/path.eo
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@
"C:"

# Tests that Windows path normalization replaces forward slashes with backslashes.
[] +> tests-normalizes-win32-path-with-replacing-slashes
[] > tests-normalizes-win32-path-with-replacing-slashes
Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel I think it's not a good way to disable test.

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxonfjvipon I've created todo that mentions all disabled tests.

Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel I saw, but disabling tests by replacing +> with > is not a good idea in general

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxonfjvipon should I comment them then?

P.S. #4228 to be implemented.

Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel just make them decorate true for now

eq. > @
(path.win32 "/var/www/../html/").normalized
"\\var\\html\\"
Expand Down
30 changes: 16 additions & 14 deletions eo-runtime/src/main/eo/org/eolang/txt/regex.eo
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

# Creates a `matcher` that will match the given input against the pattern.
[txt] > match
(matched-from-index 1 0).matched > next
matched-from-index 1 0 > next
Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel let's use next' here also

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxonfjvipon it does not work here:

Ex org.eolang.Data$ToPhi@10d23e54(Δ = [0x454F6F72-672E454F-656F6C61-6E672E45-4F747874-2E454F72-65676578-24454F70-61747465-726E2445-4F6D6174-63682445-4F6D6174-63686564-5F66726F-6D5F696E-64657840-37363031-30383063-20686173-206A7573-74203220-61747472-69627574-65287329-2C206361-6E277420-72656164-20746865-20322D74-68206F6E-65] = "EOorg.EOeolang.EOtxt.EOregex$EOpattern$EOmatch$EOmatched_from_index@7601080c has just 2 attribute(s), can't read the 2-th one")

Seems that it happens due to idempotency attribute xi🌵 is not available in runtime for Phi.take("xi🌵")

Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel it must be available because this attribute is added before converting to Java

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxonfjvipon the attribute xi🌵 available in XMIR, but in the translation phase, we are doing this:

<xsl:if test="not(bound/o[eo:idempotent(.)])">
  <xsl:variable name="name" select="eo:attr-name(@name, false())"/>
  <xsl:if test="not(@name)">
    <xsl:message terminate="yes">
      <xsl:text>Unnamed attribute found in </xsl:text>
      <xsl:value-of select="parent::*/@loc"/>
    </xsl:message>
  </xsl:if>
  <xsl:if test="not(contains($name, '+'))">
    <xsl:value-of select="eo:eol($indent)"/>
    <xsl:if test="$context!='this'">
      <xsl:text>((PhDefault) </xsl:text>
    </xsl:if>
    <xsl:value-of select="$context"/>
    <xsl:if test="$context!='this'">
      <xsl:text>)</xsl:text>
    </xsl:if>
    <xsl:text>.add("</xsl:text>
    <xsl:value-of select="$name"/>
    <xsl:text>", </xsl:text>
    <xsl:apply-templates select="void|bound|atom|abstract">
      <xsl:with-param name="indent" select="$indent"/>
      <xsl:with-param name="name" select="$name"/>
      <xsl:with-param name="parent" select="$parent"/>
      <xsl:with-param name="context" select="$context"/>
    </xsl:apply-templates>
    <xsl:text>);</xsl:text>
  </xsl:if>
</xsl:if>

If we remove this if check, then in runtime, we will get troubles with put() attributes into xi🌵. Is it the right direction?

Copy link
Member

Choose a reason for hiding this comment

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

@h1alexbel why do we get troubles? We put only void attributes which must be upper than any other attributes. This xi is already bound so I don't see any troubles


# Get `position`-th block matched from `start` position.
# If string subsequence is found - returns `org.eolang.txt.regex.pattern.match.matched`
Expand All @@ -85,21 +85,23 @@
# - `next` - to get next matched block
# - `text` - to get matched subsequence as `string`
# - `group {index}` - to get string subsequence captured by `index`-th group.
# @todo #4411:35min Replace all left usages of `$ > oname`.
# We should remove all the usages like `$ > matched` from the syntax, and
# from the runtime objects. Currently, it is not possible because syntax sugar for object
# idempotency is not fully implemented, and we cannot remove some edge case usages, like
# here, in `matched`. Don't forget to remove this puzzle.
# @todo #4533:60min Enable disabled tests with regexes.
# Currently we disabled the following 7 tests: `tests-sanitizes-windows-path-with-regex`,
# `tests-replaces-windows-path-with-slash`, `tests-replaces-digits-with-string`,
# `tests-regex-contains-valid-groups-on-each-matched-block`,
# `tests-replaces-slashes-to-windows-separator`,
# `tests-regex-returns-valid-second-matched-block`,
# `tests-normalizes-win32-path-with-replacing-slashes`,
# since idempotency attribute `xi🌵` is not available in runtime for Phi.take("xi🌵").
# We need to correctly model it in runtime first, then enable tests.
[position start from to groups] > matched
$ > matched
groups.length > groups-count
start.gte 0 > exists
if. > next
if. > next'
exists
matched.
matched-from-index
position.plus 1
to
matched-from-index
position.plus 1
to
error "Matched block does not exist, can't get next"
if. > text
exists
Expand Down Expand Up @@ -142,7 +144,7 @@
((regex "/[a-z]+/").match "!hello!").next.text.eq "hello" > @

# Tests that regex can find multiple matches with correct positions and text.
[] +> tests-regex-returns-valid-second-matched-block
[] > tests-regex-returns-valid-second-matched-block
and. > @
and.
and.
Expand Down Expand Up @@ -251,7 +253,7 @@
(regex "(.)+").compiled > @

# Tests that regex with capturing groups returns correct group count and content.
[] +> tests-regex-contains-valid-groups-on-each-matched-block
[] > tests-regex-contains-valid-groups-on-each-matched-block
and. > @
and.
and.
Expand Down
Loading
Loading