Timur Sağlam пре 4 година
родитељ
комит
792a6c736a

+ 1 - 1
jplag.frontend.text/src/main/java/de/jplag/text/AntlrParserToken.java

@@ -12,7 +12,7 @@ public class AntlrParserToken extends Token {
     private int line = -1;
 
     /**
-     * This variable holds the columnIndex of the current token in its line.
+     * This variable holds the column of the current token in its line.
      */
     private int column = -1;
 

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

@@ -14,7 +14,7 @@ import de.jplag.TokenList;
 public class ParserAdapter extends AbstractParser {
 
     private final Map<String, Integer> tokenTypes = new HashMap<>();
-    private int serial = 1; // 0 is FILE_END token, SEPARATOR is not used as there are no methods.
+    private int tokenTypeIndex = 1; // 0 is FILE_END token, SEPARATOR is not used as there are no methods.
 
     private TokenList tokens;
     private String currentFile;
@@ -73,10 +73,10 @@ public class ParserAdapter extends AbstractParser {
     private int getTokenType(String text) {
         text = text.toLowerCase();
         tokenTypes.computeIfAbsent(text, it -> {
-            if (serial == Integer.MAX_VALUE) {
-                throw new IllegalStateException("Out of serials!");
+            if (tokenTypeIndex == Integer.MAX_VALUE) {
+                throw new IllegalStateException("Too many token types, should not happen!");
             }
-            return ++serial;
+            return ++tokenTypeIndex;
         });
         return tokenTypes.get(text);
 

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

@@ -5,7 +5,7 @@ import de.jplag.Token;
 public class TextToken extends Token {
 
     private static final String NO_TEXT = "<unknown>";
-    private String text;
+    private final String text;
 
     public TextToken(int type, String file) {
         super(type, file, -1, -1, -1);