From a9cfaad4614f39cec54af7f2fc29984abc644567 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 06:40:42 +0300 Subject: [PATCH 1/9] #3592: LintMojo --- eo-maven-plugin/pom.xml | 2 +- .../src/it/duplicate_classes/pom.xml | 4 +- eo-maven-plugin/src/it/simple/pom.xml | 2 +- .../java/org/eolang/maven/BinarizeParse.java | 2 +- .../maven/{VerifyMojo.java => LintMojo.java} | 129 ++++++++++++------ .../java/org/eolang/maven/OptimizeMojo.java | 53 +------ .../java/org/eolang/maven/TranspileMojo.java | 4 +- .../org/eolang/maven/tojos/ForeignTojo.java | 22 +-- .../org/eolang/maven/tojos/ForeignTojos.java | 10 +- .../org/eolang/maven/BinarizeParseTest.java | 2 +- .../test/java/org/eolang/maven/FakeMaven.java | 8 +- ...{VerifyMojoTest.java => LintMojoTest.java} | 75 +++++----- .../org/eolang/maven/OptimizeMojoTest.java | 2 +- .../org/eolang/maven/TranspileMojoTest.java | 33 +---- .../eolang/maven/tojos/ForeignTojosTest.java | 7 +- eo-runtime/pom.xml | 4 +- .../src/test/java/integration/PhiUnphiIT.java | 4 +- .../src/test/java/integration/SnippetIT.java | 2 +- pom.xml | 8 ++ 19 files changed, 164 insertions(+), 209 deletions(-) rename eo-maven-plugin/src/main/java/org/eolang/maven/{VerifyMojo.java => LintMojo.java} (65%) rename eo-maven-plugin/src/test/java/org/eolang/maven/{VerifyMojoTest.java => LintMojoTest.java} (81%) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 1eba216f3f..d02319e3c7 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.13 + 0.0.15 com.yegor256 diff --git a/eo-maven-plugin/src/it/duplicate_classes/pom.xml b/eo-maven-plugin/src/it/duplicate_classes/pom.xml index e6176cb27a..2a49661f0c 100644 --- a/eo-maven-plugin/src/it/duplicate_classes/pom.xml +++ b/eo-maven-plugin/src/it/duplicate_classes/pom.xml @@ -66,7 +66,7 @@ SOFTWARE. register assemble - verify + lint transpile copy unplace @@ -87,7 +87,7 @@ SOFTWARE. register assemble - verify + lint transpile binarize diff --git a/eo-maven-plugin/src/it/simple/pom.xml b/eo-maven-plugin/src/it/simple/pom.xml index b140810b71..bf85f62b6b 100644 --- a/eo-maven-plugin/src/it/simple/pom.xml +++ b/eo-maven-plugin/src/it/simple/pom.xml @@ -45,7 +45,7 @@ SOFTWARE. register assemble - verify + lint transpile diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java b/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java index 225f119ec3..e0cb2bb559 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java @@ -139,7 +139,7 @@ public Collection exec(final Collection tojos) throws IO final Collection res = new ArrayList<>(0); new File(this.targetDir.toPath().resolve("Lib/").toString()).mkdirs(); for (final ForeignTojo tojo : tojos) { - final Path file = tojo.verified(); + final Path file = tojo.optimized(); for (final FFINode ffi: this.getFFIs(new XMLDocument(file))) { ffi.generateUnchecked(); if (ffi instanceof Buildable) { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java similarity index 65% rename from eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java rename to eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index c444b7b974..62d4a69143 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -26,9 +26,11 @@ import com.jcabi.log.Logger; import com.jcabi.xml.XML; import com.jcabi.xml.XMLDocument; +import java.io.IOException; import java.nio.file.Path; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.concurrent.ConcurrentHashMap; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -38,30 +40,37 @@ import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; import org.cactoos.number.SumOf; +import org.eolang.lints.Defect; +import org.eolang.lints.Program; +import org.eolang.lints.Severity; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.w3c.dom.Node; +import org.xembly.Directives; +import org.xembly.Xembler; /** - * Mojo that checks errors and warnings after "assemble" phase. + * Mojo that runs all lints and checks errors and warnings, + * preferably after the {@code assemble} goal. * * @since 0.31.0 */ @Mojo( - name = "verify", + name = "lint", defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true ) -public final class VerifyMojo extends SafeMojo { +public final class LintMojo extends SafeMojo { /** * The directory where to transpile to. */ - public static final String DIR = "6-verify"; + public static final String DIR = "6-lint"; /** * Subdirectory for optimized cache. */ - static final String CACHE = "verified"; + static final String CACHE = "linted"; /** * Whether we should fail on warning. @@ -80,12 +89,12 @@ public final class VerifyMojo extends SafeMojo { void exec() { final Collection tojos = this.scopedTojos().withShaken(); final ConcurrentHashMap counts = new ConcurrentHashMap<>(); - counts.putIfAbsent("critical", 0); - counts.putIfAbsent("error", 0); - counts.putIfAbsent("warning", 0); + counts.putIfAbsent(Severity.CRITICAL.name(), 0); + counts.putIfAbsent(Severity.ERROR.name(), 0); + counts.putIfAbsent(Severity.WARNING.name(), 0); final Collection must = new ListOf<>( new Filtered<>( - ForeignTojo::notVerified, + ForeignTojo::notLinted, tojos ) ); @@ -93,24 +102,24 @@ void exec() { new Threads<>( Runtime.getRuntime().availableProcessors(), new Mapped<>( - tojo -> () -> this.verify(tojo, counts), + tojo -> () -> this.lintOne(tojo, counts), must ) ) ).intValue(); if (must.isEmpty()) { - Logger.info(this, "No XMIR programs out of %d verified", tojos.size()); + Logger.info(this, "No XMIR programs out of %d linted", tojos.size()); } else if (tojos.isEmpty()) { - Logger.info(this, "There are no XMIR programs, nothing to verify"); + Logger.info(this, "There are no XMIR programs, nothing to lint"); } else { - final String sum = VerifyMojo.summary(counts); + final String sum = LintMojo.summary(counts); Logger.info( this, - "Verified %d out of %d XMIR program(s) that needed verification (out of %d total programs): %s", + "Linted %d out of %d XMIR program(s) that needed this (out of %d total programs): %s", passed, must.size(), tojos.size(), sum ); - if (counts.get("error") > 0 || counts.get("critical") > 0 - || counts.get("warning") > 0 && this.failOnWarning) { + if (counts.get(Severity.ERROR.name()) > 0 || counts.get(Severity.CRITICAL.name()) > 0 + || counts.get(Severity.WARNING.name()) > 0 && this.failOnWarning) { throw new IllegalStateException( String.format("In %d XMIR files, we found %s", must.size(), sum) ); @@ -123,33 +132,28 @@ void exec() { * @param tojo Foreign tojo * @param counts Counts of errors, warnings, and critical * @return Amount of passed tojos (1 if passed, 0 if errors) - * @throws Exception If failed to verify + * @throws Exception If failed to lint */ - private int verify(final ForeignTojo tojo, + private int lintOne(final ForeignTojo tojo, final ConcurrentHashMap counts) throws Exception { final Path source = tojo.shaken(); final XML xmir = new XMLDocument(source); final String name = xmir.xpath("/program/@name").get(0); - final Path base = this.targetDir.toPath().resolve(VerifyMojo.DIR); + final Path base = this.targetDir.toPath().resolve(LintMojo.DIR); final Path target = new Place(name).make(base, AssembleMojo.XMIR); int verified = 1; try { - tojo.withVerified( + tojo.withLinted( new FpDefault( - src -> { - if (!this.good(xmir, counts)) { - throw new SkipException(); - } - return xmir.toString(); - }, - this.cache.toPath().resolve(VerifyMojo.CACHE), + src -> this.counted(LintMojo.lint(xmir), counts).toString(), + this.cache.toPath().resolve(LintMojo.CACHE), this.plugin.getVersion(), new TojoHash(tojo), base.relativize(target) ).apply(source, target) ); } catch (final SkipException ex) { - Logger.debug(this, "Failed to verify %[file]s", source); + Logger.debug(this, "Failed to lint %[file]s", source); verified = 0; } return verified; @@ -161,8 +165,7 @@ private int verify(final ForeignTojo tojo, * @param counts Counts of errors, warnings, and critical * @return TRUE if it's good */ - private boolean good(final XML xml, final ConcurrentHashMap counts) { - boolean good = true; + private XML counted(final XML xml, final ConcurrentHashMap counts) { for (final XML error : xml.nodes("/program/errors/error")) { final List line = error.xpath("@line"); final StringBuilder message = new StringBuilder() @@ -174,20 +177,18 @@ private boolean good(final XML xml, final ConcurrentHashMap cou .append(error.xpath("text()").get(0)) .append(" (") .append(error.xpath("@check").get(0)) + .append(' ') + .append(error.xpath("@severity").get(0)) .append(')'); final String severity = error.xpath("@severity").get(0); counts.compute(severity, (sev, before) -> before + 1); switch (severity) { - case "warning": + case Severity.WARNING.name(): Logger.warn(this, message.toString()); - if (this.failOnWarning) { - good = false; - } break; - case "error": - case "critical": + case Severity.ERROR.name(): + case Severity.CRITICAL.name(): Logger.error(this, message.toString()); - good = false; break; default: throw new IllegalArgumentException( @@ -195,7 +196,7 @@ private boolean good(final XML xml, final ConcurrentHashMap cou ); } } - return good; + return xml; } /** @@ -205,14 +206,14 @@ private boolean good(final XML xml, final ConcurrentHashMap cou */ private static String summary(final ConcurrentHashMap counts) { final StringBuilder sum = new StringBuilder(100); - final int criticals = counts.get("critical"); + final int criticals = counts.get(Severity.CRITICAL.name()); if (criticals > 0) { sum.append(criticals).append(" critical error"); if (criticals > 1) { sum.append('s'); } } - final int errors = counts.get("error"); + final int errors = counts.get(Severity.ERROR.name()); if (errors > 0) { if (sum.length() > 0) { sum.append(", "); @@ -222,7 +223,7 @@ private static String summary(final ConcurrentHashMap counts) { sum.append('s'); } } - final int warnings = counts.get("warning"); + final int warnings = counts.get(Severity.WARNING.name()); if (warnings > 0) { if (sum.length() > 0) { sum.append(", "); @@ -238,6 +239,51 @@ private static String summary(final ConcurrentHashMap counts) { return sum.toString(); } + /** + * Find all possible linting defects. + * @param xmir The XML before linting + * @return XML after linting + * @throws IOException If fails + */ + private static XML lint(final XML xmir) throws IOException { + final Directives dirs = new Directives(); + final Collection defects = new Program(xmir).defects(); + if (!defects.isEmpty()) { + dirs.xpath("/program").addIf("errors").strict(1); + for (final Defect defect : defects) { + if (LintMojo.suppressed(xmir, defect)) { + continue; + } + dirs.add("error") + .attr("check", defect.rule()) + .attr("severity", defect.severity().toString().toLowerCase(Locale.ENGLISH)) + .set(defect.text()); + if (defect.line() > 0) { + dirs.attr("line", defect.line()); + } + dirs.up(); + } + } + final Node node = xmir.node(); + new Xembler(dirs).applyQuietly(node); + return new XMLDocument(node); + } + + /** + * This defect is suppressed? + * @param xmir The XMIR + * @param defect The defect + * @return TRUE if suppressed + */ + private static boolean suppressed(final XML xmir, final Defect defect) { + return !xmir.nodes( + String.format( + "/program/metas/meta[head='unlint' and tail='%s']", + defect.rule() + ) + ).isEmpty(); + } + /** * If this file must be skipped. * @@ -245,4 +291,5 @@ private static String summary(final ConcurrentHashMap counts) { */ public static class SkipException extends RuntimeException { } + } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java index d7c2c519b8..9222ab4fc6 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java @@ -28,10 +28,8 @@ import com.jcabi.xml.XMLDocument; import com.yegor256.xsline.Shift; import com.yegor256.xsline.Train; -import java.io.IOException; import java.nio.file.Path; import java.util.Collection; -import java.util.Locale; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -39,8 +37,6 @@ import org.cactoos.iterable.Filtered; import org.cactoos.iterable.Mapped; import org.cactoos.number.SumOf; -import org.eolang.lints.Defect; -import org.eolang.lints.Program; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.optimization.OptSpy; import org.eolang.maven.optimization.OptTrain; @@ -48,9 +44,6 @@ import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; import org.eolang.parser.TrParsing; -import org.w3c.dom.Node; -import org.xembly.Directives; -import org.xembly.Xembler; /** * Optimize XML files, applying a number of mandatory XSL transformations @@ -138,7 +131,7 @@ private int optimized(final ForeignTojo tojo, final Optimization optimization) final Path target = new Place(name).make(base, AssembleMojo.XMIR); tojo.withOptimized( new FpDefault( - src -> OptimizeMojo.lint(optimization.apply(xmir)).toString(), + src -> optimization.apply(xmir).toString(), this.cache.toPath().resolve(OptimizeMojo.CACHE), this.plugin.getVersion(), new TojoHash(tojo), @@ -166,48 +159,4 @@ private Optimization optimization() { return opt; } - /** - * Find all possible linting defects. - * @param xmir The XML before linting - * @return XML after linting - * @throws IOException If fails - */ - private static XML lint(final XML xmir) throws IOException { - final Directives dirs = new Directives(); - final Collection defects = new Program(xmir).defects(); - if (!defects.isEmpty()) { - dirs.xpath("/program").addIf("errors").strict(1); - for (final Defect defect : defects) { - if (OptimizeMojo.suppressed(xmir, defect)) { - continue; - } - dirs.add("error") - .attr("check", defect.rule()) - .attr("severity", defect.severity().toString().toLowerCase(Locale.ENGLISH)) - .set(defect.text()); - if (defect.line() > 0) { - dirs.attr("line", defect.line()); - } - dirs.up(); - } - } - final Node node = xmir.node(); - new Xembler(dirs).applyQuietly(node); - return new XMLDocument(node); - } - - /** - * This defect is suppressed? - * @param xmir The XMIR - * @param defect The defect - * @return TRUE if suppressed - */ - private static boolean suppressed(final XML xmir, final Defect defect) { - return !xmir.nodes( - String.format( - "/program/metas/meta[head='unlint' and tail='%s']", - defect.rule() - ) - ).isEmpty(); - } } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java index 9d5abef0dc..bb08b9b221 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java @@ -162,7 +162,7 @@ public final class TranspileMojo extends SafeMojo { @Override public void exec() { - final Collection sources = this.scopedTojos().verified(); + final Collection sources = this.scopedTojos().withOptimized(); final Optimization optimization = this.transpilation(); final long saved = new SumOf( new Threads<>( @@ -201,7 +201,7 @@ private long transpiled(final ForeignTojo tojo, final Optimization transpilation throws IOException { final Path source; try { - source = tojo.verified(); + source = tojo.optimized(); } catch (final AttributeNotFoundException exception) { throw new IllegalStateException( "You should check that 'Verify' goal of the plugin was run first", diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java index 66206bec2f..95014c71b6 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java @@ -76,14 +76,6 @@ public Path optimized() { return Paths.get(this.attribute(ForeignTojos.Attribute.OPTIMIZED)); } - /** - * The tojo verified xmir. - * @return The verified xmir. - */ - public Path verified() { - return Paths.get(this.attribute(ForeignTojos.Attribute.VERIFIED)); - } - /** * The tojo shaken xmir. * @return The shaken xmir. @@ -184,11 +176,11 @@ public boolean notShaken() { * * @return True if optimization is required, false otherwise. */ - public boolean notVerified() { + public boolean notLinted() { final Path src = this.xmir(); boolean res = true; - if (this.delegate.exists(ForeignTojos.Attribute.VERIFIED.getKey())) { - final Path tgt = this.verified(); + if (this.delegate.exists(ForeignTojos.Attribute.LINTED.getKey())) { + final Path tgt = this.optimized(); if (tgt.toFile().lastModified() >= src.toFile().lastModified()) { Logger.debug(this, "Already verified %[file]s to %[file]s", src, tgt); res = false; @@ -289,12 +281,12 @@ public ForeignTojo withShaken(final Path xmir) { } /** - * Set the verified xmir. - * @param xmir The verified xmir. + * Set the linted xmir. + * @param xmir The linted xmir. * @return The tojo itself. */ - public ForeignTojo withVerified(final Path xmir) { - this.delegate.set(ForeignTojos.Attribute.VERIFIED.getKey(), xmir.toString()); + public ForeignTojo withLinted(final Path xmir) { + this.delegate.set(ForeignTojos.Attribute.LINTED.getKey(), xmir.toString()); return this; } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java index d16f674706..b2927fb942 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java @@ -211,14 +211,6 @@ public Collection withOptimized() { return this.select(row -> row.exists(Attribute.OPTIMIZED.getKey())); } - /** - * Get the tojos that have corresponding verified xmir. - * @return The tojos. - */ - public Collection verified() { - return this.select(row -> row.exists(Attribute.VERIFIED.getKey())); - } - /** * Get the tojos that have not probed yet. * @return The tojos. @@ -340,7 +332,7 @@ enum Attribute { /** * Absolute path of the verified {@code .xmir} file. */ - VERIFIED("verified"), + LINTED("linted"), /** * Absolute path of the SODG file. diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java index 8fcf5b36d5..d66da3a695 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java @@ -230,7 +230,7 @@ private static Map execParse(final Path temp, final Path... progra for (final Path program : programs) { maven.withProgram(program); } - maven.execute(new FakeMaven.Verify()); + maven.execute(new FakeMaven.Lint()); } new BinarizeParse( generated, diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java index ae1cad00d5..4f2ab40a9d 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java @@ -630,14 +630,14 @@ public Iterator> iterator() { * * @since 0.31.0 */ - static final class Verify implements Iterable> { + static final class Lint implements Iterable> { @Override public Iterator> iterator() { return Arrays.>asList( ParseMojo.class, OptimizeMojo.class, ShakeMojo.class, - VerifyMojo.class + LintMojo.class ).iterator(); } } @@ -689,7 +689,7 @@ public Iterator> iterator() { ParseMojo.class, OptimizeMojo.class, ShakeMojo.class, - VerifyMojo.class, + LintMojo.class, TranspileMojo.class ).iterator(); } @@ -708,7 +708,7 @@ public Iterator> iterator() { ParseMojo.class, OptimizeMojo.class, ShakeMojo.class, - VerifyMojo.class, + LintMojo.class, BinarizeMojo.class ).iterator(); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java similarity index 81% rename from eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java rename to eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java index 67be9519dd..8b8f510799 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java @@ -43,26 +43,20 @@ import org.junit.jupiter.api.extension.ExtendWith; /** - * Test cases for {@link VerifyMojo}. + * Test cases for {@link LintMojo}. * * @since 0.31.0 - * @todo #2674:30min The messages "Warnings identified" from - * /org/eolang/parser/fail-on-warnings.xsl - * can have nullable line number. Need fix it, that it works as in - * /org/eolang/parser/warnings/mandatory-version-meta.xsl and - * /org/eolang/parser/warnings/mandatory-home-meta.xsl. - * After you need fix {@code createRegEx()}. */ @SuppressWarnings({"PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods"}) @ExtendWith(MktmpResolver.class) -final class VerifyMojoTest { +final class LintMojoTest { @Test void doesNotFailWithNoErrorsAndWarnings(@Mktmp final Path temp) { Assertions.assertDoesNotThrow( () -> new FakeMaven(temp) .withHelloWorld() - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Correct program should not have failed, but it does" ); } @@ -72,26 +66,25 @@ void detectsErrorsSuccessfully(@Mktmp final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp) .withProgram( "+package f\n", - "# This is the default 64+ symbols comment in front of named abstract object.", + "# Test.", "[] > main", " QQ.io.stdout", " \"Hello world\"" ); Assertions.assertThrows( IllegalStateException.class, - () -> maven.execute(new FakeMaven.Verify()), + () -> maven.execute(new FakeMaven.Lint()), "Program with noname attributes should have failed or error, but it didn't" ); + final Path xmir = maven.result().get("target/6-lint/foo/x/main.xmir"); MatcherAssert.assertThat( - "Verified file should not exist", - maven.result().get("target/6-verify/foo/x/main.xmir"), - Matchers.equalTo(null) + "Linted file should exist", + xmir, + Matchers.not(Matchers.equalTo(null)) ); MatcherAssert.assertThat( - "Critical error must exist in shaken XMIR", - new XMLDocument( - maven.result().get("target/3-shake/foo/x/main.xmir") - ).nodes("//errors/error[@severity='error']"), + "Critical error must exist in linted XMIR", + new XMLDocument(xmir).nodes("/program/errors/error[@severity='error']"), Matchers.hasSize(1) ); } @@ -107,7 +100,7 @@ void detectsCriticalErrorsSuccessfully(@Mktmp final Path temp) throws IOExceptio ); Assertions.assertThrows( IllegalStateException.class, - () -> maven.execute(new FakeMaven.Verify()), + () -> maven.execute(new FakeMaven.Lint()), "Wrong program should have failed or error, but it didn't" ); MatcherAssert.assertThat( @@ -138,18 +131,13 @@ void detectsWarningWithCorrespondingFlag(@Mktmp final Path temp) throws IOExcept .with("failOnWarning", true); Assertions.assertThrows( IllegalStateException.class, - () -> maven.execute(new FakeMaven.Verify()), + () -> maven.execute(new FakeMaven.Lint()), "Program with sparse decorated object should have failed on warning, but it didn't" ); - MatcherAssert.assertThat( - "Verified file should not exist", - maven.result().get("target/6-verify/foo/x/main.xmir"), - Matchers.equalTo(null) - ); MatcherAssert.assertThat( "Warning must exist in shaken XMIR", new XMLDocument( - maven.result().get("target/3-shake/foo/x/main.xmir") + maven.result().get("target/6-lint/foo/x/main.xmir") ).nodes("//errors/error[@severity='warning']"), Matchers.hasSize(Matchers.greaterThan(2)) ); @@ -168,7 +156,7 @@ void doesNotDetectWarningWithoutCorrespondingFlag(@Mktmp final Path temp) { " \"Hello world\" > @" ) .with("failOnWarning", false) - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Program with sparse decorated object should not have failed on warning without flag, but it does" ); } @@ -185,7 +173,7 @@ void failsOptimizationOnError(@Mktmp final Path temp) { "[args] > main", " (stdout \"Hello!\").print > @" ) - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Error in the eo code because of invalid alias, should fail" ); } @@ -203,7 +191,7 @@ void failsOptimizationOnCritical(@Mktmp final Path temp) { " TRUE > x", " FALSE > x" ).with("trackOptimizationSteps", true) - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -214,7 +202,7 @@ void failsParsingOnError(@Mktmp final Path temp) { IllegalStateException.class, () -> new FakeMaven(temp) .withProgram("something > is wrong here") - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Program with invalid syntax should have failed, but it didn't" ); } @@ -225,13 +213,13 @@ void failsOnInvalidProgram(@Mktmp final Path temp) { IllegalStateException.class, () -> new FakeMaven(temp) .withProgram(AssembleMojoTest.INVALID_PROGRAM) - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Invalid program with wrong syntax should have failed to assemble, but it didn't" ); } @Test - void failsOnWarning(@Mktmp final Path temp) throws Exception { + void failsOnWarning(@Mktmp final Path temp) { Assertions.assertThrows( IllegalStateException.class, () -> new FakeMaven(temp) @@ -239,14 +227,13 @@ void failsOnWarning(@Mktmp final Path temp) throws Exception { "+architect yegor256@gmail.com", "+tests", "+package org.eolang.examples\n", - "# This is the default 64+ symbols comment in front of named abstract object.", + "# Test.", "[] > main", - " # This is the default 64+ symbols comment in front of named abstract object.", " [] > @", " hello > test" ) .with("failOnWarning", true) - .execute(new FakeMaven.Verify()), + .execute(new FakeMaven.Lint()), "Program with warning should fail" ); } @@ -255,12 +242,12 @@ void failsOnWarning(@Mktmp final Path temp) throws Exception { void skipsAlreadyVerified(@Mktmp final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp) .withHelloWorld() - .execute(new FakeMaven.Verify()); + .execute(new FakeMaven.Lint()); final Path path = maven.result().get( - String.format("target/%s/foo/x/main.%s", VerifyMojo.DIR, AssembleMojo.XMIR) + String.format("target/%s/foo/x/main.%s", LintMojo.DIR, AssembleMojo.XMIR) ); final long mtime = path.toFile().lastModified(); - maven.execute(VerifyMojo.class); + maven.execute(LintMojo.class); MatcherAssert.assertThat( "VerifyMojo must skip verification if XMIR was already verified", path.toFile().lastModified(), @@ -276,10 +263,10 @@ void savesVerifiedResultsToCache(@Mktmp final Path temp) throws IOException { .withHelloWorld() .with("cache", cache.toFile()) .allTojosWithHash(() -> hash) - .execute(new FakeMaven.Verify()); + .execute(new FakeMaven.Lint()); MatcherAssert.assertThat( "Verified results must be saved to cache", - cache.resolve(VerifyMojo.CACHE) + cache.resolve(LintMojo.CACHE) .resolve(FakeMaven.pluginVersion()) .resolve(hash) .resolve("foo/x/main.xmir").toFile(), @@ -297,7 +284,7 @@ void getsAlreadyVerifiedResultsFromCache(@Mktmp final Path temp) throws Exceptio new Saved( cached, cache - .resolve(VerifyMojo.CACHE) + .resolve(LintMojo.CACHE) .resolve(FakeMaven.pluginVersion()) .resolve(hash) .resolve("foo/x/main.xmir") @@ -305,7 +292,7 @@ void getsAlreadyVerifiedResultsFromCache(@Mktmp final Path temp) throws Exceptio Files.setLastModifiedTime( cache.resolve( Paths - .get(VerifyMojo.CACHE) + .get(LintMojo.CACHE) .resolve(FakeMaven.pluginVersion()) .resolve(hash) .resolve("foo/x/main.xmir") @@ -316,7 +303,7 @@ void getsAlreadyVerifiedResultsFromCache(@Mktmp final Path temp) throws Exceptio .withHelloWorld() .with("cache", cache.toFile()) .allTojosWithHash(() -> hash) - .execute(new FakeMaven.Verify()); + .execute(new FakeMaven.Lint()); MatcherAssert.assertThat( BinarizeParseTest.TO_ADD_MESSAGE, new XMLDocument( @@ -324,7 +311,7 @@ void getsAlreadyVerifiedResultsFromCache(@Mktmp final Path temp) throws Exceptio Paths.get( String.format( "target/%s/foo/x/main.%s", - VerifyMojo.DIR, + LintMojo.DIR, AssembleMojo.XMIR ) ) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java index eabf979bde..71458bc63c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java @@ -81,7 +81,7 @@ void optimizesSimpleObject(@Mktmp final Path temp) throws Exception { MatcherAssert.assertThat( "the .xmir file contains lint defects", new XMLDocument(temp.resolve("target/eo/2-optimize/foo.xmir")), - XhtmlMatchers.hasXPaths("/program/errors/error") + XhtmlMatchers.hasXPaths("/program[not(errors)]") ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java index 6c081aed64..81f8210054 100755 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java @@ -36,13 +36,10 @@ import org.cactoos.io.ResourceOf; import org.cactoos.text.TextOf; import org.eolang.jucs.ClasspathSource; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; import org.eolang.xax.XaxStory; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.io.FileMatchers; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -204,13 +201,14 @@ void transpilesSeveralEoProgramsInParallel(@Mktmp final Path temp) throws IOExce } maven.execute(new FakeMaven.Transpile()).result(); MatcherAssert.assertThat( - BinarizeParseTest.TO_ADD_MESSAGE, - Files.list(maven.generatedPath() - .resolve("EOorg") - .resolve("EOeolang") - .resolve("EOexamples") + "All programs must be transpiled", + Files.list( + maven.generatedPath() + .resolve("EOorg") + .resolve("EOeolang") + .resolve("EOexamples") ).count(), - Matchers.equalTo(4L) + Matchers.equalTo(2L) ); } @@ -247,23 +245,6 @@ void transpilesSourcesForDifferentScopesWithoutIntersections( ); } - @Test - @CaptureLogs - void skipsTranpilationIfWasNotVerified(@Mktmp final Path temp, final Logs out) - throws IOException { - new FakeMaven(temp) - .withHelloWorld() - .execute(ParseMojo.class) - .execute(OptimizeMojo.class) - .execute(ShakeMojo.class) - .execute(TranspileMojo.class) - .result(); - Assertions.assertTrue( - out.captured().stream().anyMatch(log -> log.contains("created 0 Java files")), - "Tranpile mojo must transpile 0 files from not verified XMIRs" - ); - } - /** * Get all classes in directory. * @param root Directory to get classes from. diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java index 85f288121d..dc0138dd94 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java @@ -142,12 +142,12 @@ void getsExceptionMessageIfKeyWasNotFoundInTojo() { final ForeignTojo tojo = this.tojos.add("string"); final AttributeNotFoundException thrown = Assertions.assertThrows( AttributeNotFoundException.class, - tojo::verified + tojo::optimized ); Assertions.assertEquals( - "There is no 'VERIFIED' attribute in the tojo", + "There is no 'OPTIMIZED' attribute in the tojo", thrown.getMessage(), - "Should throw an exception if key 'VERIFIED' was not found in Tojo" + "Should throw an exception if key 'OPTIMIZED' was not found in Tojo" ); } @@ -175,7 +175,6 @@ private static Stream tojoFunctionsWithoutDefaultValues() { return Stream.of( Arguments.of("XMIR", (Func) ForeignTojo::xmir), Arguments.of("OPTIMIZED", (Func) ForeignTojo::optimized), - Arguments.of("VERIFIED", (Func) ForeignTojo::verified), Arguments.of("SHAKEN", (Func) ForeignTojo::shaken), Arguments.of("EO", (Func) ForeignTojo::source), Arguments.of("VERSION", (Func) ForeignTojo::version), diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index bc4cdc472f..bb44157ced 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -217,7 +217,7 @@ SOFTWARE. register deps assemble - verify + lint transpile copy unplace @@ -240,7 +240,7 @@ SOFTWARE. register deps assemble - verify + lint transpile binarize diff --git a/eo-runtime/src/test/java/integration/PhiUnphiIT.java b/eo-runtime/src/test/java/integration/PhiUnphiIT.java index 57579d543c..3976ab8412 100755 --- a/eo-runtime/src/test/java/integration/PhiUnphiIT.java +++ b/eo-runtime/src/test/java/integration/PhiUnphiIT.java @@ -146,7 +146,7 @@ void runsTestsAfterPhiAndUnphi(final @Mktmp Path temp) throws IOException { .goals( "register", "assemble", - "verify", + "lint", "transpile", "copy", "unplace", @@ -187,7 +187,7 @@ void runsTestsAfterPhiAndUnphi(final @Mktmp Path temp) throws IOException { .goals( "register", "assemble", - "verify", + "lint", "transpile", "binarize" ) diff --git a/eo-runtime/src/test/java/integration/SnippetIT.java b/eo-runtime/src/test/java/integration/SnippetIT.java index 3c103cd01b..cb20b7f698 100755 --- a/eo-runtime/src/test/java/integration/SnippetIT.java +++ b/eo-runtime/src/test/java/integration/SnippetIT.java @@ -99,7 +99,7 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio ) .execution("compile") .phase("generate-sources") - .goals("register", "assemble", "verify", "transpile") + .goals("register", "assemble", "lint", "transpile") .configuration() .set("failOnWarning", Boolean.FALSE.toString()); f.build() diff --git a/pom.xml b/pom.xml index 9001e126e0..d9eea88830 100644 --- a/pom.xml +++ b/pom.xml @@ -271,6 +271,14 @@ SOFTWARE. + + + org.apache.groovy + groovy + 5.0.0-alpha-11 + test + + From 5600ae5a5823c1916a58074b9400d3cf6e3f82ad Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 07:26:57 +0300 Subject: [PATCH 2/9] #3592: extra test --- eo-maven-plugin/pom.xml | 2 +- .../main/java/org/eolang/maven/LintMojo.java | 71 ++++++++----------- .../parser/packs/optimize/float-atom.yaml | 36 ++++++++++ 3 files changed, 65 insertions(+), 44 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index d02319e3c7..b77c67f463 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.15 + 0.0.16 com.yegor256 diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 62d4a69143..4633924c08 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -30,7 +30,6 @@ import java.nio.file.Path; import java.util.Collection; import java.util.List; -import java.util.Locale; import java.util.concurrent.ConcurrentHashMap; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -88,10 +87,10 @@ public final class LintMojo extends SafeMojo { @Override void exec() { final Collection tojos = this.scopedTojos().withShaken(); - final ConcurrentHashMap counts = new ConcurrentHashMap<>(); - counts.putIfAbsent(Severity.CRITICAL.name(), 0); - counts.putIfAbsent(Severity.ERROR.name(), 0); - counts.putIfAbsent(Severity.WARNING.name(), 0); + final ConcurrentHashMap counts = new ConcurrentHashMap<>(); + counts.putIfAbsent(Severity.CRITICAL, 0); + counts.putIfAbsent(Severity.ERROR, 0); + counts.putIfAbsent(Severity.WARNING, 0); final Collection must = new ListOf<>( new Filtered<>( ForeignTojo::notLinted, @@ -118,8 +117,8 @@ void exec() { "Linted %d out of %d XMIR program(s) that needed this (out of %d total programs): %s", passed, must.size(), tojos.size(), sum ); - if (counts.get(Severity.ERROR.name()) > 0 || counts.get(Severity.CRITICAL.name()) > 0 - || counts.get(Severity.WARNING.name()) > 0 && this.failOnWarning) { + if (counts.get(Severity.ERROR) > 0 || counts.get(Severity.CRITICAL) > 0 + || counts.get(Severity.WARNING) > 0 && this.failOnWarning) { throw new IllegalStateException( String.format("In %d XMIR files, we found %s", must.size(), sum) ); @@ -135,28 +134,22 @@ void exec() { * @throws Exception If failed to lint */ private int lintOne(final ForeignTojo tojo, - final ConcurrentHashMap counts) throws Exception { + final ConcurrentHashMap counts) throws Exception { final Path source = tojo.shaken(); final XML xmir = new XMLDocument(source); final String name = xmir.xpath("/program/@name").get(0); final Path base = this.targetDir.toPath().resolve(LintMojo.DIR); final Path target = new Place(name).make(base, AssembleMojo.XMIR); - int verified = 1; - try { - tojo.withLinted( - new FpDefault( - src -> this.counted(LintMojo.lint(xmir), counts).toString(), - this.cache.toPath().resolve(LintMojo.CACHE), - this.plugin.getVersion(), - new TojoHash(tojo), - base.relativize(target) - ).apply(source, target) - ); - } catch (final SkipException ex) { - Logger.debug(this, "Failed to lint %[file]s", source); - verified = 0; - } - return verified; + tojo.withLinted( + new FpDefault( + src -> this.counted(LintMojo.lint(xmir), counts).toString(), + this.cache.toPath().resolve(LintMojo.CACHE), + this.plugin.getVersion(), + new TojoHash(tojo), + base.relativize(target) + ).apply(source, target) + ); + return 1; } /** @@ -165,7 +158,7 @@ private int lintOne(final ForeignTojo tojo, * @param counts Counts of errors, warnings, and critical * @return TRUE if it's good */ - private XML counted(final XML xml, final ConcurrentHashMap counts) { + private XML counted(final XML xml, final ConcurrentHashMap counts) { for (final XML error : xml.nodes("/program/errors/error")) { final List line = error.xpath("@line"); final StringBuilder message = new StringBuilder() @@ -180,19 +173,19 @@ private XML counted(final XML xml, final ConcurrentHashMap coun .append(' ') .append(error.xpath("@severity").get(0)) .append(')'); - final String severity = error.xpath("@severity").get(0); + final Severity severity = Severity.parsed(error.xpath("@severity").get(0)); counts.compute(severity, (sev, before) -> before + 1); switch (severity) { - case Severity.WARNING.name(): + case WARNING: Logger.warn(this, message.toString()); break; - case Severity.ERROR.name(): - case Severity.CRITICAL.name(): + case ERROR: + case CRITICAL: Logger.error(this, message.toString()); break; default: throw new IllegalArgumentException( - String.format("Incorrect severity: %s", severity) + String.format("Not yet supported severity: %s", severity) ); } } @@ -204,16 +197,16 @@ private XML counted(final XML xml, final ConcurrentHashMap coun * @param counts Counts of errors, warnings, and critical * @return Summary text */ - private static String summary(final ConcurrentHashMap counts) { + private static String summary(final ConcurrentHashMap counts) { final StringBuilder sum = new StringBuilder(100); - final int criticals = counts.get(Severity.CRITICAL.name()); + final int criticals = counts.get(Severity.CRITICAL); if (criticals > 0) { sum.append(criticals).append(" critical error"); if (criticals > 1) { sum.append('s'); } } - final int errors = counts.get(Severity.ERROR.name()); + final int errors = counts.get(Severity.ERROR); if (errors > 0) { if (sum.length() > 0) { sum.append(", "); @@ -223,7 +216,7 @@ private static String summary(final ConcurrentHashMap counts) { sum.append('s'); } } - final int warnings = counts.get(Severity.WARNING.name()); + final int warnings = counts.get(Severity.WARNING); if (warnings > 0) { if (sum.length() > 0) { sum.append(", "); @@ -256,7 +249,7 @@ private static XML lint(final XML xmir) throws IOException { } dirs.add("error") .attr("check", defect.rule()) - .attr("severity", defect.severity().toString().toLowerCase(Locale.ENGLISH)) + .attr("severity", defect.severity().mnemo()) .set(defect.text()); if (defect.line() > 0) { dirs.attr("line", defect.line()); @@ -284,12 +277,4 @@ private static boolean suppressed(final XML xmir, final Defect defect) { ).isEmpty(); } - /** - * If this file must be skipped. - * - * @since 0.43.0 - */ - public static class SkipException extends RuntimeException { - } - } diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml new file mode 100644 index 0000000000..7a5be97f92 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml @@ -0,0 +1,36 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2024 Objectionary.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# 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. +--- +xsls: + - /org/eolang/parser/optimize/remove-refs.xsl + - /org/eolang/parser/optimize/abstracts-float-up.xsl + - /org/eolang/parser/optimize/remove-levels.xsl + - /org/eolang/parser/add-refs.xsl + - /org/eolang/parser/optimize/fix-missed-names.xsl + - /org/eolang/parser/clean-up.xsl +tests: + - //objects[not(o[@atom and o[@base]])] + - //o[@atom and o[not(@base) and x]] +eo: | + # Test. + [] > main + [x] > foo /number From acba6a7dc44ea8ef331c41fc1af7ab6edaa7c92c Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 08:36:54 +0300 Subject: [PATCH 3/9] #3592: extra test --- eo-maven-plugin/pom.xml | 2 +- .../parser/optimize/abstracts-float-up.xsl | 2 +- .../eolang/parser/packs/float-atom-vars.yaml | 33 +++++++++++++++++++ .../parser/packs/optimize/float-atom.yaml | 5 +-- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index b77c67f463..1e6ae6402d 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.16 + 1.0-SNAPSHOT com.yegor256 diff --git a/eo-parser/src/main/resources/org/eolang/parser/optimize/abstracts-float-up.xsl b/eo-parser/src/main/resources/org/eolang/parser/optimize/abstracts-float-up.xsl index efbd5f0686..e6de2e5c91 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/optimize/abstracts-float-up.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/optimize/abstracts-float-up.xsl @@ -116,7 +116,7 @@ SOFTWARE. - + diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml new file mode 100644 index 0000000000..8bc6bf9340 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml @@ -0,0 +1,33 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2024 Objectionary.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# 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. +--- +xsls: + - /org/eolang/parser/add-refs.xsl + - /org/eolang/parser/vars-float-up.xsl +tests: + - //objects[not(o[@atom and @base])] + - //objects[not(o[@atom and o[@base]])] + - //o[@atom and o[not(@base)]] +eo: | + # Test. + [] > main + [x] > foo /number diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml index 7a5be97f92..ce26de2f81 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml @@ -28,8 +28,9 @@ xsls: - /org/eolang/parser/optimize/fix-missed-names.xsl - /org/eolang/parser/clean-up.xsl tests: - - //objects[not(o[@atom and o[@base]])] - - //o[@atom and o[not(@base) and x]] + - //objects[not(//o[@atom and @base])] + - //objects[not(//o[@atom and o[@base]])] + - //o[@atom and o[not(@base)]] eo: | # Test. [] > main From 4cb1a5c4924e4ab07452e3fb6a3f3a08f673c4c4 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 09:18:11 +0300 Subject: [PATCH 4/9] #3592: threaded --- .../main/java/org/eolang/maven/LintMojo.java | 17 +--- .../java/org/eolang/maven/OptimizeMojo.java | 23 ++--- .../main/java/org/eolang/maven/ParseMojo.java | 23 ++--- .../main/java/org/eolang/maven/PhiMojo.java | 23 ++--- .../main/java/org/eolang/maven/PrintMojo.java | 61 ++++++------ .../main/java/org/eolang/maven/ShakeMojo.java | 23 ++--- .../java/org/eolang/maven/TranspileMojo.java | 22 ++--- .../main/java/org/eolang/maven/UnphiMojo.java | 80 ++++++++-------- .../org/eolang/maven/tojos/ForeignTojo.java | 5 + .../java/org/eolang/maven/util/Threaded.java | 93 +++++++++++++++++++ 10 files changed, 208 insertions(+), 162 deletions(-) create mode 100644 eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 4633924c08..44c88e5084 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -34,17 +34,15 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; import org.cactoos.iterable.Filtered; -import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; -import org.cactoos.number.SumOf; import org.eolang.lints.Defect; import org.eolang.lints.Program; import org.eolang.lints.Severity; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.eolang.maven.util.Threaded; import org.w3c.dom.Node; import org.xembly.Directives; import org.xembly.Xembler; @@ -97,15 +95,10 @@ void exec() { tojos ) ); - final int passed = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - tojo -> () -> this.lintOne(tojo, counts), - must - ) - ) - ).intValue(); + final int passed = new Threaded<>( + must, + tojo -> this.lintOne(tojo, counts) + ).total(); if (must.isEmpty()) { Logger.info(this, "No XMIR programs out of %d linted", tojos.size()); } else if (tojos.isEmpty()) { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java index 9222ab4fc6..b901f3684b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java @@ -33,16 +33,14 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; import org.cactoos.iterable.Filtered; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.optimization.OptSpy; import org.eolang.maven.optimization.OptTrain; import org.eolang.maven.optimization.Optimization; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.eolang.maven.util.Threaded; import org.eolang.parser.TrParsing; /** @@ -91,18 +89,13 @@ public void exec() { final long start = System.currentTimeMillis(); final Collection tojos = this.scopedTojos().withXmir(); final Optimization optimization = this.optimization(); - final int total = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - tojo -> () -> this.optimized(tojo, optimization), - new Filtered<>( - ForeignTojo::notOptimized, - tojos - ) - ) - ) - ).intValue(); + final int total = new Threaded<>( + new Filtered<>( + ForeignTojo::notOptimized, + tojos + ), + tojo -> this.optimized(tojo, optimization) + ).total(); if (total > 0) { Logger.info( this, diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java index c1580739f1..341cd16a84 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java @@ -35,14 +35,12 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.cactoos.Func; -import org.cactoos.experimental.Threads; import org.cactoos.io.InputOf; import org.cactoos.iterable.Filtered; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.eolang.maven.util.Threaded; import org.eolang.parser.EoSyntax; import org.xembly.Directives; import org.xembly.Xembler; @@ -89,18 +87,13 @@ public final class ParseMojo extends SafeMojo { @Override public void exec() { final long start = System.currentTimeMillis(); - final int total = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - tojo -> () -> this.parsed(tojo), - new Filtered<>( - ForeignTojo::notParsed, - this.scopedTojos().withSources() - ) - ) - ) - ).intValue(); + final int total = new Threaded<>( + new Filtered<>( + ForeignTojo::notParsed, + this.scopedTojos().withSources() + ), + this::parsed + ).total(); if (0 == total) { if (this.scopedTojos().withSources().isEmpty()) { Logger.info( diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java index 8cd137166f..4e46e1c79c 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java @@ -40,11 +40,9 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.cactoos.text.TextOf; import org.eolang.maven.footprint.Saved; +import org.eolang.maven.util.Threaded; import org.eolang.maven.util.Walk; import org.eolang.parser.StUnhex; import org.eolang.parser.TrParsing; @@ -111,18 +109,13 @@ public void exec() { final Walk walk = new Walk(this.phiInputDir.toPath()); final int total = walk.size(); final Xsline xsline = new Xsline(this.train()); - final int count = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - xmir -> () -> { - final int position = passed.addAndGet(1); - return this.translate(xmir, xsline, position, total); - }, - walk - ) - ) - ).intValue(); + final int count = new Threaded<>( + walk, + xmir -> { + final int position = passed.addAndGet(1); + return this.translate(xmir, xsline, position, total); + } + ).total(); if (count > 0) { Logger.info( this, "Translated %d XMIR file(s) from %[file]s to %[file]s", diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java index dc44d6c33c..2bcccdb2af 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java @@ -33,12 +33,10 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.cactoos.text.TextOf; import org.eolang.maven.util.HmBase; import org.eolang.maven.util.Home; +import org.eolang.maven.util.Threaded; import org.eolang.maven.util.Walk; import org.eolang.parser.Xmir; @@ -88,37 +86,32 @@ public final class PrintMojo extends SafeMojo { @Override void exec() throws IOException { final Home home = new HmBase(this.printOutputDir); - final int total = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - source -> () -> { - final Path relative = Paths.get( - this.printSourcesDir.toPath().relativize(source).toString() - .replace(".xmir", ".eo") - ); - final XML xml = new XMLDocument(new TextOf(source).asString()); - final String program; - if (this.printReversed) { - program = new Xmir(xml).toReversed(); - } else { - program = new Xmir(xml).toEO(); - } - home.save(program, relative); - Logger.info( - this, - "Printed: %[file]s (%[size]s) => %[file]s (%[size]s)", - source, - source.toFile().length(), - this.printOutputDir.toPath().resolve(relative), - this.printOutputDir.toPath().resolve(relative).toFile().length() - ); - return 1; - }, - new Walk(this.printSourcesDir.toPath()) - ) - ) - ).intValue(); + final int total = new Threaded<>( + new Walk(this.printSourcesDir.toPath()), + source -> { + final Path relative = Paths.get( + this.printSourcesDir.toPath().relativize(source).toString() + .replace(".xmir", ".eo") + ); + final XML xml = new XMLDocument(new TextOf(source).asString()); + final String program; + if (this.printReversed) { + program = new Xmir(xml).toReversed(); + } else { + program = new Xmir(xml).toEO(); + } + home.save(program, relative); + Logger.info( + this, + "Printed: %[file]s (%[size]s) => %[file]s (%[size]s)", + source, + source.toFile().length(), + this.printOutputDir.toPath().resolve(relative), + this.printOutputDir.toPath().resolve(relative).toFile().length() + ); + return 1; + } + ).total(); if (total == 0) { Logger.info(this, "No XMIR sources found"); } else { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java index 427e231067..995a2b8a6a 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java @@ -31,16 +31,14 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; import org.cactoos.iterable.Filtered; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.eolang.maven.footprint.FpDefault; import org.eolang.maven.optimization.OptSpy; import org.eolang.maven.optimization.OptTrain; import org.eolang.maven.optimization.Optimization; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.eolang.maven.util.Threaded; /** * Shake (prepare) XML files after optimizations for translation to java. @@ -83,18 +81,13 @@ void exec() { final long start = System.currentTimeMillis(); final Collection tojos = this.scopedTojos().withOptimized(); final Optimization optimization = this.optimization(); - final int total = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - tojo -> () -> this.shaken(tojo, optimization), - new Filtered<>( - ForeignTojo::notShaken, - tojos - ) - ) - ) - ).intValue(); + final int total = new Threaded<>( + new Filtered<>( + ForeignTojo::notShaken, + tojos + ), + tojo -> this.shaken(tojo, optimization) + ).total(); if (total > 0) { Logger.info( this, diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java index bb08b9b221..9cc14f45f8 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java @@ -38,15 +38,12 @@ import java.nio.file.Paths; import java.util.Collection; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; -import org.cactoos.experimental.Threads; -import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.cactoos.text.Joined; import org.eolang.maven.footprint.CachePath; import org.eolang.maven.footprint.Footprint; @@ -63,6 +60,7 @@ import org.eolang.maven.tojos.AttributeNotFoundException; import org.eolang.maven.tojos.ForeignTojo; import org.eolang.maven.tojos.TojoHash; +import org.eolang.maven.util.Threaded; /** * Transpile. @@ -164,12 +162,10 @@ public final class TranspileMojo extends SafeMojo { public void exec() { final Collection sources = this.scopedTojos().withOptimized(); final Optimization optimization = this.transpilation(); - final long saved = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>(tojo -> () -> this.transpiled(tojo, optimization), sources) - ) - ).longValue(); + final int saved = new Threaded<>( + sources, + tojo -> this.transpiled(tojo, optimization) + ).total(); Logger.info( this, "Transpiled %d XMIRs, created %d Java files in %[file]s", sources.size(), saved, this.generatedDir @@ -197,7 +193,7 @@ public void exec() { * @return Number of transpiled files. * @throws java.io.IOException If any issues with I/O */ - private long transpiled(final ForeignTojo tojo, final Optimization transpilation) + private int transpiled(final ForeignTojo tojo, final Optimization transpilation) throws IOException { final Path source; try { @@ -246,10 +242,10 @@ private Optimization transpilation() { * @return Amount of generated .java files * @throws IOException If fails to save files */ - private long javaGenerated(final boolean rewrite, final Path target, final String hsh) + private int javaGenerated(final boolean rewrite, final Path target, final String hsh) throws IOException { final Collection nodes = new XMLDocument(target).nodes("//class[java and not(@atom)]"); - final AtomicLong saved = new AtomicLong(0L); + final AtomicInteger saved = new AtomicInteger(0); for (final XML java : nodes) { final Path tgt = new Place(java.xpath("@java-name").get(0)).make( this.generatedDir.toPath(), TranspileMojo.JAVA diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java index eac6095773..655fcd0b4b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java @@ -38,15 +38,14 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.experimental.Threads; import org.cactoos.iterable.IterableEnvelope; import org.cactoos.iterable.Joined; import org.cactoos.iterable.Mapped; -import org.cactoos.number.SumOf; import org.cactoos.set.SetOf; import org.cactoos.text.TextOf; import org.eolang.maven.util.HmBase; import org.eolang.maven.util.Home; +import org.eolang.maven.util.Threaded; import org.eolang.maven.util.Walk; import org.eolang.parser.PhiSyntax; import org.eolang.parser.TrStepped; @@ -112,47 +111,42 @@ public void exec() { final Iterable metas = new UnphiMojo.Metas(this.unphiMetas); final Xsline xsline = new Xsline(this.measured(UnphiMojo.TRANSFORMATIONS)); final long start = System.currentTimeMillis(); - final int count = new SumOf( - new Threads<>( - Runtime.getRuntime().availableProcessors(), - new Mapped<>( - phi -> () -> { - final Path relative = this.unphiInputDir.toPath().relativize(phi); - final Path xmir = Paths.get( - relative.toString().replace( - String.format(".%s", PhiMojo.EXT), - String.format(".%s", AssembleMojo.XMIR) - ) - ); - final XML result = xsline.pass( - new PhiSyntax( - phi.getFileName().toString().replace(".phi", ""), - new TextOf(phi), - metas - ).parsed() - ); - home.save(result.toString(), xmir); - Logger.debug( - this, - "Parsed to xmir: %[file]s -> %[file]s", - phi, this.unphiOutputDir.toPath().resolve(xmir) - ); - final List here = result.xpath("//errors/error/text()"); - if (!here.isEmpty()) { - errors.add( - Logger.format( - "%[file]s:\n\t%s\n", - xmir, - String.join("\n\t", here) - ) - ); - } - return 1; - }, - new Walk(this.unphiInputDir.toPath()) - ) - ) - ).intValue(); + final int count = new Threaded<>( + new Walk(this.unphiInputDir.toPath()), + phi -> { + final Path relative = this.unphiInputDir.toPath().relativize(phi); + final Path xmir = Paths.get( + relative.toString().replace( + String.format(".%s", PhiMojo.EXT), + String.format(".%s", AssembleMojo.XMIR) + ) + ); + final XML result = xsline.pass( + new PhiSyntax( + phi.getFileName().toString().replace(".phi", ""), + new TextOf(phi), + metas + ).parsed() + ); + home.save(result.toString(), xmir); + Logger.debug( + this, + "Parsed to xmir: %[file]s -> %[file]s", + phi, this.unphiOutputDir.toPath().resolve(xmir) + ); + final List here = result.xpath("//errors/error/text()"); + if (!here.isEmpty()) { + errors.add( + Logger.format( + "%[file]s:\n\t%s\n", + xmir, + String.join("\n\t", here) + ) + ); + } + return 1; + } + ).total(); Logger.info( this, "Parsed %d phi files to xmir in %[ms]s", diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java index 95014c71b6..d028f4b22e 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java @@ -52,6 +52,11 @@ public ForeignTojo(final Tojo original) { this.delegate = original; } + @Override + public String toString() { + return this.delegate.toString(); + } + /** * The id of the tojo. * @return The id of the tojo. diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java new file mode 100644 index 0000000000..f3b1388d92 --- /dev/null +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java @@ -0,0 +1,93 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2016-2024 Objectionary.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * 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. + */ +package org.eolang.maven.util; + +import org.cactoos.Func; +import org.cactoos.experimental.Threads; +import org.cactoos.iterable.Mapped; +import org.cactoos.number.SumOf; + +/** + * Processes elements in multiple threads. + * + *

