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:
  • Field Details

    • inputFile

      private File inputFile
      The input grammar.
    • outputDirectory

      private File outputDirectory
      The option OUTPUT_DIRECTORY.
    • grammarEncoding

      private String grammarEncoding
      The option GRAMMAR_ENCODING.
    • jdkVersion

      private String jdkVersion
      The option JDK_VERSION.
    • isStatic

      private Boolean isStatic
      The option STATIC.
    • lookAhead

      private Integer lookAhead
      The option LOOK_AHEAD.
    • choiceAmbiguityCheck

      private Integer choiceAmbiguityCheck
      The option CHOICE_AMBIGUITY_CHECK.
    • otherAmbiguityCheck

      private Integer otherAmbiguityCheck
      The option OTHER_AMBIGUITY_CHECK.
    • debugParser

      private Boolean debugParser
      The option DEBUG_PARSER.
    • debugLookAhead

      private Boolean debugLookAhead
      The option DEBUG_LOOK_AHEAD.
    • debugTokenManager

      private Boolean debugTokenManager
      The option DEBUG_TOKEN_MANAGER.
    • errorReporting

      private Boolean errorReporting
      The option ERROR_REPORTING.
    • javaUnicodeEscape

      private Boolean javaUnicodeEscape
      The option JAVA_UNICODE_ESCAPE.
    • unicodeInput

      private Boolean unicodeInput
      The option UNICODE_INPUT.
    • ignoreCase

      private Boolean ignoreCase
      The option IGNORE_CASE.
    • commonTokenAction

      private Boolean commonTokenAction
      The option COMMON_TOKEN_ACTION.
    • userTokenManager

      private Boolean userTokenManager
      The option USER_TOKEN_MANAGER.
    • userCharStream

      private Boolean userCharStream
      The option USER_CHAR_STREAM.
    • buildParser

      private Boolean buildParser
      The option BUILD_PARSER.
    • buildTokenManager

      private Boolean buildTokenManager
      The option BUILD_TOKEN_MANAGER.
    • tokenManagerUsesParser

      private Boolean tokenManagerUsesParser
      The option TOKEN_MANAGER_USES_PARSER.
    • tokenExtends

      private String tokenExtends
      The option TOKEN_EXTENDS.
    • tokenFactory

      private String tokenFactory
      The option TOKEN_FACTORY.
    • sanityCheck

      private Boolean sanityCheck
      The option SANITY_CHECK.
    • forceLaCheck

      private Boolean forceLaCheck
      The option FORCE_LA_CHECK.
    • cacheTokens

      private Boolean cacheTokens
      The option CACHE_TOKENS.
    • keepLineColumn

      private Boolean keepLineColumn
      The option KEEP_LINE_COLUMN.
    • supportClassVisibilityPublic

      private Boolean supportClassVisibilityPublic
      The option SUPPORT_CLASS_VISIBILITY_PUBLIC.
  • Constructor Details

    • JavaCC

      JavaCC()
  • Method Details

    • setInputFile

      public void setInputFile(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(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(String value)
      Sets the option GRAMMAR_ENCODING.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setJdkVersion

      public void setJdkVersion(String value)
      Sets the option JDK_VERSION.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setStatic

      public void setStatic(Boolean value)
      Sets the option STATIC.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setLookAhead

      public void setLookAhead(Integer value)
      Sets the option LOOK_AHEAD.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setChoiceAmbiguityCheck

      public void setChoiceAmbiguityCheck(Integer value)
      Sets the option CHOICE_AMBIGUITY_CHECK.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setOtherAmbiguityCheck

      public void setOtherAmbiguityCheck(Integer value)
      Sets the option OTHER_AMBIGUITY_CHECK.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setDebugParser

      public void setDebugParser(Boolean value)
      Sets the option DEBUG_PARSER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setDebugLookAhead

      public void setDebugLookAhead(Boolean value)
      Sets the option DEBUG_LOOK_AHEAD.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setDebugTokenManager

      public void setDebugTokenManager(Boolean value)
      Sets the option DEBUG_TOKEN_MANAGER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setErrorReporting

      public void setErrorReporting(Boolean value)
      Sets the option ERROR_REPORTING.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setJavaUnicodeEscape

      public void setJavaUnicodeEscape(Boolean value)
      Sets the option JAVA_UNICODE_ESCAPE.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setUnicodeInput

      public void setUnicodeInput(Boolean value)
      Sets the option UNICODE_INPUT.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setIgnoreCase

      public void setIgnoreCase(Boolean value)
      Sets the option IGNORE_CASE.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setCommonTokenAction

      public void setCommonTokenAction(Boolean value)
      Sets the option COMMON_TOKEN_ACTION.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setUserTokenManager

      public void setUserTokenManager(Boolean value)
      Sets the option USER_TOKEN_MANAGER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setUserCharStream

      public void setUserCharStream(Boolean value)
      Sets the option USER_CHAR_STREAM.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setBuildParser

      public void setBuildParser(Boolean value)
      Sets the option BUILD_PARSER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setBuildTokenManager

      public void setBuildTokenManager(Boolean value)
      Sets the option BUILD_TOKEN_MANAGER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setTokenManagerUsesParser

      public void setTokenManagerUsesParser(Boolean value)
      Sets the option TOKEN_MANAGER_USES_PARSER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setTokenExtends

      public void setTokenExtends(String value)
      Sets the option TOKEN_EXTENDS.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setTokenFactory

      public void setTokenFactory(String value)
      Sets the option TOKEN_FACTORY.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setSanityCheck

      public void setSanityCheck(Boolean value)
      Sets the option SANITY_CHECK.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setForceLaCheck

      public void setForceLaCheck(Boolean value)
      Sets the option FORCE_LA_CHECK.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setCacheTokens

      public void setCacheTokens(Boolean value)
      Sets the option CACHE_TOKENS.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setKeepLineColumn

      public void setKeepLineColumn(Boolean value)
      Sets the option KEEP_LINE_COLUMN.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setSupportClassVisibilityPublic

      public void setSupportClassVisibilityPublic(Boolean value)
      Sets the option SUPPORT_CLASS_VISIBILITY_PUBLIC.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • execute

      protected int execute() throws Exception
      Runs the tool using the previously set parameters.
      Specified by:
      execute in class ToolFacade
      Returns:
      The exit code of the tool, non-zero means failure.
      Throws:
      Exception - If the tool could not be invoked.
    • generateArguments

      private 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 String toString()
      Gets a string representation of the command line arguments.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the command line arguments.