Skip to content

Commit

Permalink
Merge branch 'master' into refactor/#2498/totally-independent-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon authored Oct 1, 2023
2 parents f221dba + 46b6eca commit 79e69a1
Show file tree
Hide file tree
Showing 130 changed files with 308 additions and 352 deletions.
2 changes: 1 addition & 1 deletion eo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ SOFTWARE.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void stopsOnCritical(@TempDir final Path temp) throws IOException {
.result()
.get(
String.format(
"target/%s/foo/x/main/28-duplicate-names.xml",
"target/%s/foo/x/main/27-duplicate-names.xml",
OptimizeMojo.STEPS
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Current test shows optimization and transpilation chain for simple program.
# The aim of this test is to check that entire pipeline with
# synthetic-referenses.xsl transformation works as expected without creating
# any warnings or errors.
# Pay attention to scopes.xsl and to-java.xsl transformations.
# scoped objects works as expected without creating any warnings or errors.
# Pay attention and to-java.xsl transformations.
xsls:
- /org/eolang/parser/errors/not-empty-atoms.xsl
- /org/eolang/parser/critical-errors/duplicate-names.xsl
Expand All @@ -25,7 +24,6 @@ xsls:
- /org/eolang/parser/warnings/incorrect-version.xsl
- /org/eolang/parser/expand-aliases.xsl
- /org/eolang/parser/resolve-aliases.xsl
- /org/eolang/parser/scopes.xsl
- /org/eolang/parser/add-default-package.xsl
- /org/eolang/parser/errors/broken-refs.xsl
- /org/eolang/parser/errors/unknown-names.xsl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Current test shows optimization and transpilation chain for simple program.
# The aim of this test is to check that entire pipeline with
# synthetic-referenses.xsl transformation works as expected without creating
# any warnings or errors.
# Pay attention to scopes.xsl and to-java.xsl transformations.
# scoped objects works as expected without creating any warnings or errors.
# Pay attention to to-java.xsl transformations.
xsls:
- /org/eolang/parser/errors/not-empty-atoms.xsl
- /org/eolang/parser/critical-errors/duplicate-names.xsl
Expand All @@ -25,7 +24,6 @@ xsls:
- /org/eolang/parser/warnings/incorrect-version.xsl
- /org/eolang/parser/expand-aliases.xsl
- /org/eolang/parser/resolve-aliases.xsl
- /org/eolang/parser/scopes.xsl
- /org/eolang/parser/add-default-package.xsl
- /org/eolang/parser/errors/broken-refs.xsl
- /org/eolang/parser/errors/unknown-names.xsl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ xsls:
- /org/eolang/maven/pre/to-java.xsl
tests:
- /program/errors[count(*)=0]
- //java[contains(text(), 'Phi ret_a2_a1 = new EOorg.EOeolang.EOint(')]
- //java[contains(text(), 'Phi ret_a0 = new EOorg.EOeolang.EOint(')]
- //java[contains(text(), 'Phi ret_a1 = new EOorg.EOeolang.EOint(')]
- //java[contains(text(), 'Phi[] ret_2_a = new Phi[0]')]
- //java[contains(text(), 'new String(new byte[]')]
eo: |
Expand Down
2 changes: 0 additions & 2 deletions eo-parser/src/main/antlr4/org/eolang/parser/Program.g4
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ happlicationExtended
happlicationHead
: hmethod
| applicable
| scope
;

// Extended head of horizontal application
Expand All @@ -123,7 +122,6 @@ happlicationHeadExtended
: vmethod
| hmethodExtended
| applicable
| scopeExtended
;

// Simple statements that can be used as head of application
Expand Down
82 changes: 28 additions & 54 deletions eo-parser/src/main/java/org/eolang/parser/Objects.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
*/
package org.eolang.parser;

import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.UUID;
import org.xembly.Directive;
import org.xembly.Directives;

Expand All @@ -40,55 +37,51 @@ interface Objects extends Iterable<Directive> {
* Start new object.
* @param line At line.
* @param pos At position.
* @return Self.
*/
void start(int line, int pos);
Objects start(int line, int pos);

/**
* Add data.
* @param data Data.
* @return Self.
*/
void data(String data);
Objects data(String data);

/**
* Property.
* @param key Key.
* @param value Value.
* @return Self.
*/
void prop(String key, Object value);
Objects prop(String key, Object value);

/**
* Empty propery.
* @param key Key.
* @return Self.
*/
void prop(String key);
Objects prop(String key);

/**
* Change property by given xpath.
* @param key Key.
* @param xpath Xpath.
* @return Self.
*/
void xprop(String key, Object xpath);
Objects xprop(String key, Object xpath);

/**
* Enter last object.
* @return Self.
*/
void enter();
Objects enter();

/**
* Leave current object.
* @return Self.
*/
void leave();

/**
* Mark the next object for scoping.
*/
void scope();

/**
* Mark the current object as last inside the scope.
* Last object that relates to the scope.
*/
void closeScope();
Objects leave();

/**
* Xembly object tree.
Expand All @@ -101,64 +94,45 @@ final class ObjXembly implements Objects {
*/
private final Directives dirs = new Directives();

/**
* Generated aliases.
*/
private final Deque<String> scopes = new LinkedList<>();

@Override
public void start(final int line, final int pos) {
public Objects start(final int line, final int pos) {
this.dirs.add("o");
this.prop("line", line);
this.prop("pos", pos);
if (!this.scopes.isEmpty()) {
this.prop("scope", String.join("-", this.scopes));
}
return this.prop("line", line).prop("pos", pos);
}

@Override
public void data(final String data) {
public Objects data(final String data) {
this.dirs.set(data);
return this;
}

@Override
public void prop(final String key, final Object type) {
public Objects prop(final String key, final Object type) {
this.dirs.attr(key, type);
return this;
}

@Override
public void prop(final String key) {
this.prop(key, "");
public Objects prop(final String key) {
return this.prop(key, "");
}

@Override
public void xprop(final String key, final Object xpath) {
public Objects xprop(final String key, final Object xpath) {
this.dirs.xattr(key, xpath);
return this;
}

@Override
public void enter() {
public Objects enter() {
this.dirs.xpath("o[last()]").strict(1);
return this;
}

@Override
public void leave() {
public Objects leave() {
this.dirs.up();
}

@Override
public void scope() {
this.scopes.push(
String.format(
"scope-%s",
UUID.randomUUID()
)
);
}

@Override
public void closeScope() {
this.scopes.remove();
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public final class ParsingTrain extends TrEnvelope {
"/org/eolang/parser/warnings/incorrect-version.xsl",
"/org/eolang/parser/expand-aliases.xsl",
"/org/eolang/parser/resolve-aliases.xsl",
"/org/eolang/parser/scopes.xsl",
"/org/eolang/parser/add-refs.xsl",
"/org/eolang/parser/add-default-package.xsl",
"/org/eolang/parser/errors/broken-refs.xsl",
Expand Down
Loading

3 comments on commit 79e69a1

@0pdd
Copy link

@0pdd 0pdd commented on 79e69a1 Oct 1, 2023

Choose a reason for hiding this comment

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

Puzzle 2435-00e0d128 disappeared from eo-runtime/src/test/eo/org/eolang/tuple-tests.eo), that's why I closed #2452. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 79e69a1 Oct 1, 2023

Choose a reason for hiding this comment

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

Puzzle 2497-58e65091 discovered in eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo) and submitted as #2515. 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 79e69a1 Oct 1, 2023

Choose a reason for hiding this comment

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

Puzzle 2498-1c661137 discovered in eo-runtime/src/test/eo/org/eolang/rust-tests.eo) and submitted as #2516. 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.