Class GrammarDependencies

java.lang.Object
org.antlr.mojo.antlr4.GrammarDependencies

class GrammarDependencies extends Object
  • Field Details

    • graph

      private final Graph<String> graph
    • sourceDirectory

      private final File sourceDirectory
    • libDirectory

      private final File libDirectory
    • statusFile

      private final File statusFile
    • packageName

      private final String packageName
    • grammars

      private final Map<File,Map.Entry<byte[],Collection<String>>> grammars
      Map grammars to their checksum and references.
    • log

      private final org.apache.maven.plugin.logging.Log log
  • Constructor Details

    • GrammarDependencies

      public GrammarDependencies(File sourceDirectory, File libDirectory, List<String> arguments, File status, org.apache.maven.plugin.logging.Log log)
  • Method Details

    • getPackage

      private String getPackage(List<String> arguments)
      Determines the package to use.
      Parameters:
      arguments - the tool arguments.
      Returns:
      the package. Returns null to indicate that no package should be used.
    • save

      public void save() throws IOException
      Throws:
      IOException
    • analyze

      public GrammarDependencies analyze(Set<File> grammarFiles, Set<File> importGrammarFiles, Tool tool) throws IOException
      Performs dependency analysis for the given grammar files.
      Parameters:
      grammarFiles - the grammar files.
      importGrammarFiles - the import grammar files.
      tool - the tool to use.
      Returns:
      self-reference.
      Throws:
      IOException
    • isDependencyChanged

      public boolean isDependencyChanged(File grammarFile) throws IOException
      Determines whether a grammar used by the given grammar was modified since the last build.
      Parameters:
      grammarFile - the grammar.
      Returns:
      true if a grammar used by the given grammar has been modified.
      Throws:
      IOException
    • getRelativePath

      private String getRelativePath(File grammarFile)
      Determines the relative target path of the given grammar file.
      Parameters:
      grammarFile - the grammar file.
      Returns:
      the relative path.
    • findUsages

      private Collection<String> findUsages(String grammarFileName)
      Returns the grammar file names that directly or indirectly use the given grammar.
      Parameters:
      grammarFileName - the grammar file name.
      Returns:
      the grammar file names that use the given grammar file.
    • explore

      private void explore(String grammarName, Collection<String> result)
    • analyse

      private void analyse(File grammarFile, Collection<File> grammarFiles, Tool tool)
    • resolve

      private File resolve(String name, String path)
      Resolves the given grammar name.
      Parameters:
      name - the name.
      path - the relative path.
      Returns:
      the grammar file.
    • loadStatus

      private Map<File,Map.Entry<byte[],Collection<String>>> loadStatus(File statusFile)
    • stripPath

      private String stripPath(String str)
    • stripQuotes

      private String stripQuotes(String str)