Language.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package de.jplag;
  2. import java.io.File;
  3. /**
  4. * Common interface for all languages. Each language-front end must provide a concrete language implementation.
  5. */
  6. public interface Language {
  7. /**
  8. * Suffixes for the files containing code of the language.
  9. */
  10. public String[] suffixes();
  11. /**
  12. * Descriptive name of the language.
  13. */
  14. public String name();
  15. /**
  16. * Short name of the language used for CLI options.
  17. */
  18. public String getShortName();
  19. /**
  20. * Minimum number of tokens required for a match.
  21. */
  22. public int min_token_match();
  23. /**
  24. * Parses a set files in a directory.
  25. */
  26. public TokenList parse(File dir, String[] files);
  27. /**
  28. * Whether errors were found during the last {@link #parse}.
  29. */
  30. public boolean errors();
  31. /**
  32. * Number of errors found during the last {@link #parse}.
  33. */
  34. public int errorsCount();
  35. /**
  36. * Determines whether the parser provide column information.
  37. */
  38. public boolean supportsColumns();
  39. /**
  40. * Determines whether JPlag should use a fixed-width font in its reports.
  41. */
  42. public boolean isPreformatted();
  43. /**
  44. * Determines whether tokens from the scanner are indexed.
  45. */
  46. public boolean usesIndex();
  47. /**
  48. * Number of defined tokens in the scanner of the language.
  49. */
  50. public int noOfTokens();
  51. /**
  52. * Convert a token type to a text representation.
  53. */
  54. public String type2string(int type);
  55. }