Package org.codehaus.mojo.javacc
Class JavaCC
- java.lang.Object
-
- org.codehaus.mojo.javacc.ToolFacade
-
- org.codehaus.mojo.javacc.JavaCC
-
class JavaCC extends ToolFacade
Provides a facade for the mojos to invoke JavaCC.- Version:
- $Id: JavaCC.java 10603 2009-09-06 15:05:08Z bentmann $
- See Also:
- JavaCC Command Line Syntax
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean
buildParser
The option BUILD_PARSER.private java.lang.Boolean
buildTokenManager
The option BUILD_TOKEN_MANAGER.private java.lang.Boolean
cacheTokens
The option CACHE_TOKENS.private java.lang.Integer
choiceAmbiguityCheck
The option CHOICE_AMBIGUITY_CHECK.private java.lang.Boolean
commonTokenAction
The option COMMON_TOKEN_ACTION.private java.lang.Boolean
debugLookAhead
The option DEBUG_LOOK_AHEAD.private java.lang.Boolean
debugParser
The option DEBUG_PARSER.private java.lang.Boolean
debugTokenManager
The option DEBUG_TOKEN_MANAGER.private java.lang.Boolean
errorReporting
The option ERROR_REPORTING.private java.lang.Boolean
forceLaCheck
The option FORCE_LA_CHECK.private java.lang.String
grammarEncoding
The option GRAMMAR_ENCODING.private java.lang.Boolean
ignoreCase
The option IGNORE_CASE.private java.io.File
inputFile
The input grammar.private java.lang.Boolean
isStatic
The option STATIC.private java.lang.Boolean
javaUnicodeEscape
The option JAVA_UNICODE_ESCAPE.private java.lang.String
jdkVersion
The option JDK_VERSION.private java.lang.Boolean
keepLineColumn
The option KEEP_LINE_COLUMN.private java.lang.Integer
lookAhead
The option LOOK_AHEAD.private java.lang.Integer
otherAmbiguityCheck
The option OTHER_AMBIGUITY_CHECK.private java.io.File
outputDirectory
The option OUTPUT_DIRECTORY.private java.lang.Boolean
sanityCheck
The option SANITY_CHECK.private java.lang.Boolean
supportClassVisibilityPublic
The option SUPPORT_CLASS_VISIBILITY_PUBLIC.private java.lang.String
tokenExtends
The option TOKEN_EXTENDS.private java.lang.String
tokenFactory
The option TOKEN_FACTORY.private java.lang.Boolean
tokenManagerUsesParser
The option TOKEN_MANAGER_USES_PARSER.private java.lang.Boolean
unicodeInput
The option UNICODE_INPUT.private java.lang.Boolean
userCharStream
The option USER_CHAR_STREAM.private java.lang.Boolean
userTokenManager
The option USER_TOKEN_MANAGER.
-
Constructor Summary
Constructors Constructor Description JavaCC()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
execute()
Runs the tool using the previously set parameters.private java.lang.String[]
generateArguments()
Assembles the command line arguments for the invocation of JavaCC according to the configuration.
Note: To prevent conflicts with JavaCC options that might be set directly in the grammar file, only those parameters that have been explicitly set are passed on the command line.void
setBuildParser(java.lang.Boolean value)
Sets the option BUILD_PARSER.void
setBuildTokenManager(java.lang.Boolean value)
Sets the option BUILD_TOKEN_MANAGER.void
setCacheTokens(java.lang.Boolean value)
Sets the option CACHE_TOKENS.void
setChoiceAmbiguityCheck(java.lang.Integer value)
Sets the option CHOICE_AMBIGUITY_CHECK.void
setCommonTokenAction(java.lang.Boolean value)
Sets the option COMMON_TOKEN_ACTION.void
setDebugLookAhead(java.lang.Boolean value)
Sets the option DEBUG_LOOK_AHEAD.void
setDebugParser(java.lang.Boolean value)
Sets the option DEBUG_PARSER.void
setDebugTokenManager(java.lang.Boolean value)
Sets the option DEBUG_TOKEN_MANAGER.void
setErrorReporting(java.lang.Boolean value)
Sets the option ERROR_REPORTING.void
setForceLaCheck(java.lang.Boolean value)
Sets the option FORCE_LA_CHECK.void
setGrammarEncoding(java.lang.String value)
Sets the option GRAMMAR_ENCODING.void
setIgnoreCase(java.lang.Boolean value)
Sets the option IGNORE_CASE.void
setInputFile(java.io.File value)
Sets the absolute path to the grammar file to pass into JavaCC for compilation.void
setJavaUnicodeEscape(java.lang.Boolean value)
Sets the option JAVA_UNICODE_ESCAPE.void
setJdkVersion(java.lang.String value)
Sets the option JDK_VERSION.void
setKeepLineColumn(java.lang.Boolean value)
Sets the option KEEP_LINE_COLUMN.void
setLookAhead(java.lang.Integer value)
Sets the option LOOK_AHEAD.void
setOtherAmbiguityCheck(java.lang.Integer value)
Sets the option OTHER_AMBIGUITY_CHECK.void
setOutputDirectory(java.io.File value)
Sets the absolute path to the output directory.void
setSanityCheck(java.lang.Boolean value)
Sets the option SANITY_CHECK.void
setStatic(java.lang.Boolean value)
Sets the option STATIC.void
setSupportClassVisibilityPublic(java.lang.Boolean value)
Sets the option SUPPORT_CLASS_VISIBILITY_PUBLIC.void
setTokenExtends(java.lang.String value)
Sets the option TOKEN_EXTENDS.void
setTokenFactory(java.lang.String value)
Sets the option TOKEN_FACTORY.void
setTokenManagerUsesParser(java.lang.Boolean value)
Sets the option TOKEN_MANAGER_USES_PARSER.void
setUnicodeInput(java.lang.Boolean value)
Sets the option UNICODE_INPUT.void
setUserCharStream(java.lang.Boolean value)
Sets the option USER_CHAR_STREAM.void
setUserTokenManager(java.lang.Boolean value)
Sets the option USER_TOKEN_MANAGER.java.lang.String
toString()
Gets a string representation of the command line arguments.-
Methods inherited from class org.codehaus.mojo.javacc.ToolFacade
getLog, getToolName, run, setLog
-
-
-
-
Field Detail
-
inputFile
private java.io.File inputFile
The input grammar.
-
outputDirectory
private java.io.File outputDirectory
The option OUTPUT_DIRECTORY.
-
grammarEncoding
private java.lang.String grammarEncoding
The option GRAMMAR_ENCODING.
-
jdkVersion
private java.lang.String jdkVersion
The option JDK_VERSION.
-
isStatic
private java.lang.Boolean isStatic
The option STATIC.
-
lookAhead
private java.lang.Integer lookAhead
The option LOOK_AHEAD.
-
choiceAmbiguityCheck
private java.lang.Integer choiceAmbiguityCheck
The option CHOICE_AMBIGUITY_CHECK.
-
otherAmbiguityCheck
private java.lang.Integer otherAmbiguityCheck
The option OTHER_AMBIGUITY_CHECK.
-
debugParser
private java.lang.Boolean debugParser
The option DEBUG_PARSER.
-
debugLookAhead
private java.lang.Boolean debugLookAhead
The option DEBUG_LOOK_AHEAD.
-
debugTokenManager
private java.lang.Boolean debugTokenManager
The option DEBUG_TOKEN_MANAGER.
-
errorReporting
private java.lang.Boolean errorReporting
The option ERROR_REPORTING.
-
javaUnicodeEscape
private java.lang.Boolean javaUnicodeEscape
The option JAVA_UNICODE_ESCAPE.
-
unicodeInput
private java.lang.Boolean unicodeInput
The option UNICODE_INPUT.
-
ignoreCase
private java.lang.Boolean ignoreCase
The option IGNORE_CASE.
-
commonTokenAction
private java.lang.Boolean commonTokenAction
The option COMMON_TOKEN_ACTION.
-
userTokenManager
private java.lang.Boolean userTokenManager
The option USER_TOKEN_MANAGER.
-
userCharStream
private java.lang.Boolean userCharStream
The option USER_CHAR_STREAM.
-
buildParser
private java.lang.Boolean buildParser
The option BUILD_PARSER.
-
buildTokenManager
private java.lang.Boolean buildTokenManager
The option BUILD_TOKEN_MANAGER.
-
tokenManagerUsesParser
private java.lang.Boolean tokenManagerUsesParser
The option TOKEN_MANAGER_USES_PARSER.
-
tokenExtends
private java.lang.String tokenExtends
The option TOKEN_EXTENDS.
-
tokenFactory
private java.lang.String tokenFactory
The option TOKEN_FACTORY.
-
sanityCheck
private java.lang.Boolean sanityCheck
The option SANITY_CHECK.
-
forceLaCheck
private java.lang.Boolean forceLaCheck
The option FORCE_LA_CHECK.
-
cacheTokens
private java.lang.Boolean cacheTokens
The option CACHE_TOKENS.
-
keepLineColumn
private java.lang.Boolean keepLineColumn
The option KEEP_LINE_COLUMN.
-
supportClassVisibilityPublic
private java.lang.Boolean supportClassVisibilityPublic
The option SUPPORT_CLASS_VISIBILITY_PUBLIC.
-
-
Method Detail
-
setInputFile
public void setInputFile(java.io.File value)
Sets the absolute path to the grammar file to pass into JavaCC for compilation.- Parameters:
value
- The absolute path to the grammar file to pass into JavaCC for compilation.
-
setOutputDirectory
public void setOutputDirectory(java.io.File value)
Sets the absolute path to the output directory.- Parameters:
value
- The absolute path to the output directory for the generated parser file. If this directory does not exist yet, it is created. Note that this path should already include the desired package hierarchy because JavaCC will not append the required sub directories automatically.
-
setGrammarEncoding
public void setGrammarEncoding(java.lang.String value)
Sets the option GRAMMAR_ENCODING.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setJdkVersion
public void setJdkVersion(java.lang.String value)
Sets the option JDK_VERSION.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setStatic
public void setStatic(java.lang.Boolean value)
Sets the option STATIC.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setLookAhead
public void setLookAhead(java.lang.Integer value)
Sets the option LOOK_AHEAD.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setChoiceAmbiguityCheck
public void setChoiceAmbiguityCheck(java.lang.Integer value)
Sets the option CHOICE_AMBIGUITY_CHECK.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setOtherAmbiguityCheck
public void setOtherAmbiguityCheck(java.lang.Integer value)
Sets the option OTHER_AMBIGUITY_CHECK.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setDebugParser
public void setDebugParser(java.lang.Boolean value)
Sets the option DEBUG_PARSER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setDebugLookAhead
public void setDebugLookAhead(java.lang.Boolean value)
Sets the option DEBUG_LOOK_AHEAD.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setDebugTokenManager
public void setDebugTokenManager(java.lang.Boolean value)
Sets the option DEBUG_TOKEN_MANAGER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setErrorReporting
public void setErrorReporting(java.lang.Boolean value)
Sets the option ERROR_REPORTING.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setJavaUnicodeEscape
public void setJavaUnicodeEscape(java.lang.Boolean value)
Sets the option JAVA_UNICODE_ESCAPE.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setUnicodeInput
public void setUnicodeInput(java.lang.Boolean value)
Sets the option UNICODE_INPUT.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setIgnoreCase
public void setIgnoreCase(java.lang.Boolean value)
Sets the option IGNORE_CASE.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setCommonTokenAction
public void setCommonTokenAction(java.lang.Boolean value)
Sets the option COMMON_TOKEN_ACTION.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setUserTokenManager
public void setUserTokenManager(java.lang.Boolean value)
Sets the option USER_TOKEN_MANAGER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setUserCharStream
public void setUserCharStream(java.lang.Boolean value)
Sets the option USER_CHAR_STREAM.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setBuildParser
public void setBuildParser(java.lang.Boolean value)
Sets the option BUILD_PARSER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setBuildTokenManager
public void setBuildTokenManager(java.lang.Boolean value)
Sets the option BUILD_TOKEN_MANAGER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setTokenManagerUsesParser
public void setTokenManagerUsesParser(java.lang.Boolean value)
Sets the option TOKEN_MANAGER_USES_PARSER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setTokenExtends
public void setTokenExtends(java.lang.String value)
Sets the option TOKEN_EXTENDS.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setTokenFactory
public void setTokenFactory(java.lang.String value)
Sets the option TOKEN_FACTORY.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setSanityCheck
public void setSanityCheck(java.lang.Boolean value)
Sets the option SANITY_CHECK.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setForceLaCheck
public void setForceLaCheck(java.lang.Boolean value)
Sets the option FORCE_LA_CHECK.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setCacheTokens
public void setCacheTokens(java.lang.Boolean value)
Sets the option CACHE_TOKENS.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setKeepLineColumn
public void setKeepLineColumn(java.lang.Boolean value)
Sets the option KEEP_LINE_COLUMN.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setSupportClassVisibilityPublic
public void setSupportClassVisibilityPublic(java.lang.Boolean value)
Sets the option SUPPORT_CLASS_VISIBILITY_PUBLIC.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
execute
protected int execute() throws java.lang.Exception
Runs the tool using the previously set parameters.- Specified by:
execute
in classToolFacade
- Returns:
- The exit code of the tool, non-zero means failure.
- Throws:
java.lang.Exception
- If the tool could not be invoked.
-
generateArguments
private java.lang.String[] generateArguments()
Assembles the command line arguments for the invocation of JavaCC according to the configuration.
Note: To prevent conflicts with JavaCC options that might be set directly in the grammar file, only those parameters that have been explicitly set are passed on the command line.- Returns:
- A string array that represents the command line arguments to use for JavaCC.
-
toString
public java.lang.String toString()
Gets a string representation of the command line arguments.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the command line arguments.
-
-