Skip to content

Commit

Permalink
Merge pull request #3716 from volodya-lombrozo/3706_fix_token_names
Browse files Browse the repository at this point in the history
feat(#3706): Use Correct Token Names
  • Loading branch information
yegor256 authored Dec 20, 2024
2 parents 05f05d9 + cfbf907 commit 21b1227
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
21 changes: 0 additions & 21 deletions eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -47,17 +46,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'",
Expand All @@ -66,17 +55,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'",
Expand Down

2 comments on commit 21b1227

@0pdd
Copy link

@0pdd 0pdd commented on 21b1227 Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 3706-fc151a0d disappeared from eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java), that's why I closed #3714. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 21b1227 Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 3706-d005da96 disappeared from eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java), that's why I closed #3715. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.