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

public Class JJTree

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

Runs the JJTree compiler compiler.

Field Summary

Modifier and TypeField and Description
private static final String
private CommandlineJava
private static final String
private File
private 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 final Map<String, Object>
private static final String
private File
private String
private static final String
private File
private static final String
private static final String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
JJTree()

Constructor

Method Summary

Modifier and TypeMethod and Description
private String
createOutputFileName(File destFile, String optionalOutputFile, String outputDir)

public void
execute()

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

Run the task.
private String
private File

Returns:

file's root directory
getRoot
(File
File
file
)

Determine root directory for a given file.

private String
public void
setBuildnodefiles(boolean
a boolean value.
buildNodeFiles
)

Sets the BUILD_NODE_FILES grammar option.

public void
setJavacchome(File
the directory containing JavaCC.
javaccHome
)

The directory containing the JavaCC distribution.

public void
setMaxmemory(String
max memory parameter.
max
)

Corresponds -Xmx.

public void
setMulti(boolean
a boolean value.
multi
)

Sets the MULTI grammar option.

public void
setNodedefaultvoid(boolean
a boolean value.
nodeDefaultVoid
)

Sets the NODE_DEFAULT_VOID grammar option.

public void
setNodefactory(boolean
a boolean value.
nodeFactory
)

Sets the NODE_FACTORY grammar option.

public void
setNodepackage(String
the option to use.
nodePackage
)

Sets the NODE_PACKAGE grammar option.

public void
setNodeprefix(String
the option to use.
nodePrefix
)

Sets the NODE_PREFIX grammar option.

public void
setNodescopehook(boolean
a boolean value.
nodeScopeHook
)

Sets the NODE_SCOPE_HOOK grammar option.

public void
setNodeusesparser(boolean
a boolean value.
nodeUsesParser
)

Sets the NODE_USES_PARSER grammar option.

public void
setOutputdirectory(File
the output directory.
outputDirectory
)

The directory to write the generated JavaCC grammar and node files to.

public void
setOutputfile(String
the output file name.
outputFile
)

The outputfile to write the generated JavaCC grammar file to.

public void
setStatic(boolean
a boolean value.
staticParser
)

Sets the STATIC grammar option.

public void
setTarget(File
the grammar file.
targetFile
)

The jjtree grammar file to process.

public void
setVisitor(boolean
a boolean value.
visitor
)

Sets the VISITOR grammar option.

public void
setVisitorException(String
the option to use.
visitorException
)

Sets the VISITOR_EXCEPTION grammar option.

private String

Returns:

validation file, relative if possible; null if not set
validateOutputFile
(String
String
destFile
,
String
String
outputDir
)

When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must always be set.

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

Field Detail

BUILD_NODE_FILESback to summary
private static final String BUILD_NODE_FILES
cmdlback to summary
private CommandlineJava cmdl
DEFAULT_SUFFIXback to summary
private static final String DEFAULT_SUFFIX
javaccHomeback to summary
private File javaccHome
maxMemoryback to summary
private String maxMemory
MULTIback to summary
private static final String MULTI
NODE_DEFAULT_VOIDback to summary
private static final String NODE_DEFAULT_VOID
NODE_FACTORYback to summary
private static final String NODE_FACTORY
NODE_PACKAGEback to summary
private static final String NODE_PACKAGE
NODE_PREFIXback to summary
private static final String NODE_PREFIX
NODE_SCOPE_HOOKback to summary
private static final String NODE_SCOPE_HOOK
NODE_USES_PARSERback to summary
private static final String NODE_USES_PARSER
optionalAttrsback to summary
private final Map<String, Object> optionalAttrs
OUTPUT_FILEback to summary
private static final String OUTPUT_FILE
outputDirectoryback to summary
private File outputDirectory
outputFileback to summary
private String outputFile
STATICback to summary
private static final String STATIC
targetFileback to summary
private File targetFile
VISITORback to summary
private static final String VISITOR
VISITOR_EXCEPTIONback to summary
private static final String VISITOR_EXCEPTION

