Skip to content

Commit

Permalink
fix(objectionary#2930): checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Mar 12, 2024
1 parent 4591a44 commit a7e3a63
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
12 changes: 0 additions & 12 deletions eo-parser/src/main/java/org/eolang/parser/Objects.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ interface Objects extends Iterable<Directive> {
*/
Objects leave();

/**
* Remove current object.
* @return Self.
*/
Objects remove();

/**
* Xembly object tree.
* @since 0.1
Expand Down Expand Up @@ -153,12 +147,6 @@ public Objects leave() {
return this;
}

@Override
public Objects remove() {
this.dirs.remove();
return this;
}

@Override
public Iterator<Directive> iterator() {
return this.dirs.iterator();
Expand Down
27 changes: 17 additions & 10 deletions eo-parser/src/main/java/org/eolang/parser/XePhiListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.eolang.parser.xmir.XmirInfo;
import org.xembly.Directive;
import org.xembly.Directives;
import org.xembly.Xembler;

/**
* The PHI-CALCULUS grammar listener for ANTLR4 walker.
Expand Down Expand Up @@ -183,7 +182,8 @@ public void exitFormation(final PhiParser.FormationContext ctx) {
}

@Override
public void enterScoped(PhiParser.ScopedContext ctx) {
@SuppressWarnings("PMD.ConfusingTernary")
public void enterScoped(final PhiParser.ScopedContext ctx) {
if (ctx.HOME() != null) {
this.objects().prop("base", "Q").leave();
} else if (ctx.XI() != null) {
Expand All @@ -192,7 +192,7 @@ public void enterScoped(PhiParser.ScopedContext ctx) {
}

@Override
public void exitScoped(PhiParser.ScopedContext ctx) {
public void exitScoped(final PhiParser.ScopedContext ctx) {
// Nothing here
}

Expand All @@ -212,6 +212,7 @@ public void exitBindings(final PhiParser.BindingsContext ctx) {
}

@Override
@SuppressWarnings("PMD.ConfusingTernary")
public void enterBinding(final PhiParser.BindingContext ctx) {
if (ctx.alphaBinding() != null) {
if (ctx.alphaBinding().attribute().VERTEX() != null) {
Expand All @@ -228,21 +229,26 @@ public void enterBinding(final PhiParser.BindingContext ctx) {
}

@Override
@SuppressWarnings("PMD.ConfusingTernary")
public void exitBinding(final PhiParser.BindingContext ctx) {
if (this.objs.size() > this.packages.size()) {
if (ctx.alphaBinding() != null) {
if (ctx.alphaBinding().attribute().VERTEX() != null) {
this.attributes.pop();
this.objs.removeLast();
} else {
this.objects().enter().prop(this.properties.peek(), this.attributes.pop()).leave();
this.objects().enter()
.prop(this.properties.peek(), this.attributes.pop())
.leave();
}
} else if (ctx.emptyBinding() != null) {
if (ctx.emptyBinding().attribute().VERTEX() != null) {
this.attributes.pop();
this.objs.removeLast();
} else {
this.objects().enter().prop(this.properties.peek(), this.attributes.pop()).leave();
this.objects().enter()
.prop(this.properties.peek(), this.attributes.pop())
.leave();
}
}
}
Expand Down Expand Up @@ -349,7 +355,6 @@ public void exitApplication(final PhiParser.ApplicationContext ctx) {
this.properties.pop();
}


@Override
@SuppressWarnings("PMD.ConfusingTernary")
public void enterDispatch(final PhiParser.DispatchContext ctx) {
Expand All @@ -362,12 +367,12 @@ public void exitDispatch(final PhiParser.DispatchContext ctx) {
}

@Override
public void enterApplicationsOrDispatches(PhiParser.ApplicationsOrDispatchesContext ctx) {
public void enterApplicationsOrDispatches(final PhiParser.ApplicationsOrDispatchesContext ctx) {
// Nothing here
}

@Override
public void exitApplicationsOrDispatches(PhiParser.ApplicationsOrDispatchesContext ctx) {
public void exitApplicationsOrDispatches(final PhiParser.ApplicationsOrDispatchesContext ctx) {
// Nothing here
}

Expand Down Expand Up @@ -423,8 +428,10 @@ private static boolean hasLambdaPackage(final PhiParser.BindingsContext ctx) {
return ctx.binding()
.stream()
.anyMatch(
context -> context.lambdaBidning() != null
&& context.lambdaBidning().FUNCTION().getText().equals(XePhiListener.LAMBDA_PACKAGE)
context -> context.lambdaBidning() != null && context.lambdaBidning()
.FUNCTION()
.getText()
.equals(XePhiListener.LAMBDA_PACKAGE)
);
}
}

0 comments on commit a7e3a63

Please sign in to comment.