<!--
 Copyright (c) 2006, 2009 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html

 Contributors:
     IBM Corporation - initial API and implementation
-->

<project name="CDT Extensible LR Parser Framework" basedir=".">
    <description>Generates LPG parsers from grammar files</description>
	
	<import file="generate.xml"/>

	<property name="c99_location" value="../src/org/eclipse/cdt/internal/core/dom/lrparser/c99"/>
	<property name="gcc_location" value="../src/org/eclipse/cdt/internal/core/dom/lrparser/gcc"/>
	<property name="cpp_location" value="../src/org/eclipse/cdt/internal/core/dom/lrparser/cpp"/>
	<property name="gpp_location" value="../src/org/eclipse/cdt/internal/core/dom/lrparser/gpp"/>
		
	<target name="all" depends="c99, gcc, cpp, gpp"/>
	
	<target name="clean_l_files">
		<delete>
			<fileset dir="${c99_location}" includes="**/*.l"/>
			<fileset dir="${gcc_location}" includes="**/*.l"/>
			<fileset dir="${cpp_location}" includes="**/*.l"/>
			<fileset dir="${gpp_location}" includes="**/*.l"/>
		</delete>
	</target>
	
	
	<target name="c99">
		<description>Generate the C99 parser</description>
		<!-- Generate main parser -->
		<antcall target="generate_c99">
            <param name="grammar_name" value="C99Parser"/>
		</antcall>
		<!-- Generate parser for disambiguating declarations vs expression statements -->
		<antcall target="generate_c99">
            <param name="grammar_name" value="C99ExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
		<antcall target="generate_c99">
            <param name="grammar_name" value="C99NoCastExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating sizeof expressions -->
		<antcall target="generate_c99">
            <param name="grammar_name" value="C99SizeofExpressionParser"/>
		</antcall>
	</target>
	
	<target name="generate_c99">
		<antcall target="generate">
			<param name="grammar_dir" value="c99"/>
			<param name="output_dir" value="${c99_location}"/>
			<param name="grammar_name" value="${grammar_name}"/>
		</antcall>
	</target>

	
	<target name="gcc">
		<description>Generate the GCC parser</description>
		<!-- Generate main parser -->
		<antcall target="generate_gcc">
            <param name="grammar_name" value="GCCParser"/>
		</antcall>
		<antcall target="generate_gcc">
            <param name="grammar_name" value="GCCSizeofExpressionParser"/>
		</antcall>
	</target>
	
	
	<target name="generate_gcc">
		<antcall target="generate">
			<param name="grammar_dir" value="gcc"/>
			<param name="output_dir" value="${gcc_location}"/>
			<param name="grammar_name" value="${grammar_name}"/>
		</antcall>
	</target>
	

	<target name="cpp">
		<description>Generate the C++ parser</description>
		<antcall target="generate_cpp">
			<param name="grammar_name" value="CPPParser"/>
		</antcall>
		<!-- Generate parser for disambiguating declarations vs expression statements -->
		<antcall target="generate_cpp">
            <param name="grammar_name" value="CPPExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
		<antcall target="generate_cpp">
            <param name="grammar_name" value="CPPNoCastExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating sizeof expressions -->
		<antcall target="generate_cpp">
            <param name="grammar_name" value="CPPSizeofExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating declarators -->
		<antcall target="generate_cpp">
            <param name="grammar_name" value="CPPNoFunctionDeclaratorParser"/>
		</antcall>
		<!-- Generate parser for disambiguating template parameters -->
		<antcall target="generate_cpp">
            <param name="grammar_name" value="CPPTemplateTypeParameterParser"/>
		</antcall>
	</target>
	
	<target name="generate_cpp">
		<antcall target="generate">
			<param name="grammar_dir" value="cpp"/>
			<param name="output_dir" value="${cpp_location}"/>
			<param name="grammar_name" value="${grammar_name}"/>
		</antcall>
	</target>
	
	
	<target name="gpp">
		<description>Generate the GCC parser</description>
		<!-- Generate main parser -->
		<antcall target="generate_gpp">
            <param name="grammar_name" value="GPPParser"/>
		</antcall>
		<antcall target="generate_gpp">
            <param name="grammar_name" value="GPPSizeofExpressionParser"/>
		</antcall>
	</target>
	
	
	<target name="generate_gpp">
		<antcall target="generate">
			<param name="grammar_dir" value="gpp"/>
			<param name="output_dir" value="${gpp_location}"/>
			<param name="grammar_name" value="${grammar_name}"/>
		</antcall>
	</target>
	

	
	
	
</project>  