Class ANTLR
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.optional.ANTLR
- All Implemented Interfaces:
Cloneable
Invokes the ANTLR Translator generator on a grammar file.
-
Field Summary
Fields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddClasspathEntry(String resource) Search for the given resource and add the directory or archive that contains it to the classpath.Adds a classpath to be set because a directory might be given for Antlr debug.Adds a new JVM argument.voidexecute()Execute the task.voidinit()Adds the jars or directories containing Antlr this should make the forked JVM work without having to specify it directly.protected booleanis272()Whether the antlr version is 2.7.2 (or higher).voidsetDebug(boolean enable) Sets a flag to enable ParseView debuggingvoidsetDiagnostic(boolean enable) Sets a flag to emit diagnostic textvoidThe working directory of the processvoidsetFork(boolean s) voidSets an optional super grammar filevoidDeprecated.since ant 1.6voidsetHtml(boolean enable) If true, emit htmlvoidsetOutputdirectory(File outputDirectory) The directory to write the generated files to.voidThe grammar file to process.voidsetTrace(boolean enable) If true, enables all tracing.voidsetTraceLexer(boolean enable) If true, enables lexer tracing.voidsetTraceParser(boolean enable) If true, enables parser tracing.voidsetTraceTreeWalker(boolean enable) Sets a flag to allow the user to enable tree walker tracingMethods inherited from class Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeModifier and TypeMethodDescriptionfinal voidbindToOwner(Task owner) Bind a task to another; use this when configuring a newly created task to do work on behalf of another.Returns the container target of this task.Returns the wrapper used for runtime configuration.Returns the name to use in logging messages.Return the type of task.protected RuntimeConfigurableReturn the runtime configurable structure for this task.protected voidhandleErrorFlush(String output) Handles an error line by logging it with the WARN priority.protected voidhandleErrorOutput(String output) Handles an error output by logging it with the WARN priority.protected voidhandleFlush(String output) Handles output by logging it with the INFO priority.protected inthandleInput(byte[] buffer, int offset, int length) Handle an input request by this task.protected voidhandleOutput(String output) Handles output by logging it with the INFO priority.protected final booleanHas this task been marked invalid?voidLogs a message with the default (INFO) priority.voidLogs a message with the given priority.voidLogs a message with the given priority.voidLogs a message with the given priority.voidConfigures this task - if it hasn't been done already.final voidperform()Performs this task if it's still valid, or gets a replacement version and performs that otherwise.voidForce the task to be reconfigured from its RuntimeConfigurable.voidsetOwningTarget(Target target) Sets the target container of this task.voidSets the wrapper to be used for runtime configuration.voidsetTaskName(String name) Sets the name to use in logging messages.voidsetTaskType(String type) Sets the name with which the task has been invoked.Methods inherited from class ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProjectModifier and TypeMethodDescriptionclone()Returns the description of the current action.Returns the file/location where this task was defined.Returns the project to which this component belongs.voidsetDescription(String desc) Sets a description of the current action.voidsetLocation(Location location) Sets the file/location where this task was defined.voidsetProject(Project project) Sets the project object of this component.
-
Constructor Details
-
ANTLR
public ANTLR()Constructor for ANTLR task.
-
-
Method Details
-
setTarget
The grammar file to process.- Parameters:
target- the grammar file
-
setOutputdirectory
The directory to write the generated files to.- Parameters:
outputDirectory- the output directory
-
setGlib
Deprecated.since ant 1.6Sets an optional super grammar file. Use setGlib(File superGrammar) instead.- Parameters:
superGrammar- the super grammar filename
-
setGlib
Sets an optional super grammar file- Parameters:
superGrammar- the super grammar file- Since:
- ant 1.6
-
setDebug
public void setDebug(boolean enable) Sets a flag to enable ParseView debugging- Parameters:
enable- abooleanvalue
-
setHtml
public void setHtml(boolean enable) If true, emit html- Parameters:
enable- abooleanvalue
-
setDiagnostic
public void setDiagnostic(boolean enable) Sets a flag to emit diagnostic text- Parameters:
enable- abooleanvalue
-
setTrace
public void setTrace(boolean enable) If true, enables all tracing.- Parameters:
enable- abooleanvalue
-
setTraceParser
public void setTraceParser(boolean enable) If true, enables parser tracing.- Parameters:
enable- abooleanvalue
-
setTraceLexer
public void setTraceLexer(boolean enable) If true, enables lexer tracing.- Parameters:
enable- abooleanvalue
-
setTraceTreeWalker
public void setTraceTreeWalker(boolean enable) Sets a flag to allow the user to enable tree walker tracing- Parameters:
enable- abooleanvalue
-
setFork
public void setFork(boolean s) - Parameters:
s- abooleanvalue
-
setDir
The working directory of the process- Parameters:
d- the working directory
-
createClasspath
Adds a classpath to be set because a directory might be given for Antlr debug.- Returns:
- a path to be configured
-
createJvmarg
Adds a new JVM argument.- Returns:
- create a new JVM argument so that any argument can be passed to the JVM.
- See Also:
-
init
Adds the jars or directories containing Antlr this should make the forked JVM work without having to specify it directly.- Overrides:
initin classTask- Throws:
BuildException- on error
-
addClasspathEntry
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.
- Parameters:
resource- the resource name to search for
-
execute
Execute the task.- Overrides:
executein classTask- Throws:
BuildException- on error
-
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
-