Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0b39b1f8bab0ae956184f44252a8277fbe29fe53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!--
 Copyright (c) 2006, 2008 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="UPC Parser" default="upc" basedir=".">
    <description>Generates the UPC parser from LPG grammar files</description>
	
	<fail unless="lpg_exe">
		Property $${lpg_exe} not set.
		This property must be set to the full path to the LPG generator executable.
	</fail>
	
	<fail unless="lpg_template">
		Property $${lpg_template} not set.
		This property must be set to the full path to the LPG templates folder.
	</fail>
	
	<property name="upc_location" value="../src/org/eclipse/cdt/internal/core/dom/parser/upc"/>

	<target name="upc">
		<description>Generate the UPC parser</description>
		<!-- Generate main parser -->
		<antcall target="generate_upc">
            <param name="grammar_name" value="UPCParser"/>
		</antcall>
		<!-- Generate parser for disambiguating declarations vs expression statements -->
		<antcall target="generate_upc">
            <param name="grammar_name" value="UPCExpressionStatementParser"/>
		</antcall>
		<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
		<antcall target="generate_upc">
            <param name="grammar_name" value="UPCNoCastExpressionParser"/>
		</antcall>
		<!-- Generate parser for disambiguating sizeof expressions -->
		<antcall target="generate_upc">
            <param name="grammar_name" value="UPCSizeofExpressionParser"/>
		</antcall>
	</target>
	
	
	<target name="generate_upc">
		<antcall target="generate">
			<param name="grammar_dir" value="upc"/>
			<param name="output_dir" value="${upc_location}"/>
			<param name="grammar_name" value="${grammar_name}"/>
		</antcall>
	</target>

	
	<target name="generate">
		<property name="grammar_file" value="${grammar_dir}/${grammar_name}.g"/>
		<echo message="lpg_exe=${lpg_exe}"/>
		<echo message="lpg_template=${lpg_template}"/>
		<echo message="grammar_file=${grammar_file}.g"/>
		<echo message="output_dir=${output_dir}"/>

		<exec executable="${lpg_exe}">
			<arg value="${grammar_file}"/>
			<env key="LPG_TEMPLATE" path="${lpg_template}"/>
		</exec>
		
		<move overwrite="true" toDir="${output_dir}">
		    <fileset dir=".">
			    <include name="${grammar_name}*.*"/>
			</fileset>
		</move>
	</target> 
	
</project>  

Back to the top