Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional.javacc

public Class JavaCC

extends Task
Class Inheritance
Imports
java.io.File, .InputStream, java.util.Hashtable, .Map, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.Execute, org.apache.tools.ant.types.Commandline, .CommandlineJava, .Path, org.apache.tools.ant.util.JavaEnvUtils

JavaCC compiler compiler task.

Field Summary

Modifier and TypeField and Description
protected static final String[]
protected static final int[]
private static final String
private static final String
private static final String
private static final String
private CommandlineJava
protected static final String
protected static final String
protected static final String
protected static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private File
private static final String
private static final String
private static final String
private String
private static final String
private final Map<String, Object>
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
private static final String
private File
private static final String
private static final String
private File
protected static final int
protected static final int
protected static final int
private static final String
private static final String
private static final String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
JavaCC()

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Run the task.
protected static File

Returns:

the file object pointing to the JavaCC archive.
getArchiveFile
(File
the javacc home path directory.
home
)

Helper method to retrieve the path used to store the JavaCC.zip or javacc.jar which is different from versions.

private static int

Returns:

the archive location index
getArchiveLocationIndex
(File
the javacc home path directory.
home
)

Helper method to determine the archive location index.

protected static String

Returns:

the main class for the taskdef.
getMainClass
(File
the javacc home path directory.
home
,
int
the taskdef.
type
)

Helper method to retrieve main class which is different from versions.

protected static String

Returns:

the main class for the taskdef.
getMainClass
(Path
classpath to search in.
path
,
int
the taskdef.
type
)

Helper method to retrieve main class which is different from versions.

protected static int

Returns:

a the major version number
getMajorVersionNumber
(File
the javacc home path directory.
home
)

Helper method to determine the major version number of JavaCC.

private File
getOutputJavaFile(File outputdir, File srcfile)

Determines the output Java file to be generated by the given grammar file.

public void
setBuildparser(boolean
a boolean value.
buildParser
)

Sets the BUILD_PARSER grammar option.

public void
setBuildtokenmanager(boolean
a boolean value.
buildTokenManager
)

Sets the BUILD_TOKEN_MANAGER grammar option.

public void
setCachetokens(boolean
a boolean value.
cacheTokens
)

Sets the CACHE_TOKENS grammar option.

public void
setChoiceambiguitycheck(int
an int value.
choiceAmbiguityCheck
)

Sets the CHOICE_AMBIGUITY_CHECK grammar option.

public void
setCommontokenaction(boolean
a boolean value.
commonTokenAction
)

Sets the COMMON_TOKEN_ACTION grammar option.

public void
setDebuglookahead(boolean
a boolean value.
debugLookahead
)

Sets the DEBUG_LOOKAHEAD grammar option.

public void
setDebugparser(boolean
a boolean value.
debugParser
)

Sets the DEBUG_PARSER grammar option.

public void
setDebugtokenmanager(boolean
a boolean value.
debugTokenManager
)

Sets the DEBUG_TOKEN_MANAGER grammar option.

public void
setErrorreporting(boolean
a boolean value.
errorReporting
)

Sets the ERROR_REPORTING grammar option.

public void
setForcelacheck(boolean
a boolean value.
forceLACheck
)

Sets the FORCE_LA_CHECK grammar option.

public void
setIgnorecase(boolean
a boolean value.
ignoreCase
)

Sets the IGNORE_CASE grammar option.

public void
setJavacchome(File
the directory.
javaccHome
)

The directory containing the JavaCC distribution.

public void
setJavaunicodeescape(boolean
a boolean value.
javaUnicodeEscape
)

Sets the JAVA_UNICODE_ESCAPE grammar option.

public void
setJDKversion(String
the version to use.
jdkVersion
)

Sets the JDK_VERSION option.

public void
setKeeplinecolumn(boolean
a boolean value.
keepLineColumn
)

Sets the KEEP_LINE_COLUMN grammar option.

