org.apache.tools.ant.taskdefs.optional

Class ANTLR


public class ANTLR
extends Task

Invokes the ANTLR Translator generator on a grammar file.

Field Summary

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

description, location, target, taskName, taskType, wrapper

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

project

Constructor Summary

ANTLR()
Sole constructor.

Method Summary

protected void
addClasspathEntry(String resource)
Search for the given resource and add the directory or archive that contains it to the classpath.
Path
createClasspath()
Adds a classpath to be set because a directory might be given for Antlr debug.
Commandline.Argument
createJvmarg()
Adds a new JVM argument.
void
execute()
Called by the project to let the task do its work.
void
init()
Adds the jars or directories containing Antlr this should make the forked JVM work without having to specify it directly.
protected boolean
is272()
Whether the antlr version is 2.7.2 (or higher).
void
setDebug(boolean enable)
Sets a flag to enable ParseView debugging
void
setDiagnostic(boolean enable)
Sets a flag to emit diagnostic text
void
setDir(File d)
The working directory of the process
void
setFork(boolean s)
void
setGlib(File superGrammar)
Sets an optional super grammar file
void
setGlib(String superGrammar)
Deprecated. since ant 1.6
void
setHtml(boolean enable)
If true, emit html
void
setOutputdirectory(File outputDirectory)
The directory to write the generated files to.
void
setTarget(File target)
The grammar file to process.
void
setTrace(boolean enable)
If true, enables all tracing.
void
setTraceLexer(boolean enable)
If true, enables lexer tracing.
void
setTraceParser(boolean enable)
If true, enables parser tracing.
void
setTraceTreeWalker(boolean enable)
Sets a flag to allow the user to enable tree walker tracing

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

execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

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

getProject, log, log, setProject

Constructor Details

ANTLR

public ANTLR()
Sole constructor.

Method Details

addClasspathEntry

protected void addClasspathEntry(String resource)
Search for the given resource and add the directory or archive that contains it to the classpath.

Doesn't work for archives in JDK 1.1 as the URL returned by getResource doesn't contain the name of the archive.


createClasspath

public Path createClasspath()
Adds a classpath to be set because a directory might be given for Antlr debug.


createJvmarg

public Commandline.Argument createJvmarg()
Adds a new JVM argument.

Returns:
create a new JVM argument so that any argument can be passed to the JVM.

See Also:
setFork(boolean)


execute

public void execute()
            throws BuildException
Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.
Overrides:
execute in interface Task

Throws:
BuildException - if something goes wrong with the build


init

public void init()
            throws BuildException
Adds the jars or directories containing Antlr this should make the forked JVM work without having to specify it directly.
Overrides:
init in interface Task


is272

protected boolean is272()
Whether the antlr version is 2.7.2 (or higher).

Returns:
true if the version of Antlr present is 2.7.2 or later.

Since:
Ant 1.6


setDebug

public void setDebug(boolean enable)
Sets a flag to enable ParseView debugging


setDiagnostic

public void setDiagnostic(boolean enable)
Sets a flag to emit diagnostic text


setDir

public void setDir(File d)
The working directory of the process


setFork

public void setFork(boolean s)


setGlib

public void setGlib(File superGrammar)
Sets an optional super grammar file

Since:
ant 1.6


setGlib

public void setGlib(String superGrammar)

Deprecated. since ant 1.6

Sets an optional super grammar file. Use setGlib(File superGrammar) instead.


setHtml

public void setHtml(boolean enable)
If true, emit html


setOutputdirectory

public void setOutputdirectory(File outputDirectory)
The directory to write the generated files to.


setTarget

public void setTarget(File target)
The grammar file to process.


setTrace

public void setTrace(boolean enable)
If true, enables all tracing.


setTraceLexer

public void setTraceLexer(boolean enable)
If true, enables lexer tracing.


setTraceParser

public void setTraceParser(boolean enable)
If true, enables parser tracing.


setTraceTreeWalker

public void setTraceTreeWalker(boolean enable)
Sets a flag to allow the user to enable tree walker tracing


Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.