TextToken.java 680 B

12345678910111213141516171819202122232425262728
  1. package de.jplag.text;
  2. import de.jplag.Token;
  3. public class TextToken extends Token {
  4. private static final String NO_TEXT = "<unknown>";
  5. private final String text;
  6. public TextToken(int type, String file) {
  7. super(type, file, -1, -1, -1);
  8. this.text = NO_TEXT;
  9. }
  10. public TextToken(String text, int type, String file, AntlrParserToken parserToken) {
  11. super(type, file, parserToken.getLine(), parserToken.getColumn(), parserToken.getLength());
  12. this.text = text.toLowerCase();
  13. }
  14. public String getText() {
  15. return this.text;
  16. }
  17. @Override
  18. protected String type2string() {
  19. return getText();
  20. }
  21. }