public void
setLookahead(int
an int value.
lookahead
)

Sets the LOOKAHEAD grammar option.

public void
setMaxmemory(String
max memory parameter.
max
)

Corresponds -Xmx.

public void
setOptimizetokenmanager(boolean
a boolean value.
optimizeTokenManager
)

Sets the OPTIMIZE_TOKEN_MANAGER grammar option.

public void
setOtherambiguityCheck(int
an int value.
otherAmbiguityCheck
)

Sets the OTHER_AMBIGUITY_CHECK grammar option.

public void
setOutputdirectory(File
the output directory.
outputDirectory
)

The directory to write the generated files to.

public void
setSanitycheck(boolean
a boolean value.
sanityCheck
)

Sets the SANITY_CHECK grammar option.

public void
setStatic(boolean
a boolean value.
staticParser
)

Sets the STATIC grammar option.

public void
setTarget(File
the grammar file.
targetFile
)

The grammar file to process.

public void
setUnicodeinput(boolean
a boolean value.
unicodeInput
)

Sets the UNICODE_INPUT grammar option.

public void
setUsercharstream(boolean
a boolean value.
userCharStream
)

Sets the USER_CHAR_STREAM grammar option.

public void
setUsertokenmanager(boolean
a boolean value.
userTokenManager
)

Sets the USER_TOKEN_MANAGER grammar option.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

ARCHIVE_LOCATIONSback to summary
protected static final String[] ARCHIVE_LOCATIONS
ARCHIVE_LOCATIONS_VS_MAJOR_VERSIONback to summary
protected static final int[] ARCHIVE_LOCATIONS_VS_MAJOR_VERSION
BUILD_PARSERback to summary
private static final String BUILD_PARSER
BUILD_TOKEN_MANAGERback to summary
private static final String BUILD_TOKEN_MANAGER
CACHE_TOKENSback to summary
private static final String CACHE_TOKENS
CHOICE_AMBIGUITY_CHECKback to summary
private static final String CHOICE_AMBIGUITY_CHECK
cmdlback to summary
private CommandlineJava cmdl
COM_JAVACC_CLASSback to summary
protected static final String COM_JAVACC_CLASS
COM_JJDOC_CLASSback to summary
protected static final String COM_JJDOC_CLASS
COM_JJTREE_CLASSback to summary
protected static final String COM_JJTREE_CLASS
COM_PACKAGEback to summary
protected static final String COM_PACKAGE
COMMON_TOKEN_ACTIONback to summary
private static final String COMMON_TOKEN_ACTION
DEBUG_LOOKAHEADback to summary
private static final String DEBUG_LOOKAHEAD
DEBUG_PARSERback to summary
private static final String DEBUG_PARSER
DEBUG_TOKEN_MANAGERback to summary
private static final String DEBUG_TOKEN_MANAGER
ERROR_REPORTINGback to summary
private static final String ERROR_REPORTING
FORCE_LA_CHECKback to summary
private static final String FORCE_LA_CHECK
IGNORE_CASEback to summary
private static final String IGNORE_CASE
JAVA_UNICODE_ESCAPEback to summary
private static final String JAVA_UNICODE_ESCAPE
javaccHomeback to summary
private File javaccHome
JDK_VERSIONback to summary
private static final String JDK_VERSION
KEEP_LINE_COLUMNback to summary
private static final String KEEP_LINE_COLUMN
LOOKAHEADback to summary
private static final String LOOKAHEAD
maxMemoryback to summary
private String maxMemory
OPTIMIZE_TOKEN_MANAGERback to summary
private static final String OPTIMIZE_TOKEN_MANAGER
optionalAttrsback to summary
private final Map<String, Object> optionalAttrs
ORG_JAVACC_CLASSback to summary
protected static final String ORG_JAVACC_CLASS
ORG_JJDOC_CLASSback to summary
protected static final String ORG_JJDOC_CLASS
ORG_JJTREE_CLASSback to summary
protected static final String ORG_JJTREE_CLASS
ORG_PACKAGE_3_0back to summary
protected static final String ORG_PACKAGE_3_0
ORG_PACKAGE_3_1back to summary
protected static final String ORG_PACKAGE_3_1
OTHER_AMBIGUITY_CHECKback to summary
private static final String OTHER_AMBIGUITY_CHECK
outputDirectoryback to summary
private File outputDirectory
SANITY_CHECKback to summary
private static final String SANITY_CHECK
STATICback to summary
private static final String STATIC
targetFileback to summary
private File targetFile
TASKDEF_TYPE_JAVACCback to summary
protected static final int TASKDEF_TYPE_JAVACC
TASKDEF_TYPE_JJDOCback to summary
protected static final int TASKDEF_TYPE_JJDOC
TASKDEF_TYPE_JJTREEback to summary
protected static final int TASKDEF_TYPE_JJTREE
UNICODE_INPUTback to summary
private static final String UNICODE_INPUT
USER_CHAR_STREAMback to summary
private static final String USER_CHAR_STREAM
USER_TOKEN_MANAGERback to summary
private static final String USER_TOKEN_MANAGER

