<?xml version='1.0' encoding='ISO-8859-1' ?>

<project name="Java 1.5 Parser" default="compile-and-test" basedir=".">
  <property name="version"
            value="1.0">
  </property>
  <property name="javacc.root"
            value="../../../">
  </property>
  <property name="debug_parser"
            value="false">
  </property>
  <property name="debug_scanner"
            value="false">
  </property>

  <target name="compile-and-test" depends="compile">
     <exec failonerror="true" executable="java">
           <arg value="-classpath"/>
           <arg value="."/>
           <arg value="JavaParser"/>
           <arg value="JavaGenerics.java"/>
     </exec>

     <exec failonerror="true" executable="java">
           <arg value="-classpath"/>
           <arg value="."/>
           <arg value="JavaParser"/>
           <arg value="JavaParser.java"/>
     </exec>
  </target>

  <target name="compile" depends="generated-files">
    <javac srcdir="."
           destdir="." >
    </javac>
  </target>

  <target name="clean">
    <delete>
      <fileset dir=".">
         <include name="JavaParser.java"/>
         <include name="JavaParserTokenManager.java"/>
         <include name="JavaParserConstants.java"/>
         <include name="*CharStream*.java"/>
         <include name="Token.java"/>
         <include name="TokenMgrError.java"/>
         <include name="ParseException.java"/>
         <include name="*.class"/>
      </fileset>
    </delete>
  </target>

  <target name="parser-files-init">
        <uptodate property="parser.gen"
                  targetfile="Java1.5.jj">
            <srcfiles dir="." includes="JavaParser.java"/>
        </uptodate>
  </target>

  <target name="generated-files" depends="parser-files-init" if="parser.gen">
     <exec failonerror="true" executable="${javacc.root}/bin/javacc" >
           <arg value="-DEBUG_PARSER=${debug_parser}"/>
           <arg value="-DEBUG_TOKEN_MANAGER=${debug_scanner}"/>
           <arg value="Java1.5.jj"/>
     </exec>
  </target>
</project>