Constructor Detail

JJTreeback to summary
public JJTree()

Constructor

Method Detail

createOutputFileNameback to summary
private String createOutputFileName(File destFile, String optionalOutputFile, String outputDir)
executeback to summary
public void execute() throws BuildException

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

Run the task.

Annotations
@Override
Exceptions
BuildException:
on error.
getDefaultOutputDirectoryback to summary
private String getDefaultOutputDirectory()
getRootback to summary
private File getRoot(File file)

Determine root directory for a given file.

Parameters
file:File

File

Returns:File

file's root directory

makeOutputFileRelativeback to summary
private String makeOutputFileRelative(String destFile)
setBuildnodefilesback to summary
public void setBuildnodefiles(boolean buildNodeFiles)

Sets the BUILD_NODE_FILES grammar option.

Parameters
buildNodeFiles:boolean

a boolean value.

setJavacchomeback to summary
public void setJavacchome(File javaccHome)

The directory containing the JavaCC distribution.

Parameters
javaccHome:File

the directory containing JavaCC.

setMaxmemoryback to summary
public void setMaxmemory(String max)

Corresponds -Xmx.

Parameters
max:String

max memory parameter.

Since
Ant 1.8.3
setMultiback to summary
public void setMulti(boolean multi)

Sets the MULTI grammar option.

Parameters
multi:boolean

a boolean value.

setNodedefaultvoidback to summary
public void setNodedefaultvoid(boolean nodeDefaultVoid)

Sets the NODE_DEFAULT_VOID grammar option.

Parameters
nodeDefaultVoid:boolean

a boolean value.

setNodefactoryback to summary
public void setNodefactory(boolean nodeFactory)

Sets the NODE_FACTORY grammar option.

Parameters
nodeFactory:boolean

a boolean value.

setNodepackageback to summary
public void setNodepackage(String nodePackage)

Sets the NODE_PACKAGE grammar option.

Parameters
nodePackage:String

the option to use.

setNodeprefixback to summary
public void setNodeprefix(String nodePrefix)

Sets the NODE_PREFIX grammar option.

Parameters
nodePrefix:String

the option to use.

setNodescopehookback to summary
public void setNodescopehook(boolean nodeScopeHook)

Sets the NODE_SCOPE_HOOK grammar option.

Parameters
nodeScopeHook:boolean

a boolean value.

setNodeusesparserback to summary
public void setNodeusesparser(boolean nodeUsesParser)

Sets the NODE_USES_PARSER grammar option.

Parameters
nodeUsesParser:boolean

a boolean value.

setOutputdirectoryback to summary
public void setOutputdirectory(File outputDirectory)

The directory to write the generated JavaCC grammar and node files to. If not set, the files are written to the directory containing the grammar file.

Parameters
outputDirectory:File

the output directory.

setOutputfileback to summary
public void setOutputfile(String outputFile)

The outputfile to write the generated JavaCC grammar file to. If not set, the file is written with the same name as the JJTree grammar file with a suffix .jj.

Parameters
outputFile:String

the output file name.

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 jjtree grammar file to process.

Parameters
targetFile:File

the grammar file.

setVisitorback to summary
public void setVisitor(boolean visitor)

Sets the VISITOR grammar option.

Parameters
visitor:boolean

a boolean value.

setVisitorExceptionback to summary
public void setVisitorException(String visitorException)

Sets the VISITOR_EXCEPTION grammar option.

Parameters
visitorException:String

the option to use.

validateOutputFileback to summary
private String validateOutputFile(String destFile, String outputDir) throws BuildException

When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must always be set. But when -OUTPUT_DIRECTORY is set, -OUTPUT_FILE is handled as if relative of this -OUTPUT_DIRECTORY. Thus when the -OUTPUT_FILE is absolute or contains a drive letter we have a problem.

Parameters
destFile:String

String

outputDir:String

String

Returns:String

validation file, relative if possible; null if not set

Exceptions
BuildException:
if something goes wrong