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$
- See Also:
- JavaCC Command Line Syntax
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.BooleanbuildParserThe option BUILD_PARSER.private java.lang.BooleanbuildTokenManagerThe option BUILD_TOKEN_MANAGER.private java.lang.BooleancacheTokensThe option CACHE_TOKENS.private java.lang.IntegerchoiceAmbiguityCheckThe option CHOICE_AMBIGUITY_CHECK.private java.lang.BooleancommonTokenActionThe option COMMON_TOKEN_ACTION.private java.lang.BooleandebugLookAheadThe option DEBUG_LOOK_AHEAD.private java.lang.BooleandebugParserThe option DEBUG_PARSER.private java.lang.BooleandebugTokenManagerThe option DEBUG_TOKEN_MANAGER.private java.lang.BooleanerrorReportingThe option ERROR_REPORTING.private java.lang.BooleanforceLaCheckThe option FORCE_LA_CHECK.private java.lang.StringgrammarEncodingThe option GRAMMAR_ENCODING.private java.lang.BooleanignoreCaseThe option IGNORE_CASE.private java.io.FileinputFileThe input grammar.private java.lang.BooleanisStaticThe option STATIC.private java.lang.BooleanjavaUnicodeEscapeThe option JAVA_UNICODE_ESCAPE.private java.lang.StringjdkVersionThe option JDK_VERSION.private java.lang.BooleankeepLineColumnThe option KEEP_LINE_COLUMN.private java.lang.IntegerlookAheadThe option LOOK_AHEAD.private java.lang.IntegerotherAmbiguityCheckThe option OTHER_AMBIGUITY_CHECK.private java.io.FileoutputDirectoryThe option OUTPUT_DIRECTORY.private java.lang.BooleansanityCheckThe option SANITY_CHECK.private java.lang.BooleansupportClassVisibilityPublicThe option SUPPORT_CLASS_VISIBILITY_PUBLIC.private java.lang.StringtokenExtendsThe option TOKEN_EXTENDS.private java.lang.StringtokenFactoryThe option TOKEN_FACTORY.private java.lang.BooleantokenManagerUsesParserThe option TOKEN_MANAGER_USES_PARSER.private java.lang.BooleanunicodeInputThe option UNICODE_INPUT.private java.lang.BooleanuserCharStreamThe option USER_CHAR_STREAM.private java.lang.BooleanuserTokenManagerThe option USER_TOKEN_MANAGER.
-
Constructor Summary
Constructors Constructor Description JavaCC()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intexecute()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.voidsetBuildParser(java.lang.Boolean value)Sets the option BUILD_PARSER.voidsetBuildTokenManager(java.lang.Boolean value)Sets the option BUILD_TOKEN_MANAGER.voidsetCacheTokens(java.lang.Boolean value)Sets the option CACHE_TOKENS.voidsetChoiceAmbiguityCheck(java.lang.Integer value)Sets the option CHOICE_AMBIGUITY_CHECK.voidsetCommonTokenAction(java.lang.Boolean value)Sets the option COMMON_TOKEN_ACTION.voidsetDebugLookAhead(java.lang.Boolean value)Sets the option DEBUG_LOOK_AHEAD.voidsetDebugParser(java.lang.Boolean value)Sets the option DEBUG_PARSER.voidsetDebugTokenManager(java.lang.Boolean value)Sets the option DEBUG_TOKEN_MANAGER.voidsetErrorReporting(java.lang.Boolean value)Sets the option ERROR_REPORTING.voidsetForceLaCheck(java.lang.Boolean value)Sets the option FORCE_LA_CHECK.voidsetGrammarEncoding(java.lang.String value)Sets the option GRAMMAR_ENCODING.voidsetIgnoreCase(java.lang.Boolean value)Sets the option IGNORE_CASE.voidsetInputFile(java.io.File value)Sets the absolute path to the grammar file to pass into JavaCC for compilation.voidsetJavaUnicodeEscape(java.lang.Boolean value)Sets the option JAVA_UNICODE_ESCAPE.voidsetJdkVersion(java.lang.String value)Sets the option JDK_VERSION.voidsetKeepLineColumn(java.lang.Boolean value)Sets the option KEEP_LINE_COLUMN.voidsetLookAhead(java.lang.Integer value)Sets the option LOOK_AHEAD.voidsetOtherAmbiguityCheck(java.lang.Integer value)Sets the option OTHER_AMBIGUITY_CHECK.voidsetOutputDirectory(java.io.File value)Sets the absolute path to the output directory.voidsetSanityCheck(java.lang.Boolean value)Sets the option SANITY_CHECK.voidsetStatic(java.lang.Boolean value)Sets the option STATIC.voidsetSupportClassVisibilityPublic(java.lang.Boolean value)Sets the option SUPPORT_CLASS_VISIBILITY_PUBLIC.voidsetTokenExtends(java.lang.String value)Sets the option TOKEN_EXTENDS.voidsetTokenFactory(java.lang.String value)Sets the option TOKEN_FACTORY.voidsetTokenManagerUsesParser(java.lang.Boolean value)Sets the option TOKEN_MANAGER_USES_PARSER.voidsetUnicodeInput(java.lang.Boolean value)Sets the option UNICODE_INPUT.voidsetUserCharStream(java.lang.Boolean value)Sets the option USER_CHAR_STREAM.voidsetUserTokenManager(java.lang.Boolean value)Sets the option USER_TOKEN_MANAGER.java.lang.StringtoString()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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto 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 benullto use the value provided in the grammar or the default.
-
execute
protected int execute() throws java.lang.ExceptionRuns the tool using the previously set parameters.- Specified by:
executein 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:
toStringin classjava.lang.Object- Returns:
- A string representation of the command line arguments.
-
-