public class RetrieveEvent extends IvyEvent {
    private ModuleRevisionId mrid;
    private RetrieveOptions options;

    protected RetrieveEvent(String name, ModuleRevisionId mrid,
            String[] confs, RetrieveOptions options) {
        super(name);
        this.mrid = mrid;
        addMridAttributes(mrid);
        addConfsAttribute(confs);
        addAttribute("symlink", String.valueOf(options.isMakeSymlinks()));
        addAttribute("sync", String.valueOf(options.isSync()));
        this.options = options;
    }

    public ModuleRevisionId getModuleRevisionId() {
        return mrid;
    }

    public RetrieveOptions getOptions() {
        return options;

FUNC_DECL PARAM PARAM PARAM PARAM ASSIGN CALL CALL CALL CALL ASSIGN CALL LITERAL_ANCHOR CALL LITERAL_ANCHOR CALL CALL


public final class CachedNodeListIterator extends DTMAxisIteratorBase {

    /**
     * Source for this iterator.
     */
    private DTMAxisIterator _source;
    private IntegerArray _nodes = new IntegerArray();
    private int _numCachedNodes = 0;
    private int _index = 0;
    private boolean _isEnded = false;

    public CachedNodeListIterator(DTMAxisIterator source) {
	_source = source;
    }

    public void setRestartable(boolean isRestartable) {
    }

    public DTMAxisIterator setStartNode(int node) {
	if (_isRestartable) {
	    _startNode = node;
	    _source.setStartNode(node);
	    resetPosition();

	    _isRestartable = false;
	}
	return this;
    }

    public int next() {
        return getNode(_index++);
    }

    public int getPosition() {
    	return _index == 0 ? 1 : _index;
    }

    public int getNodeByPosition(int pos) {
    	return getNode(pos);
    }

    public int getNode(int index) {
        if (index < _numCachedNodes) {
            return _nodes.at(index);
        }
        else if (!_isEnded){
            int node = _source.next();
            if (node != END) {
            	_nodes.add(node);
            	_numCachedNodes++;
            }
            else {
            	_isEnded = true;
            }
            return node;
        }
        else
            return END;
    }

    public DTMAxisIterator cloneIterator() {
	ClonedNodeListIterator clone = new ClonedNodeListIterator(this);
	return clone;
    }

    public DTMAxisIterator reset() {
    	_index = 0;
    	return this;
    }

    public void setMark() {
	_source.setMark();
    }

    public void gotoMark() {
	_source.gotoMark();

FUNC_DECL RETURN IF PARAM ASSIGN CALL CALL ASSIGN LITERAL_ANCHOR

FUNC_DECL IF PARAM IF BINARY_OP RETURN RETURN RETURN IF VAR_DECL CALL BINARY_OP CALL ASSIGN CALL LITERAL_ANCHOR


public class Function3Args extends Function2Args
{

  /** The third argument passed to the function (at index 2).
   *  @serial  */
  Expression m_arg2;

  /**
   * Return the third argument passed to the function (at index 2).
   *
   * @return An expression that represents the third argument passed to the
   *         function.
   */
  public Expression getArg2()
  {
    return m_arg2;
  }

  /**
   * This function is used to fixup variables from QNames to stack frame
   * indexes at stylesheet build time.
   * @param vars List of QNames that correspond to variables.  This list
   * should be searched backwards for the first qualified name that
   * corresponds to the variable reference qname.  The position of the
   * QName in the vector from the start of the vector will be its position
   * in the stack frame (but variables above the globalsTop value will need
   * to be offset to the current stack frame).
   */
  public void fixupVariables(java.util.Vector vars, int globalsSize)
  {
    super.fixupVariables(vars, globalsSize);
    if(null != m_arg2)
      m_arg2.fixupVariables(vars, globalsSize);
  }

  /**
   * Set an argument expression for a function.  This method is called by the
   * XPath compiler.
   *
   * @param arg non-null expression that represents the argument.
   * @param argNum The argument number index.
   *
   * @throws WrongNumberArgsException If the argNum parameter is greater than 2.
   */
  public void setArg(Expression arg, int argNum)
          throws WrongNumberArgsException
  {

    if (argNum < 2)
      super.setArg(arg, argNum);
    else if (2 == argNum)
    {
      m_arg2 = arg;
      arg.exprSetParent(this);
    }
    else
		  reportWrongNumberArgs();
  }

  /**
   * Check that the number of arguments passed to this function is correct.
   *
   *
   * @param argNum The number of arguments that is being passed to the function.
   *
   * @throws WrongNumberArgsException
   */
  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
  {
    if (argNum != 3)
      reportWrongNumberArgs();
  }

  /**
   * Constructs and throws a WrongNumberArgException with the appropriate
   * message for this function object.
   *
   * @throws WrongNumberArgsException
   */
  protected void reportWrongNumberArgs() throws WrongNumberArgsException {
      throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("three", null));
  }

  /**
   * Tell if this expression or it's subexpressions can traverse outside
   * the current subtree.
   *
   * @return true if traversal outside the context node's subtree can occur.
   */
   public boolean canTraverseOutsideSubtree()
   {
    return super.canTraverseOutsideSubtree()
    ? true : m_arg2.canTraverseOutsideSubtree();
   }

  class Arg2Owner implements ExpressionOwner
  {
    /**
     * @see ExpressionOwner#getExpression()
     */
    public Expression getExpression()
    {
      return m_arg2;
    }

    /**
     * @see ExpressionOwner#setExpression(Expression)
     */
    public void setExpression(Expression exp)
    {
    	exp.exprSetParent(Function3Args.this);
    	m_arg2 = exp;
    }
  }

  /**
   * @see XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
   */
  public void callArgVisitors(XPathVisitor visitor)
  {
  	super.callArgVisitors(visitor);
  	if(null != m_arg2)
  		m_arg2.callVisitors(new Arg2Owner(), visitor);
  }

  /**
   * @see Expression#deepEquals(Expression)
   */
  public boolean deepEquals(Expression expr)
  {
  	if(!super.deepEquals(expr))
  		return false;

  	if(null != m_arg2)
  	{
  		if(null == ((Function3Args)expr).m_arg2)
  			return false;

  		if(!m_arg2.deepEquals(((Function3Args)expr).m_arg2))
  			return false;
  	}
  	else if (null != ((Function3Args)expr).m_arg2)
  		return false;

  	return true;


public interface BufferChangeListener
{
	//{{{ foldLevelChanged() method
	/**
	 * Called when line fold levels change.
	 * @param buffer The buffer in question
	 * @param startLine The start line number
	 * @param endLine The end line number
	 * @since jEdit 4.0pre1
	 */
	void foldLevelChanged(Buffer buffer, int startLine, int endLine);
	//}}}

	//{{{ contentInserted() method
	/**
	 * Called when text is inserted into the buffer.
	 * @param buffer The buffer in question
	 * @param startLine The first line
	 * @param offset The start offset, from the beginning of the buffer
	 * @param numLines The number of lines inserted
	 * @param length The number of characters inserted
	 * @since jEdit 4.0pre1
	 */
	void contentInserted(Buffer buffer, int startLine, int offset,
		int numLines, int length);
	//}}}

	//{{{ contentRemoved() method
	/**
	 * Called when text is removed from the buffer.
	 * @param buffer The buffer in question
	 * @param startLine The first line
	 * @param offset The start offset, from the beginning of the buffer
	 * @param numLines The number of lines removed
	 * @param length The number of characters removed
	 * @since jEdit 4.0pre1
	 */
	void contentRemoved(Buffer buffer, int startLine, int offset,
		int numLines, int length);
	//}}}

	//{{{ preContentRemoved() method
	/**
	 * Called when text is about to be removed from the buffer, but is
	 * still present.
	 * @param buffer The buffer in question
	 * @param startLine The first line
	 * @param offset The start offset, from the beginning of the buffer
	 * @param numLines The number of lines to be removed
	 * @param length The number of characters to be removed
	 * @since jEdit 4.2pre1
	 */
	public void preContentRemoved(Buffer buffer, int startLine, int offset,
		int numLines, int length);
	//}}}

	//{{{ transactionComplete() method
	/**
	 * Called after an undo or compound edit has finished. The text area
	 * uses this event to queue up and collapse cleanup operations so they
	 * are only run once during a long transaction (such as a "Replace All"
	 * operation.)
	 *
	 * @param buffer The buffer in question
	 * @since jEdit 4.0pre6
	 */
	void transactionComplete(Buffer buffer);
	//}}}

	//{{{ foldHandlerChanged() method
	/**
	 * Called to notify the text area that folds need to be collapsed if
	 * the "collapseFolds" property is set. This method is called after the
	 * buffer has been loaded, and also if the user changes the fold
	 * handler.
	 *
	 * @param buffer The buffer in question
	 * @since jEdit 4.2pre2
	 */
	void foldHandlerChanged(Buffer buffer);
	//}}}

	//{{{ foldHandlerChanged() method
	/**
	 * Called to notify the text area that the buffer has been reloaded.
	 *
	 * @param buffer The buffer in question
	 * @since jEdit 4.3pre1
	 */
	void bufferLoaded(Buffer buffer);
	//}}}

	//{{{ Compatibility with older jEdit plugins
	public class Adapter implements BufferListener
	{
		private BufferChangeListener delegate;

		//{{{ Adapter constructor
		public Adapter(BufferChangeListener delegate)
		{
			this.delegate = delegate;
		} //}}}

		//{{{ getDelegate() method
		public BufferChangeListener getDelegate()
		{
			return delegate;
		} //}}}

		//{{{ foldLevelChanged() method
		/**
		 * Called when line fold levels change.
		 * @param buffer The buffer in question
		 * @param startLine The start line number
		 * @param endLine The end line number
		 * @since jEdit 4.3pre3
		 */
		public void foldLevelChanged(JEditBuffer buffer, int startLine, int endLine)
		{
			delegate.foldLevelChanged((Buffer)buffer,startLine,endLine);
		} //}}}

		//{{{ contentInserted() method
		/**
		 * Called when text is inserted into the buffer.
		 * @param buffer The buffer in question
		 * @param startLine The first line
		 * @param offset The start offset, from the beginning of the buffer
		 * @param numLines The number of lines inserted
		 * @param length The number of characters inserted
		 * @since jEdit 4.3pre3
		 */
		public void contentInserted(JEditBuffer buffer, int startLine, int offset,
			int numLines, int length)
		{
			delegate.contentInserted((Buffer)buffer,startLine,offset,numLines,length);
		} //}}}

		//{{{ contentRemoved() method
		/**
		 * Called when text is removed from the buffer.
		 * @param buffer The buffer in question
		 * @param startLine The first line
		 * @param offset The start offset, from the beginning of the buffer
		 * @param numLines The number of lines removed
		 * @param length The number of characters removed
		 * @since jEdit 4.3pre3
		 */
		public void contentRemoved(JEditBuffer buffer, int startLine, int offset,
			int numLines, int length)
		{
			delegate.contentRemoved((Buffer)buffer,startLine,offset,numLines,length);
		} //}}}

		/**
		 * Called when text is about to be inserted in the buffer.
		 *
		 * @param buffer    The buffer in question
		 * @param startLine The first line
		 * @param offset    The start offset, from the beginning of the buffer
		 * @param numLines  The number of lines inserted
		 * @param length    The number of characters inserted
		 * @since jEdit 4.3pre11
		 */
		public void preContentInserted(JEditBuffer buffer, int startLine, int offset, int numLines, int length)
		{
		}

		//{{{ preContentRemoved() method
		/**
		 * Called when text is about to be removed from the buffer, but is
		 * still present.
		 * @param buffer The buffer in question
		 * @param startLine The first line
		 * @param offset The start offset, from the beginning of the buffer
		 * @param numLines The number of lines to be removed
		 * @param length The number of characters to be removed
		 * @since jEdit 4.3pre3
		 */
		public void preContentRemoved(JEditBuffer buffer, int startLine, int offset,
			int numLines, int length)
		{
			delegate.preContentRemoved((Buffer)buffer,startLine,offset,numLines,length);
		} //}}}

		//{{{ transactionComplete() method
		/**
		 * Called after an undo or compound edit has finished. The text area
		 * uses this event to queue up and collapse cleanup operations so they
		 * are only run once during a long transaction (such as a "Replace All"
		 * operation.)
		 *
		 * @param buffer The buffer in question
		 * @since jEdit 4.3pre3
		 */
		public void transactionComplete(JEditBuffer buffer)
		{
			delegate.transactionComplete((Buffer)buffer);
		} //}}}

		//{{{ foldHandlerChanged() method
		/**
		 * Called to notify the text area that folds need to be collapsed if
		 * the "collapseFolds" property is set. This method is called after the
		 * buffer has been loaded, and also if the user changes the fold
		 * handler.
		 *
		 * @param buffer The buffer in question
		 * @since jEdit 4.3pre3
		 */
		public void foldHandlerChanged(JEditBuffer buffer)
		{
			delegate.foldHandlerChanged((Buffer)buffer);
		} //}}}

		//{{{ foldHandlerChanged() method
		/**
		 * Called to notify the text area that the buffer has been reloaded.
		 *
		 * @param buffer The buffer in question
		 * @since jEdit 4.3pre3
		 */
		public void bufferLoaded(JEditBuffer buffer)
		{
			delegate.bufferLoaded((Buffer)buffer);


org.apache.xalan.transformer.MsgMgr

public class MsgMgr
{

  /**
   * Create a message manager object.
   *
   * @param transformer non transformer instance
   */
  public MsgMgr(TransformerImpl transformer)
  {
    m_transformer = transformer;
  }

  /** Transformer instance          */
  private TransformerImpl m_transformer;

  /**
   * Warn the user of a problem.
   * This is public for access by extensions.
   *
   * @param msg The message text to issue
   * @param terminate Flag indicating whether to terminate this process
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   */
  public void message(SourceLocator srcLctr, String msg, boolean terminate) throws TransformerException
  {

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
    {
      errHandler.warning(new TransformerException(msg, srcLctr));
    }
    else
    {
      if (terminate)
        throw new TransformerException(msg, srcLctr);
      else
        System.out.println(msg);
    }
  }

  /**
   * Warn the user of a problem.
   *
   * @param msg Message text to issue
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void warn(SourceLocator srcLctr, String msg) throws TransformerException
  {
    warn(srcLctr, null, null, msg, null);
  }

  /**
   * Warn the user of a problem.
   *
   * @param msg Message text to issue
   * @param args Arguments to pass to the message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void warn(SourceLocator srcLctr, String msg, Object[] args) throws TransformerException
  {
    warn(srcLctr, null, null, msg, args);
  }

  /**
   * Warn the user of a problem.
   *
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void warn(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg)
          throws TransformerException
  {
    warn(srcLctr, styleNode, sourceNode, msg, null);
  }

  /**
   * Warn the user of a problem.
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @param args Arguments to pass to the message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void warn(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object args[])
          throws TransformerException
  {

    String formattedMsg = XSLMessages.createWarning(msg, args);
    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
      errHandler.warning(new TransformerException(formattedMsg, srcLctr));
    else
      System.out.println(formattedMsg);
  }

  /* This method is not properly i18nized. We need to use the following method
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   *
  public void error(SourceLocator srcLctr, String msg) throws TransformerException
  {

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
      errHandler.fatalError(new TransformerException(msg, srcLctr));
    else
      throw new TransformerException(msg, srcLctr);
  }

 * @xsl.usage internal
 */

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, String msg) throws TransformerException
  {
    error(srcLctr, null, null, msg, null);
  }

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @param args Arguments to be passed to the message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, String msg, Object[] args) throws TransformerException
  {
    error(srcLctr, null, null, msg, args);
  }

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @param e Exception to throw
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, String msg, Exception e) throws TransformerException
  {
    error(srcLctr, msg, null, e);
  }

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @param args Arguments to use in message
   * @param e Exception to throw
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, String msg, Object args[], Exception e) throws TransformerException
  {

    String formattedMsg = XSLMessages.createMessage(msg, args);

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
      errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else
      throw new TransformerException(formattedMsg, srcLctr);
  }

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg)
          throws TransformerException
  {
    error(srcLctr, styleNode, sourceNode, msg, null);
  }

  /**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @param args Arguments to use in message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
  public void error(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object args[])
          throws TransformerException
  {

    String formattedMsg = XSLMessages.createMessage(msg, args);

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
      errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else
      throw new TransformerException(formattedMsg, srcLctr);

FUNC_DECL IF VAR_DECL PARAM PARAM PARAM BINARY_OP IF LITERAL_ANCHOR CALL THROW_RAISE CALL CALL CALL CALL

FUNC_DECL PARAM PARAM PARAM PARAM CALL LITERAL_ANCHOR

FUNC_DECL IF VAR_DECL VAR_DECL PARAM PARAM PARAM PARAM PARAM BINARY_OP CALL CALL LITERAL_ANCHOR CALL CALL CALL

FUNC_DECL PARAM PARAM PARAM CALL LITERAL_ANCHOR


public abstract class OperationPtg extends Ptg
{
    public final static int TYPE_UNARY    = 0;
    public final static int TYPE_BINARY   = 1;
    public final static int TYPE_FUNCTION = 2;

    public abstract int getType();

    /**
     *  returns a string representation of the operations
     *  the length of the input array should equal the number returned by
     *  @see #getNumberOfOperands
     *
     */
    public abstract String toFormulaString(String[] operands);

    /**
     * The number of operands expected by the operations
     */
    public abstract int getNumberOfOperands();

    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}


org.apache.tools.ant.Main

public class Main {

    /** The default build file name */
    public static final String DEFAULT_BUILD_FILENAME = "build.xml";

    /** Our current message output status. Follows Project.MSG_XXX */
    private int msgOutputLevel = Project.MSG_INFO;

    /** File that we are using for configuration */
    private File buildFile; /** null */

    /** Stream that we are using for logging */
    private PrintStream out = System.out;

    /** Stream that we are using for logging error messages */
    private PrintStream err = System.err;

    /** The build targets */
    private Vector targets = new Vector(5);

    /** Set of properties that can be used by tasks */
    private Properties definedProps = new Properties();

    /** Names of classes to add as listeners to project */
    private Vector listeners = new Vector(5);

    /**
     * The Ant logger class. There may be only one logger. It will have the
     * right to use the 'out' PrintStream. The class must implements the BuildLogger
     * interface
     */
    private String loggerClassname = null;

    /**
     * Indicates whether output to the log is to be unadorned.
     */
    private boolean emacsMode = false;

    /**
     * Indicates if this ant should be run.
     */
    private boolean readyToRun = false;

    /**
     * Indicates we should only parse and display the project help information
     */
    private boolean projectHelp = false;

    /**
     * Prints the message of the Throwable if it's not null.
     */
    private static void printMessage(Throwable t) {
        String message = t.getMessage();
        if (message != null) {
            System.err.println(message);
        }
    }

    /**
     * Entry point allowing for more options from other front ends
     */
    public static void start(String[] args, Properties additionalUserProperties,
                             ClassLoader coreLoader) {
        Main m = null;

        try {
            m = new Main(args);
        } catch(Throwable exc) {
            printMessage(exc);
            System.exit(1);
        }

        if (additionalUserProperties != null) {
            for (Enumeration e = additionalUserProperties.keys(); e.hasMoreElements(); ) {
                String key = (String) e.nextElement();
                String property = additionalUserProperties.getProperty(key);
                m.definedProps.put(key, property);
            }
        }

        try {
            m.runBuild(coreLoader);
            System.exit(0);
        } catch (BuildException be) {
            if (m.err != System.err) {
                printMessage(be);
            }
            System.exit(1);
        } catch(Throwable exc) {
            printMessage(exc);
            System.exit(1);
        }
    }

    /**
     * Command line entry point. This method kicks off the building
     * of a project object and executes a build using either a given
     * target or the default target.
     *
     * @param args Command line args.
     */
    public static void main(String[] args) {
        start(args, null, null);
    }

    protected Main(String[] args) throws BuildException {

        String searchForThis = null;

        for (int i = 0; i < args.length; i++) {
            String arg = args[i];

            if (arg.equals("-help")) {
                printUsage();
                return;
            } else if (arg.equals("-version")) {
                printVersion();
                return;
            } else if (arg.equals("-quiet") || arg.equals("-q")) {
                msgOutputLevel = Project.MSG_WARN;
            } else if (arg.equals("-verbose") || arg.equals("-v")) {
                printVersion();
                msgOutputLevel = Project.MSG_VERBOSE;
            } else if (arg.equals("-debug")) {
                printVersion();
                msgOutputLevel = Project.MSG_DEBUG;
            } else if (arg.equals("-logfile") || arg.equals("-l")) {
                try {
                    File logFile = new File(args[i+1]);
                    i++;
                    out = new PrintStream(new FileOutputStream(logFile));
                    err = out;
                    System.setOut(out);
                    System.setErr(out);
                } catch (IOException ioe) {
                    String msg = "Cannot write on the specified log file. " +
                        "Make sure the path exists and you have write permissions.";
                    System.out.println(msg);
                    return;
                } catch (ArrayIndexOutOfBoundsException aioobe) {
                    String msg = "You must specify a log file when " +
                        "using the -log argument";
                    System.out.println(msg);
                    return;
                }
            } else if (arg.equals("-buildfile") || arg.equals("-file") || arg.equals("-f")) {
                try {
                    buildFile = new File(args[i+1]);
                    i++;
                } catch (ArrayIndexOutOfBoundsException aioobe) {
                    String msg = "You must specify a buildfile when " +
                        "using the -buildfile argument";
                    System.out.println(msg);
                    return;
                }
            } else if (arg.equals("-listener")) {
                try {
                    listeners.addElement(args[i+1]);
                    i++;
                } catch (ArrayIndexOutOfBoundsException aioobe) {
                    String msg = "You must specify a classname when " +
                        "using the -listener argument";
                    System.out.println(msg);
                    return;
                }
            } else if (arg.startsWith("-D")) {

                /* Interestingly enough, we get to here when a user
                 * uses -Dname=value. However, in some cases, the JDK
                 * goes ahead * and parses this out to args
                 *   {"-Dname", "value"}
                 * so instead of parsing on "=", we just make the "-D"
                 * characters go away and skip one argument forward.
                 *
                 * I don't know how to predict when the JDK is going
                 * to help or not, so we simply look for the equals sign.
                 */

                String name = arg.substring(2, arg.length());
                String value = null;
                int posEq = name.indexOf("=");
                if (posEq > 0) {
                    value = name.substring(posEq+1);
                    name = name.substring(0, posEq);
                } else if (i < args.length-1)
                    value = args[++i];

                definedProps.put(name, value);
            } else if (arg.equals("-logger")) {
                if (loggerClassname != null) {
                    System.out.println("Only one logger class may be specified.");
                    return;
                }
                try {
                    loggerClassname = args[++i];
                }
                catch (ArrayIndexOutOfBoundsException aioobe) {
                    System.out.println("You must specify a classname when " +
                                       "using the -logger argument");
                    return;
                }
            } else if (arg.equals("-emacs")) {
                emacsMode = true;
            } else if (arg.equals("-projecthelp")) {
                projectHelp = true;
            } else if (arg.equals("-find")) {
                if (i < args.length-1) {
                    searchForThis = args[++i];
                } else {
                    searchForThis = DEFAULT_BUILD_FILENAME;
                }
            } else if (arg.startsWith("-")) {
                String msg = "Unknown argument: " + arg;
                System.out.println(msg);
                printUsage();
                return;
            } else {
                targets.addElement(arg);
            }

        }

        if (buildFile == null) {
            if (searchForThis != null) {
                buildFile = findBuildFile(System.getProperty("user.dir"),
                                          searchForThis);
            } else {
                buildFile = new File(DEFAULT_BUILD_FILENAME);
            }
        }

        if (!buildFile.exists()) {
            System.out.println("Buildfile: " + buildFile + " does not exist!");
            throw new BuildException("Build failed");
        }

        if (buildFile.isDirectory()) {
            System.out.println("What? Buildfile: " + buildFile + " is a dir!");
            throw new BuildException("Build failed");
        }

        readyToRun = true;
    }

    /**
     * Helper to get the parent file for a given file.
     *
     *
Added to simulate File.getParentFile() from JDK 1.2.
     *
     * @param file   File
     * @return       Parent file or null if none
     */
    private File getParentFile(File file) {
        String filename = file.getAbsolutePath();
        file = new File(filename);
        filename = file.getParent();

        if (filename != null && msgOutputLevel >= Project.MSG_VERBOSE) {
            System.out.println("Searching in "+filename);
        }

        return (filename == null) ? null : new File(filename);
    }

    /**
     * Search parent directories for the build file.
     *
     *
Takes the given target as a suffix to append to each
     *    parent directory in seach of a build file.  Once the
     *    root of the file-system has been reached an exception
     *    is thrown.
     *
     * @param suffix    Suffix filename to look for in parents.
     * @return          A handle to the build file
     *
     * @exception BuildException    Failed to locate a build file
     */
    private File findBuildFile(String start, String suffix) throws BuildException {
        if (msgOutputLevel >= Project.MSG_INFO) {
            System.out.println("Searching for " + suffix + " ...");
        }

        File parent = new File(new File(start).getAbsolutePath());
        File file = new File(parent, suffix);

        while (!file.exists()) {
            parent = getParentFile(parent);

            if (parent == null) {
                throw new BuildException("Could not locate a build file!");
            }

            file = new File(parent, suffix);
        }

        return file;
    }

    /**
     * Executes the build.
     */
    private void runBuild(ClassLoader coreLoader) throws BuildException {

        if (!readyToRun) {
            return;
        }

        if (msgOutputLevel >= Project.MSG_INFO) {
            System.out.println("Buildfile: " + buildFile);
        }

        final Project project = new Project();
        project.setCoreLoader(coreLoader);

        Throwable error = null;

        try {
            addBuildListeners(project);

            PrintStream err = System.err;
            PrintStream out = System.out;
            SecurityManager oldsm = System.getSecurityManager();

            try {
                System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
                System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
                project.fireBuildStarted();
                project.init();
                project.setUserProperty("ant.version", getAntVersion());

                Enumeration e = definedProps.keys();
                while (e.hasMoreElements()) {
                    String arg = (String)e.nextElement();
                    String value = (String)definedProps.get(arg);
                    project.setUserProperty(arg, value);
                }

                project.setUserProperty("ant.file" , buildFile.getAbsolutePath() );

                String noParserMessage = '';
                try {
                    Class.forName("javax.xml.parsers.SAXParserFactory");
                    ProjectHelper.configureProject(project, buildFile);
                } catch (NoClassDefFoundError ncdfe) {
                    throw new BuildException(noParserMessage, ncdfe);
                } catch (ClassNotFoundException cnfe) {
                    throw new BuildException(noParserMessage, cnfe);
                } catch (NullPointerException npe) {
                    throw new BuildException(noParserMessage, npe);
                }

                if (targets.size() == 0) {
                    targets.addElement(project.getDefaultTarget());
                }

                if (!projectHelp) {
                    project.executeTargets(targets);
                }
            }
            finally {
                System.setOut(out);
                System.setErr(err);
            }
            if (projectHelp) {
                printDescription(project);
                printTargets(project);
            }
        }
        catch(RuntimeException exc) {
            error = exc;
            throw exc;
        }
        catch(Error err) {
            error = err;
            throw err;
        }
        finally {
            project.fireBuildFinished(error);
        }
    }

    protected void addBuildListeners(Project project) {

        project.addBuildListener(createLogger());

        for (int i = 0; i < listeners.size(); i++) {
            String className = (String) listeners.elementAt(i);
            try {
                BuildListener listener =
                    (BuildListener) Class.forName(className).newInstance();
                project.addBuildListener(listener);
            }
            catch(Throwable exc) {
                throw new BuildException("Unable to instantiate listener " + className, exc);
            }
        }
    }

    /**
     *  Creates the default build logger for sending build events to the ant log.
     */
    private BuildLogger createLogger() {
        BuildLogger logger = null;
        if (loggerClassname != null) {
            try {
                logger = (BuildLogger)(Class.forName(loggerClassname).newInstance());
            }
            catch (ClassCastException e) {
                System.err.println("The specified logger class " + loggerClassname +
                                         " does not implement the BuildLogger interface");
                throw new RuntimeException();
            }
            catch (Exception e) {
                System.err.println("Unable to instantiate specified logger class " +
                                           loggerClassname + " : " + e.getClass().getName());
                throw new RuntimeException();
            }
        }
        else {
            logger = new DefaultLogger();
        }

        logger.setMessageOutputLevel(msgOutputLevel);
        logger.setOutputPrintStream(out);
        logger.setErrorPrintStream(err);
        logger.setEmacsMode(emacsMode);

        return logger;
    }

    /**
     * Prints the usage of how to use this class to System.out
     */
    private static void printUsage() {
        String lSep = System.getProperty("line.separator");
        StringBuffer msg = new StringBuffer();
        msg.append("ant [options] [target [target2 [target3] ...]]" + lSep);
        msg.append("Options: " + lSep);
        msg.append("  -help                  print this message" + lSep);
        msg.append("  -projecthelp           print project help information" + lSep);
        msg.append("  -version               print the version information and exit" + lSep);
        msg.append("  -quiet                 be extra quiet" + lSep);
        msg.append("  -verbose               be extra verbose" + lSep);
        msg.append("  -debug                 print debugging information" + lSep);
        msg.append("  -emacs                 produce logging information without adornments" + lSep);
        msg.append("  -logfile <file>        use given file for log" + lSep);
        msg.append("  -logger <classname>    the class which is to perform logging" + lSep);
        msg.append("  -listener <classname>  add an instance of class as a project listener" + lSep);
        msg.append("  -buildfile <file>      use given buildfile" + lSep);
        msg.append("  -D<property>=<value>   use value for given property" + lSep);
        msg.append("  -find <file>           search for buildfile towards the root of the" + lSep);
        msg.append("                         filesystem and use it" + lSep);
        System.out.println(msg.toString());
    }

    private static void printVersion() throws BuildException {
        System.out.println(getAntVersion());
    }

    private static String antVersion = null;

    public synchronized static String getAntVersion() throws BuildException {
        if (antVersion == null) {
            try {
                Properties props = new Properties();
                InputStream in =
                    Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
                props.load(in);
                in.close();

                String lSep = System.getProperty("line.separator");
                StringBuffer msg = new StringBuffer();
                msg.append("Ant version ");
                msg.append(props.getProperty("VERSION"));
                msg.append(" compiled on ");
                msg.append(props.getProperty("DATE"));
                antVersion = msg.toString();
            } catch (IOException ioe) {
                throw new BuildException("Could not load the version information:"
                                         + ioe.getMessage());
            } catch (NullPointerException npe) {
                throw new BuildException("Could not load the version information.");
            }
        }
        return antVersion;
    }

     /**
      * Print the project description, if any
      */
    private static void printDescription(Project project) {
       if (project.getDescription() != null) {
          System.out.println(project.getDescription());
       }
    }

    /**
     * Print out a list of all targets in the current buildfile
     */
    private static void printTargets(Project project) {
        int maxLength = 0;
        Enumeration ptargets = project.getTargets().elements();
        String targetName;
        String targetDescription;
        Target currentTarget;
        Vector topNames = new Vector();
        Vector topDescriptions = new Vector();
        Vector subNames = new Vector();

        while (ptargets.hasMoreElements()) {
            currentTarget = (Target)ptargets.nextElement();
            targetName = currentTarget.getName();
            targetDescription = currentTarget.getDescription();
            if (targetDescription == null) {
                int pos = findTargetPosition(subNames, targetName);
                subNames.insertElementAt(targetName, pos);
            } else {
                int pos = findTargetPosition(topNames, targetName);
                topNames.insertElementAt(targetName, pos);
                topDescriptions.insertElementAt(targetDescription, pos);
                if (targetName.length() > maxLength) {
                    maxLength = targetName.length();
                }
            }
        }

        String defaultTarget = project.getDefaultTarget();
            Vector defaultName = new Vector();
            Vector defaultDesc = null;
            defaultName.addElement(defaultTarget);

            int indexOfDefDesc = topNames.indexOf(defaultTarget);
            if (indexOfDefDesc >= 0) {
                defaultDesc = new Vector();
                defaultDesc.addElement(topDescriptions.elementAt(indexOfDefDesc));
            }
            printTargets(defaultName, defaultDesc, "Default target:", maxLength);

        printTargets(topNames, topDescriptions, "Main targets:", maxLength);
        printTargets(subNames, null, "Subtargets:", 0);
    }

    /**
     * Search for the insert position to keep names a sorted list of Strings
     */
    private static int findTargetPosition(Vector names, String name) {
        int res = names.size();
        for (int i=0; i<names.size() && res == names.size(); i++) {
            if (name.compareTo((String)names.elementAt(i)) < 0) {
                res = i;
            }
        }
        return res;
    }

    /**
     * Output a formatted list of target names with an optional description
     */
    private static void printTargets(Vector names, Vector descriptions, String heading, int maxlen) {
        String lSep = System.getProperty("line.separator");
        String spaces = "    ";
        while (spaces.length()<maxlen) {
            spaces += spaces;
        }
        StringBuffer msg = new StringBuffer();
        msg.append(heading + lSep + lSep);
        for (int i=0; i<names.size(); i++) {
            msg.append(" ");
            msg.append(names.elementAt(i));
            if (descriptions != null) {
                msg.append(spaces.substring(0, maxlen - ((String)names.elementAt(i)).length() + 2));
                msg.append(descriptions.elementAt(i));
            }
            msg.append(lSep);
        }
        System.out.println(msg.toString());

FUNC_DECL TRY IF TRY VAR_DECL PARAM PARAM PARAM CATCH CATCH BINARY_OP CATCH IF CALL CALL LOOP LITERAL_ANCHOR ASSIGN LITERAL_ANCHOR CALL CALL CALL BINARY_OP LITERAL_ANCHOR CALL CALL CALL CALL LITERAL_ANCHOR LITERAL_ANCHOR VAR_DECL VAR_DECL LITERAL_ANCHOR CALL CALL CALL CALL CALL

FUNC_DECL TRY VAR_DECL VAR_DECL IF IF PARAM CATCH CATCH IF TRY VAR_DECL VAR_DECL VAR_DECL CALL BINARY_OP CALL THROW_RAISE THROW_RAISE IF IF TRY VAR_DECL LOOP VAR_DECL CALL LITERAL_ANCHOR CALL RETURN ASSIGN ASSIGN CALL CALL BINARY_OP CATCH CATCH CATCH CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL LITERAL_ANCHOR CALL THROW_RAISE THROW_RAISE THROW_RAISE CALL CALL LITERAL_ANCHOR CALL LITERAL_ANCHOR VAR_DECL VAR_DECL CALL CALL LITERAL_ANCHOR CALL CALL BINARY_OP CALL CALL CALL CALL CALL LITERAL_ANCHOR CALL CALL CALL LITERAL_ANCHOR CALL LITERAL_ANCHOR LITERAL_ANCHOR CALL CALL


public interface RegexpMatcher {

    /**
     * Set the regexp pattern from the String description.
     */
    public void setPattern(String pattern) throws BuildException;

    /**
     * Get a String representation of the regexp pattern
     */
    public String getPattern();

    /**
     * Does the given argument match the pattern?
     */
    public boolean matches(String argument);

    /**
     * Returns a Vector of matched groups found in the argument.
     *
     *
Group 0 will be the full match, the rest are the
     * parenthesized subexpressions
.
     */
    public Vector getGroups(String argument);