From 0c68033fa94575d21b32b06c1df0d98d3bb66eb0 Mon Sep 17 00:00:00 2001 From: volodya-lombrozo Date: Fri, 20 Dec 2024 12:37:28 +0300 Subject: [PATCH 1/2] feat(#3706): remove puzzles --- .../org/eolang/parser/EoIndentLexerTest.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 9d8c574273..4c5052a47c 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -47,17 +47,7 @@ public final class EoIndentLexerTest { */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** - * Tests if the lexer emits a tab token with the correct name. - * @throws IOException In case if the input is invalid. - * @todo #3706:30min Fix the the name of the TAB token. - * Currently {@link EoIndentLexer} emits TAB token with the name 'ZERO' instead of 'TAB'. - * Fix the lexer to emit TAB token with the correct name. - * This problem affects lexer error messages. - * When this issue is fixed, remove the @Disabled annotation from the test. - */ @Test - @Disabled void emitsTabWithCorrectName() throws IOException { MatcherAssert.assertThat( "We expect the token to be a tab indentation with name 'TAB'", @@ -66,17 +56,7 @@ void emitsTabWithCorrectName() throws IOException { ); } - /** - * Tests if the lexer emits an untab token with the correct name. - * @throws IOException In case if the input is invalid. - * @todo #3706:30min Fix the the name of the UNTAB token. - * Currently {@link EoIndentLexer} emits UNTAB token with the name 'INT' instead of 'UNTAB'. - * Fix the lexer to emit UNTAB token with the correct name. - * This problem affects lexer error messages. - * When this issue is fixed, remove the @Disabled annotation from the test. - */ @Test - @Disabled void emitsUntabWithCorrectName() throws IOException { MatcherAssert.assertThat( "We expect the token to be an untab indentation with name 'UNTAB'", From bad3869ae5b8c7ce92057bc9984b22e37640560a Mon Sep 17 00:00:00 2001 From: volodya-lombrozo Date: Fri, 20 Dec 2024 12:43:51 +0300 Subject: [PATCH 2/2] feat(#3706): use correct token names --- eo-parser/src/main/java/org/eolang/parser/EoIndentLexer.java | 2 +- .../src/test/java/org/eolang/parser/EoIndentLexerTest.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/eo-parser/src/main/java/org/eolang/parser/EoIndentLexer.java b/eo-parser/src/main/java/org/eolang/parser/EoIndentLexer.java index bcdb3cd0c6..e5de30f476 100644 --- a/eo-parser/src/main/java/org/eolang/parser/EoIndentLexer.java +++ b/eo-parser/src/main/java/org/eolang/parser/EoIndentLexer.java @@ -161,7 +161,7 @@ private void emitDedent(final int shift) { * @param type Type. */ private void emitToken(final int type) { - final CommonToken tkn = new CommonToken(type, this.getRuleNames()[type]); + final CommonToken tkn = new CommonToken(type, EoParser.VOCABULARY.getSymbolicName(type)); tkn.setLine(this.getLine() + 1); this.tokens.offer(tkn); } diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 4c5052a47c..2e33552913 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -27,7 +27,6 @@ import org.cactoos.text.TextOf; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /**