Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show file name and line number #3736

Merged
merged 14 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion eo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ SOFTWARE.
<configuration combine.self="override">
<skipInstallation>${skipITs}</skipInstallation>
<skipInvocation>${skipITs}</skipInvocation>
<pomExcludes/>
<pomExcludes>
<exclude>fibonacci/pom.xml</exclude>
</pomExcludes>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ SOFTWARE.
<xsl:value-of select="$indent"/>
<xsl:value-of select="eo:tabs(1)"/>
<xsl:value-of select="$name"/>
<xsl:text> = new PhLocated(</xsl:text>
<xsl:text> = new PhSafe(</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>, "</xsl:text>
<xsl:value-of select="/program/@name"/>
Expand Down Expand Up @@ -538,9 +538,9 @@ SOFTWARE.
<xsl:value-of select="eo:eol(3 + $indent)"/>
<xsl:text>new Dataized(</xsl:text>
<xsl:value-of select="eo:eol(4 + $indent)"/>
<xsl:text>new PhSafe(new </xsl:text>
<xsl:text>new </xsl:text>
<xsl:value-of select="eo:class-name(@name, eo:suffix(@line, @pos))"/>
<xsl:text>())</xsl:text>
<xsl:text>()</xsl:text>
<xsl:value-of select="eo:eol(3 + $indent)"/>
<xsl:text>).asBool()</xsl:text>
<xsl:value-of select="eo:eol(2 + $indent)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ sheets:
- /org/eolang/parser/blank-xsd-schema.xsl
asserts:
- /program[not(errors)]
- //java[contains(text(), 'new PhLocated(ret, "scenario", 3, 2, "Φ.foo.φ")')]
- //java[contains(text(), 'new PhLocated(ret_base, "scenario", 6, 4, "Φ.foo.other.φ.ρ")')]
- //java[contains(text(), 'new PhLocated(ret, "scenario", 6, 6, "Φ.foo.other.φ")')]
- //java[contains(text(), 'new PhLocated(ret_1, "scenario", 6, 12, "Φ.foo.other.φ.α0")')]
- //java[contains(text(), 'new PhLocated(ret_base, "scenario", 10, 2, "Φ.bar.φ.ρ")')]
- //java[contains(text(), 'new PhLocated(ret, "scenario", 10, 4, "Φ.bar.φ")')]
- //java[contains(text(), 'new PhLocated(ret_1, "scenario", 10, 10, "Φ.bar.φ.α0")')]
- //java[contains(text(), 'new PhLocated(ret, "scenario", 11, 2, "Φ.bar.five")')]
- //java[contains(text(), 'new PhSafe(ret, "scenario", 3, 2, "Φ.foo.φ")')]
- //java[contains(text(), 'new PhSafe(ret_base, "scenario", 6, 4, "Φ.foo.other.φ.ρ")')]
- //java[contains(text(), 'new PhSafe(ret, "scenario", 6, 6, "Φ.foo.other.φ")')]
- //java[contains(text(), 'new PhSafe(ret_1, "scenario", 6, 12, "Φ.foo.other.φ.α0")')]
- //java[contains(text(), 'new PhSafe(ret_base, "scenario", 10, 2, "Φ.bar.φ.ρ")')]
- //java[contains(text(), 'new PhSafe(ret, "scenario", 10, 4, "Φ.bar.φ")')]
- //java[contains(text(), 'new PhSafe(ret_1, "scenario", 10, 10, "Φ.bar.φ.α0")')]
- //java[contains(text(), 'new PhSafe(ret, "scenario", 11, 2, "Φ.bar.five")')]
input: |
# No comments.
[] > foo
Expand Down
6 changes: 4 additions & 2 deletions eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOslice.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public Phi lambda() {
.must(integer -> integer >= 0)
.otherwise("must be a positive integer")
.it();
final byte[] array = new Dataized(this.take(Attr.RHO)).take();
return new Data.ToPhi(
Arrays.copyOfRange(array, start, start + length)
Arrays.copyOfRange(
new Dataized(this.take(Attr.RHO)).take(),
start, start + length
)
);
}
}
18 changes: 18 additions & 0 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOerror.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ public ExError(final Phi enclosure) {
this(enclosure, Collections.emptyList());
}

/**
* Ctor.
* @param cause Previous error
* @param message New message
*/
public ExError(final Phi cause, final String message) {
this(cause, Collections.singletonList(message));
}

/**
* Ctor.
* @param cause Previous error
Expand All @@ -119,6 +128,15 @@ public ExError(final Phi enclosure, final Collection<String> before) {
this.trace = before;
}

@Override
public String toString() {
return String.format(
"%s +%s",
super.toString(),
this.trace.size()
);
}

/**
* Take it.
* @return The enclosed object
Expand Down
15 changes: 10 additions & 5 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOtry.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
import org.eolang.Atom;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhCopy;
import org.eolang.PhDefault;
import org.eolang.PhSafe;
import org.eolang.PhWith;
import org.eolang.Phi;
import org.eolang.XmirObject;

Expand All @@ -59,11 +60,15 @@ public EOtry() {
public Phi lambda() {
byte[] result;
try {
result = new Dataized(new PhSafe(this.take("main"))).take();
result = new Dataized(this.take("main")).take();
} catch (final EOerror.ExError ex) {
final Phi caught = this.take("catch").copy();
caught.put(0, ex.enclosure());
result = new Dataized(caught).take();
result = new Dataized(
yegor256 marked this conversation as resolved.
Show resolved Hide resolved
new PhWith(
new PhCopy(this.take("catch")),
0,
ex.enclosure()
)
).take();
} finally {
new Dataized(this.take("finally")).take();
}
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/Expect.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Expect<T> otherwise(final String message) {
return this.sup.get();
} catch (final ExFailure ex) {
throw new ExFailure(
String.format("%s %s", this.subject, message),
String.format("%s %s %s", this.subject, ex.getMessage(), message),
ex
);
}
Expand All @@ -118,7 +118,7 @@ public Expect<T> must(final Function<T, Boolean> fun) {
final T ret = this.sup.get();
if (!fun.apply(ret)) {
throw new ExFailure(
String.format("%s (%s)", this.subject, ret)
String.format("(%s)", ret)
);
}
return ret;
Expand Down
216 changes: 0 additions & 216 deletions eo-runtime/src/main/java/org/eolang/PhLocated.java

This file was deleted.

Loading
Loading