Constructor Detail

JavaCCback to summary
public JavaCC()

Constructor

Method Detail

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Run the task.

Annotations
@Override
Exceptions
BuildException:
on error.
getArchiveFileback to summary
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:File

the javacc home path directory.

Returns:File

the file object pointing to the JavaCC archive.

Exceptions
BuildException:
thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.
getArchiveLocationIndexback to summary
private static int getArchiveLocationIndex(File home) throws BuildException

Helper method to determine the archive location index.

Parameters
home:File

the javacc home path directory.

Returns:int

the archive location index

Exceptions
BuildException:
thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.
getMainClassback to summary
protected static String getMainClass(File home, int type) throws BuildException

Helper method to retrieve main class which is different from versions.

Parameters
home:File

the javacc home path directory.

type:int

the taskdef.

Returns:String

the main class for the taskdef.

Exceptions
BuildException:
thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.
getMainClassback to summary
protected static String getMainClass(Path path, int type) throws BuildException

Helper method to retrieve main class which is different from versions.

Parameters
path:Path

classpath to search in.

type:int

the taskdef.

Returns:String

the main class for the taskdef.

Exceptions
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
getMajorVersionNumberback to summary
protected static int getMajorVersionNumber(File home) throws BuildException

Helper method to determine the major version number of JavaCC.

Parameters
home:File

the javacc home path directory.

Returns:int

a the major version number

Exceptions
BuildException:
thrown if the home directory is invalid or if the archive could not be found despite attempts to do so.
getOutputJavaFileback to summary
private File getOutputJavaFile(File outputdir, File srcfile)

Determines the output Java file to be generated by the given grammar file.

setBuildparserback to summary
public void setBuildparser(boolean buildParser)

Sets the BUILD_PARSER grammar option.

Parameters
buildParser:boolean

a boolean value.

setBuildtokenmanagerback to summary
public void setBuildtokenmanager(boolean buildTokenManager)

Sets the BUILD_TOKEN_MANAGER grammar option.

Parameters
buildTokenManager:boolean

a boolean value.

setCachetokensback to summary
public void setCachetokens(boolean cacheTokens)

Sets the CACHE_TOKENS grammar option.

Parameters
cacheTokens:boolean

a boolean value.

setChoiceambiguitycheckback to summary
public void setChoiceambiguitycheck(int choiceAmbiguityCheck)

Sets the CHOICE_AMBIGUITY_CHECK grammar option.

Parameters
choiceAmbiguityCheck:int

an int value.

setCommontokenactionback to summary
public void setCommontokenaction(boolean commonTokenAction)

Sets the COMMON_TOKEN_ACTION grammar option.

Parameters
commonTokenAction:boolean

a boolean value.

setDebuglookaheadback to summary
public void setDebuglookahead(boolean debugLookahead)

