Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Dec 7, 2023
2 parents eafd274 + dd418e8 commit 14ca213
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public final class BinarizeParseMojo extends SafeMojo {
public static final Path DIR = Paths.get("binarize");

/**
* Parsing train with XSLs.
* Parsing train with XSLs. The task of XSLs is to find all the FFI inserts and put them at
* the end of the xmir file. When adding a new language for FFI inserts, you need to add the
* appropriate XSL transformation.
*/
static final Train<Shift> TRAIN = new TrBulk<>(
new TrClasspath<>(
Expand Down Expand Up @@ -122,11 +124,12 @@ public void exec() throws IOException {
}

/**
* Creates a "rust" section in xml file and returns the resulting XML.
* Creates sections for each language for FFI insert in xmir and returns the resulting XML file.
* @param input The .xmir file
* @return The content of rust section
* @return The content of FFI inserts sections
* @checkstyle AbbreviationAsWordInNameCheck (8 lines)
*/
private XML addRust(
private XML addFFIs(
final XML input
) {
final String name = input.xpath("/program/@name").get(0);
Expand All @@ -142,14 +145,17 @@ private XML addRust(
* Add ffi node via xsl transformation and return list of them.
* @param input Input xmir.
* @return FFI nodes.
* @todo #2609:90min We can make the current class more generic
* by transferring this.addRust(input) snippet to corresponding
* FFINode- {@link RustNode}. We wanna make the class independent of
* ffi-insert as a result.
* @todo #2649:90min This method may be more general. We need to get rid from rust dependencies
* in this method, because when adding another type of inserts it will be just copy-paste here.
* First of all, the for-loop must create all kinds of FFI nodes, not only {@link RustNode}. I
* think we can implement it, using something like {@code FFINodeFactory}, that will return
* appropriate FFI node for every XML node from {@code nodes}. Also it will be great to move
* paths to XML FFI insert nodes (such as {@code "/program/rusts/rust"}) from this method to
* a static class field.
* @checkstyle AbbreviationAsWordInNameCheck (8 lines)
*/
private Collection<FFINode> getFFIs(final XML input) {
final List<XML> nodes = this.addRust(input).nodes("/program/rusts/rust");
final List<XML> nodes = this.addFFIs(input).nodes("/program/rusts/rust");
final Collection<FFINode> ret = new ArrayList<>(nodes.size());
for (final XML node : nodes) {
ret.add(
Expand Down

2 comments on commit 14ca213

@0pdd
Copy link

@0pdd 0pdd commented on 14ca213 Dec 7, 2023

Choose a reason for hiding this comment

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

Puzzle 2609-cb1cc596 disappeared from eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParseMojo.java), that's why I closed #2649. 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 14ca213 Dec 7, 2023

Choose a reason for hiding this comment

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

Puzzle 2649-2559f1c7 discovered in eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParseMojo.java) and submitted as #2683. 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.