CharToken.java 775 B

1234567891011121314151617181920212223242526272829303132333435
  1. package jplag.chars;
  2. public class CharToken extends jplag.Token {
  3. private static final long serialVersionUID = 1L;
  4. private int index;
  5. private Parser parser;
  6. public CharToken(int type, String file, int index, Parser parser) {
  7. super(type, file, -1);
  8. this.index = index;
  9. this.parser = parser;
  10. }
  11. public CharToken(int type, String file, Parser parser) {
  12. this(type, file, -1, parser);
  13. }
  14. public int getLine() {
  15. return index; // so that the result-index is sorted correctly
  16. }
  17. public int getColumn() { return 0; }
  18. public int getLength() { return 0; }
  19. public int getIndex() { return index; }
  20. public static String type2string(int type, Parser parser) {
  21. return "" + parser.reverseMapping(type);
  22. }
  23. public static int numberOfTokens() { return 36; }
  24. }