JavaCC (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.javacc, class: JavaCC

Package org.apache.tools.ant.taskdefs.optional.javacc

# Class JavaCC

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.optional.javacc.JavaCC

All Implemented Interfaces:
  `Cloneable`

public class JavaCC extends Task
JavaCC compiler compiler task.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String[]`
  `ARCHIVE_LOCATIONS`
  `protected static final int[]`
  `ARCHIVE_LOCATIONS_VS_MAJOR_VERSION`
  `protected static final String`
  `COM_JAVACC_CLASS`
  `protected static final String`
  `COM_JJDOC_CLASS`
  `protected static final String`
  `COM_JJTREE_CLASS`
  `protected static final String`
  `COM_PACKAGE`
  `protected static final String`
  `ORG_JAVACC_CLASS`
  `protected static final String`
  `ORG_JJDOC_CLASS`
  `protected static final String`
  `ORG_JJTREE_CLASS`
  `protected static final String`
  `ORG_PACKAGE_3_0`
  `protected static final String`
  `ORG_PACKAGE_3_1`
  `protected static final int`
  `TASKDEF_TYPE_JAVACC`
  `protected static final int`
  `TASKDEF_TYPE_JJDOC`
  `protected static final int`
  `TASKDEF_TYPE_JJTREE`

  ### Fields inherited from class org.apache.tools.ant.Task

  `target, taskName, taskType, wrapper`

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JavaCC()`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute()`
  Run the task.
  `protected static File`
  `getArchiveFile(File home)`
  Helper method to retrieve the path used to store the JavaCC.zip or javacc.jar which is different from versions.
  `protected static String`
  `getMainClass(File home, int type)`
  Helper method to retrieve main class which is different from versions.
  `protected static String`
  `getMainClass(Path path, int type)`
  Helper method to retrieve main class which is different from versions.
  `protected static int`
  `getMajorVersionNumber(File home)`
  Helper method to determine the major version number of JavaCC.
  `void`
  `setBuildparser(boolean buildParser)`
  Sets the BUILD_PARSER grammar option.
  `void`
  `setBuildtokenmanager(boolean buildTokenManager)`
  Sets the BUILD_TOKEN_MANAGER grammar option.
  `void`
  `setCachetokens(boolean cacheTokens)`
  Sets the CACHE_TOKENS grammar option.
  `void`
  `setChoiceambiguitycheck(int choiceAmbiguityCheck)`
  Sets the CHOICE_AMBIGUITY_CHECK grammar option.
  `void`
  `setCommontokenaction(boolean commonTokenAction)`
  Sets the COMMON_TOKEN_ACTION grammar option.
  `void`
  `setDebuglookahead(boolean debugLookahead)`
  Sets the DEBUG_LOOKAHEAD grammar option.
  `void`
  `setDebugparser(boolean debugParser)`
  Sets the DEBUG_PARSER grammar option.
  `void`
  `setDebugtokenmanager(boolean debugTokenManager)`
  Sets the DEBUG_TOKEN_MANAGER grammar option.
  `void`
  `setErrorreporting(boolean errorReporting)`
  Sets the ERROR_REPORTING grammar option.
  `void`
  `setForcelacheck(boolean forceLACheck)`
  Sets the FORCE_LA_CHECK grammar option.
  `void`
  `setIgnorecase(boolean ignoreCase)`
  Sets the IGNORE_CASE grammar option.
  `void`
  `setJavacchome(File javaccHome)`
  The directory containing the JavaCC distribution.
  `void`
  `setJavaunicodeescape(boolean javaUnicodeEscape)`
  Sets the JAVA_UNICODE_ESCAPE grammar option.
  `void`
  `setJDKversion(String jdkVersion)`
  Sets the JDK_VERSION option.
  `void`
  `setKeeplinecolumn(boolean keepLineColumn)`
  Sets the KEEP_LINE_COLUMN grammar option.
  `void`
  `setLookahead(int lookahead)`
  Sets the LOOKAHEAD grammar option.
  `void`
  `setMaxmemory(String max)`
  Corresponds -Xmx.
  `void`
  `setOptimizetokenmanager(boolean optimizeTokenManager)`
  Sets the OPTIMIZE_TOKEN_MANAGER grammar option.
  `void`
  `setOtherambiguityCheck(int otherAmbiguityCheck)`
  Sets the OTHER_AMBIGUITY_CHECK grammar option.
  `void`
  `setOutputdirectory(File outputDirectory)`
  The directory to write the generated files to.
  `void`
  `setSanitycheck(boolean sanityCheck)`
  Sets the SANITY_CHECK grammar option.
  `void`
  `setStatic(boolean staticParser)`
  Sets the STATIC grammar option.
  `void`
  `setTarget(File targetFile)`
  The grammar file to process.
  `void`
  `setUnicodeinput(boolean unicodeInput)`
  Sets the UNICODE_INPUT grammar option.
  `void`
  `setUsercharstream(boolean userCharStream)`
  Sets the USER_CHAR_STREAM grammar option.
  `void`
  `setUsertokenmanager(boolean userTokenManager)`
  Sets the USER_TOKEN_MANAGER grammar option.

  ### Methods inherited from class org.apache.tools.ant.Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TASKDEF_TYPE_JAVACC

    protected static final int TASKDEF_TYPE_JAVACC
    See Also:
      - Constant Field Values

  - ### TASKDEF_TYPE_JJTREE

    protected static final int TASKDEF_TYPE_JJTREE
    See Also:
      - Constant Field Values

  - ### TASKDEF_TYPE_JJDOC

    protected static final int TASKDEF_TYPE_JJDOC
    See Also:
      - Constant Field Values

  - ### ARCHIVE_LOCATIONS

    protected static final String[] ARCHIVE_LOCATIONS

  - ### ARCHIVE_LOCATIONS_VS_MAJOR_VERSION

    protected static final int[] ARCHIVE_LOCATIONS_VS_MAJOR_VERSION

  - ### COM_PACKAGE

    protected static final String COM_PACKAGE
    See Also:
      - Constant Field Values

  - ### COM_JAVACC_CLASS

    protected static final String COM_JAVACC_CLASS
    See Also:
      - Constant Field Values

  - ### COM_JJTREE_CLASS

    protected static final String COM_JJTREE_CLASS
    See Also:
      - Constant Field Values

  - ### COM_JJDOC_CLASS

    protected static final String COM_JJDOC_CLASS
    See Also:
      - Constant Field Values

  - ### ORG_PACKAGE_3_0

    protected static final String ORG_PACKAGE_3_0
    See Also:
      - Constant Field Values

  - ### ORG_PACKAGE_3_1

    protected static final String ORG_PACKAGE_3_1
    See Also:
      - Constant Field Values

  - ### ORG_JAVACC_CLASS

    protected static final String ORG_JAVACC_CLASS
    See Also:
      - Constant Field Values

  - ### ORG_JJTREE_CLASS

    protected static final String ORG_JJTREE_CLASS
    See Also:
      - Constant Field Values

  - ### ORG_JJDOC_CLASS

    protected static final String ORG_JJDOC_CLASS
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### JavaCC

    public JavaCC()
    Constructor

- ## Method Details

  - ### setLookahead

    public void setLookahead(int lookahead)
    Sets the LOOKAHEAD grammar option.
    Parameters:
      `lookahead` - an `int` value.

  - ### setChoiceambiguitycheck

    public void setChoiceambiguitycheck(int choiceAmbiguityCheck)
    Sets the CHOICE_AMBIGUITY_CHECK grammar option.
    Parameters:
      `choiceAmbiguityCheck` - an `int` value.

  - ### setOtherambiguityCheck

    public void setOtherambiguityCheck(int otherAmbiguityCheck)
    Sets the OTHER_AMBIGUITY_CHECK grammar option.
    Parameters:
      `otherAmbiguityCheck` - an `int` value.

  - ### setStatic

    public void setStatic(boolean staticParser)
    Sets the STATIC grammar option.
    Parameters:
      `staticParser` - a `boolean` value.

  - ### setDebugparser

    public void setDebugparser(boolean debugParser)
    Sets the DEBUG_PARSER grammar option.
    Parameters:
      `debugParser` - a `boolean` value.

  - ### setDebuglookahead

    public void setDebuglookahead(boolean debugLookahead)
    Sets the DEBUG_LOOKAHEAD grammar option.
    Parameters:
      `debugLookahead` - a `boolean` value.

  - ### setDebugtokenmanager

    public void setDebugtokenmanager(boolean debugTokenManager)
    Sets the DEBUG_TOKEN_MANAGER grammar option.
    Parameters:
      `debugTokenManager` - a `boolean` value.

  - ### setOptimizetokenmanager

    public void setOptimizetokenmanager(boolean optimizeTokenManager)
    Sets the OPTIMIZE_TOKEN_MANAGER grammar option.
    Parameters:
      `optimizeTokenManager` - a `boolean` value.

  - ### setErrorreporting

    public void setErrorreporting(boolean errorReporting)
    Sets the ERROR_REPORTING grammar option.
    Parameters:
      `errorReporting` - a `boolean` value.

  - ### setJavaunicodeescape

    public void setJavaunicodeescape(boolean javaUnicodeEscape)
    Sets the JAVA_UNICODE_ESCAPE grammar option.
    Parameters:
      `javaUnicodeEscape` - a `boolean` value.

  - ### setUnicodeinput

    public void setUnicodeinput(boolean unicodeInput)
    Sets the UNICODE_INPUT grammar option.
    Parameters:
      `unicodeInput` - a `boolean` value.

  - ### setIgnorecase

    public void setIgnorecase(boolean ignoreCase)
    Sets the IGNORE_CASE grammar option.
    Parameters:
      `ignoreCase` - a `boolean` value.

  - ### setCommontokenaction

    public void setCommontokenaction(boolean commonTokenAction)
    Sets the COMMON_TOKEN_ACTION grammar option.
    Parameters:
      `commonTokenAction` - a `boolean` value.

  - ### setUsertokenmanager

    public void setUsertokenmanager(boolean userTokenManager)
    Sets the USER_TOKEN_MANAGER grammar option.
    Parameters:
      `userTokenManager` - a `boolean` value.

  - ### setUsercharstream

    public void setUsercharstream(boolean userCharStream)
    Sets the USER_CHAR_STREAM grammar option.
    Parameters:
      `userCharStream` - a `boolean` value.

  - ### setBuildparser

    public void setBuildparser(boolean buildParser)
    Sets the BUILD_PARSER grammar option.
    Parameters:
      `buildParser` - a `boolean` value.

  - ### setBuildtokenmanager

    public void setBuildtokenmanager(boolean buildTokenManager)
    Sets the BUILD_TOKEN_MANAGER grammar option.
    Parameters:
      `buildTokenManager` - a `boolean` value.

  - ### setSanitycheck

    public void setSanitycheck(boolean sanityCheck)
    Sets the SANITY_CHECK grammar option.
    Parameters:
      `sanityCheck` - a `boolean` value.

  - ### setForcelacheck

    public void setForcelacheck(boolean forceLACheck)
    Sets the FORCE_LA_CHECK grammar option.
    Parameters:
      `forceLACheck` - a `boolean` value.

  - ### setCachetokens

    public void setCachetokens(boolean cacheTokens)
    Sets the CACHE_TOKENS grammar option.
    Parameters:
      `cacheTokens` - a `boolean` value.

  - ### setKeeplinecolumn

    public void setKeeplinecolumn(boolean keepLineColumn)
    Sets the KEEP_LINE_COLUMN grammar option.
    Parameters:
      `keepLineColumn` - a `boolean` value.

  - ### setJDKversion

    public void setJDKversion(String jdkVersion)
    Sets the JDK_VERSION option.
    Parameters:
      `jdkVersion` - the version to use.
    Since:
      Ant1.7

  - ### setOutputdirectory

    public void setOutputdirectory(File outputDirectory)
    The directory to write the generated files to. If not set, the files are written to the directory containing the grammar file.
    Parameters:
      `outputDirectory` - the output directory.

  - ### setTarget

    public void setTarget(File targetFile)
    The grammar file to process.
    Parameters:
      `targetFile` - the grammar file.

  - ### setJavacchome

    public void setJavacchome(File javaccHome)
    The directory containing the JavaCC distribution.
    Parameters:
      `javaccHome` - the directory.

  - ### setMaxmemory

    public void setMaxmemory(String max)
    Corresponds -Xmx.
    Parameters:
      `max` - max memory parameter.
    Since:
      Ant 1.8.3

  - ### execute

    public void execute() throws BuildException
    Run the task.
    Overrides:
      `execute` in class `Task`
    Throws:
      `BuildException` - on error.

  - ### getArchiveFile

    protected static File getArchiveFile(File home) throws BuildException
    Helper method to retrieve the path used to store the JavaCC.zip or javacc.jar which is different from versions.
    Parameters:
      `home` - the javacc home path directory.
    Returns:
      the file object pointing to the JavaCC archive.
    Throws:
      `BuildException` - thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.

  - ### getMainClass

    protected static String getMainClass(File home, int type) throws BuildException
    Helper method to retrieve main class which is different from versions.
    Parameters:
      `home` - the javacc home path directory.
      `type` - the taskdef.
    Returns:
      the main class for the taskdef.
    Throws:
      `BuildException` - thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.

  - ### getMainClass

    protected static String getMainClass(Path path, int type) throws BuildException
    Helper method to retrieve main class which is different from versions.
    Parameters:
      `path` - classpath to search in.
      `type` - the taskdef.
    Returns:
      the main class for the taskdef.
    Throws:
      `BuildException` - thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.
    Since:
      Ant 1.7

  - ### getMajorVersionNumber

    protected static int getMajorVersionNumber(File home) throws BuildException
    Helper method to determine the major version number of JavaCC.
    Parameters:
      `home` - the javacc home path directory.
    Returns:
      a the major version number
    Throws:
      `BuildException` - thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.