We use this class to process a large number of elements in parallel, + * using all available processors. It is used in most Mojos, where multiple + * files must be processed parallel.

+ * + * @param The type of the element to iterate + * @since 0.1 + */ +public final class Threaded { + + /** + * The sources. + */ + private final Iterable sources; + + /** + * The function. + */ + private final Func scalar; + + /** + * Ctor. + * @param src The sources + * @param fun The function to run + */ + public Threaded(final Iterable src, final Func fun) { + this.sources = src; + this.scalar = fun; + } + + /** + * Exec them all and count. + * @return How many succeeded + */ + @SuppressWarnings("PMD.AvoidCatchingGenericException") + public int total() { + return new SumOf( + new Threads<>( + Runtime.getRuntime().availableProcessors() * 2, + new Mapped<>( + tojo -> () -> { + try { + return this.scalar.apply(tojo); + // @checkstyle IllegalCatchCheck (1 line) + } catch (final Exception ex) { + throw new IllegalStateException( + String.format( + "Failed to process %s (%s)", + tojo, tojo.getClass().getCanonicalName() + ), + ex + ); + } + }, + this.sources + ) + ) + ).intValue(); + } + +} From 290e3f40cb045e751dab6f300696398ae557db05 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 09:33:11 +0300 Subject: [PATCH 5/9] #3592: tojos up --- eo-maven-plugin/pom.xml | 2 +- .../src/main/java/org/eolang/maven/util/Threaded.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 1e6ae6402d..25debd0630 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -199,7 +199,7 @@ SOFTWARE. com.yegor256 tojos - 0.18.2 + 0.18.3 javax.json diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java index f3b1388d92..def77ad304 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Threaded.java @@ -77,7 +77,7 @@ public int total() { } catch (final Exception ex) { throw new IllegalStateException( String.format( - "Failed to process %s (%s)", + "Failed to process \"%s\" (%s)", tojo, tojo.getClass().getCanonicalName() ), ex From 8b4a2dfe740ad73a7eed3b1300281a0f37df420a Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 10:20:00 +0300 Subject: [PATCH 6/9] #3592: fixed --- .../java/org/eolang/maven/TranspileMojo.java | 4 +-- .../org/eolang/maven/TranspileMojoTest.java | 2 +- .../java/org/eolang/parser/DrProgram.java | 12 ++++--- .../optimize/float-noname-abstracts.yaml | 32 +++++++++++++++++++ eo-runtime/pom.xml | 2 -- 5 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-noname-abstracts.yaml diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java index 9cc14f45f8..e6af293cca 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java @@ -160,7 +160,7 @@ public final class TranspileMojo extends SafeMojo { @Override public void exec() { - final Collection sources = this.scopedTojos().withOptimized(); + final Collection sources = this.scopedTojos().withShaken(); final Optimization optimization = this.transpilation(); final int saved = new Threaded<>( sources, @@ -197,7 +197,7 @@ private int transpiled(final ForeignTojo tojo, final Optimization transpilation) throws IOException { final Path source; try { - source = tojo.optimized(); + source = tojo.shaken(); } catch (final AttributeNotFoundException exception) { throw new IllegalStateException( "You should check that 'Verify' goal of the plugin was run first", diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java index 81f8210054..1d1322e2fe 100755 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java @@ -208,7 +208,7 @@ void transpilesSeveralEoProgramsInParallel(@Mktmp final Path temp) throws IOExce .resolve("EOeolang") .resolve("EOexamples") ).count(), - Matchers.equalTo(2L) + Matchers.equalTo(4L) ); } diff --git a/eo-parser/src/main/java/org/eolang/parser/DrProgram.java b/eo-parser/src/main/java/org/eolang/parser/DrProgram.java index 72e44b2a61..76a942423f 100644 --- a/eo-parser/src/main/java/org/eolang/parser/DrProgram.java +++ b/eo-parser/src/main/java/org/eolang/parser/DrProgram.java @@ -64,16 +64,19 @@ public Iterator iterator() { "\n ", "", "This is XMIR, a dialect of XML, which is used to represent a parsed", - "EO program. For more information about the XMIR format, please visit", + "EO program. For more information about XMIR format please visit:", "https://news.eolang.org/2022-11-25-xmir-guide.html.", "", String.format( - "The file was auto-generated by the parser %s (%s) at %s.", + "The file was auto-generated by the parser %s (%s)", Manifests.read("EO-Version"), - Manifests.read("EO-Revision"), + Manifests.read("EO-Revision") + ), + String.format( + "at %s. Do not edit it manually.", when ), - "Do not edit it manually. The source code of the parser is available", + "The source code of the parser is available", "on GitHub, at https://github.com/objectionary/eo (bug reports are welcome).", "" ) @@ -112,6 +115,7 @@ private static String schema() { final String[] opts = { "XMIR.xsd", "src/main/resources/XMIR.xsd", + "eo-parser/src/main/resources/XMIR.xsd", "../eo-parser/src/main/resources/XMIR.xsd", }; for (final String opt : opts) { diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-noname-abstracts.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-noname-abstracts.yaml new file mode 100644 index 0000000000..4918fc172f --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-noname-abstracts.yaml @@ -0,0 +1,32 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2024 Objectionary.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# 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. +--- +xsls: + - /org/eolang/parser/optimize/abstracts-float-up.xsl + - /org/eolang/parser/clean-up.xsl +tests: + - /program/objects[count(o)=2] +eo: | + # No comments. + [x] > foo + bar > @ + zzz 42 > [t] diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index bb44157ced..7f2c4796b8 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -217,7 +217,6 @@ SOFTWARE. register deps assemble - lint transpile copy unplace @@ -240,7 +239,6 @@ SOFTWARE. register deps assemble - lint transpile binarize From b7070eced7bbfd46f44465d789784b1aad44b5b8 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 10:41:32 +0300 Subject: [PATCH 7/9] #3592: lints up --- eo-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 25debd0630..c399741e4f 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 1.0-SNAPSHOT + 0.0.17 com.yegor256 From 8397802785f4cc11cf5b47d15ec443ea0219bfc4 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 10:52:56 +0300 Subject: [PATCH 8/9] #3592: no comments --- .../java/org/eolang/maven/LintMojoTest.java | 4 ++-- .../java/org/eolang/maven/PullMojoTest.java | 2 +- .../maven/phi/yaml/with-anonym-abstract.yaml | 2 +- .../eolang/maven/print/samples/dataless.yaml | 2 +- .../java/org/eolang/parser/EoSyntaxTest.java | 10 +++++----- .../org/eolang/parser/packs/add-locators.yaml | 2 +- .../parser/packs/add-probes-to-empty.yaml | 2 +- .../org/eolang/parser/packs/add-probes.yaml | 6 +++--- .../parser/packs/add-versioned-probes.yaml | 2 +- .../parser/packs/adds-default-package.yaml | 2 +- .../eolang/parser/packs/adds-no-probes.yaml | 2 +- .../org/eolang/parser/packs/adds-refs.yaml | 6 +++--- .../eolang/parser/packs/const-to-dataized.yaml | 2 +- .../parser/packs/cti/cti-adds-error.yaml | 4 ++-- .../parser/packs/cti/cti-adds-warning.yaml | 4 ++-- .../org/eolang/parser/packs/empty-vs-free.yaml | 4 ++-- .../org/eolang/parser/packs/expand-qqs.yaml | 2 +- .../eolang/parser/packs/expands-aliases.yaml | 2 +- .../eolang/parser/packs/float-atom-vars.yaml | 2 +- .../parser/packs/float-up-same-attrs.yaml | 8 ++++---- .../org/eolang/parser/packs/float-vars.yaml | 14 +++++++------- .../org/eolang/parser/packs/full-syntax.yaml | 12 ++++++------ .../org/eolang/parser/packs/has-comment.yaml | 2 +- .../org/eolang/parser/packs/leap-year.yaml | 4 ++-- .../eolang/parser/packs/no-ref-to-bytes.yaml | 2 +- .../optimize/fix-names-with-duplicates.yaml | 8 ++++---- .../parser/packs/optimize/float-abstracts.yaml | 18 +++++++++--------- .../packs/optimize/float-and-keep-names.yaml | 4 ++-- .../parser/packs/optimize/float-atom.yaml | 2 +- .../optimize/floating-sets-parent-names.yaml | 4 ++-- .../packs/optimize/not-redundant-levels.yaml | 4 ++-- ...ls-with-arguments-and-abstract-parents.yaml | 8 ++++---- ...ant-levels-with-arguments-and-siblings.yaml | 6 +++--- .../optimize/redundant-levels-with-arrays.yaml | 2 +- .../redundant-levels-with-siblings.yaml | 6 +++--- .../packs/optimize/redundant-levels.yaml | 6 +++--- .../eolang/parser/packs/preserves-spaces.yaml | 2 +- .../packs/priority/additional-brackets.yaml | 2 +- .../parser/packs/priority/space-between.yaml | 2 +- .../org/eolang/parser/packs/recursion.yaml | 4 ++-- .../eolang/parser/packs/resolves-aliases.yaml | 2 +- .../parser/packs/scope-before-method.yaml | 6 +++--- .../parser/packs/scopes-double-scope.yaml | 8 ++++---- .../org/eolang/parser/packs/scopes-nested.yaml | 5 +---- .../packs/scopes-with-doubled-methods.yaml | 2 +- .../packs/scopes-with-nested-methods.yaml | 14 +++++++------- .../org/eolang/parser/packs/scopes.yaml | 2 +- .../eolang/parser/packs/syntax/anonymous.yaml | 4 ++-- .../packs/syntax/redundant-parentheses.yaml | 2 +- .../eolang/parser/packs/syntax/versions.yaml | 2 +- .../org/eolang/parser/packs/unicode.yaml | 2 +- .../org/eolang/parser/packs/wraps-methods.yaml | 2 +- .../org/eolang/parser/samples/dataless.yaml | 2 +- .../org/eolang/parser/typos/broken-head.yaml | 2 +- .../eolang/parser/typos/comment-in-method.yaml | 2 +- .../parser/typos/double-empty-lines.yaml | 4 ++-- .../typos/double-root-inside-locator.yaml | 2 +- .../parser/typos/double-space-in-meta.yaml | 2 +- .../typos/empty-line-before-application.yaml | 4 ++-- .../typos/empty-line-before-first-object.yaml | 2 +- .../typos/empty-line-before-method-2.yaml | 12 ++++++------ .../parser/typos/empty-line-before-method.yaml | 4 ++-- .../typos/empty-line-before-ref-deep.yaml | 8 ++++---- .../parser/typos/empty-line-before-ref.yaml | 4 ++-- .../empty-line-in-vertical-application.yaml | 2 +- .../parser/typos/invalid-int-literal.yaml | 2 +- .../eolang/parser/typos/long-character.yaml | 2 +- .../eolang/parser/typos/not-empty-atoms.yaml | 4 ++-- .../eolang/parser/typos/one-space-indent.yaml | 2 +- .../parser/typos/redundant-parenheses.yaml | 2 +- .../typos/reversed-as-separate-argument.yaml | 2 +- .../parser/typos/root-inside-locator.yaml | 2 +- .../typos/scoped-application-after-suffix.yaml | 2 +- .../eolang/parser/typos/space-in-naming.yaml | 2 +- .../org/eolang/parser/typos/space-in-tail.yaml | 2 +- .../eolang/parser/typos/suffix-with-dots.yaml | 2 +- .../parser/typos/too-far-right-indent.yaml | 2 +- .../typos/trailing-space-in-comment.yaml | 4 ++-- .../typos/version-with-inline-application.yaml | 2 +- .../eolang/parser/typos/xi-inside-locator.yaml | 2 +- 80 files changed, 157 insertions(+), 160 deletions(-) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java index 8b8f510799..670aca6baa 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java @@ -66,7 +66,7 @@ void detectsErrorsSuccessfully(@Mktmp final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp) .withProgram( "+package f\n", - "# Test.", + "# No comments.", "[] > main", " QQ.io.stdout", " \"Hello world\"" @@ -227,7 +227,7 @@ void failsOnWarning(@Mktmp final Path temp) { "+architect yegor256@gmail.com", "+tests", "+package org.eolang.examples\n", - "# Test.", + "# No comments.", "[] > main", " [] > @", " hello > test" diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java index 791b4777ec..fe7c488365 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java @@ -447,7 +447,7 @@ void getsAlreadyPulledResultsFromCache(@Mktmp final Path temp) throws Exception ); new FakeMaven(temp) .withProgram( - "# Test.", + "# No comments.", "[] > app", " QQ.io.stdout > @" ) diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/phi/yaml/with-anonym-abstract.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/phi/yaml/with-anonym-abstract.yaml index b601a3be95..48bda2ec8c 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/phi/yaml/with-anonym-abstract.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/phi/yaml/with-anonym-abstract.yaml @@ -21,7 +21,7 @@ # SOFTWARE. --- eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > test ([] (^ > x)).plus > s int diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/print/samples/dataless.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/print/samples/dataless.yaml index d6b5e3675d..69639c6707 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/print/samples/dataless.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/print/samples/dataless.yaml @@ -23,7 +23,7 @@ origin: | +package sandbox - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main QQ.io.stdout > @ args.at diff --git a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java index 286e439d27..c37e589a4f 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java @@ -78,7 +78,7 @@ void parsesSimpleCode() throws Exception { void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { final String src = String.join( "\n", - "# This is the default 64+ symbols comment in front of abstract object.", + "# No comments.", "[] > x-н, 1\n" ); MatcherAssert.assertThat( @@ -127,9 +127,9 @@ void copiesListingCorrectly() throws Exception { "1 > x\r\n\r\n2 > y", "1 > x\n2 > y\n", "1 > x\n\n2 > y", - "# This is the default 64+ symbols comment in front of abstract object.\n[] > x", + "# No comments.\n[] > x", "a b c > x\n x ^ > @", - "# This is the default 64+ symbols comment in front of abstract object.\n[] > x\n x ^ > @" + "# No comments.\n[] > x\n x ^ > @" }) void parsesSuccessfully(final String code) { final EoSyntax syntax = new EoSyntax( @@ -160,10 +160,10 @@ void parsesArrow() throws IOException { void prasesNested() throws IOException { final String src = String.join( "\n", - "# This is the default 64+ symbols comment in front of abstract object.", + "# No comments.", "[] > base", " memory 0 > x", - " # This is the default 64+ symbols comment in front of abstract object.", + " # No comments.", " [self] > f", " v > @", " v\n" diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/add-locators.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/add-locators.yaml index 8bd4115d43..4628be1b8c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/add-locators.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/add-locators.yaml @@ -45,7 +45,7 @@ eo: | +home www.abc.com +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > a b > @ x diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes-to-empty.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes-to-empty.yaml index b865c61005..b170e8929e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes-to-empty.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes-to-empty.yaml @@ -25,6 +25,6 @@ tests: - //metas[count(.//meta[head/text()='probe'])=1] - /program/sheets[sheet='add-probes'] eo: | - # Test. + # No comments. [] > app Q.foo.boom > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes.yaml index 891ea98f45..e4316f455f 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/add-probes.yaml @@ -35,7 +35,7 @@ eo: | +package org.eolang.custom +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > app QQ.txt.sprintf > @ "Hello, world!\n" @@ -50,7 +50,7 @@ eo: | fibonacci n > f true - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [i] > other stdout > @ sprintf @@ -58,6 +58,6 @@ eo: | $.other 1 > one memory 0 > price - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [p] > set-price ^.price.write p > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/add-versioned-probes.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/add-versioned-probes.yaml index 8213b107d0..2aa9fb9648 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/add-versioned-probes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/add-versioned-probes.yaml @@ -36,7 +36,7 @@ eo: | +package org.eolang.custom +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > app QQ.cage|0.28.10 > cg-versioned QQ.cage > cg-simple diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-default-package.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-default-package.yaml index 4bd08814d3..30e7d2b6f4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-default-package.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-default-package.yaml @@ -40,7 +40,7 @@ eo: | +alias stdout org.eolang.io.stdout +foo Some other meta - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main and (scanner stdin).next-line > line! diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-no-probes.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-no-probes.yaml index 67f89f1482..93bd04cd07 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-no-probes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-no-probes.yaml @@ -25,6 +25,6 @@ tests: - /program[not(metas)] - /program/sheets[sheet='add-probes'] eo: | - # Test. + # No comments. [] > app 42 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-refs.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-refs.yaml index 6febfa83a6..677283bea2 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/adds-refs.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/adds-refs.yaml @@ -34,7 +34,7 @@ tests: - //o[@base='x' and @line='18' and @ref='16'] - //o[@base='first' and @line='19' and @ref='2'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x a] > first stdout x second > hello @@ -48,13 +48,13 @@ eo: | x something > a - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [a] > x tt x 4 first - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > y one [f] diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/const-to-dataized.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/const-to-dataized.yaml index 43204a8e95..c3b3cc9000 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/const-to-dataized.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/const-to-dataized.yaml @@ -27,7 +27,7 @@ tests: - //o[@base='.as-bytes' and @line and @pos and @name='y' and o[@base='org.eolang.dataized' and o[@base='org.eolang.c' and not(@name)]]] - //objects[count(//o[@const])=0] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foo number > x! # This is the default 64+ symbols comment in front of named abstract object. diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-error.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-error.yaml index da2a83d85b..3858260680 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-error.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-error.yaml @@ -29,14 +29,14 @@ tests: - /program/errors/error[text()='This method is deprecated!'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foo cti > @ 2.times 2 "error" "This method is deprecated!" - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > app QQ.io.stdout > @ QQ.txt.sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-warning.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-warning.yaml index 5527dfbe00..e0ca538136 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-warning.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/cti/cti-adds-warning.yaml @@ -29,14 +29,14 @@ tests: - /program/errors/error[text()='This method is deprecated!'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foo cti > @ 2.times 2 "warning" "This method is deprecated!" - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > app QQ.io.stdout > @ QQ.txt.sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/empty-vs-free.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/empty-vs-free.yaml index 525b2c81de..3972b59c23 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/empty-vs-free.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/empty-vs-free.yaml @@ -30,7 +30,7 @@ eo: | +package test +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] > foo - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > y diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/expand-qqs.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/expand-qqs.yaml index 3ad4eb1f2d..bdacf0db83 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/expand-qqs.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/expand-qqs.yaml @@ -33,7 +33,7 @@ tests: eo: | +alias QQ.txt.sprintfQQ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > app QQ.io.stdout > @ "Hello, world!\n" diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/expands-aliases.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/expands-aliases.yaml index 11745d993f..bc0c8b1db9 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/expands-aliases.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/expands-aliases.yaml @@ -30,7 +30,7 @@ eo: | +alias org.eolang.txt.scanner +alias stdin org.eolang.io.stdin - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main and (scanner stdin).next-line > line! diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml index 8bc6bf9340..6115c0b068 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/float-atom-vars.yaml @@ -28,6 +28,6 @@ tests: - //objects[not(o[@atom and o[@base]])] - //o[@atom and o[not(@base)]] eo: | - # Test. + # No comments. [] > main [x] > foo /number diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/float-up-same-attrs.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/float-up-same-attrs.yaml index f4b5d8a325..5e00ea528a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/float-up-same-attrs.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/float-up-same-attrs.yaml @@ -29,9 +29,9 @@ xsls: tests: - /program[count(.//o[@base='build' and not(@ref)])=2] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > hello - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [f s] > calc plus. > @ f.next @@ -42,13 +42,13 @@ eo: | "Result is %d\n" calc [] - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] > build x.plus 1 > @ build (@.plus 1) > next build 1 > @ [] - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [y] > build y.plus 2 > @ build (@.plus 2) > next diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/float-vars.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/float-vars.yaml index f7c6d11615..13ade9ca9c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/float-vars.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/float-vars.yaml @@ -38,30 +38,30 @@ tests: - //o[@name='mm' and @base='number'] - //o[@base='mm'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > x first > ff one - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > y two input > t! "Hello, world!" - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > oops 50 three t - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > last three 1 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [ppp] > pp one - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [aaa] > kkk 1 > ooo - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > head bb > @ [zz] diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml index 629033cacc..9b043a5860 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml @@ -47,14 +47,14 @@ eo: | 500.43.@ > one - # This is the default 64+ symbols comment in front of abstract object. + # No comments. "Hello, друг!" > hello! - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [tt a] > atom /int # This is very good object - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] > first x > @ second > hello @@ -101,14 +101,14 @@ eo: | b oops - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > obj "some" > @ [] > foo ^.@ > @ # Comments are allowed only in front of top-level objects - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > named one.two.three.four.five t.o @@ -121,7 +121,7 @@ eo: | me (now (f (f (f (f 1)))).f):i - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > ooo [] > o-1 /? diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml index ab09bf8f76..83cf69e0c6 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml @@ -24,5 +24,5 @@ xsls: [ ] tests: - /comment()[1] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > main diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/leap-year.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/leap-year.yaml index 0e31ecfd1a..4b70fe610e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/leap-year.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/leap-year.yaml @@ -37,9 +37,9 @@ eo: | +package test +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [y] > leap or. > @ and. diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/no-ref-to-bytes.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/no-ref-to-bytes.yaml index 6316f817b8..7b8e5fa00a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/no-ref-to-bytes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/no-ref-to-bytes.yaml @@ -28,6 +28,6 @@ tests: eo: | +package org.eolang - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > bytes $.eq 01- > yes diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/fix-names-with-duplicates.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/fix-names-with-duplicates.yaml index 734c3634d0..e7aabf4e35 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/fix-names-with-duplicates.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/fix-names-with-duplicates.yaml @@ -30,9 +30,9 @@ tests: - //objects[count(.//o[@base='hello$t1$t2$t2$t1$a0$build'] and @name='next')=1] - //objects[count(.//o[@base='hello$t1$t2$t2$t1$a1$build'] and @name='next')=1] eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > hello - # This is the default 64+ symbols comment in front of abstract object + # No comments [f s] > calc plus. > @ f.next @@ -44,13 +44,13 @@ eo: | "Result is %d\n" calc [] - # This is the default 64+ symbols comment in front of abstract object + # No comments [x] > build x.plus 1 > @ build (@.plus 1) > next build 1 > @ [] - # This is the default 64+ symbols comment in front of abstract object + # No comments [y] > build y.plus 2 > @ build (@.plus 2) > next diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-abstracts.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-abstracts.yaml index bff4c3fe6f..c51332a066 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-abstracts.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-abstracts.yaml @@ -39,33 +39,33 @@ tests: - //o[@name='first$t2$second$third']/o[@base='stdout']/o[@base='a'] - //o[@line and @name='aa'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [a b] > first test > foo a > yes - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > native - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x b] > second a > no - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [b c] > third no > yes (stdout a b c x).print > print t - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > third "hello, world!" > msg f - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > third "hello, world!" > msg - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > fourth "Failure" > failure - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [aa] > ooo - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [bbb] > fff aa.test > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-and-keep-names.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-and-keep-names.yaml index 3404635f54..f8ab95f6e1 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-and-keep-names.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-and-keep-names.yaml @@ -30,9 +30,9 @@ xsls: tests: - //o[@base='first$second' and @line='6'] eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [a] > first - # This is the default 64+ symbols comment in front of abstract object + # No comments [b] > second print second 1 diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml index ce26de2f81..2ff06b4799 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/float-atom.yaml @@ -32,6 +32,6 @@ tests: - //objects[not(//o[@atom and o[@base]])] - //o[@atom and o[not(@base)]] eo: | - # Test. + # No comments. [] > main [x] > foo /number diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/floating-sets-parent-names.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/floating-sets-parent-names.yaml index 544a1484ae..5e396b81f3 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/floating-sets-parent-names.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/floating-sets-parent-names.yaml @@ -28,9 +28,9 @@ tests: - /program[not(errors)] - //o[@name='a$m$t2$a0'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > a - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [f] > m $ > this z > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/not-redundant-levels.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/not-redundant-levels.yaml index 8496d1cc72..d7f8cfd746 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/not-redundant-levels.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/not-redundant-levels.yaml @@ -45,8 +45,8 @@ tests: # arg.method > a # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [arg] > first - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > second arg.method > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-abstract-parents.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-abstract-parents.yaml index d38ba7ae34..b927515102 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-abstract-parents.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-abstract-parents.yaml @@ -69,14 +69,14 @@ tests: # arg.two > @ # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [arg] > main sibling > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > sibling - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > first arg.one > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > second arg.two > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-siblings.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-siblings.yaml index 34a8dccba8..b85559610a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-siblings.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-siblings.yaml @@ -59,13 +59,13 @@ tests: # arg.two > @ # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [arg] > main sibling > @ eq. > sibling - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > first arg.one > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > second arg.two > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arrays.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arrays.yaml index e60bc11c3d..82a00d3f7a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arrays.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-arrays.yaml @@ -60,7 +60,7 @@ tests: # 2 # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > main * 0 (* 1 2) > arr eq > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml index 62e46be65f..09659251eb 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml @@ -53,13 +53,13 @@ tests: # 2 > @ # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > main sibling > @ eq. > sibling - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > first 1 > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > second 2 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels.yaml index 9dac830767..5eb4bd4287 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels.yaml @@ -52,12 +52,12 @@ tests: # ____ eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > another eq. > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > first 1 > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > second 2 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/preserves-spaces.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/preserves-spaces.yaml index b5803833f3..ed96727d4c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/preserves-spaces.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/preserves-spaces.yaml @@ -26,7 +26,7 @@ tests: - //o[@name='y' and text()='20-66-6F-6F'] - //o[@name='z' and text()='66-6F-6F-20'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foo " " > x " foo" > y diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/priority/additional-brackets.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/priority/additional-brackets.yaml index b480c4cd7e..9ce006d22a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/priority/additional-brackets.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/priority/additional-brackets.yaml @@ -28,6 +28,6 @@ eo: | +package org.eolang.priority +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > x 1.times 2 (1.plus other.value) > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/priority/space-between.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/priority/space-between.yaml index 9553815532..0b59fca917 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/priority/space-between.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/priority/space-between.yaml @@ -29,6 +29,6 @@ eo: | +package org.eolang.priority +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > sum ^.a.plus ^.b > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/recursion.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/recursion.yaml index eaea344519..7c5ec38a93 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/recursion.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/recursion.yaml @@ -29,8 +29,8 @@ eo: | +package test +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [n] > f f 5 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/resolves-aliases.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/resolves-aliases.yaml index 17ab0e3501..86a0cebebd 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/resolves-aliases.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/resolves-aliases.yaml @@ -40,7 +40,7 @@ eo: | +alias stdout org.eolang.io.stdout +foo Some other meta - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main and (scanner stdin).next-line > line! diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scope-before-method.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scope-before-method.yaml index ca8c5f071f..9be73767f3 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scope-before-method.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scope-before-method.yaml @@ -24,11 +24,11 @@ xsls: [ ] tests: - //o[@base='foo' and count(o)=1] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] > foo - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [y] > @ 42 > @ eq. > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-double-scope.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-double-scope.yaml index e56165e12f..83d6c6adba 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-double-scope.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-double-scope.yaml @@ -26,15 +26,15 @@ tests: - //o[@base='bar' and count(o)=2] - //o[@base='foobar' and count(o)=2] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x y] > foo 42 > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [z k] > bar 43 > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [i j] > foobar 44 > @ eq. > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-nested.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-nested.yaml index d396f9b3a6..11cd4b4233 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-nested.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-nested.yaml @@ -26,15 +26,12 @@ tests: - //o[@base='bar' and count(o)=2] - //o[@base='foobar' and count(o)=2 and o[@base='foo' and count(o)=2]] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases - # This is the default 64+ symbols comment in front of abstract object. [x y] > foo 42 > @ - # This is the default 64+ symbols comment in front of abstract object. [z k] > bar 43 > @ - # This is the default 64+ symbols comment in front of abstract object. [i j] > foobar 44 > @ eq. > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-doubled-methods.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-doubled-methods.yaml index bc5f7b6290..55656defbd 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-doubled-methods.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-doubled-methods.yaml @@ -26,7 +26,7 @@ tests: - //o[@base='.foo' and count(o)=2] - //o[@base='.bar' and count(o)=2] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases eq. > @ (1.bar 2).foo (3.bar 4) diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-nested-methods.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-nested-methods.yaml index 9d33067c16..ce69105055 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-nested-methods.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes-with-nested-methods.yaml @@ -27,21 +27,21 @@ tests: - //o[@base='.with' and count(o)=2]/o[@base='.with' and count(o)=3]/o[@base='foobar'] - //o[@base='.with' and count(o)=2]/o[@base='.with' and count(o)=2]/o[@base='.with' and count(o)=3]/o[@base='foobar'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foo - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [y] > with 42 > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > bar - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] > with foo > @ - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > foobar - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [z d] > with bar > @ eq. > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes.yaml index cb359b06f6..e1fdf024c6 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/scopes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/scopes.yaml @@ -24,6 +24,6 @@ xsls: [ ] tests: - //o[@abstract and count(o)=1] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > aliases a (b (c d)) diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/anonymous.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/anonymous.yaml index aa43797cb1..b8cd8fc343 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/anonymous.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/anonymous.yaml @@ -26,10 +26,10 @@ tests: - //o[@base='.plus' and @name='a'] - //o[@base='number' and @name='@' and starts-with(text(), '40-14')] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [x] (x.plus 1 > a) (5 > @) > first - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [a b] ((a.plus 6).plus b > inner) > second foo diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/redundant-parentheses.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/redundant-parentheses.yaml index 3c599441ae..6c6691f19e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/redundant-parentheses.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/redundant-parentheses.yaml @@ -44,5 +44,5 @@ eo: | """ (-_-) """ > x - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > obj diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/versions.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/versions.yaml index 74b52d2b54..3d2fc8f921 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/versions.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/versions.yaml @@ -30,7 +30,7 @@ tests: - //o[@base='.stdout' and @ver='1.28.5'] - //o[@base='.sprintf' and @ver='0.28.5' and @name='y'] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > main func0|3.4.5 > x func1|1.2.3 diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/unicode.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/unicode.yaml index fc164b7ba4..10b690b64e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/unicode.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/unicode.yaml @@ -28,7 +28,7 @@ tests: eo: | +package test - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [a bя xты-друг] > iПрИвЕт_кАк-дЕла123_你好 process. > @ a diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/wraps-methods.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/wraps-methods.yaml index 9f72272649..200d81e5bb 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/wraps-methods.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/wraps-methods.yaml @@ -34,7 +34,7 @@ tests: - //o[@base='a' and @name='xxx'] - //o[@base='.f2' and not(@name)] eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > app stdout sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/samples/dataless.yaml b/eo-parser/src/test/resources/org/eolang/parser/samples/dataless.yaml index d6b5e3675d..69639c6707 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/samples/dataless.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/samples/dataless.yaml @@ -23,7 +23,7 @@ origin: | +package sandbox - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > main QQ.io.stdout > @ args.at diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/broken-head.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/broken-head.yaml index c2cfda291c..02f487e41c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/broken-head.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/broken-head.yaml @@ -22,5 +22,5 @@ --- line: 2 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > a [] > b [] > c [] > d hello world diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/comment-in-method.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/comment-in-method.yaml index a397454b89..50575bb62f 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/comment-in-method.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/comment-in-method.yaml @@ -22,7 +22,7 @@ --- line: 5 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [args] > app stdout > @ # a comment here is prohibited diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/double-empty-lines.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/double-empty-lines.yaml index e55c15bdb0..c638e90ba4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/double-empty-lines.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/double-empty-lines.yaml @@ -22,9 +22,9 @@ --- line: 4 eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [args] > one - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > two diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/double-root-inside-locator.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/double-root-inside-locator.yaml index 39a0b0b666..f38aab58d0 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/double-root-inside-locator.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/double-root-inside-locator.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > hello a.QQ.b > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/double-space-in-meta.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/double-space-in-meta.yaml index e922c54012..65b2bd494e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/double-space-in-meta.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/double-space-in-meta.yaml @@ -24,5 +24,5 @@ line: 1 eo: | +meta with spaces - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > app diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-application.yaml index c1e9a90b4e..93dffc1a08 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-application.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-application.yaml @@ -22,9 +22,9 @@ --- line: 6 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x x y > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-first-object.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-first-object.yaml index 84208db271..9fcd7fe145 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-first-object.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-first-object.yaml @@ -22,7 +22,7 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > object "Hello" > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method-2.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method-2.yaml index c807b85b36..f6aae7dac6 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method-2.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method-2.yaml @@ -22,22 +22,22 @@ --- line: 19 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > y - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > z - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > m x > a - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > o o > b diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method.yaml index dfb0702bbe..bdcca88ac4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-method.yaml @@ -22,9 +22,9 @@ --- line: 6 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x x.y > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref-deep.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref-deep.yaml index 38bf49964e..99a72fc2e9 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref-deep.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref-deep.yaml @@ -22,15 +22,15 @@ --- line: 12 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > y x > z - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > a a > c diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref.yaml index 3ce98ec1f1..6f6f5d483b 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-before-ref.yaml @@ -22,9 +22,9 @@ --- line: 6 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x x > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-in-vertical-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-in-vertical-application.yaml index 9e5d31df44..1a5f8ebdb7 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-in-vertical-application.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/empty-line-in-vertical-application.yaml @@ -22,7 +22,7 @@ --- line: 5 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > main x > @ a diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/invalid-int-literal.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/invalid-int-literal.yaml index 846c0a703f..6df2c2dd55 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/invalid-int-literal.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/invalid-int-literal.yaml @@ -22,7 +22,7 @@ --- line: 6 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > app stdout sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/long-character.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/long-character.yaml index 91f630d4c3..cebd7e0112 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/long-character.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/long-character.yaml @@ -22,7 +22,7 @@ --- line: 6 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [args] > app stdout sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/not-empty-atoms.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/not-empty-atoms.yaml index abb361baff..feeb050c07 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/not-empty-atoms.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/not-empty-atoms.yaml @@ -22,7 +22,7 @@ --- line: 4 eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > test /int - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > inner diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/one-space-indent.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/one-space-indent.yaml index f9b7eaf206..16bb3cb827 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/one-space-indent.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/one-space-indent.yaml @@ -22,7 +22,7 @@ --- line: 4 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > foo * 1 diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml index 81493935d0..789b60f73c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml @@ -26,6 +26,6 @@ eo: | +package a.b.c +version 0.0.0 - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > x (1.plus 2) > y diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/reversed-as-separate-argument.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/reversed-as-separate-argument.yaml index 146f10934a..f8515920fe 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/reversed-as-separate-argument.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/reversed-as-separate-argument.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > foo a. b. c > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/root-inside-locator.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/root-inside-locator.yaml index 2b86a26ee3..c755e1bc61 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/root-inside-locator.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/root-inside-locator.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > hello a.Q.b > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/scoped-application-after-suffix.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/scoped-application-after-suffix.yaml index b00a0f1205..1b9afecf49 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/scoped-application-after-suffix.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/scoped-application-after-suffix.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [x] > first a > x (b > x) diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-naming.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-naming.yaml index 08a83a7d82..4d44d1e89a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-naming.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-naming.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > hello a : b > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-tail.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-tail.yaml index b8b3eb4b70..d257eb049f 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-tail.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/space-in-tail.yaml @@ -22,5 +22,5 @@ --- line: 2 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > foo diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/suffix-with-dots.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/suffix-with-dots.yaml index 6aa27c8995..47adf30165 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/suffix-with-dots.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/suffix-with-dots.yaml @@ -22,5 +22,5 @@ --- line: 2 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > foo.x.main diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/too-far-right-indent.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/too-far-right-indent.yaml index 853279c8fe..056139c196 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/too-far-right-indent.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/too-far-right-indent.yaml @@ -22,7 +22,7 @@ --- line: 5 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [args] > app stdout sprintf diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/trailing-space-in-comment.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/trailing-space-in-comment.yaml index 3ef334131f..d8c17f98f1 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/trailing-space-in-comment.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/trailing-space-in-comment.yaml @@ -23,8 +23,8 @@ line: 4 # yamllint disable rule:trailing-spaces eo: | - # This is the default 64+ symbols comment in front of abstract object. + # No comments. [] > t - # This is the default 64+ symbols comment in front of abstract object + # No comments # This one with space at the end [] > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/version-with-inline-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/version-with-inline-application.yaml index 52b5019a30..faabead4f4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/version-with-inline-application.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/version-with-inline-application.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [args] > app stdout|1.2.3 42 diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/xi-inside-locator.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/xi-inside-locator.yaml index d30bb7fd24..7b2b41e877 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/typos/xi-inside-locator.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/xi-inside-locator.yaml @@ -22,6 +22,6 @@ --- line: 3 eo: | - # This is the default 64+ symbols comment in front of abstract object + # No comments [] > hello a.$.b > x From 915034e865c5634ae9ddaeee1d413491cc7bb2f7 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 3 Dec 2024 11:07:37 +0300 Subject: [PATCH 9/9] #3592: shaken --- .../src/main/java/org/eolang/maven/BinarizeParse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java b/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java index e0cb2bb559..a318a48e34 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/BinarizeParse.java @@ -139,7 +139,7 @@ public Collection exec(final Collection tojos) throws IO final Collection res = new ArrayList<>(0); new File(this.targetDir.toPath().resolve("Lib/").toString()).mkdirs(); for (final ForeignTojo tojo : tojos) { - final Path file = tojo.optimized(); + final Path file = tojo.shaken(); for (final FFINode ffi: this.getFFIs(new XMLDocument(file))) { ffi.generateUnchecked(); if (ffi instanceof Buildable) {