Sets the DEBUG_LOOKAHEAD grammar option.

Parameters
debugLookahead:boolean

a boolean value.

setDebugparserback to summary
public void setDebugparser(boolean debugParser)

Sets the DEBUG_PARSER grammar option.

Parameters
debugParser:boolean

a boolean value.

setDebugtokenmanagerback to summary
public void setDebugtokenmanager(boolean debugTokenManager)

Sets the DEBUG_TOKEN_MANAGER grammar option.

Parameters
debugTokenManager:boolean

a boolean value.

setErrorreportingback to summary
public void setErrorreporting(boolean errorReporting)

Sets the ERROR_REPORTING grammar option.

Parameters
errorReporting:boolean

a boolean value.

setForcelacheckback to summary
public void setForcelacheck(boolean forceLACheck)

Sets the FORCE_LA_CHECK grammar option.

Parameters
forceLACheck:boolean

a boolean value.

setIgnorecaseback to summary
public void setIgnorecase(boolean ignoreCase)

Sets the IGNORE_CASE grammar option.

Parameters
ignoreCase:boolean

a boolean value.

setJavacchomeback to summary
public void setJavacchome(File javaccHome)

The directory containing the JavaCC distribution.

Parameters
javaccHome:File

the directory.

setJavaunicodeescapeback to summary
public void setJavaunicodeescape(boolean javaUnicodeEscape)

Sets the JAVA_UNICODE_ESCAPE grammar option.

Parameters
javaUnicodeEscape:boolean

a boolean value.

setJDKversionback to summary
public void setJDKversion(String jdkVersion)

Sets the JDK_VERSION option.

Parameters
jdkVersion:String

the version to use.

Since
Ant1.7
setKeeplinecolumnback to summary
public void setKeeplinecolumn(boolean keepLineColumn)

Sets the KEEP_LINE_COLUMN grammar option.

Parameters
keepLineColumn:boolean

a boolean value.

setLookaheadback to summary
public void setLookahead(int lookahead)

Sets the LOOKAHEAD grammar option.

Parameters
lookahead:int

an int value.

setMaxmemoryback to summary
public void setMaxmemory(String max)

Corresponds -Xmx.

Parameters
max:String

max memory parameter.

Since
Ant 1.8.3
setOptimizetokenmanagerback to summary
public void setOptimizetokenmanager(boolean optimizeTokenManager)

Sets the OPTIMIZE_TOKEN_MANAGER grammar option.

Parameters
optimizeTokenManager:boolean

a boolean value.

setOtherambiguityCheckback to summary
public void setOtherambiguityCheck(int otherAmbiguityCheck)

Sets the OTHER_AMBIGUITY_CHECK grammar option.

Parameters
otherAmbiguityCheck:int

an int value.

setOutputdirectoryback to summary
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:File

the output directory.

setSanitycheckback to summary
public void setSanitycheck(boolean sanityCheck)

Sets the SANITY_CHECK grammar option.

Parameters
sanityCheck:boolean

a boolean value.

setStaticback to summary
public void setStatic(boolean staticParser)

Sets the STATIC grammar option.

Parameters
staticParser:boolean

a boolean value.

setTargetback to summary
public void setTarget(File targetFile)

The grammar file to process.

Parameters
targetFile:File

the grammar file.

setUnicodeinputback to summary
public void setUnicodeinput(boolean unicodeInput)

Sets the UNICODE_INPUT grammar option.

Parameters
unicodeInput:boolean

a boolean value.

setUsercharstreamback to summary
public void setUsercharstream(boolean userCharStream)

Sets the USER_CHAR_STREAM grammar option.

Parameters
userCharStream:boolean

a boolean value.

setUsertokenmanagerback to summary
public void setUsertokenmanager(boolean userTokenManager)

Sets the USER_TOKEN_MANAGER grammar option.

Parameters
userTokenManager:boolean

a boolean value.