org.apache.tools.ant.taskdefs.optional

Class ANTLR

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class ANTLR
    extends Task
    Invokes the ANTLR Translator generator on a grammar file.
    • Constructor Detail

      • ANTLR

        public ANTLR()
        Constructor for ANTLR task.
    • Method Detail

      • setTarget

        public void setTarget(java.io.File target)
        The grammar file to process.
        Parameters:
        target - the grammar file
      • setOutputdirectory

        public void setOutputdirectory(java.io.File outputDirectory)
        The directory to write the generated files to.
        Parameters:
        outputDirectory - the output directory
      • setGlib

        public void setGlib(java.lang.String superGrammar)
        Deprecated. since ant 1.6
        Sets an optional super grammar file. Use setGlib(File superGrammar) instead.
        Parameters:
        superGrammar - the super grammar filename
      • setGlib

        public void setGlib(java.io.File superGrammar)
        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 - a boolean value
      • setHtml

        public void setHtml(boolean enable)
        If true, emit html
        Parameters:
        enable - a boolean value
      • setDiagnostic

        public void setDiagnostic(boolean enable)
        Sets a flag to emit diagnostic text
        Parameters:
        enable - a boolean value
      • setTrace

        public void setTrace(boolean enable)
        If true, enables all tracing.
        Parameters:
        enable - a boolean value
      • setTraceParser

        public void setTraceParser(boolean enable)
        If true, enables parser tracing.
        Parameters:
        enable - a boolean value
      • setTraceLexer

        public void setTraceLexer(boolean enable)
        If true, enables lexer tracing.
        Parameters:
        enable - a boolean value
      • setTraceTreeWalker

        public void setTraceTreeWalker(boolean enable)
        Sets a flag to allow the user to enable tree walker tracing
        Parameters:
        enable - a boolean value
      • setFork

        public void setFork(boolean s)
        Parameters:
        s - a boolean value
      • setDir

        public void setDir(java.io.File d)
        The working directory of the process
        Parameters:
        d - the working directory
      • createClasspath

        public Path createClasspath()
        Adds a classpath to be set because a directory might be given for Antlr debug.
        Returns:
        a path to be configured
      • 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 - on error
      • 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.

        Parameters:
        resource - the resource name to search for
      • 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