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 19, 2024
2 parents 446d62f + b112122 commit 97054f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eo-parser/src/main/antlr4/org/eolang/parser/Phi.g4
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ emptyBinding
;

deltaBidning
: DELTA DASHED_ARROW BYTES
: DELTA DASHED_ARROW (BYTES | EMPTY)
;

lambdaBidning
Expand Down
7 changes: 7 additions & 0 deletions eo-parser/src/main/java/org/eolang/parser/XePhiListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ public void exitEmptyBinding(final PhiParser.EmptyBindingContext ctx) {

@Override
public void enterDeltaBidning(final PhiParser.DeltaBidningContext ctx) {
if (ctx.EMPTY() != null) {
throw new ParsingException(
"It's impossible to represent Δ ⤍ ∅ binding in EO",
new IllegalStateException(),
ctx.getStart().getLine()
);
}
this.objects()
.start()
.prop("data", "bytes")
Expand Down
10 changes: 10 additions & 0 deletions eo-parser/src/test/java/org/eolang/parser/PhiSyntaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.jcabi.matchers.XhtmlMatchers;
import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.xembly.Directives;

Expand All @@ -48,6 +49,15 @@ void addsError() throws IOException {
);
}

@Test
void catchesDeltaToNothingBinding() throws IOException {
Assertions.assertThrows(
ParsingException.class,
new PhiSyntax("{ ⟦ x ↦ ⟦ Δ ⤍ ∅ ⟧ ⟧ }")::parsed,
"Impossible binding with Δ should be caught"
);
}

@Test
void addsExtra() throws IOException {
MatcherAssert.assertThat(
Expand Down

4 comments on commit 97054f3

@0pdd
Copy link

@0pdd 0pdd commented on 97054f3 Mar 19, 2024

Choose a reason for hiding this comment

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

Puzzle 2931-0831d4d9 discovered in eo-runtime/src/test/java/org/eolang/DataizedTest.java) and submitted as #2978. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link

@0pdd 0pdd commented on 97054f3 Mar 19, 2024

Choose a reason for hiding this comment

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

Puzzle 2931-021739d9 discovered in eo-runtime/src/test/java/org/eolang/MainTest.java) and submitted as #2979. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link

@0pdd 0pdd commented on 97054f3 Mar 19, 2024

Choose a reason for hiding this comment

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

Puzzle 2931-fce5e0d6 discovered in eo-runtime/src/test/java/org/eolang/PhConstTest.java) and submitted as #2980. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link

@0pdd 0pdd commented on 97054f3 Mar 19, 2024

Choose a reason for hiding this comment

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

Puzzle 2931-daec7a22 discovered in eo-runtime/src/test/java/org/eolang/PhMethodTest.java) and submitted as #2981. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.