From a748f10fd7c54d496da55cf1ad54966b94e19c7e Mon Sep 17 00:00:00 2001 From: volodya-lombrozo Date: Mon, 23 Dec 2024 17:15:08 +0300 Subject: [PATCH] feat(#3706): fix all the code offences --- eo-parser/src/main/java/org/eolang/parser/EoSyntax.java | 2 -- eo-parser/src/main/java/org/eolang/parser/ParsingErrors.java | 3 ++- .../src/main/java/org/eolang/parser/ParsingException.java | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/eo-parser/src/main/java/org/eolang/parser/EoSyntax.java b/eo-parser/src/main/java/org/eolang/parser/EoSyntax.java index 4170560231..548324ea7b 100644 --- a/eo-parser/src/main/java/org/eolang/parser/EoSyntax.java +++ b/eo-parser/src/main/java/org/eolang/parser/EoSyntax.java @@ -28,9 +28,7 @@ import com.jcabi.xml.XMLDocument; import java.io.IOException; import java.util.List; -import org.antlr.v4.runtime.BailErrorStrategy; import org.antlr.v4.runtime.CommonTokenStream; -import org.antlr.v4.runtime.DiagnosticErrorListener; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.cactoos.Input; import org.cactoos.Text; diff --git a/eo-parser/src/main/java/org/eolang/parser/ParsingErrors.java b/eo-parser/src/main/java/org/eolang/parser/ParsingErrors.java index faed677aad..ee8ee8573f 100644 --- a/eo-parser/src/main/java/org/eolang/parser/ParsingErrors.java +++ b/eo-parser/src/main/java/org/eolang/parser/ParsingErrors.java @@ -31,6 +31,7 @@ import org.antlr.v4.runtime.BaseErrorListener; import org.antlr.v4.runtime.InputMismatchException; import org.antlr.v4.runtime.NoViableAltException; +import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.Recognizer; import org.antlr.v4.runtime.Token; @@ -91,7 +92,7 @@ public void syntaxError( ) { if (error instanceof NoViableAltException || error instanceof InputMismatchException) { final Token token = (Token) symbol; - final EoParser parser = (EoParser) recognizer; + final Parser parser = (Parser) recognizer; final String rule = parser.getRuleInvocationStack().get(0); final String[] names = parser.getRuleNames(); final String detailed; diff --git a/eo-parser/src/main/java/org/eolang/parser/ParsingException.java b/eo-parser/src/main/java/org/eolang/parser/ParsingException.java index c68300c557..857019b306 100644 --- a/eo-parser/src/main/java/org/eolang/parser/ParsingException.java +++ b/eo-parser/src/main/java/org/eolang/parser/ParsingException.java @@ -46,8 +46,7 @@ public final class ParsingException extends RuntimeException { * @param line The place */ public ParsingException(final String msg, final int line) { - super(msg); - this.place = line; + this(msg, null, line); } /**