Parser.java 842 B

12345678910111213141516171819202122232425262728
  1. package de.jplag.java19;
  2. import java.io.File;
  3. public class Parser extends de.jplag.Parser {
  4. private de.jplag.TokenList tokenList;
  5. public de.jplag.TokenList parse(File dir, String files[]) {
  6. tokenList = new de.jplag.TokenList();
  7. errors = 0;
  8. File pathedFiles[] = new File[files.length];
  9. for (int i = 0; i < files.length; i++) {
  10. pathedFiles[i] = new File(dir, files[i]);
  11. }
  12. JavacAdapter javac = new JavacAdapter();
  13. errors += javac.parseFiles(dir, pathedFiles, this);
  14. this.parseEnd();
  15. return tokenList;
  16. }
  17. public void add(int type, String filename, long line, long col, long length) {
  18. tokenList.addToken(new JavaToken(type, filename, (int) line, (int) col, (int) length));
  19. }
  20. public void errorsInc() {
  21. errors++;
  22. }
  23. }