Explorar o código

address comments

SirYwell %!s(int64=4) %!d(string=hai) anos
pai
achega
2977ab3b18

+ 4 - 2
jplag.frontend.text/src/main/java/de/jplag/text/ParserAdapter.java

@@ -25,6 +25,9 @@ public class ParserAdapter extends AbstractParser {
     private TokenList tokens;
     private String currentFile;
     private int currentLine;
+    /**
+     * The position of the current line break in the content string
+     */
     private int currentLineIndex;
 
     public ParserAdapter() {
@@ -105,8 +108,7 @@ public class ParserAdapter extends AbstractParser {
         int type = getTokenType(text);
         int column = label.beginPosition() - currentLineIndex;
         int length = label.endPosition() - label.beginPosition();
-        TokenPosition position = new TokenPosition(currentLine, column, length);
-        tokens.addToken(new TextToken(text, type, currentFile, position));
+        tokens.addToken(new TextToken(text, type, currentFile, currentLine, column, length));
     }
 
     private String readFile(Path filePath) {

+ 2 - 2
jplag.frontend.text/src/main/java/de/jplag/text/TextToken.java

@@ -12,8 +12,8 @@ public class TextToken extends Token {
         this.text = NO_TEXT;
     }
 
-    public TextToken(String text, int type, String file, TokenPosition parserToken) {
-        super(type, file, parserToken.line(), parserToken.column(), parserToken.length());
+    public TextToken(String text, int type, String file, int line, int column, int length) {
+        super(type, file, line, column, length);
         this.text = text.toLowerCase();
     }
 

+ 0 - 8
jplag.frontend.text/src/main/java/de/jplag/text/TokenPosition.java

@@ -1,8 +0,0 @@
-package de.jplag.text;
-
-public record TokenPosition(
-    int line,
-    int column,
-    int length
-) {
-}