## org.apache.tools.ant.taskdefs.optional
Class ANTLR

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--org.apache.tools.ant.taskdefs.optional.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()`

Method Summary
`protected void` `addClasspathEntry(java.lang.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(java.io.File d)` The working directory of the process
`void` `setFork(boolean s)`
`void` `setGlib(java.io.File superGrammar)` Sets an optional super grammar file
`void` `setGlib(java.lang.String superGrammar)` Deprecated. since ant 1.6
`void` `setHtml(boolean enable)` If true, emit html
`void` `setOutputdirectory(java.io.File outputDirectory)` The directory to write the generated files to.
`void` `setTarget(java.io.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
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ANTLR

    public ANTLR()

Method Detail

### setTarget

    public void setTarget(java.io.File target)

  The grammar file to process.

### setOutputdirectory

    public void setOutputdirectory(java.io.File outputDirectory)

  The directory to write the generated files to.

### setGlib

    public void setGlib(java.lang.String superGrammar)

  Deprecated. since ant 1.6

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

### setGlib

    public void setGlib(java.io.File superGrammar)

  Sets an optional super grammar file

  Since:
    ant 1.6

### setDebug

    public void setDebug(boolean enable)

  Sets a flag to enable ParseView debugging

### setHtml

    public void setHtml(boolean enable)

  If true, emit html

### setDiagnostic

    public void setDiagnostic(boolean enable)

  Sets a flag to emit diagnostic text

### setTrace

    public void setTrace(boolean enable)

  If true, enables all tracing.

### setTraceParser

    public void setTraceParser(boolean enable)

  If true, enables parser tracing.

### setTraceLexer

    public void setTraceLexer(boolean enable)

  If true, enables lexer tracing.

### setTraceTreeWalker

    public void setTraceTreeWalker(boolean enable)

  Sets a flag to allow the user to enable tree walker tracing

### setFork

    public void setFork(boolean s)

### setDir

    public void setDir(java.io.File d)

  The working directory of the process

### 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)`

### 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 class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### addClasspathEntry

    protected void addClasspathEntry(java.lang.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.

### execute

    public void execute()
                 throws BuildException

  Description copied from class: `Task`
  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 class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### 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

Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.