Package org.antlr.mojo.antlr4
Class GrammarDependencies
java.lang.Object
org.antlr.mojo.antlr4.GrammarDependencies
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
analyse
(File grammarFile, Collection<File> grammarFiles, Tool tool) Performs dependency analysis for the given grammar files.private void
explore
(String grammarName, Collection<String> result) private Collection
<String> findUsages
(String grammarFileName) Returns the grammar file names that directly or indirectly use the given grammar.private String
getPackage
(List<String> arguments) Determines the package to use.private String
getRelativePath
(File grammarFile) Determines the relative target path of the given grammar file.boolean
isDependencyChanged
(File grammarFile) Determines whether a grammar used by the given grammar was modified since the last build.private Map
<File, Map.Entry<byte[], Collection<String>>> loadStatus
(File statusFile) private File
Resolves the given grammar name.void
save()
private String
private String
stripQuotes
(String str)
-
Field Details
-
graph
-
sourceDirectory
-
libDirectory
-
statusFile
-
packageName
-
grammars
Map grammars to their checksum and references. -
log
private final org.apache.maven.plugin.logging.Log log
-
-
Constructor Details
-
GrammarDependencies
-
-
Method Details
-
getPackage
Determines the package to use.- Parameters:
arguments
- the tool arguments.- Returns:
- the package. Returns
null
to indicate that no package should be used.
-
save
- 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
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
Determines the relative target path of the given grammar file.- Parameters:
grammarFile
- the grammar file.- Returns:
- the relative path.
-
findUsages
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
-
analyse
-
resolve
Resolves the given grammar name.- Parameters:
name
- the name.path
- the relative path.- Returns:
- the grammar file.
-
loadStatus
-
stripPath
-
stripQuotes
-