class GrammarInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
grammarFile
The path to the grammar file (relative to its source directory, e.g.
|
private java.lang.String |
parserDirectory
The path to the directory of the parser package (relative to a source root directory, e.g.
|
private java.lang.String |
parserFile
The path to the generated parser file (relative to a source root directory, e.g.
|
private java.lang.String |
parserName
The simple name of the generated parser (e.g.
|
private java.lang.String |
parserPackage
The declared package for the generated parser (e.g.
|
private java.io.File |
sourceDirectory
The absolute path to the base directory in which the grammar file resides.
|
Constructor and Description |
---|
GrammarInfo(java.io.File sourceDir,
java.lang.String inputFile)
Creates a new info from the specified grammar file.
|
GrammarInfo(java.io.File sourceDir,
java.lang.String inputFile,
java.lang.String packageName)
Creates a new info from the specified grammar file.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
findPackageName(java.lang.String grammar)
Extracts the declared package name from the specified grammar file.
|
private java.lang.String |
findParserName(java.lang.String grammar)
Extracts the simple parser name from the specified grammar file.
|
java.io.File |
getGrammarFile()
Gets the absolute path to the grammar file.
|
java.lang.String |
getParserDirectory()
Gets the path to the directory of the parser package (relative to a source root directory, e.g.
|
java.lang.String |
getParserFile()
Gets the path to the parser file (relative to a source root directory, e.g.
|
java.lang.String |
getParserName()
Gets the simple name of the generated parser (e.g.
|
java.lang.String |
getParserPackage()
Gets the declared package for the generated parser (e.g.
|
java.lang.String |
getRelativeGrammarFile()
Gets the path to the grammar file (relative to its source directory).
|
java.io.File |
getSourceDirectory()
Gets the absolute path to the base directory in which the grammar file resides.
|
java.lang.String |
resolvePackageName(java.lang.String packageName)
Resolves the specified package name against the package name of the parser generated from this grammar.
|
java.lang.String |
toString()
Gets a string representation of this bean.
|
private final java.io.File sourceDirectory
private final java.lang.String grammarFile
private final java.lang.String parserPackage
private final java.lang.String parserDirectory
private final java.lang.String parserName
private final java.lang.String parserFile
public GrammarInfo(java.io.File sourceDir, java.lang.String inputFile) throws java.io.IOException
sourceDir
- The absolute path to the base directory in which the grammar file resides, must not be
null
.inputFile
- The path to the grammar file (relative to the source directory), must not be null
.java.io.IOException
- If reading the grammar file failed.public GrammarInfo(java.io.File sourceDir, java.lang.String inputFile, java.lang.String packageName) throws java.io.IOException
sourceDir
- The absolute path to the base directory in which the grammar file resides, must not be
null
.inputFile
- The path to the grammar file (relative to the source directory), must not be null
.packageName
- The package name for the generated parser, may be null
to use the package
declaration from the grammar file.java.io.IOException
- If reading the grammar file failed.private java.lang.String findPackageName(java.lang.String grammar)
grammar
- The contents of the grammar file, must not be null
.private java.lang.String findParserName(java.lang.String grammar)
grammar
- The contents of the grammar file, must not be null
.public java.io.File getSourceDirectory()
null
.public java.io.File getGrammarFile()
null
.public java.lang.String getRelativeGrammarFile()
null
.public java.lang.String resolvePackageName(java.lang.String packageName)
packageName
- The package name to resolve, may be null
.null
if the input string was null
.public java.lang.String getParserPackage()
null
.public java.lang.String getParserDirectory()
null
.public java.lang.String getParserName()
null
.public java.lang.String getParserFile()
null
.public java.lang.String toString()
toString
in class java.lang.Object