<project name="BioUML" default="parser" basedir=".">
	
	<property name="COMMONDIR" value="/home/lsa80/opt/java/javacc-4.1/bin/lib/" />
	
	<target name="parser" >
		
		<echo message="Generating parser" />

			        <echo message="Remove old files" />
			        <delete>
			            <fileset dir="ru/biosoft/oql/parser">
			                <include name="*.java" />
			            </fileset>
			        </delete>
		
	 	<java classname="jjtree" dir="ru/biosoft/oql/parser" fork="yes">
	            <jvmarg value="-Xmx256m" />
	            <classpath>
	                <pathelement path="${COMMONDIR}/javacc.jar" />
	            </classpath>
	            <arg value="Parser.jjt" />
	    </java>
		
		 <java classname="javacc" dir="ru/biosoft/oql/parser" fork="yes">
		            <jvmarg value="-Xmx256m" />
		            <classpath>
		                <pathelement path="${COMMONDIR}/javacc.jar" />
		            </classpath>
		            <arg value="Parser.jj" />
		        </java>

	    <java classname="jjdoc" dir="ru/biosoft/oql/parser" fork="yes">
	            <jvmarg value="-Xmx256m" />
	            <classpath>
	                <pathelement path="${COMMONDIR}/javacc.jar" />
	            </classpath>
	            <arg value="Parser.jj" />
	    </java>
		
	    	<replace file="ru/biosoft/oql/parser/JJTParserState.java" token="package ru.biosoft.oql.parser;">
	    		            <replacevalue>
	    		                <![CDATA[package ru.biosoft.oql.parser;

	    		import ru.biosoft.oql.model.Node;]]>
	    		            </replacevalue>
	    		        </replace>

	    		        <echo message="Remove stub files" />
	    		        <delete>
	    		            <fileset dir="ru/biosoft/oql/parser">
	    		                <include name="Ast*.java" />
	    		                <include name="Node.java" />
	    		                <include name="SimpleNode.java" />
	    		            </fileset>
	    		        </delete>
		
	</target>
	
</project>